[PATCH 5/9] kvm: qemu: Disable recv notifications until avail buffers exhausted

Mark McLoughlin
2008-07-24T11:53:13Z

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
qemu/hw/virtio-net.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index 4adfa42..419a2d7 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -106,9 +106,12 @@ static int virtio_net_can_receive(void *opaque)
!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
return 0;

- if (n->rx_vq->vring.avail->idx == n->rx_vq->last_avail_idx)
+ if (n->rx_vq->vring.avail->idx == n->rx_vq->last_avail_idx) {
+ n->rx_vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
return 0;
+ }

+ n->rx_vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;
return 1;
}

--
1.5.4.1