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 E5129A00E6 for ; Wed, 7 Aug 2019 16:38:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B64C1B95D; Wed, 7 Aug 2019 16:38:19 +0200 (CEST) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by dpdk.org (Postfix) with ESMTP id CCDD02BD3 for ; Wed, 7 Aug 2019 16:37:59 +0200 (CEST) Received: by mail-wr1-f66.google.com with SMTP id p17so91618438wrf.11 for ; Wed, 07 Aug 2019 07:37:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=4AA75z0k2YLTMG07EUslwT4j6faGfzjKPl2dPIEQc+8=; b=Pa/Vux9GnMvq1KD2HnkSFGZHUFf4SSL90rNVA53DkJUHZiAb4+E1G3nvHUR4kZJ4VH McGHxvZRtH8mIKzIHZRICx4FR8VKjuiIYCK80hNkwkCu1X/CWcmbojehaAfQIwBnZt3H lW/iXT7DB1XLFZUGD3MQv0EO1qlFEsHXT2r/C4mbnrbffXrbeKQiRrdasPUFUEQ/nbu5 5IijOCQ/INzA6zD9G+pgmY1THWnyo1y7tz0Rnrfb/IjGYDFDxUaq+Jdb85j/jxh3wBzU 4nMT98OuCc55S4xnoV6zW/IShr1XWgwO9szAophXc6iTNgdqh+CW7XXyeKZLMvHbUL2t agsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4AA75z0k2YLTMG07EUslwT4j6faGfzjKPl2dPIEQc+8=; b=Gu6Ov+WtTRHpqmmytr7Dd/LLBcpajH0FI2zUROwBlzIxvBFn/fVOmK63Mqf5OmlSMs 2H7sHLSREINQwJXSf2xW05dOwEG+xDxJUEm8id9/gx68f/Il8sOZ4LBDY3Awn9jWEhh2 ByRj7srmwyxPWJ3dPQLCv9S1MIR6CS9SYdfee/7ks1E+bmMaEGfQlSPNa++1KajqFCn6 zExxqUV4ymE2ERfl5UFkGVYLhRPlZWQh7bZJgh/lOtePXyQELCjaZZD1YQqBVnMzYwCb rPp20szKD3wJLxf7SliLevQJzrt+BMlKquwGHFV1YTDfMeSdVZLjYtvjLMxgjkJzBj6v c42w== X-Gm-Message-State: APjAAAXwwdwDERq9ZLk7aBLA9AM+B5XjoC5Vwhv1av8Lwih5//0cu0Fv wkxYDwFht6fBD9oLsbdQs7n2FGlk5Q== X-Google-Smtp-Source: APXvYqwVIz0CcMepYnW86v/z/6XZIvxDJ2NWv2+h0gr42npToMrYgXYynO1cfSGOuzE5AYHQIl/mQQ== X-Received: by 2002:a5d:4e90:: with SMTP id e16mr11233670wru.339.1565188679657; Wed, 07 Aug 2019 07:37:59 -0700 (PDT) Received: from ascain.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 2sm133441211wrn.29.2019.08.07.07.37.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 07:37:59 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Wed, 7 Aug 2019 16:37:28 +0200 Message-Id: <3afc75c18d194c49bdc647eb3787f04a1c788c3e.1565188248.git.thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-stable] [PATCH 19.11 09/12] virtio: get all pending rx packets with vectorized functions 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" From: Thibaut Collet The loop to read packets does not take all packets as the number of available packets (nb_used) is decremented in the loop. Take all available packets provides a performance improvement of 3%. Fixes: fc3d66212fed ("virtio: add vector Rx") Cc: stable at dpdk.org Signed-off-by: Thibaut Collet --- drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++-- drivers/net/virtio/virtio_rxtx_simple_sse.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c index e4b18cba0ce5..66bdaa00e01f 100644 --- a/drivers/net/virtio/virtio_rxtx_simple_neon.c +++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c @@ -42,7 +42,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, struct virtnet_rx *rxvq = rx_queue; struct virtqueue *vq = rxvq->vq; struct virtio_hw *hw = vq->hw; - uint16_t nb_used; + uint16_t nb_used, nb_total; uint16_t desc_idx; struct vring_used_elem *rused; struct rte_mbuf **sw_ring; @@ -106,9 +106,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, virtqueue_notify(vq); } + nb_total = nb_used; ref_rx_pkts = rx_pkts; for (nb_pkts_received = 0; - nb_pkts_received < nb_used;) { + nb_pkts_received < nb_total;) { uint64x2_t desc[RTE_VIRTIO_DESC_PER_LOOP / 2]; uint64x2_t mbp[RTE_VIRTIO_DESC_PER_LOOP / 2]; uint64x2_t pkt_mb[RTE_VIRTIO_DESC_PER_LOOP]; diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c index c757e8c9d601..811b416755e7 100644 --- a/drivers/net/virtio/virtio_rxtx_simple_sse.c +++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c @@ -43,7 +43,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, struct virtnet_rx *rxvq = rx_queue; struct virtqueue *vq = rxvq->vq; struct virtio_hw *hw = vq->hw; - uint16_t nb_used; + uint16_t nb_used, nb_total; uint16_t desc_idx; struct vring_used_elem *rused; struct rte_mbuf **sw_ring; @@ -108,9 +108,10 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, virtqueue_notify(vq); } + nb_total = nb_used; ref_rx_pkts = rx_pkts; for (nb_pkts_received = 0; - nb_pkts_received < nb_used;) { + nb_pkts_received < nb_total;) { __m128i desc[RTE_VIRTIO_DESC_PER_LOOP / 2]; __m128i mbp[RTE_VIRTIO_DESC_PER_LOOP / 2]; __m128i pkt_mb[RTE_VIRTIO_DESC_PER_LOOP]; -- 2.11.0