From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id 582FF5A65 for ; Wed, 28 Oct 2015 03:59:57 +0100 (CET) Received: by pasz6 with SMTP id z6so241288279pas.2 for ; Tue, 27 Oct 2015 19:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel_co_jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=h7687GOtoaZq0fgRNKrR7fW72NYk0fumEbEX2ywMO8k=; b=lJLwXuyPxKAq6DoZwy1vEdvhw5l7L/8hboUAwfM5U+VShodIUChKFWG2UjziW4etaL UtDzL1+vTLKz30OU97FeuNLLCBGeADLvFVzrTuoUDt5j8kFGyJ3Lkxosi4sq3uMmwnon 1ndjKVt2q7hElz2CAfy+nwJAyau+5EdX7rGT+7AQBvTTgepVSZzkPY3/iGIEbFAEtstc rwPMzkrFD3HH9tY85hw64Cl/Dzajtj+50rFgrqOM/N9MZVzEUiwA2UNfHPdINyd7a2Kh +AdOiWF3sdUv0mUxbpWRJ+Fjf/Rg1n+b1uX9AsIrGch6MFs56YXDtjRHv+ZT1o81e0gr li+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=h7687GOtoaZq0fgRNKrR7fW72NYk0fumEbEX2ywMO8k=; b=K4YgGRXYUnzV+sTC2DV96E9j7iQl/6xdSr3PIsok13ZYmFaihdTaEaq+b7gONaEz6o Sn4J8YichV3TExFWTEkqKsOHNLMaXoHdQIOdnrCSRvxZSFKfk2iowM+xifKcUCTOLlk4 baDDMjU+cza3Y+/f/E3Jnvmevpds8sHsrXnl1TYyZNpNJKFLiHac8MyUhTfbxLXZhhZO KPoqfAh4Oayx0k/A33K+Qcho+neUIEaHV1RgSoRsaR2ie4wGuXCJoO1b91iegErD5EZ7 2wzOYjjv6dwcjev3iHv9fw1hCWtXC/tMdbXX/yaVMDcbDyAbI/QZu6JVleGwnALQTbZV LeWw== X-Gm-Message-State: ALoCoQkfaSSA/iENtag9WfRk5qexBI5bp98Dd3wA/RWsV9kGp7jdki21uAdvb6cJHfTSVl8J28Po X-Received: by 10.68.57.205 with SMTP id k13mr38837413pbq.4.1446001196732; Tue, 27 Oct 2015 19:59:56 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id we9sm42235046pab.3.2015.10.27.19.59.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 19:59:56 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org Date: Wed, 28 Oct 2015 11:59:39 +0900 Message-Id: <1446001179-27443-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.1.4 Cc: ann.zhuangyanying@huawei.com Subject: [dpdk-dev] [PATCH v2] vhost: Fix wrong handling of virtqueue array index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Oct 2015 02:59:57 -0000 The patch fixes wrong handling of virtqueue array index when GET_VRING_BASE message comes. --- lib/librte_vhost/vhost_user/virtio-net-user.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/librte_vhost/vhost_user/virtio-net-user.c b/lib/librte_vhost/vhost_user/virtio-net-user.c index a998ad8..d07452a 100644 --- a/lib/librte_vhost/vhost_user/virtio-net-user.c +++ b/lib/librte_vhost/vhost_user/virtio-net-user.c @@ -300,13 +300,9 @@ user_get_vring_base(struct vhost_device_ctx ctx, * sent and only sent in vhost_vring_stop. * TODO: cleanup the vring, it isn't usable since here. */ - if (dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd >= 0) { - close(dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd); - dev->virtqueue[state->index + VIRTIO_RXQ]->kickfd = -1; - } - if (dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd >= 0) { - close(dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd); - dev->virtqueue[state->index + VIRTIO_TXQ]->kickfd = -1; + if (dev->virtqueue[state->index]->kickfd >= 0) { + close(dev->virtqueue[state->index]->kickfd); + dev->virtqueue[state->index]->kickfd = -1; } return 0; -- 2.1.4