Skip to contentSkip to conversation

net/null: fix Tx statistics accumulation

PATCH In review Zhanibek Bakin 2 participants 2 messages Jan 29 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/null: fix Tx statistics accumulation

The eth_stats_get() function incorrectly uses assignment (=) instead of accumulation (+=) for opackets and obytes in the TX queue loop. This causes only the last TX queue's statistics to be reported, while the RX side correctly uses +=.

Fixes 31326ce7f151 ("net/null: count all queues")

---
v2: Fixed Fixes tag to use 12-character hash

---
 drivers/net/null/rte_eth_null.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/null/rte_eth_null.c +2 -2
index 46e7e7bd8c..7fba3a661b 100644
@@ -345,8 +345,8 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats,
 		pkts = rte_atomic_load_explicit(&q->tx_pkts, rte_memory_order_relaxed);
 		bytes = rte_atomic_load_explicit(&q->tx_bytes, rte_memory_order_relaxed);
 
-		stats->opackets = pkts;
-		stats->obytes = bytes;
+		stats->opackets += pkts;
+		stats->obytes += bytes;
 
 		if (qstats != NULL && i < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
 			qstats->q_opackets[i] = pkts;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · On Thu, 29 Jan 2026 14:03:12 +0500 Zhanibek Bakin <[email protected]>…

The eth_stats_get() function incorrectly uses assignment (=) instead of accumulation (+=) for opackets and obytes in the TX queue loop. This causes only the last TX queue's statistics to be reported, while the RX side correctly uses +=.

Quoted 7 lines
Fixes 31326ce7f151 ("net/null: count all queues")

---
v2: Fixed Fixes tag to use 12-character hash
---

Looks good, queued to next-net.