This series fixes TX data discard when backend disconnects.
On backend disconnection, QEMU cannot retrieve its internal
avail index, which makes the virtio queue internal state
inconsistent (last_avail_idx will always be 0, whereas used_idx
is correct).
It results in discarding TX data to corrupt the vring state, by
completing descriptors already completed by the backend.
This series fixes this by restoring last_avail_idx to the vring
used idx, as some backends used to do on reconnection.
Maxime Coquelin (2):
virtio: Add queue interface to restore avail index from vring used
index
vhost: restore avail index from vring used index on disconnection
hw/virtio/vhost.c | 4 ++++
hw/virtio/virtio.c | 10 ++++++++++
include/hw/virtio/virtio.h | 1 +
3 files changed, 15 insertions(+)