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

Nicolai Buchwitz <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 18.9.2026 02:07, Florian Fainelli wrote:
> 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 <[email protected]>
> 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 <[email protected]>

Thanks,
Nicolai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.