From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 5701D1BE7B for ; Wed, 4 Jul 2018 07:39:41 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2018 22:39:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,306,1526367600"; d="scan'208";a="68514124" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.228]) by fmsmga004.fm.intel.com with ESMTP; 03 Jul 2018 22:39:39 -0700 Date: Wed, 4 Jul 2018 13:39:40 +0800 From: Tiwei Bie To: Maxime Coquelin Cc: zhihong.wang@intel.com, jfreimann@redhat.com, dev@dpdk.org, mst@redhat.com, jasowang@redhat.com, wexu@redhat.com Message-ID: <20180704053940.GB28826@debian> References: <20180702081629.29258-1-maxime.coquelin@redhat.com> <20180702081629.29258-3-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180702081629.29258-3-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.5 (2018-04-13) Subject: Re: [dpdk-dev] [PATCH v6 02/15] vhost: add helpers for packed 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: , X-List-Received-Date: Wed, 04 Jul 2018 05:39:41 -0000 On Mon, Jul 02, 2018 at 10:16:16AM +0200, Maxime Coquelin wrote: > From: Jens Freimann > > Add some helper functions to check descriptor flags > and check if a vring is of type packed. > > Signed-off-by: Jens Freimann > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/vhost.h | 6 ++++++ > lib/librte_vhost/virtio-packed.h | 8 ++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index cecd5c1ee..cabbc3ab7 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -318,6 +318,12 @@ struct virtio_net { > struct vhost_user_extern_ops extern_ops; > } __rte_cache_aligned; > > +static __rte_always_inline bool > +vq_is_packed(struct virtio_net *dev) > +{ > + return dev->features & (1ull << VIRTIO_F_RING_PACKED); > +} > + > #define VHOST_LOG_PAGE 4096 > > /* > diff --git a/lib/librte_vhost/virtio-packed.h b/lib/librte_vhost/virtio-packed.h > index 744b3991b..d386cb6df 100644 > --- a/lib/librte_vhost/virtio-packed.h > +++ b/lib/librte_vhost/virtio-packed.h > @@ -19,4 +19,12 @@ struct vring_desc_packed { > uint16_t flags; > }; > > + There is no need to add above blank line. > +static inline bool > +desc_is_avail(struct vring_desc_packed *desc, bool wrap_counter) > +{ > + return wrap_counter == !!(desc->flags & VRING_DESC_F_AVAIL) && > + wrap_counter != !!(desc->flags & VRING_DESC_F_USED); > +} > + > #endif /* __VIRTIO_PACKED_H */ > -- > 2.14.4 >