Stop dropping so many RX packets in tap
commit3f3239d33e663182cfe9a7ddaac82fabab5b7da8
authorAnthony Liguori <aliguori@us.ibm.com>
Wed, 7 May 2008 18:09:40 +0000 (7 13:09 -0500)
committerAvi Kivity <avi@qumranet.com>
Sun, 18 May 2008 12:54:30 +0000 (18 15:54 +0300)
tree325f26f859d0bc96bb06ac49a07011e5f1f41f23
parent367fa7828a0e935640acb9d3c142c41e8cdb0a88
Stop dropping so many RX packets in tap

Normally, tap always reads packets and simply lets the client drop them if it
cannot receive them.  For virtio-net, this results in massive packet loss and
about an 80% performance loss in TCP throughput.

This patch modifies qemu_send_packet() to only deliver a packet to a VLAN
client if it doesn't have a fd_can_read method or the fd_can_read method
indicates that it can receive packets.  We also return a status of whether
any clients were able to receive the packet.

If no clients were able to receive a packet, we buffer the packet until a
client indicates that it can receive packets again.

This patch also modifies the tap code to only read from the tap fd if at least
one client on the VLAN is able to receive a packet.

Finally, this patch changes the tap code to drain all possible packets from
the tap device when the tap fd is readable.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
net.h
vl.c