From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by dpdk.org (Postfix) with ESMTP id BE1895A65 for ; Wed, 28 Oct 2015 04:47:46 +0100 (CET) Received: by pabla5 with SMTP id la5so49695786pab.0 for ; Tue, 27 Oct 2015 20:47:46 -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=K39om6CgfshfRLBuRc4GE+EY526HVLlo0lGEtv/RJSo=; b=Ij6L+uZ5Qa5tTsJCn3VIgOHAhtZtZHFrmQyFsNENLtPdmtI4CmYESDddUU2xyjiUe4 jfbEYqO0od0XmWrYisItIEoUzO1A6r19NFfTlz94HGUDX83OCdlrhzfXeRDojwdUk54q wg1tioGyH4BAw2RnxG0s/xlsQNdd/SezNzduM9kPxHdqB0Cv9CuNXf8YvHrsoZ4qb9mS W10TeIXIgG+WpUnhNhynLE3pUcKici8b5itSkVoFW/5QePfVgV1t+H3Eazn9Rt2i/dGS BxurZ2HOxlbuwsGp3kIPvGr2NNB0AhDjdnwYc1sT1n4TOV3xBrRqn7snG7c4NvebxH/f Hx9A== 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=K39om6CgfshfRLBuRc4GE+EY526HVLlo0lGEtv/RJSo=; b=mOABvz4fVINxXW4qr2/33eX2Lpl9aRgOQITr5FBbW2Ixq7ouW/Vps7C5g4u0HGr1Tw nDqvkGrwezv6M+5g5SzKdtSQqqTpbpA5RMZypBT7snQXPWMVIGbeOxAgmQGZB4nMlqEx 73G2dpa4vDlyDGFUESahKWkiRHiR2poLw8KhyoUU9+3Pu6gUCcxnGkdUwwXot6oTfjKu s7jnIhxr1ZRDfm9byKGj6p1+w8wv/SH9RQwOrK+uYywHXn2ET5ZXteiN53E26lwR+PIL QWSbiu5uV6ARPnxV+iuzIp3s1/MrEHhq5i9tjnpdQxXcRT9thNShr7d3sNJ9a9v7jn/j ju2Q== X-Gm-Message-State: ALoCoQlwskGUdulf89/KY95lscah/cs8EcEU+DESW72p3T2gfk0pR2g2GYXMH6+Lljj24mr/PR/Q X-Received: by 10.68.201.200 with SMTP id kc8mr31684062pbc.18.1446004066152; Tue, 27 Oct 2015 20:47:46 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id lo9sm42426527pab.19.2015.10.27.20.47.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Oct 2015 20:47:45 -0700 (PDT) From: Tetsuya Mukawa To: dev@dpdk.org Date: Wed, 28 Oct 2015 12:47:40 +0900 Message-Id: <1446004060-29198-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 v3] 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 03:47:47 -0000 The patch fixes wrong handling of virtqueue array index when GET_VRING_BASE message comes. Signed-off-by: Tetsuya Mukawa --- 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