Skip to contentSkip to conversation

bnxt: skip getting statistics for queues not started

PATCH In review Stephen Hemminger 2 participants 2 messages Apr 21, 2021 – Apr 24, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bnxt: skip getting statistics for queues not started

An application using rte_flow may define a large number of queues but only use a small subset of them at any one time.

Since querying the status of each queue requires a request/spin/reply with the firmware, optimize by skipping the request for queues not running. For those queues the statistics will be 0.

This cuts the cost of single xstats query in half and has even bigger gain for simple stats query.

---
 drivers/net/bnxt/bnxt_stats.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/bnxt/bnxt_stats.c +4 -0
index bb4b2eee194e..11767e06d074 100644
@@ -528,6 +528,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_rx_queue *rxq = bp->rx_queues[i];
 		struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
+		if (!rxq->rx_started)
+			continue;
 		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
 				     bnxt_stats, 1);
 		if (unlikely(rc))
@@ -543,6 +545,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
 		struct bnxt_tx_queue *txq = bp->tx_queues[i];
 		struct bnxt_cp_ring_info *cpr = txq->cp_ring;
 
+		if (!txq->tx_started)
+			continue;
 		rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
 				     bnxt_stats, 0);
 		if (unlikely(rc))
Signature · 1 line
2.30.2
#1 lore raw
Quoted 4 lines · Stephen Hemminger

An application using rte_flow may define a large number of queues but only use a small subset of them at any one time.

Quoted 8 lines

Since querying the status of each queue requires a request/spin/reply with the firmware, optimize by skipping the request for queues not running. For those queues the statistics will be 0.

This cuts the cost of single xstats query in half and has even bigger gain for simple stats query.

Changed the commit headline to
"net/bnxt: skip get statistics for stopped queues" Patch applied to dpdk-next-net-brcm. Thanks

Quoted 29 lines
---
 drivers/net/bnxt/bnxt_stats.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/bnxt/bnxt_stats.c +4 -1
index bb4b2eee194e..11767e06d074 100644
@@ -528,6 +528,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
                struct bnxt_rx_queue *rxq = bp->rx_queues[i];
                struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
+               if (!rxq->rx_started)
+                       continue;
                rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
                                     bnxt_stats, 1);
                if (unlikely(rc))
@@ -543,6 +545,8 @@ int bnxt_stats_get_op(struct rte_eth_dev *eth_dev,
                struct bnxt_tx_queue *txq = bp->tx_queues[i];
                struct bnxt_cp_ring_info *cpr = txq->cp_ring;
 
+               if (!txq->tx_started)
+                       continue;
                rc = bnxt_hwrm_ctx_qstats(bp, cpr->hw_stats_ctx_id, i,
                                     bnxt_stats, 0);
                if (unlikely(rc))
--

2.30.2