netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>
Cc: Breno Leitao <leitao@debian.org>,
	Pavan Chebbi <pavan.chebbi@broadcom.com>,
	Michael Chan <mchan@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH net-next] tg3: extract GRXRINGS from .get_rxnfc
Date: Fri, 7 Nov 2025 11:04:22 +0000	[thread overview]
Message-ID: <aQ3SNvSigJwffoQK@horms.kernel.org> (raw)
In-Reply-To: <CACKFLinyjqWRue89WDzyNXUM2gWPbKRO8k9wzN=JjRqdrHz_fA@mail.gmail.com>

On Thu, Nov 06, 2025 at 10:45:21AM -0800, Michael Chan wrote:
> On Thu, Nov 6, 2025 at 9:06 AM Breno Leitao <leitao@debian.org> wrote:
> >     tg3: Fix num of RX queues being reported by ethtool
> >
> >     Using num_online_cpus() to report number of queues is actually not
> >     correct, as reported by Michael[1].
> >
> >     netif_get_num_default_rss_queues() was used to replace num_online_cpus()
> >     in the past, but tg3 ethtool callbacks didn't get converted. Doing it
> >     now.
> >
> >     Link: https://lore.kernel.org/all/CACKFLim7ruspmqvjr6bNRq5Z_XXVk3vVaLZOons7kMCzsEG23A@mail.gmail.com/#t [1]
> >
> >     Signed-off-by: Breno Leitao <leitao@debian.org>
> >     Suggested-by: Michael Chan <michael.chan@broadcom.com>
> >
> > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > index fa58c3ffceb06..5fdaee7ef9d7a 100644
> > --- a/drivers/net/ethernet/broadcom/tg3.c
> > +++ b/drivers/net/ethernet/broadcom/tg3.c
> > @@ -12729,7 +12729,7 @@ static u32 tg3_get_rx_ring_count(struct net_device *dev)
> >         if (netif_running(tp->dev))
> >                 return tp->rxq_cnt;
> >
> > -       return min(num_online_cpus(), TG3_RSS_MAX_NUM_QS);
> > +       return min((u32) netif_get_num_default_rss_queues(), tp->rxq_max);
> 
> Isn't it better to use min_t()?

FWIIW, umin() seems appropriate to me.

Commit 80fcac55385c ("minmax: add umin(a, b) and umax(a, b)")
includes quite a long explanation of why it exists.
And that does seem to match this case.

  reply	other threads:[~2025-11-07 11:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 18:01 [PATCH net-next] tg3: extract GRXRINGS from .get_rxnfc Breno Leitao
2025-11-05 19:05 ` Michael Chan
2025-11-06  1:01   ` Jakub Kicinski
2025-11-06  6:00     ` Michael Chan
2025-11-06 17:06   ` Breno Leitao
2025-11-06 18:45     ` Michael Chan
2025-11-07 11:04       ` Simon Horman [this message]
2025-11-07 13:59         ` Breno Leitao
2025-11-06 22:50 ` patchwork-bot+netdevbpf

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=aQ3SNvSigJwffoQK@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchan@broadcom.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@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).