From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 329CA1B2D0 for ; Fri, 19 Jan 2018 14:47:30 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98FED80F95; Fri, 19 Jan 2018 13:47:29 +0000 (UTC) Received: from localhost (ovpn-116-254.ams2.redhat.com [10.36.116.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id C364461987; Fri, 19 Jan 2018 13:47:21 +0000 (UTC) From: Stefan Hajnoczi To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, Yuanhan Liu , wei.w.wang@intel.com, mst@redhat.com, zhiyong.yang@intel.com, jasowang@redhat.com, Stefan Hajnoczi Date: Fri, 19 Jan 2018 13:44:36 +0000 Message-Id: <20180119134444.24927-17-stefanha@redhat.com> In-Reply-To: <20180119134444.24927-1-stefanha@redhat.com> References: <20180119134444.24927-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 19 Jan 2018 13:47:29 +0000 (UTC) Subject: [dpdk-dev] [RFC 16/24] vhost: remember a vhost_virtqueue's queue index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2018 13:47:30 -0000 Currently the only way of determining a struct vhost_virtqueue's index is to search struct virtio_net->virtqueue[] for its address. Stash the index in struct vhost_virtqueue so we won't have to search the array. This new field will be used by virtio-vhost-user. Signed-off-by: Stefan Hajnoczi --- drivers/librte_vhost/vhost.h | 1 + drivers/librte_vhost/vhost.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/librte_vhost/vhost.h b/drivers/librte_vhost/vhost.h index a50b802e7..08ad874ef 100644 --- a/drivers/librte_vhost/vhost.h +++ b/drivers/librte_vhost/vhost.h @@ -72,6 +72,7 @@ struct vhost_virtqueue { struct vring_avail *avail; struct vring_used *used; uint32_t size; + uint32_t vring_idx; uint16_t last_avail_idx; uint16_t last_used_idx; diff --git a/drivers/librte_vhost/vhost.c b/drivers/librte_vhost/vhost.c index 0d95a4b3a..886444683 100644 --- a/drivers/librte_vhost/vhost.c +++ b/drivers/librte_vhost/vhost.c @@ -191,6 +191,8 @@ init_vring_queue(struct virtio_net *dev, uint32_t vring_idx) memset(vq, 0, sizeof(struct vhost_virtqueue)); + vq->vring_idx = vring_idx; + vq->kickfd = VIRTIO_UNINITIALIZED_EVENTFD; vq->callfd = VIRTIO_UNINITIALIZED_EVENTFD; -- 2.14.3