From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: Re: [PATCH 11/14] vhost: add helpers for packed virtqueues Date: Thu, 1 Feb 2018 10:20:12 +0100 Message-ID: References: <20180129141143.13437-1-jfreimann@redhat.com> <20180129141143.13437-12-jfreimann@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: tiwei.bie@intel.com, yliu@fridaylinux.org, mst@redhat.com To: Jens Freimann , dev@dpdk.org Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 228E5199B4 for ; Thu, 1 Feb 2018 10:20:24 +0100 (CET) In-Reply-To: <20180129141143.13437-12-jfreimann@redhat.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 01/29/2018 03:11 PM, Jens Freimann wrote: > Add some helper functions to set/check descriptor flags > and toggle the used wrap counter. > > Signed-off-by: Jens Freimann > --- > lib/librte_vhost/virtio-1.1.h | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/lib/librte_vhost/virtio-1.1.h b/lib/librte_vhost/virtio-1.1.h > index 5ca0bc33f..84039797e 100644 > --- a/lib/librte_vhost/virtio-1.1.h > +++ b/lib/librte_vhost/virtio-1.1.h > @@ -17,4 +17,47 @@ struct vring_desc_1_1 { > uint16_t flags; > }; > > +static inline void > +toggle_wrap_counter(struct vhost_virtqueue *vq) > +{ > + vq->used_wrap_counter ^= 1; > +} > + > +static inline int > +desc_is_avail(struct vhost_virtqueue *vq, struct vring_desc_1_1 *desc) > +{ > + if (!vq) > + return -1; Maybe use unlikely() here? Maxime