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 76676A00E6 for ; Thu, 8 Aug 2019 10:24:10 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 696F84CA9; Thu, 8 Aug 2019 10:23:12 +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 63F872082 for ; Thu, 8 Aug 2019 10:22:59 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id p74so1472533wme.4 for ; Thu, 08 Aug 2019 01:22: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=/wwyBWtHvE0iti6aeLOKXJyfmprdVMD/mYawrC3wwNg=; b=Yeukic7Pu3vN0/cjWS2WwWNutu7at0UWTMfcdIN0vARF2vG6kcweLx1uQxQOM1APWm V+whRfO/SZ/SLgNFEsSW6G8QrG+kq3vmoqwO05dBnaHYVwm9cCGh6GA5m5DGdlFHUF8I TPddNwq41AUMoyB7uUibKkhH6neHDzjcZYgOxrNub7K1t2NXb1qPevRc+rsxoLmr7zN9 nk0SJGVzkWjVUsn9YwQnBXtxHC9Egj1eeZkeAS/tu2oomxQqOQov2IwN4StCTXOGtca3 dLDVrALOTMo5dRh2M7oDUY4meGQ9JmqzULbMuj80z2/pNXTL8Zi0vG+6Dc7imMpKZ7s2 MOxQ== 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=/wwyBWtHvE0iti6aeLOKXJyfmprdVMD/mYawrC3wwNg=; b=L8yd3EBOhTzojVRB5BlmIkFcp6/C/rY0UmuQQdKvR+WdvH1XRsQfBzPJDW4jKsrbgc Sx4NcQvRDqrS3NTTP+yFqKmTUkmKMAL0Xcxj8/GcADpbYQNP28ipVya6FJfofScvSoji /r0wwJIEO8mdrnF34HnfkZ44KP+GdXWgChFSdK8UhALSa+/Jg/Y+iqcO45kRZyAcHoST lAdXb8Sccu/pPHpI8bajU20L1pIuCxMII+TfxaukUjr80am8PLn+H3UwoN1wDFc8GHzK SR7l9UayXHO1jmS/x0sej8XqO9I2qWlLtwOiuQzFd7Pcx4WF8BieVIIDRYRc2h1X1TQY gq/Q== X-Gm-Message-State: APjAAAXCWDMdfchNfnGcnn6Wy03jX7thMHVXO79G/JlOEVwy9dCDr2GC aMhy7OrYM3Guiv4gXmbSmTJzcfl+qA== X-Google-Smtp-Source: APXvYqz1xLgw6xGINocMEvV1m502E2Ri8dT5FHjVcBhm79GhIhHPYTPsqhR1iRYCtv357/9GEP9HZg== X-Received: by 2002:a1c:cb43:: with SMTP id b64mr2964363wmg.86.1565252578794; Thu, 08 Aug 2019 01:22:58 -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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Aug 2019 01:22:58 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Thu, 8 Aug 2019 10:22:13 +0200 Message-Id: <29a5fde9fc18b74c9893d003e652dd14b31369d0.1565252336.git.thierry.herbelot@6wind.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 19.11 V3 08/12] 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 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.11.0