Thread (21 messages) flat view 21 messages, 2 authors, 19h ago

Re: [PATCH net 2/8] net: bcmgenet: initialize u64 stats seq counter for all queues

From: Nicolai Buchwitz <hidden>
Date: 2026-09-18 10:13:43
Also in: lkml

On 18.9.2026 02:07, Florian Fainelli wrote:
quoted hunk ↗ jump to hunk
bcmgenet_gstrings_stats statically defines ethtool statistics for 
queues
0 through GENET_MAX_MQ_CNT (4). However, bcmgenet_probe() only 
initialized
the u64_stats_sync seq counter up to priv->hw_params->rx_queues and
priv->hw_params->tx_queues.

Since priv->hw_params->rx_queues is 0 across all hardware versions (and
priv->hw_params->tx_queues is 0 on GENET V1), rings 1..4 have 
uninitialized
u64_stats_sync structures. When ethtool -S is run on 32-bit kernels,
bcmgenet_get_ethtool_stats() reads stats from rx_rings[1..4], causing
lockdep warnings due to the uninitialized sequence counters.

Initialize the sequence counters for all GENET_MAX_MQ_CNT + 1 queues.

Fixes: ffc2c8c4a714 ("net: bcmgenet: Initialize u64 stats seq counter")
Assisted-by: LLM
Co-authored-by: Cursor [off-list ref]
Change-Id: I6c3debbd9fa5e7a151789fccf3d9a38db184f434
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 7b089de9484e..055e1362173b 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -4134,10 +4134,10 @@ static int bcmgenet_probe(struct 
platform_device *pdev)
 		priv->rx_rings[i].rx_max_coalesced_frames = 1;

 	/* Initialize u64 stats seq counter for 32bit machines */
-	for (i = 0; i <= priv->hw_params->rx_queues; i++)
+	for (i = 0; i <= GENET_MAX_MQ_CNT; i++) {
 		u64_stats_init(&priv->rx_rings[i].stats64.syncp);
-	for (i = 0; i <= priv->hw_params->tx_queues; i++)
 		u64_stats_init(&priv->tx_rings[i].stats64.syncp);
+	}

 	/* libphy will determine the link state */
 	netif_carrier_off(dev);
Reviewed-by: Nicolai Buchwitz <redacted>

Thanks,
Nicolai
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help