qemu-e2k/include/net
Greg Kurz 94b52958b7 virtio_net: flush uncompleted TX on reset
If the backend could not transmit a packet right away for some reason,
the packet is queued for asynchronous sending. The corresponding vq
element is tracked in the async_tx.elem field of the VirtIONetQueue,
for later freeing when the transmission is complete.

If a reset happens before completion, virtio_net_tx_complete() will push
async_tx.elem back to the guest anyway, and we end up with the inuse flag
of the vq being equal to -1. The next call to virtqueue_pop() is then
likely to fail with "Virtqueue size exceeded".

This can be reproduced easily by starting a guest with an hubport backend
that is not connected to a functional network, eg,

 -device virtio-net-pci,netdev=hub0 -netdev hubport,id=hub0,hubid=0

and no other -netdev hubport,hubid=0 on the command line.

The appropriate fix is to ensure that such an asynchronous transmission
cannot survive a device reset. So for all queues, we first try to send
the packet again, and eventually we purge it if the backend still could
not deliver it.

CC: qemu-stable@nongnu.org
Reported-by: R. Nageswara Sastry <nasastry@in.ibm.com>
Buglink: https://github.com/open-power-host-os/qemu/issues/37
Signed-off-by: Greg Kurz <groug@kaod.org>
Tested-by: R. Nageswara Sastry <nasastry@in.ibm.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
2018-03-26 14:49:17 +08:00
..
can_emu.h net/can: simple messages transport implementation for QEMU 2018-02-13 11:44:13 +01:00
can_host.h net/can: simple messages transport implementation for QEMU 2018-02-13 11:44:13 +01:00
checksum.h net: Transmit zero UDP checksum as 0xFFFF 2017-11-20 11:08:00 +08:00
eth.h net: fix misaligned member access 2018-03-02 18:44:00 +00:00
filter.h Include less of the generated modular QAPI headers 2018-03-02 13:45:50 -06:00
net.h virtio_net: flush uncompleted TX on reset 2018-03-26 14:49:17 +08:00
queue.h net/queue: export qemu_net_queue_append_iov 2015-10-12 13:31:18 +08:00
slirp.h Move include qemu/option.h from qemu-common.h to actual users 2018-02-09 13:52:16 +01:00
tap.h Drop superfluous includes of qapi-types.h and test-qapi-types.h 2018-02-09 05:05:11 +01:00
vhost-user.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
vhost_net.h tap: setting error appropriately when calling net_init_tap_one() 2018-03-05 10:30:16 +08:00