From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71CBCA2EFC for ; Wed, 18 Sep 2019 07:50:48 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 55F791BF91; Wed, 18 Sep 2019 07:50:48 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 921B51BF79; Wed, 18 Sep 2019 07:50:44 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 22:50:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,519,1559545200"; d="scan'208";a="216826695" Received: from dpdk-virtio-tbie-2.sh.intel.com (HELO ___) ([10.67.104.71]) by fmsmga002.fm.intel.com with ESMTP; 17 Sep 2019 22:50:41 -0700 Date: Wed, 18 Sep 2019 13:47:59 +0800 From: Tiwei Bie To: JinYu Cc: dev@dpdk.org, changpeng.liu@intel.com, maxime.coquelin@redhat.com, zhihong.wang@intel.com, stable@dpdk.org, Lin Li , Xun Ni , Yu Zhang Message-ID: <20190918054758.GA9304@___> References: <20190829141224.49700> <20190917145234.16951-1-jin.yu@intel.com> <20190917145234.16951-9-jin.yu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190917145234.16951-9-jin.yu@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-stable] [PATCH v7 08/11] vhost: fix vring functions to support packed ring X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Sep 17, 2019 at 10:52:31PM +0800, JinYu wrote: > This patch fix two APIs so user can get the packed ring > support. > > Fixes: fceec568 (vhost: add packed ring) > Cc: stable@dpdk.org I changed my mind, as the packed ring related fields are just added to rte_vhost_vring in this series, we shouldn't treat this change as a fix and there is no need to cc stable. Please also update the title correspondingly. Thanks! Tiwei > > Signed-off-by: Lin Li > Signed-off-by: Xun Ni > Signed-off-by: Yu Zhang > Signed-off-by: Jin Yu > --- > lib/librte_vhost/vhost.c | 68 +++++++++++++++++++++++++++++----------- > 1 file changed, 49 insertions(+), 19 deletions(-) > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 95f99ea51..1b6dcca98 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -771,9 +771,15 @@ rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx, > if (!vq) > return -1; > > - vring->desc = vq->desc; > - vring->avail = vq->avail; > - vring->used = vq->used; > + if (vq_is_packed(dev)) { > + vring->desc_packed = vq->desc_packed; > + vring->driver_event = vq->driver_event; > + vring->device_event = vq->device_event; > + } else { > + vring->desc = vq->desc; > + vring->avail = vq->avail; > + vring->used = vq->used; > + } > vring->log_guest_addr = vq->log_guest_addr; > > vring->callfd = vq->callfd; > @@ -1273,13 +1279,51 @@ int rte_vhost_get_log_base(int vid, uint64_t *log_base, > int rte_vhost_get_vring_base(int vid, uint16_t queue_id, > uint16_t *last_avail_idx, uint16_t *last_used_idx) > { > + struct vhost_virtqueue *vq; > struct virtio_net *dev = get_device(vid); > > if (dev == NULL || last_avail_idx == NULL || last_used_idx == NULL) > return -1; > > - *last_avail_idx = dev->virtqueue[queue_id]->last_avail_idx; > - *last_used_idx = dev->virtqueue[queue_id]->last_used_idx; > + vq = dev->virtqueue[queue_id]; > + if (!vq) > + return -1; > + > + if (vq_is_packed(dev)) { > + *last_avail_idx = (vq->avail_wrap_counter << 15) | > + vq->last_avail_idx; > + *last_used_idx = (vq->used_wrap_counter << 15) | > + vq->last_used_idx; > + } else { > + *last_avail_idx = vq->last_avail_idx; > + *last_used_idx = vq->last_used_idx; > + } > + > + return 0; > +} > + > +int rte_vhost_set_vring_base(int vid, uint16_t queue_id, > + uint16_t last_avail_idx, uint16_t last_used_idx) > +{ > + struct vhost_virtqueue *vq; > + struct virtio_net *dev = get_device(vid); > + > + if (!dev) > + return -1; > + > + vq = dev->virtqueue[queue_id]; > + if (!vq) > + return -1; > + > + if (vq_is_packed(dev)) { > + vq->last_avail_idx = last_avail_idx & 0x7fff; > + vq->avail_wrap_counter = !!(last_avail_idx & (1 << 15)); > + vq->last_used_idx = last_used_idx & 0x7fff; > + vq->used_wrap_counter = !!(last_used_idx & (1 << 15)); > + } else { > + vq->last_avail_idx = last_avail_idx; > + vq->last_used_idx = last_used_idx; > + } > > return 0; > } > @@ -1308,20 +1352,6 @@ rte_vhost_get_vring_base_from_inflight(int vid, > return 0; > } > > -int rte_vhost_set_vring_base(int vid, uint16_t queue_id, > - uint16_t last_avail_idx, uint16_t last_used_idx) > -{ > - struct virtio_net *dev = get_device(vid); > - > - if (!dev) > - return -1; > - > - dev->virtqueue[queue_id]->last_avail_idx = last_avail_idx; > - dev->virtqueue[queue_id]->last_used_idx = last_used_idx; > - > - return 0; > -} > - > int rte_vhost_extern_callback_register(int vid, > struct rte_vhost_user_extern_ops const * const ops, void *ctx) > { > -- > 2.17.2 >