From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 636F01B6BC for ; Wed, 19 Dec 2018 10:47:55 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC68C1E2F0; Wed, 19 Dec 2018 09:47:54 +0000 (UTC) Received: from localhost (dhcp-192-241.str.redhat.com [10.33.192.241]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 83E675D772; Wed, 19 Dec 2018 09:47:45 +0000 (UTC) Date: Wed, 19 Dec 2018 10:47:43 +0100 From: Jens Freimann To: Maxime Coquelin Cc: dev@dpdk.org, tiwei.bie@intel.com, zhihong.wang@intel.com Message-ID: <20181219094743.yjuqrbwk6mjiilt4@jenstp.localdomain> References: <20181211134804.10318-1-maxime.coquelin@redhat.com> <20181211134804.10318-4-maxime.coquelin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20181211134804.10318-4-maxime.coquelin@redhat.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Dec 2018 09:47:54 +0000 (UTC) Subject: Re: [dpdk-dev] [PATCH v2 3/3] net/virtio: improve batching in mergeable path 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, 19 Dec 2018 09:47:55 -0000 On Tue, Dec 11, 2018 at 02:48:04PM +0100, Maxime Coquelin wrote: >This patch improves both descriptors dequeue and refill, >by using the same bathing strategy as done in in-order path. s/bathing/batching/ > >Signed-off-by: Maxime Coquelin >--- > drivers/net/virtio/virtio_rxtx.c | 237 ++++++++++++++++--------------- > 1 file changed, 126 insertions(+), 111 deletions(-) > >diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c >index ebe5c74b5..59bcac2f7 100644 >--- a/drivers/net/virtio/virtio_rxtx.c >+++ b/drivers/net/virtio/virtio_rxtx.c >@@ -267,41 +267,42 @@ virtqueue_enqueue_refill_inorder(struct virtqueue *vq, > } > > static inline int >-virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct rte_mbuf *cookie) >+virtqueue_enqueue_recv_refill(struct virtqueue *vq, struct rte_mbuf **cookie, >+ uint16_t num) > { > struct vq_desc_extra *dxp; > struct virtio_hw *hw = vq->hw; >- struct vring_desc *start_dp; >- uint16_t needed = 1; >- uint16_t head_idx, idx; >+ struct vring_desc *start_dp = vq->vq_ring.desc; >+ uint16_t idx, i; > > if (unlikely(vq->vq_free_cnt == 0)) > return -ENOSPC; >- if (unlikely(vq->vq_free_cnt < needed)) >+ if (unlikely(vq->vq_free_cnt < num)) > return -EMSGSIZE; > >- head_idx = vq->vq_desc_head_idx; >- if (unlikely(head_idx >= vq->vq_nentries)) >+ if (unlikely(vq->vq_desc_head_idx >= vq->vq_nentries)) > return -EFAULT; > >- idx = head_idx; >- dxp = &vq->vq_descx[idx]; >- dxp->cookie = (void *)cookie; >- dxp->ndescs = needed; >+ for (i = 0; i < num; i++) { >+ idx = vq->vq_desc_head_idx; >+ dxp = &vq->vq_descx[idx]; >+ dxp->cookie = (void *)cookie[i]; I think code is safe as it is, but should we check if cookie actually points to something? I tested this patch and saw the same performance improvement, so Tested-by: Jens Freimann Reviewed-by: Jens Freimann regards, Jens