Commit 5e63b29c authored by Stefan Lankes's avatar Stefan Lankes Committed by Stefan Lankes
Browse files

add function to set virtio_net in polling mode

- avoids unnecessry interrupts
parent 9a3fea3f
......@@ -396,6 +396,15 @@ impl<'a> Virtq<'a> {
}
}
pub fn set_polling_mode(&mut self, value: bool) {
let mut vqavail = self.avail.borrow_mut();
if value == true {
*vqavail.flags = VRING_AVAIL_F_NO_INTERRUPT;
} else {
*vqavail.flags = 0;
}
}
pub fn has_packet(&self) -> bool {
let vqused = self.used.borrow();
......
......@@ -377,6 +377,10 @@ impl<'a> VirtioNetDriver<'a> {
false
}
pub fn set_polling_mode(&mut self, value: bool) {
(self.vqueues.as_deref_mut().unwrap())[0].set_polling_mode(value);
}
pub fn get_mac_address(&self) -> [u8; 6] {
self.device_cfg.mac
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment