aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-04-29 13:40:02 +0100
committerMark McLoughlin <markmc@redhat.com>2009-06-09 11:38:50 +0100
commit8aeff62d75b72263d855a0b5892b8d52ad6f09e0 (patch)
tree7bfdba96a16d2816d81659b8ee5124900242781e
parente19eb22486f258a421108ac22b8380a4e2f16b97 (diff)
virtio-net: implement rx packet queueing
If we don't have room to receive a packet, we return zero from virtio_net_receive() and call qemu_flush_queued_packets() as soon as space becomes available. Signed-off-by: Mark McLoughlin <markmc@redhat.com>
-rw-r--r--hw/virtio-net.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 6b34c5afc1..a3ba890312 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -269,6 +269,9 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
{
+ VirtIONet *n = to_virtio_net(vdev);
+
+ qemu_flush_queued_packets(n->vc);
}
static int do_virtio_net_can_receive(VirtIONet *n, int bufsize)
@@ -368,7 +371,7 @@ static ssize_t virtio_net_receive(VLANClientState *vc, const uint8_t *buf, size_
size_t hdr_len, offset, i;
if (!do_virtio_net_can_receive(n, size))
- return -1;
+ return 0;
if (!receive_filter(n, buf, size))
return size;