From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 7757A4C8F for ; Mon, 19 Mar 2018 11:26:55 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2018 03:26:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,330,1517904000"; d="scan'208";a="38661750" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164]) by fmsmga004.fm.intel.com with ESMTP; 19 Mar 2018 03:26:51 -0700 Date: Mon, 19 Mar 2018 18:25:19 +0800 From: Tiwei Bie To: Jens Freimann Cc: dev@dpdk.org, yliu@fridaylinux.org, maxime.coquelin@redhat.com, mst@redhat.com Message-ID: <20180319102518.ymc2gizos3ntj3n7@debian> References: <20180316152120.13199-1-jfreimann@redhat.com> <20180316152120.13199-11-jfreimann@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180316152120.13199-11-jfreimann@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH 10/17] vhost: vring address setup for packed queues 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: Mon, 19 Mar 2018 10:26:55 -0000 On Fri, Mar 16, 2018 at 04:21:13PM +0100, Jens Freimann wrote: > From: Yuanhan Liu > > Add code to set up packed queues when enabled. > > Signed-off-by: Yuanhan Liu > Signed-off-by: Jens Freimann > --- > lib/librte_vhost/vhost.c | 1 + > lib/librte_vhost/vhost.h | 1 + > lib/librte_vhost/vhost_user.c | 17 ++++++++++++++++- > 3 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index a407067..a300812 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -567,6 +567,7 @@ struct virtio_net * > return -1; > } > > + There is no need to add this blank line. > dev->virtqueue[queue_id]->used->flags = VRING_USED_F_NO_NOTIFY; > return 0; > } > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index 06e973e..d35c4b1 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -70,6 +70,7 @@ struct batch_copy_elem { > */ > struct vhost_virtqueue { > struct vring_desc *desc; > + struct vring_desc_packed *desc_packed; > struct vring_avail *avail; > struct vring_used *used; It's better to use union here. > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index 90ed211..bd1e393 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -415,6 +415,19 @@ > struct vhost_virtqueue *vq = dev->virtqueue[vq_index]; > struct vhost_vring_addr *addr = &vq->ring_addrs; > > + if (dev->features & (1ULL << VIRTIO_F_RING_PACKED)) { > + vq->desc_packed = (struct vring_desc_packed *) ring_addr_to_vva > + (dev, vq, addr->desc_user_addr, sizeof(vq->desc_packed)); > + vq->desc = NULL; > + vq->avail = NULL; > + vq->used = NULL; > + vq->log_guest_addr = 0; > + > + assert(vq->last_used_idx == 0); As a library, we shouldn't crash the process. Thanks