Commit 4cb3284c authored by Stefan Lankes's avatar Stefan Lankes
Browse files

reschedule system only, if a packet is available

parent 897c598c
Pipeline #281320 passed with stages
in 4 minutes and 40 seconds
......@@ -885,10 +885,14 @@ pub fn init_virtio_device(adapter: pci::PciAdapter) {
#[cfg(target_arch = "x86_64")]
extern "x86-interrupt" fn virtio_irqhandler(_stack_frame: &mut ExceptionStackFrame) {
debug!("Receive virtio interrupt");
match get_network_driver() {
apic::eoi();
let check_scheduler = match get_network_driver() {
Some(driver) => driver.borrow_mut().handle_interrupt(),
_ => (),
_ => false,
};
if check_scheduler {
core_scheduler().scheduler();
}
apic::eoi();
core_scheduler().scheduler();
}
......@@ -354,13 +354,20 @@ impl<'a> VirtioNetDriver<'a> {
fence(Ordering::SeqCst);
}
pub fn handle_interrupt(&mut self) {
pub fn handle_interrupt(&mut self) -> bool {
let isr_status = *(self.isr_cfg);
if (isr_status & 0x1) == 0x1 {
self.check_used_elements();
// handle changes to the queue
netwakeup();
//self.check_used_elements();
if self.has_packet() {
// handle incoming packets
netwakeup();
return true;
}
}
false
}
pub fn get_mac_address(&self) -> [u8; 6] {
......
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