DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>
Subject: Re: [PATCH] net/ixgbe: fix per-queue stats for less queues
Date: Thu, 24 Oct 2024 09:49:02 -0700	[thread overview]
Message-ID: <20241024094902.69cdb3d1@hermes.local> (raw)
In-Reply-To: <20241024111757.791634-1-mb@smartsharesystems.com>

On Thu, 24 Oct 2024 11:17:57 +0000
Morten Brørup <mb@smartsharesystems.com> wrote:

> Remove the requirement that the configured number of queues to provide
> statistics for (RTE_ETHDEV_QUEUE_STAT_CNTRS) cannot be less than the
> driver's max supported number of the same (IXGBE_QUEUE_STAT_COUNTERS).
> 
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index ab37c37469..895d6e7169 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>  	stats->opackets = hw_stats->gptc;
>  	stats->obytes = hw_stats->gotc;
>  
> -	for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) {
> +	for (i = 0; i < RTE_MIN(IXGBE_QUEUE_STAT_COUNTERS,
> +			(typeof(IXGBE_QUEUE_STAT_COUNTERS))RTE_ETHDEV_QUEUE_STAT_CNTRS); i++) {

Maybe use RTE_MIN_T to avoid using typeof directly here.

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ab37c37469..cdf689c22d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -3385,7 +3385,8 @@ ixgbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        stats->opackets = hw_stats->gptc;
        stats->obytes = hw_stats->gotc;
 
-       for (i = 0; i < IXGBE_QUEUE_STAT_COUNTERS; i++) {
+       for (i = 0; i < RTE_MIN_T(IXGBE_QUEUE_STAT_COUNTERS,
+                         RTE_ETHDEV_QUEUE_STAT_CNTRS, unsigned); i++) {
                stats->q_ipackets[i] = hw_stats->qprc[i];
                stats->q_opackets[i] = hw_stats->qptc[i];
                stats->q_ibytes[i] = hw_stats->qbrc[i];

      parent reply	other threads:[~2024-10-24 16:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24 11:17 Morten Brørup
2024-10-24 15:15 ` Morten Brørup
2024-10-24 16:02   ` Bruce Richardson
2024-10-24 16:28     ` Morten Brørup
2024-10-24 16:46       ` Bruce Richardson
2024-10-24 19:00   ` Morten Brørup
2024-10-24 16:49 ` Stephen Hemminger [this message]

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=20241024094902.69cdb3d1@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.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).