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 1BDC1A00E6 for ; Wed, 7 Aug 2019 17:11:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8B99B1B956; Wed, 7 Aug 2019 17:10:09 +0200 (CEST) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by dpdk.org (Postfix) with ESMTP id 357962C58 for ; Wed, 7 Aug 2019 17:09:49 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id v19so385179wmj.5 for ; Wed, 07 Aug 2019 08:09:49 -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=wzMJLr5HuW9ORQ9vvvtNfZIR5feaIwKAEQaY3/qiO4c=; b=Yl4AxzEXCJzqBRqzHlxJb4QShHmh2FY86mjS9g2NStYkMQjrlWh/+tDndzyYuOYoUg gJspsvx85/vRZS2bIWjVpHnxDV6fG3b39pF0JyYBVfVkzEGB0nrOx1KWAfEtz3/hwbIb GaHQa5ZkuVcqvVAcXg1QseltVF2iRZ5fkjqwtmEikZkI3kKbc3wze1bU0XwWm3fVNwaW LkJ6lgxClsmAyVc/gnHDXn+r4UGvK6ILh3olZoow3mLvB8hVDOhJ8NNMzXYE3r41BzQm Lr5UnlByA4HGo6qJSPrKo8DBE0WYJkdlhPv2qokSGip5k6WawRlvIhCSgeC86hUNbiFT N6tw== 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=wzMJLr5HuW9ORQ9vvvtNfZIR5feaIwKAEQaY3/qiO4c=; b=Nx/htr8U53oKco3u4lRHNyvC9fQuoK2eu/1msbPQUjeJj6CRZfb+ez0uEEWL9O3aX8 wEDPOUysgTnstoamrbVa0eVsoSAor7/RbDdwUMc7rsfzz5ldP4lEQmkWx/pOJhUd7otQ kKnsi1aJ++W6rodKKlfQX1LXpiOxgoQxOg/PgN4I6tZQC0zOABfG5CaiRKMqi2ILJXd/ 2t9dtfo4LDNsiUr5b4icFktkMifJF0F8VfkWBAMksaOEu7o6/q2e+AA3wO+f4vNx6Gpj FQMrD8eRCuYifAEYzBWLwV8N2vSKRCUTadJ/T/YLIhqhKkJztRpLBxhUILGb2KK4WHcy mgSA== X-Gm-Message-State: APjAAAV1u9ubPFVYizPqQkXkI70nFV5g0F7f++DvBpnkLmtpIMEsiJWt TJQxkYgSYkXCdVf/o9lYorQy6UvOtg== X-Google-Smtp-Source: APXvYqyFL54hzzR7f8+bQ1j45GkoTf4hqcJ+Iou16gA/LS3hYPFyiwLgSCuDzc3OIGJXhMPXin4ewA== X-Received: by 2002:a1c:3587:: with SMTP id c129mr473058wma.90.1565190588722; Wed, 07 Aug 2019 08:09:48 -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 r5sm382862wmh.35.2019.08.07.08.09.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 08:09:47 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Wed, 7 Aug 2019 17:09:18 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 19.11 V2 09/12] virtio: get all pending rx packets with vectorized functions 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 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