[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACKFLim7ruspmqvjr6bNRq5Z_XXVk3vVaLZOons7kMCzsEG23A@mail.gmail.com>
Date: Wed, 5 Nov 2025 11:05:34 -0800
From: Michael Chan <michael.chan@...adcom.com>
To: Breno Leitao <leitao@...ian.org>
Cc: Pavan Chebbi <pavan.chebbi@...adcom.com>, Michael Chan <mchan@...adcom.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH net-next] tg3: extract GRXRINGS from .get_rxnfc
On Wed, Nov 5, 2025 at 10:02 AM Breno Leitao <leitao@...ian.org> wrote:
>
> Commit 84eaf4359c36 ("net: ethtool: add get_rx_ring_count callback to
> optimize RX ring queries") added specific support for GRXRINGS callback,
> simplifying .get_rxnfc.
>
> Remove the handling of GRXRINGS in .get_rxnfc() by moving it to the new
> .get_rx_ring_count().
>
> Given that tg3_get_rxnfc() only handles ETHTOOL_GRXRINGS, then this
> function becomes useless now, and it is removed.
>
> This also fixes the behavior for devices without MSIX support.
> Previously, the function would return -EOPNOTSUPP, but now it correctly
> returns 1.
>
> The functionality remains the same: return the current queue count
> if the device is running, otherwise return the minimum of online
> CPUs and TG3_RSS_MAX_NUM_QS.
>
> Signed-off-by: Breno Leitao <leitao@...ian.org>
> ---
> PS: This was compiled-tested only and NOT tested on a real hardware.
> ---
> drivers/net/ethernet/broadcom/tg3.c | 24 ++++++------------------
> 1 file changed, 6 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index d78cafdb20949..fa58c3ffceb06 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -12719,29 +12719,17 @@ static int tg3_get_sset_count(struct net_device *dev, int sset)
> }
> }
>
> -static int tg3_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
> - u32 *rules __always_unused)
> +static u32 tg3_get_rx_ring_count(struct net_device *dev)
> {
> struct tg3 *tp = netdev_priv(dev);
>
> if (!tg3_flag(tp, SUPPORT_MSIX))
> - return -EOPNOTSUPP;
> + return 1;
>
> - switch (info->cmd) {
> - case ETHTOOL_GRXRINGS:
> - if (netif_running(tp->dev))
> - info->data = tp->rxq_cnt;
> - else {
> - info->data = num_online_cpus();
> - if (info->data > TG3_RSS_MAX_NUM_QS)
> - info->data = TG3_RSS_MAX_NUM_QS;
> - }
> + if (netif_running(tp->dev))
> + return tp->rxq_cnt;
>
> - return 0;
> -
> - default:
> - return -EOPNOTSUPP;
> - }
> + return min(num_online_cpus(), TG3_RSS_MAX_NUM_QS);
The existing code to use num_online_cpus() is actually not correct.
This is more correct:
return min(netif_get_num_default_rss_queues(), tp->rxq_max);
I think when netif_get_num_default_rss_queues() was used to replace
num_online_cpus(), tg3_get_rxnfc() was not properly converted.
Thanks.
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5469 bytes)
Powered by blists - more mailing lists