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 C6A21A00E6 for ; Wed, 7 Aug 2019 16:39:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AA8701B957; Wed, 7 Aug 2019 16:38:17 +0200 (CEST) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 5942B2C02 for ; Wed, 7 Aug 2019 16:37:59 +0200 (CEST) Received: by mail-wm1-f68.google.com with SMTP id s15so284932wmj.3 for ; Wed, 07 Aug 2019 07:37: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=NZH3GcJKdzDfO7jK2vjY1yf+BFeXzaz2yLSDIletMW4=; b=M22ZRP7VC7l8Fbpv0GGBfLcUxAvlj4zEeJw4FbTGAGGa4wDRY6uZY2j5zdmF+GNBL+ gfui28Q6Vn1O+HjVBQQhkybHPTNtPYcb0w7bVHHyod+u03VLF1dGo6MfNYsJOOvFIMqb zhTecWP7MBcyNDqkqa55Wdg/CfJtyjtXbNmN57TqbH+RL3FitdwPSlBEjQ56iqbCQ5JV Kmw05NsFshnVia5Ujer+De+tcdnphyLYjiZ/CZXDfqMetmhrPXhAd5i7URtor8qonGAB Nq8T5vNCHOFZdX1d8mxojq8j1mW9uDhO9hs9PjjbaDKwxNqkyam6hjSKwgIbV6XI+nOH LV4Q== 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=NZH3GcJKdzDfO7jK2vjY1yf+BFeXzaz2yLSDIletMW4=; b=Do1STrLMa436Rl0NbJSxTdhlb28ZAjb3s1/+5Fj080lOU80MyT8nQdz109a4ngn+6f 3qn5rRPGWmS10SVtrqocoNV2FJtao0z8UbqYrbsWO+r3XqKuM/p5HKEolMyzaa73E6LG 9hlxG8dH7darBJddMuqNw8ZNXDiNgRQZvsoR8UQezRU6zvOl7fGBOk84RrxzeZ56/W6H gQLyB8uv6zNimCD9i8zd1/amYqnb1yy0YGuaGsZx1fphGin/SMTz3SEI2wbJTpswMGxY DVvrJmetmmc0eFscvJsjJoAMFeUyyosUoteISsKcRevEemD+MorGgRjHjgKcodGQvaqe i1EA== X-Gm-Message-State: APjAAAUmpXcanTe5/UMFBHkTM4AWiX+R5sUDbPIxGU8WzddBXj6FFo9R 5Du8t10XIGfooY/NlUOTDV2idGpwHg== X-Google-Smtp-Source: APXvYqz4YoNJyl+FB/43B4I5o1E9aDNlvaAHFzwPkpOzXBZLmaeiS3LJn4hWQ6Szth8mYyvYlZCZTQ== X-Received: by 2002:a1c:ca14:: with SMTP id a20mr268839wmg.71.1565188678845; Wed, 07 Aug 2019 07:37: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 2sm133441211wrn.29.2019.08.07.07.37.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 07:37:58 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Wed, 7 Aug 2019 16:37:27 +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 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 at 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 | 6 ++++++ drivers/net/virtio/virtio_rxtx_simple_sse.c | 6 ++++++ 4 files changed, 15 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..e4b18cba0ce5 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,9 @@ 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++) { + rxvq->stats.bytes += ref_rx_pkts[nb_used]->pkt_len; + 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..c757e8c9d601 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,9 @@ 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++) { + rxvq->stats.bytes += ref_rx_pkts[nb_used]->pkt_len; + virtio_update_packet_stats(&rxvq->stats, ref_rx_pkts[nb_used]); + } return nb_pkts_received; } -- 2.11.0