Re: [PATCH net-next] tg3: extract GRXRINGS from .get_rxnfc

From: Breno Leitao

Date: Thu Nov 06 2025 - 12:06:06 EST


On Wed, Nov 05, 2025 at 11:05:34AM -0800, Michael Chan wrote:
> 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.

I can resend the current patch with this additional patch:

Author: Breno Leitao <leitao@xxxxxxxxxx>
Date: Thu Nov 6 08:05:49 2025 -0800

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@xxxxxxxxxxxxxx/#t [1]

Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
Suggested-by: Michael Chan <michael.chan@xxxxxxxxxxxx>

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);
}

static u32 tg3_get_rxfh_indir_size(struct net_device *dev)