From patchwork Wed Jun 19 15:14:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikos Dragazis X-Patchwork-Id: 54973 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B8CD21C420; Wed, 19 Jun 2019 17:16:36 +0200 (CEST) Received: from mx0.arrikto.com (mx0.arrikto.com [212.71.252.59]) by dpdk.org (Postfix) with ESMTP id DB6361C392 for ; Wed, 19 Jun 2019 17:15:44 +0200 (CEST) Received: from troi.prod.arr (mail.arr [10.99.0.5]) by mx0.arrikto.com (Postfix) with ESMTP id BCC94182017; Wed, 19 Jun 2019 18:15:44 +0300 (EEST) Received: from localhost.localdomain (unknown [10.89.50.133]) by troi.prod.arr (Postfix) with ESMTPSA id 5AF4E2B2; Wed, 19 Jun 2019 18:15:44 +0300 (EEST) From: Nikos Dragazis To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang , Stefan Hajnoczi , Wei Wang , Stojaczyk Dariusz , Vangelis Koukis Date: Wed, 19 Jun 2019 18:14:44 +0300 Message-Id: <1560957293-17294-20-git-send-email-ndragazis@arrikto.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560957293-17294-1-git-send-email-ndragazis@arrikto.com> References: <1560957293-17294-1-git-send-email-ndragazis@arrikto.com> Subject: [dpdk-dev] [PATCH 19/28] vhost: add index field in vhost virtqueues 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Stefan Hajnoczi 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 --- lib/librte_vhost/vhost.c | 2 ++ lib/librte_vhost/vhost.h | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 91a286d..d083d7e 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -407,6 +407,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; diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index aba8d9b..2e7eabe 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -107,6 +107,7 @@ struct vhost_virtqueue { struct vring_packed_desc_event *device_event; }; uint32_t size; + uint32_t vring_idx; uint16_t last_avail_idx; uint16_t last_used_idx;