]> git.ipfire.org Git - thirdparty/qemu.git/commit
net: disable draining tap queue in one go
authorMark McLoughlin <markmc@redhat.com>
Tue, 27 Oct 2009 18:18:37 +0000 (18:18 +0000)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 10 Nov 2009 17:17:57 +0000 (18:17 +0100)
commit3e01c7b93d2d7b2366a09ad8dc2a9a71d0a60f17
tree39aee9323a4536cc84d467008b27bbb245e12b53
parent4a53815a9e82a14daf7c57fdb6573ab045d9cb36
net: disable draining tap queue in one go

If qemu_send_packet_async() returns zero, it means the packet has been
queued and the sent callback will be invoked once it has been flushed.

This is only possible where the NIC's receive() handler returns zero
and promises to notify the networking core that room is available in its
queue again.

In the case where the receive handler does not have this capability
(and its queue fills up) it returns -1 and the networking core does not
queue up the packet. This condition is indicated by a -1 return from
qemu_send_packet_async().

Currently, tap handles this condition simply by dropping the packet. It
should do its best to avoid getting into this situation by checking such
NIC's have room for a packet before copying the packet from the tap
interface.

tap_send() used to achieve this by only reading a single packet before
returning to the mainloop. That way, tap_can_send() is called before
reading each packet.

tap_send() was changed to completely drain the tap interface queue
without taking into account the situation where the NIC returns an
error and the packet is not queued. Let's start fixing this by
reverting to the previous behaviour of reading one packet at a time.

Reported-by: Scott Tsai <scottt.tw@gmail.com>
Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
net.c