Commit 8aeff62d75b72263d855a0b5892b8d52ad6f09e0
1 parent
e19eb224
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>
Showing
1 changed file
with
4 additions
and
1 deletions
hw/virtio-net.c
... | ... | @@ -269,6 +269,9 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq) |
269 | 269 | |
270 | 270 | static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq) |
271 | 271 | { |
272 | + VirtIONet *n = to_virtio_net(vdev); | |
273 | + | |
274 | + qemu_flush_queued_packets(n->vc); | |
272 | 275 | } |
273 | 276 | |
274 | 277 | 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_ |
368 | 371 | size_t hdr_len, offset, i; |
369 | 372 | |
370 | 373 | if (!do_virtio_net_can_receive(n, size)) |
371 | - return -1; | |
374 | + return 0; | |
372 | 375 | |
373 | 376 | if (!receive_filter(n, buf, size)) |
374 | 377 | return size; | ... | ... |