DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bnxt: skip getting statistics for queues not started
@ 2021-04-21 23:09 Stephen Hemminger
  2021-04-24 18:56 ` Ajit Khaparde
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2021-04-21 23:09 UTC (permalink / raw)
  To: Ajit Khaparde, Somnath Kotur; +Cc: dev, 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.

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


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

* Re: [dpdk-dev] [PATCH] bnxt: skip getting statistics for queues not started
  2021-04-21 23:09 [dpdk-dev] [PATCH] bnxt: skip getting statistics for queues not started Stephen Hemminger
@ 2021-04-24 18:56 ` Ajit Khaparde
  0 siblings, 0 replies; 2+ messages in thread
From: Ajit Khaparde @ 2021-04-24 18:56 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Somnath Kotur, dpdk-dev

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Wed, Apr 21, 2021 at 4:09 PM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> 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>
Changed the commit headline to
"net/bnxt: skip get statistics for stopped queues"
Patch applied to dpdk-next-net-brcm. Thanks

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

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

end of thread, other threads:[~2021-04-24 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 23:09 [dpdk-dev] [PATCH] bnxt: skip getting statistics for queues not started Stephen Hemminger
2021-04-24 18:56 ` Ajit Khaparde

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