From: Marc-André Lureau Date: Mon, 6 Jun 2016 16:45:01 +0000 (+0200) Subject: tests/vhost-user-bridge: workaround stale vring base X-Git-Tag: v2.7.0-rc0~115^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=523b018dde3b7650fe5401d0499b30cf2f117515;p=thirdparty%2Fqemu.git tests/vhost-user-bridge: workaround stale vring base 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 --- diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index e231ce9833f..36b3cd8b8c5 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; }