Received: from eggs.gnu.org ([2001:4830:134:3::10]:49523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9xeY-0004F9-Jw for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9xeV-0005Yj-DE for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:26 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:35704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9xeV-0005Yf-8z for qemu-devel@nongnu.org; Mon, 06 Jun 2016 12:45:23 -0400 Received: by mail-qt0-x241.google.com with SMTP id 37so1669700qtc.2 for ; Mon, 06 Jun 2016 09:45:23 -0700 (PDT) Sender: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= From: marcandre.lureau@redhat.com Date: Mon, 6 Jun 2016 18:45:01 +0200 Message-Id: <1465231508-30183-4-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1465231508-30183-1-git-send-email-marcandre.lureau@redhat.com> References: <1465231508-30183-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH 03/10] tests/vhost-user-bridge: workaround stale vring base List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Michael S . Tsirkin" , Tetsuya Mukawa , jonshin@cisco.com, Ilya Maximets , Yuanhan Liu , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau 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 --- 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 f907ce7..38963e4 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; } -- 2.7.4