From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by dpdk.org (Postfix) with ESMTP id 25AAE1BDD8 for ; Wed, 4 Jul 2018 18:10:02 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9EC56402382F; Wed, 4 Jul 2018 16:10:01 +0000 (UTC) Received: from [10.36.112.34] (ovpn-112-34.ams2.redhat.com [10.36.112.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18691111AF05; Wed, 4 Jul 2018 16:09:54 +0000 (UTC) To: Tiwei Bie Cc: zhihong.wang@intel.com, jfreimann@redhat.com, dev@dpdk.org, mst@redhat.com, jasowang@redhat.com, wexu@redhat.com References: <20180702081629.29258-1-maxime.coquelin@redhat.com> <20180702081629.29258-14-maxime.coquelin@redhat.com> <20180704054505.GC28826@debian> From: Maxime Coquelin Message-ID: Date: Wed, 4 Jul 2018 18:09:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180704054505.GC28826@debian> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Jul 2018 16:10:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Jul 2018 16:10:01 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'maxime.coquelin@redhat.com' RCPT:'' 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 16:10:02 -0000 On 07/04/2018 07:45 AM, Tiwei Bie wrote: > 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. Right, it seems it should be removed in the _split version too, but I'll do that in a separate patch. Thanks, Maxime >> + >> + 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); >> + } >> + > [...] >