• Greg Kurz's avatar
    virtio_net: flush uncompleted TX on reset · 94b52958
    Greg Kurz authored
    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: 's avatarR. Nageswara Sastry <nasastry@in.ibm.com>
    Buglink: https://github.com/open-power-host-os/qemu/issues/37Signed-off-by: 's avatarGreg Kurz <groug@kaod.org>
    Tested-by: 's avatarR. Nageswara Sastry <nasastry@in.ibm.com>
    Signed-off-by: 's avatarJason Wang <jasowang@redhat.com>
    94b52958
Name
Last commit
Last update
..
can_emu.h Loading commit data...
can_host.h Loading commit data...
checksum.h Loading commit data...
eth.h Loading commit data...
filter.h Loading commit data...
net.h Loading commit data...
queue.h Loading commit data...
slirp.h Loading commit data...
tap.h Loading commit data...
vhost-user.h Loading commit data...
vhost_net.h Loading commit data...