From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [PATCH] net/bnxt: fix the stat collection
Date: Mon, 12 Jan 2026 14:23:51 -0500 [thread overview]
Message-ID: <20260112192354.3096196-1-kishore.padmanabha@broadcom.com> (raw)
The stats collection was not aggregrating the stats for rings greater
than RTE_ETHDEV_QUEUE_STAT_CNTRS if the application did not increase
the stats counters but supports more than the limit.
Added checks to increment the aggregated stats from queues
greater than the limit.
Bugzilla ID: 1836
Cc: stable@dpdk.org
Fixes: 57d5e5bc86e4 ("net/bnxt: add statistics")
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
---
drivers/net/bnxt/bnxt_stats.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 3ed1dc8101db..88cfbaf9ff4b 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -659,7 +659,7 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,
num_q_stats = RTE_MIN(bp->rx_cp_nr_rings,
(unsigned int)RTE_ETHDEV_QUEUE_STAT_CNTRS);
- for (i = 0; i < num_q_stats; i++) {
+ for (i = 0; i < bp->rx_cp_nr_rings; i++) {
struct bnxt_rx_queue *rxq = bp->rx_queues[i];
struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
struct bnxt_ring_stats_ext ring_stats = {0};
@@ -675,7 +675,8 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,
if (unlikely(rc))
return rc;
- bnxt_fill_rte_eth_stats_ext(bnxt_stats, &ring_stats, qstats, i, true);
+ bnxt_fill_rte_eth_stats_ext(bnxt_stats, &ring_stats,
+ i < num_q_stats ? qstats : NULL, i, true);
bnxt_stats->rx_nombuf +=
rte_atomic_load_explicit(&rxq->rx_mbuf_alloc_fail,
rte_memory_order_relaxed);
@@ -684,7 +685,7 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,
num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
(unsigned int)RTE_ETHDEV_QUEUE_STAT_CNTRS);
- for (i = 0; i < num_q_stats; i++) {
+ for (i = 0; i < bp->tx_cp_nr_rings; i++) {
struct bnxt_tx_queue *txq = bp->tx_queues[i];
struct bnxt_cp_ring_info *cpr = txq->cp_ring;
struct bnxt_ring_stats_ext ring_stats = {0};
@@ -697,7 +698,8 @@ static int bnxt_stats_get_ext(struct rte_eth_dev *eth_dev,
if (unlikely(rc))
return rc;
- bnxt_fill_rte_eth_stats_ext(bnxt_stats, &ring_stats, qstats, i, false);
+ bnxt_fill_rte_eth_stats_ext(bnxt_stats, &ring_stats,
+ i < num_q_stats ? qstats : NULL, i, false);
}
return rc;
@@ -724,7 +726,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
num_q_stats = RTE_MIN(bp->rx_cp_nr_rings,
(unsigned int)RTE_ETHDEV_QUEUE_STAT_CNTRS);
- for (i = 0; i < num_q_stats; i++) {
+ for (i = 0; i < bp->rx_cp_nr_rings; i++) {
struct bnxt_rx_queue *rxq = bp->rx_queues[i];
struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
struct bnxt_ring_stats ring_stats = {0};
@@ -739,7 +741,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
if (unlikely(rc))
return rc;
- bnxt_fill_rte_eth_stats(bnxt_stats, &ring_stats, qstats, i, true);
+ bnxt_fill_rte_eth_stats(bnxt_stats, &ring_stats,
+ i < num_q_stats ? qstats : NULL, i, true);
bnxt_stats->rx_nombuf +=
rte_atomic_load_explicit(&rxq->rx_mbuf_alloc_fail,
rte_memory_order_relaxed);
@@ -748,7 +751,7 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
num_q_stats = RTE_MIN(bp->tx_cp_nr_rings,
(unsigned int)RTE_ETHDEV_QUEUE_STAT_CNTRS);
- for (i = 0; i < num_q_stats; i++) {
+ for (i = 0; i < bp->tx_cp_nr_rings; i++) {
struct bnxt_tx_queue *txq = bp->tx_queues[i];
struct bnxt_cp_ring_info *cpr = txq->cp_ring;
struct bnxt_ring_stats ring_stats = {0};
@@ -761,7 +764,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
if (unlikely(rc))
return rc;
- bnxt_fill_rte_eth_stats(bnxt_stats, &ring_stats, qstats, i, false);
+ bnxt_fill_rte_eth_stats(bnxt_stats, &ring_stats,
+ i < num_q_stats ? qstats : NULL, i, false);
bnxt_stats->oerrors +=
rte_atomic_load_explicit(&txq->tx_mbuf_drop,
rte_memory_order_relaxed);
--
2.45.4
next reply other threads:[~2026-01-12 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 19:23 Kishore Padmanabha [this message]
2026-01-13 0:42 ` [PATCH] net/bnxt: fix the stat collection Stephen Hemminger
2026-01-13 14:59 ` [PATCH v2] " Kishore Padmanabha
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=20260112192354.3096196-1-kishore.padmanabha@broadcom.com \
--to=kishore.padmanabha@broadcom.com \
--cc=dev@dpdk.org \
--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