patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: stable@dpdk.org
Subject: [dpdk-stable] [PATCH 19.11 6/6] net/bnxt: clear cached statistics
Date: Mon, 16 Aug 2021 20:20:59 +0530	[thread overview]
Message-ID: <20210816145059.31065-7-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210816145059.31065-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

[ upstream commit 84fd852caac19795d0a05af8dabce8f011fe61a4 ]

As part of the workaround put in the commit "219842b9990c",
driver caches the last read stats values from the hardware.
But this is not cleared during the clear stats operation. This
results in showing up stale stats values while reading the stats
after the clear operation.

Fixes: 219842b9990c ("net/bnxt: workaround spurious zero stats in Thor")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 2b8b927..b9538bb 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -475,6 +475,16 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 	return rc;
 }
 
+static void bnxt_clear_prev_stat(struct bnxt *bp)
+{
+	/*
+	 * Clear the cached values of stats returned by HW in the previous
+	 * get operation.
+	 */
+	memset(bp->prev_rx_ring_stats, 0, sizeof(struct bnxt_ring_stats) * bp->rx_cp_nr_rings);
+	memset(bp->prev_tx_ring_stats, 0, sizeof(struct bnxt_ring_stats) * bp->tx_cp_nr_rings);
+}
+
 int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 {
 	struct bnxt *bp = eth_dev->data->dev_private;
@@ -497,6 +507,8 @@ int bnxt_stats_reset_op(struct rte_eth_dev *eth_dev)
 		rte_atomic64_clear(&rxq->rx_mbuf_alloc_fail);
 	}
 
+	bnxt_clear_prev_stat(bp);
+
 	return ret;
 }
 
@@ -662,5 +674,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 		PMD_DRV_LOG(ERR, "Failed to reset xstats: %s\n",
 			    strerror(-ret));
 
+	bnxt_clear_prev_stat(bp);
+
 	return ret;
 }
-- 
2.10.1


  parent reply	other threads:[~2021-08-16 14:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 14:50 [dpdk-stable] [PATCH 19.11 0/6] backport bnxt fixes to 19.11 Kalesh A P
2021-08-16 14:50 ` [dpdk-stable] [PATCH 19.11 1/6] net/bnxt: fix auto-negotiation on Whitney+ Kalesh A P
2021-08-16 14:50 ` [dpdk-stable] [PATCH 19.11 2/6] net/bnxt: remove unnecessary comment Kalesh A P
2021-08-16 14:50 ` [dpdk-stable] [PATCH 19.11 3/6] net/bnxt: invoke device removal event on recovery failure Kalesh A P
2021-08-16 14:50 ` [dpdk-stable] [PATCH 19.11 4/6] net/bnxt: detect bad opaque in Rx completion Kalesh A P
2021-08-16 14:50 ` [dpdk-stable] [PATCH 19.11 5/6] net/bnxt: workaround spurious zero stats in Thor Kalesh A P
2021-08-16 14:50 ` Kalesh A P [this message]
2021-08-17  9:40 ` [dpdk-stable] [PATCH 19.11 0/6] backport bnxt fixes to 19.11 Christian Ehrhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210816145059.31065-7-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).