From 523b018dde3b7650fe5401d0499b30cf2f117515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 6 Jun 2016 18:45:01 +0200 Subject: tests/vhost-user-bridge: workaround stale vring base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch is a similar solution to what Yuanhan Liu/Huawei Xie have suggested for DPDK. When vubr quits (killed or crashed), a restart of vubr would get stale vring base from QEMU. That would break the kernel virtio net completely, making it non-work any more, unless a driver reset is done. So, instead of getting the stale vring base from QEMU, Huawei suggested we could get a proper one from used->idx. This works because the queues packets are processed in order. Signed-off-by: Marc-André Lureau Tested-by: Yuanhan Liu Reviewed-by: Yuanhan Liu Reviewed-by: Victor Kaplansky Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/vhost-user-bridge.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index e231ce9833..36b3cd8b8c 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -946,6 +946,13 @@ vubr_set_vring_addr_exec(VubrDev *dev, VhostUserMsg *vmsg) DPRINT(" vring_avail at %p\n", vq->avail); vq->last_used_index = vq->used->idx; + + if (vq->last_avail_index != vq->used->idx) { + DPRINT("Last avail index != used index: %d != %d, resuming", + vq->last_avail_index, vq->used->idx); + vq->last_avail_index = vq->used->idx; + } + return 0; } -- cgit v1.2.3