DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH] bnxt: skip getting statistics for queues not started
Date: Wed, 21 Apr 2021 16:09:29 -0700	[thread overview]
Message-ID: <20210421230929.434822-1-stephen@networkplumber.org> (raw)

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.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnxt/bnxt_stats.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index bb4b2eee194e..11767e06d074 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -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


             reply	other threads:[~2021-04-21 23:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 23:09 Stephen Hemminger [this message]
2021-04-24 18:56 ` Ajit Khaparde

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=20210421230929.434822-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=somnath.kotur@broadcom.com \
    /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).