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 00929A2EEB for ; Wed, 11 Sep 2019 18:04:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BA9EF1E8CA; Wed, 11 Sep 2019 18:04:52 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id D97F81E8C2 for ; Wed, 11 Sep 2019 18:04:51 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id p7so4142596wmp.4 for ; Wed, 11 Sep 2019 09:04:51 -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=9k+VkqWIKhC5aBr3JYg4qcAj0AVeNDxY4zBQQntLZUI=; b=jAMqlH5tbFxOTIma4XCqGKHVoHwKdVD1g8lXbSKKVmYERWbTvKPnhlPL3xCfe9SJKb bm2/uyc4+pIz7g3ga6z/RJhk6SpR+zwmThIlzbWAL3Il5lUZGP90RF2oEnaGf8VNjoAd DLb4IgYf8gfp0uIndjIFqk5qsYTL+844SXMCmb6A2NRn1ug0/bvzfeUkAwkufX845E2Z qCF24FLug7M5/tQ8RwJskDWPUoPbYhmahSNcCmAc28v2PqVbfmoTdylCvZxNU0Rgi94C 9pEfhuJYlj1JDHTG8ooP5NWumzAi4l9i6TcHyVSsUlKXVq0PDW1mnUE4zIqhvBPFmlFf mVDg== 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=9k+VkqWIKhC5aBr3JYg4qcAj0AVeNDxY4zBQQntLZUI=; b=VorfImg57XoI1gdgCkCTI/9HIe5kUvVV2uyjoT2x1S9MQqNXHkMC16GcGgW9ViQz3f Ps1RgF31r2/wWPWyym/3dV6CDnvBfMTPRVKed0+NAkLKYD9Y7gy5X9QA5eY2VpX9iOUX x19pg0y2NRCU5czBs/7rwGoBfZXClsDv/p81+ROSd80FPeJBIQXjvvXzIipXeABkrnSn wy+ff2p03C83GjApjiE6FRbsM7TWzqb509sL00Fkau1No2wWa9UviLcew/ZhL+kpmE0z 5fZ+Oy0Tu4X9eBiLhW2YzokvfTUkWlaxH/wMSV1vyTwl+5SsNiPJo+403CZ4r9svCPJa 3plQ== X-Gm-Message-State: APjAAAWsbEfz/TifEgzdpDllgzNCP5pT5NY1m33w5t49/kCPxsr/L8Lq Zlt/KWr+oLUJwNJkPf6+ryTDWRHe2TXZ X-Google-Smtp-Source: APXvYqwWMCexadyr4b7TeJ3cvDAF5cNjID5eFVjWCgAcaVn2lj640B39LuP4R3QryTiujFo5DB46CQ== X-Received: by 2002:a1c:9ec9:: with SMTP id h192mr4739937wme.105.1568217891392; Wed, 11 Sep 2019 09:04:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2019 09:04:50 -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 Date: Wed, 11 Sep 2019 18:04:08 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/2] virtio: fix rx stats 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 With vectorized functions, only the rx stats for number of packets is incremented. Update also the other statistics. Performance impact is about 2% 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 Signed-off-by: Thibaut Collet --- drivers/net/virtio/virtio_rxtx.c | 2 +- drivers/net/virtio/virtio_rxtx.h | 2 ++ drivers/net/virtio/virtio_rxtx_simple_neon.c | 5 +++++ drivers/net/virtio/virtio_rxtx_simple_sse.c | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index 27ead19fbe81..6dd62bf51863 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -1083,7 +1083,7 @@ virtio_discard_rxbuf_inorder(struct virtqueue *vq, struct rte_mbuf *m) } } -static inline void +void virtio_update_packet_stats(struct virtnet_stats *stats, struct rte_mbuf *mbuf) { uint32_t s = mbuf->pkt_len; diff --git a/drivers/net/virtio/virtio_rxtx.h b/drivers/net/virtio/virtio_rxtx.h index 685cc4f8104c..1eb8dae227ee 100644 --- a/drivers/net/virtio/virtio_rxtx.h +++ b/drivers/net/virtio/virtio_rxtx.h @@ -59,5 +59,7 @@ struct virtnet_ctl { }; int virtio_rxq_vec_setup(struct virtnet_rx *rxvq); +void virtio_update_packet_stats(struct virtnet_stats *stats, + struct rte_mbuf *mbuf); #endif /* _VIRTIO_RXTX_H_ */ diff --git a/drivers/net/virtio/virtio_rxtx_simple_neon.c b/drivers/net/virtio/virtio_rxtx_simple_neon.c index cdc2a4d28ed5..70e89fc428e0 100644 --- a/drivers/net/virtio/virtio_rxtx_simple_neon.c +++ b/drivers/net/virtio/virtio_rxtx_simple_neon.c @@ -47,6 +47,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, struct vring_used_elem *rused; struct rte_mbuf **sw_ring; struct rte_mbuf **sw_ring_end; + struct rte_mbuf **ref_rx_pkts; uint16_t nb_pkts_received = 0; uint8x16_t shuf_msk1 = { @@ -105,6 +106,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, virtqueue_notify(vq); } + ref_rx_pkts = rx_pkts; for (nb_pkts_received = 0; nb_pkts_received < nb_used;) { uint64x2_t desc[RTE_VIRTIO_DESC_PER_LOOP / 2]; @@ -204,5 +206,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, vq->vq_used_cons_idx += nb_pkts_received; vq->vq_free_cnt += nb_pkts_received; rxvq->stats.packets += nb_pkts_received; + for (nb_used = 0; nb_used < nb_pkts_received; nb_used++) + virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]); + return nb_pkts_received; } diff --git a/drivers/net/virtio/virtio_rxtx_simple_sse.c b/drivers/net/virtio/virtio_rxtx_simple_sse.c index af76708d66ae..cb1610e71563 100644 --- a/drivers/net/virtio/virtio_rxtx_simple_sse.c +++ b/drivers/net/virtio/virtio_rxtx_simple_sse.c @@ -48,6 +48,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, struct vring_used_elem *rused; struct rte_mbuf **sw_ring; struct rte_mbuf **sw_ring_end; + struct rte_mbuf **ref_rx_pkts; uint16_t nb_pkts_received = 0; __m128i shuf_msk1, shuf_msk2, len_adjust; @@ -107,6 +108,7 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, virtqueue_notify(vq); } + ref_rx_pkts = rx_pkts; for (nb_pkts_received = 0; nb_pkts_received < nb_used;) { __m128i desc[RTE_VIRTIO_DESC_PER_LOOP / 2]; @@ -190,5 +192,8 @@ virtio_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, vq->vq_used_cons_idx += nb_pkts_received; vq->vq_free_cnt += nb_pkts_received; rxvq->stats.packets += nb_pkts_received; + for (nb_used = 0; nb_used < nb_pkts_received; nb_used++) + virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]); + return nb_pkts_received; } -- 2.20.1