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 B15D0A00E6 for ; Thu, 8 Aug 2019 10:23:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 01B284F91; Thu, 8 Aug 2019 10:23:13 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 0B1792082 for ; Thu, 8 Aug 2019 10:23:00 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id p74so1472571wme.4 for ; Thu, 08 Aug 2019 01:23:00 -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=uU3vOsC5tYEEbl/Y7A+DbWIseB+egChyotcPE52/iZs=; b=W5fYXOPa2CqK1NBLyRBzI+pNvEXSTEIqSP4a4MeOJwO6wyQBluIhYpDfGLNNZAQu0E wGGT2s+LQs+nZpVuLgu8yvl8QJC6kfOBZGaAQmRrnR0eqbVAoYdVR4JJ3PTEe3SebW9/ ye1WfwGQ8guPzlxV/2OKUfQlz7OgpZZ/wSVpVdE+1lCCyuzHDVchCEABlasfKwPGk3n+ 9cPQ+bc09rL7KwEZzUB0hkgmS8UYEUjWVo9Zga2brkw9/vMLzuklpkxB8DW5aalz6ifY D1jjzqIUbVog+2ciHxxKzydsH94emogRFd2NUUg//qAu66kKVwWZU1IvRIu8QETmIQzB Rq/A== 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=uU3vOsC5tYEEbl/Y7A+DbWIseB+egChyotcPE52/iZs=; b=WlO5ccBi0f2PJYNKwoMgc+73kRRmICMe/K1mByNph6KQC7TMwZcsTugVpKzsz3csAF WN3Eb9GY//6VHmGnF4Gq73317MWUiqVLSw+H/q+kmZoPPxmU8knlRNEYMT7MdxCy3ucq HRErKzwnPlOWO2AlCjW1dvonByjL+9Ycp8fo8tt+pjjT/XlaV58rNM1qfZhHNjUM0DtB BMjFe0eOoWQLtUD5S3UJ0d7/O98flUpC7vOKXmcUuDQSahuD7zsL1718IriPn1CJyExc 88WxyuAhEFYNyaLLfsWyAj0oVWkUNZOt2K969BqX1b6HMzn4EGdDBqyh17Z77RsHV7Ye PZuA== X-Gm-Message-State: APjAAAWkc+ClB2Ve6U4LZVgi08z3wB+RA6dsL/EwwYZms1QrmhMO3DdO OOcYwn+HWjvYtDnf+C/V/07i X-Google-Smtp-Source: APXvYqwHgUGFpXQ6XzQjbQL8LME2cVUn2rMvKNkCtiIvGvcXdFDlxp0u10Uwa4/eNt23YV0eKCDcfA== X-Received: by 2002:a1c:c5c2:: with SMTP id v185mr3052174wmf.161.1565252579698; Thu, 08 Aug 2019 01:22: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 t13sm111437018wrr.0.2019.08.08.01.22.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Aug 2019 01:22:59 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Thu, 8 Aug 2019 10:22:14 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-stable] [PATCH 19.11 V3 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@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 70e89fc428e0..992e71f010eb 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 cb1610e71563..f9ec4ae69986 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