From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tiwei Bie Subject: Re: [PATCH v6 13/15] vhost: add Tx support for packed ring Date: Wed, 4 Jul 2018 13:45:05 +0800 Message-ID: <20180704054505.GC28826@debian> References: <20180702081629.29258-1-maxime.coquelin@redhat.com> <20180702081629.29258-14-maxime.coquelin@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: zhihong.wang@intel.com, jfreimann@redhat.com, dev@dpdk.org, mst@redhat.com, jasowang@redhat.com, wexu@redhat.com To: Maxime Coquelin Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 70938683E for ; Wed, 4 Jul 2018 07:45:06 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20180702081629.29258-14-maxime.coquelin@redhat.com> 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 Mon, Jul 02, 2018 at 10:16:27AM +0200, Maxime Coquelin wrote: > Signed-off-by: Maxime Coquelin > --- > lib/librte_vhost/vhost.h | 1 + > lib/librte_vhost/virtio_net.c | 121 +++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 121 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h > index a7320469a..6ea8fb896 100644 > --- a/lib/librte_vhost/vhost.h > +++ b/lib/librte_vhost/vhost.h > @@ -56,6 +56,7 @@ struct buf_vector { > struct zcopy_mbuf { > struct rte_mbuf *mbuf; > uint32_t desc_idx; > + uint16_t desc_count; > uint16_t in_use; > > TAILQ_ENTRY(zcopy_mbuf) next; > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > index 2e286e228..03dd38235 100644 > --- a/lib/librte_vhost/virtio_net.c > +++ b/lib/librte_vhost/virtio_net.c > @@ -1445,6 +1445,122 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, > return i; > } > > +static __rte_always_inline uint16_t > +virtio_dev_tx_packed(struct virtio_net *dev, struct vhost_virtqueue *vq, > + struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count) > +{ > + uint16_t i; > + > + rte_prefetch0(&vq->desc_packed[vq->last_avail_idx]); > + > + if (unlikely(dev->dequeue_zero_copy)) { > + struct zcopy_mbuf *zmbuf, *next; > + int nr_updated = 0; > + > + for (zmbuf = TAILQ_FIRST(&vq->zmbuf_list); > + zmbuf != NULL; zmbuf = next) { > + next = TAILQ_NEXT(zmbuf, next); > + > + if (mbuf_is_consumed(zmbuf->mbuf)) { > + update_shadow_used_ring_packed(vq, > + zmbuf->desc_idx, > + 0, > + zmbuf->desc_count); > + nr_updated += 1; nr_updated isn't really used. > + > + TAILQ_REMOVE(&vq->zmbuf_list, zmbuf, next); > + restore_mbuf(zmbuf->mbuf); > + rte_pktmbuf_free(zmbuf->mbuf); > + put_zmbuf(zmbuf); > + vq->nr_zmbuf -= 1; > + } > + } > + > + flush_shadow_used_ring_packed(dev, vq); > + vhost_vring_call(dev, vq); > + } > + [...]