diff --git a/src/linux/virtio.rs b/src/linux/virtio.rs index 25b95203..c2e24daf 100644 --- a/src/linux/virtio.rs +++ b/src/linux/virtio.rs @@ -406,10 +406,8 @@ impl VirtioNetPciDevice { ); match write_packet(&poll_rx_queue, &mut frame_queue, &mmap) { - Ok(sent) => { - // TODO: replace Ok(usize) with bool (if needs notification) - // trace!("wrote {}/{} received frames to guest memory", sent, l); - if sent > 0 && poll_rx_queue.lock().needs_notification(&mmap).unwrap() { + Ok(data_sent) => { + if data_sent && poll_rx_queue.lock().needs_notification(&mmap).unwrap() { _delay = time::Instant::now(); alert.store(true, Ordering::Release); irq_evtfd.write(1).unwrap(); @@ -609,7 +607,7 @@ fn write_packet( rx_queue: &Arc>, frame_queue: &mut Vec<([u8; UHYVE_NET_MTU], usize)>, mmap: &GuestMemoryMmap, -) -> Result { +) -> Result { let mut queue = rx_queue.lock(); if !queue.is_valid(mmap) { @@ -662,7 +660,7 @@ fn write_packet( }); queue.enable_notification(mmap)?; - Ok(l - frame_queue.len()) + Ok(l - frame_queue.len() > 0) } fn send_available_packets(