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 70938683E for ; Wed, 4 Jul 2018 07:45:06 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jul 2018 22:45:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,306,1526367600"; d="scan'208";a="69928894" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.228]) by orsmga001.jf.intel.com with ESMTP; 03 Jul 2018 22:45:04 -0700 Date: Wed, 4 Jul 2018 13:45:05 +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: <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 Content-Disposition: inline In-Reply-To: <20180702081629.29258-14-maxime.coquelin@redhat.com> User-Agent: Mutt/1.9.5 (2018-04-13) Subject: Re: [dpdk-dev] [PATCH v6 13/15] vhost: add Tx support for packed ring 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:45:06 -0000 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); > + } > + [...]