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 3F2FAA2EEB for ; Wed, 11 Sep 2019 18:05:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D9A1E1E8DB; Wed, 11 Sep 2019 18:05:00 +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 C92A51E8C9 for ; Wed, 11 Sep 2019 18:04:59 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id c10so4144735wmc.0 for ; Wed, 11 Sep 2019 09:04: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 :mime-version:content-transfer-encoding; bh=RwQWS9CO9J/2iL73c/pHW9nEZcegR1EglYm2fZBdyoY=; b=gC0zktI63riKxrgjgiveSzzNjGr0iVKxXkyIBNdKlSJSApD2LFEEiIYHkyng1K6gHm Iyi95r/camSJh/bVzFvPRnEmIgN9KfaMXTt09eCfXh2wOqfBtDZ9a0C7BxRicYXNA4C6 cnwbEJZWPURYqk8Me86v3w5k6/Pkx/DWpMRqvf3Kd/hQAzT7lpfrd71HngnGxhjDPayI atJUa2bNNy/XokiqpNcW3GfOdAhRnZxQdRWwqEBTREm8MWe5PYsY4be2MwY6+U9z03+D NC8x0KSX3cqx5NxV0j5zxePiPQsIZ5PEQJg+sGnahc3H05MqEclDXvq2s/GbcRMOlmiw TEcw== 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:mime-version:content-transfer-encoding; bh=RwQWS9CO9J/2iL73c/pHW9nEZcegR1EglYm2fZBdyoY=; b=RLjZIr78YRw6MZbrOVsqO9oXEaRakGvmTfgyzOAn17lGwNzSjIRgldKE12gjKdlDHD 7W/3Bp37jXJtqiorhrkKG4l7V4ILdxS3kGf3Fb8MhGd0gQP/GMkURBpHEWSYvgR49V61 HWupJQn74QioUYxVV8Z9btlZajCXpU63WYMoAb6UikqYH9XqKQXCizwNWrTAcvqCL2/G QODWJPhw2HHAU8hP3Isjp4XLYNUZswIjtKc8IbFJORY4QNJpfJMdUv9K5lGD4/l7Fk8Q KLoDvH2JCB7gn+v4lRPicVqCsztmWgNzS8tLR5nKzKz54BMDXOdz5X1jaSvZfQrJOUvY HlOw== X-Gm-Message-State: APjAAAV57P9SY22T9ER7Dx8HkwVam6ye24T+Y9rhhQh9bM8BCbM9uGdJ ILTcrSGGUL6aGNUTS2NOqVbtoKiJBuoqSDw= X-Google-Smtp-Source: APXvYqz2m3PVhL5JTcqujrom4gz40XgCT5HBvIw9jjx+ph4Vci7OZ68yCOq1w4BeqU/nFSXBLC6qZA== X-Received: by 2002:a7b:c054:: with SMTP id u20mr4481301wmc.11.1568217899386; Wed, 11 Sep 2019 09:04: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 v8sm33477216wra.79.2019.09.11.09.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 09:04:58 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , Thomas Monjalon , stable@dpdk.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, jerinj@marvell.com, gavin.hu@arm.com Date: Wed, 11 Sep 2019 18:04:09 +0200 Message-Id: <4532a3e5b53802da7e1b35c6c9383b406a18c30d.1568216827.git.thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 2/2] 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 Cc: maxime.coquelin@redhat.com Cc: tiwei.bie@intel.com Cc: zhihong.wang@intel.com Cc: jerinj@marvell.com Cc: gavin.hu@arm.com 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.20.1