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 31E69A00E6 for ; Wed, 7 Aug 2019 17:10:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C2CA814EC; Wed, 7 Aug 2019 17:10:08 +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 339C62C0C for ; Wed, 7 Aug 2019 17:09:47 +0200 (CEST) Received: by mail-wm1-f65.google.com with SMTP id 207so417727wma.1 for ; Wed, 07 Aug 2019 08:09:47 -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=jSQu2DFj7DD6iYsxknajP4MvciHyyDmKoyWDLHaf6hw=; b=j6aUIHFb7A3rSAW4Vc9MosY5dJI3nKzKbRZb1/qwKloEePti6u4BBLixf2qWBW7VDO 3BbQSPu/gG8NZA7XPhFOlC8n+BOD6dldEq84DyaI4cdAYBEwYhwmDDcWY534bTxIS63B rGW1sLtIJBnD+gmV4PJnKyUjjxvOArc7eTm4gbw2B42AIJHq2aIfSyjVHXP4+p5CuU4U 9VPimTWxCQzcxfnWeOeNSMLTZNqCh2Rj/MNH0lWSNhXB8RFU/aQU/MYzUY17/hv6YsLf YPEP8R7pgoDSRM3TA7A7dO5gPpcOrZjOVFF0t3ZIP0WNdzeDnEaXj4mi4LFCzN8/84yu nZ3w== 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=jSQu2DFj7DD6iYsxknajP4MvciHyyDmKoyWDLHaf6hw=; b=hRUevEn3ElHUnkmAKYkh83WH45J0qo3hpj3HilDanZRxEYq80Bzzeew4DL306aA2cg nBE4Q6Maeg32+res/kPHKoWqLPmckaPnfS+LLx9YimCA5WdxU4mGw6UulgM3OTZCfQXg Va0njmWlvOWWlDWyNHrmwWVYzX9Dq54wXcrADYf0umjBicyt3/sB3tnn3CfeC4YSNnYJ O77usu8a5ZH5u9Wp8Yqmee9q1ORA+mw0aktV8doZMVISFis0fa0HOKT+8EoRez7HQ6hR 177TQHOBFMOQvBRigi12UlrMqZwrbnb5F2es6Soqpkzos8hHKUNboHmKpUxWZQ//3n9S yNwg== X-Gm-Message-State: APjAAAXSP2SoCqThhXRsUUQLlEjKd+YHILOhF1oq6Vv10ozUWsZxhyQm OQKZ2xoJvzkmRWnN/r3t/3bF+YWsMg== X-Google-Smtp-Source: APXvYqxwZ72xIVoRm8/w3WQWv7zDc/S/z/FkudMNeyt0avUm9Bc7hx34onXqJmV3se76hozHcAL17w== X-Received: by 2002:a1c:7a02:: with SMTP id v2mr390730wmc.159.1565190586979; Wed, 07 Aug 2019 08:09:46 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Aug 2019 08:09:46 -0700 (PDT) From: Thierry Herbelot To: dev@dpdk.org Cc: Thibaut Collet , stable@dpdk.org, Thomas Monjalon Date: Wed, 7 Aug 2019 17:09:17 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-stable] [PATCH 19.11 V2 08/12] virtio: fix rx stats with vectorized functions X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 | 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