public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: fix the stat collection
@ 2026-01-12 19:23 Kishore Padmanabha
  2026-01-13  0:42 ` Stephen Hemminger
  2026-01-13 14:59 ` [PATCH v2] " Kishore Padmanabha
  0 siblings, 2 replies; 3+ messages in thread
From: Kishore Padmanabha @ 2026-01-12 19:23 UTC (permalink / raw)
  To: dev; +Cc: stable

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/bnxt: fix the stat collection
  2026-01-12 19:23 [PATCH] net/bnxt: fix the stat collection Kishore Padmanabha
@ 2026-01-13  0:42 ` Stephen Hemminger
  2026-01-13 14:59 ` [PATCH v2] " Kishore Padmanabha
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2026-01-13  0:42 UTC (permalink / raw)
  To: Kishore Padmanabha; +Cc: dev, stable

On Mon, 12 Jan 2026 14:23:51 -0500
Kishore Padmanabha <kishore.padmanabha@broadcom.com> wrote:

> 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>
> ---

Did AI code review on this (yes I am lazy)..

DPDK Patch Review: net/bnxt: fix the stat collection
Summary

This patch fixes statistics aggregation for Rx/Tx queues beyond the RTE_ETHDEV_QUEUE_STAT_CNTRS limit. The approach is to iterate over all rings but pass NULL for per-queue stats when the index exceeds the limit, ensuring aggregate counters still accumulate properly.
Commit Message Issues

ERROR — Tag Order Violation

The tags are in wrong order. Per AGENTS.md, the correct order is:

Bugzilla ID:
Fixes:
Cc:
<blank line>
Signed-off-by:

Current patch has:

Bugzilla ID: 1836
Cc: stable@dpdk.org       ← wrong position
Fixes: 57d5e5bc86e4 (...)

Signed-off-by: ...

Cc: must come after Fixes:, not before.

WARNING — Typo in Commit Body

Line 105: "aggregrating" should be "aggregating"

WARNING — Double Space

Line 106: There's a double space before "if" (CNTRS  if)

INFO — Suggested Rewrite

net/bnxt: fix the stat collection

Stats collection was not aggregating stats for rings greater
than RTE_ETHDEV_QUEUE_STAT_CNTRS when the application did not
increase the stats counters but supports more queues than the
limit. Add checks to increment aggregated stats from queues
greater than the limit.

Bugzilla ID: 1836
Fixes: 57d5e5bc86e4 ("net/bnxt: add statistics")
Cc: stable@dpdk.org

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

Code Review

Style Compliance ✓

    Line lengths within 100 characters
    Proper use of DPDK atomics (rte_atomic_load_explicit, rte_memory_order_relaxed)
    Consistent indentation with surrounding code
    No forbidden tokens detected

Technical Observations

The fix correctly:

    Extends iteration to cover all rings (bp->rx_cp_nr_rings / bp->tx_cp_nr_rings)
    Uses conditional i < num_q_stats ? qstats : NULL to suppress per-queue stats for indices beyond the limit while still accumulating aggregate stats

INFO — Implicit NULL Handling Assumption

The patch assumes bnxt_fill_rte_eth_stats() and bnxt_fill_rte_eth_stats_ext() safely handle NULL for the qstats parameter. This is likely intentional and correct, but worth confirming in review. A brief comment in the commit message like "The fill functions already handle NULL qstats for aggregate-only collection" would strengthen the patch.
Verdict
Category	Status
Subject line	✓ Pass
Tag format	ERROR — wrong order
Body content	WARNING — typo, double space
Signed-off-by	✓ Present
Code style	✓ Pass
Technical correctness	✓ Looks correct (pending NULL-handling verification)

Recommendation: Request v2 with corrected tag order and typo fix.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] net/bnxt: fix the stat collection
  2026-01-12 19:23 [PATCH] net/bnxt: fix the stat collection Kishore Padmanabha
  2026-01-13  0:42 ` Stephen Hemminger
@ 2026-01-13 14:59 ` Kishore Padmanabha
  1 sibling, 0 replies; 3+ messages in thread
From: Kishore Padmanabha @ 2026-01-13 14:59 UTC (permalink / raw)
  To: dev; +Cc: ajit.khaparde, stable

Stats collection was not aggregating stats for rings greater than
RTE_ETHDEV_QUEUE_STAT_CNTRS  when the application did not increase
the stats counters but supports more queues than the limit. Add
checks to increment aggregated stats from queues greater than
the limit. The fill functions already handle NULL qstats for
aggregate-only collection.

Bugzilla ID: 1836
Fixes: 57d5e5bc86e4 ("net/bnxt: add statistics")
Cc: stable@dpdk.org

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

v2:
* udpate the git commit message
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-13 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 19:23 [PATCH] net/bnxt: fix the stat collection Kishore Padmanabha
2026-01-13  0:42 ` Stephen Hemminger
2026-01-13 14:59 ` [PATCH v2] " Kishore Padmanabha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox