Re: [PATCH net 8/8] net: bcmgenet: mask DMA_TIMEOUT_MASK when reading DMA_RING0_TIMEOUT

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_get_coalesce() reads DMA_RING0_TIMEOUT to calculate
> rx_coalesce_usecs without masking out bits outside DMA_TIMEOUT_MASK
> (16 bits). If upper bits are non-zero or contain status/flags, the
> computed value of rx_coalesce_usecs returned to userspace via ethtool
> becomes corrupted.
> 
> Mask the register read with DMA_TIMEOUT_MASK before computing the
> timeout in microseconds.
> 
> Fixes: 4a29645bfe6c ("net: bcmgenet: Implement RX coalescing control 
> knobs")
> Assisted-by: LLM
> Co-authored-by: Cursor <[email protected]>
> Change-Id: I4c5b5019e764dbd0c7e51bd8c7365939a4736e44
> ---
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c 
> b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 3a6a2f075959..b15e64a484b4 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -852,7 +852,8 @@ static int bcmgenet_get_coalesce(struct net_device 
> *dev,
>  	ec->rx_max_coalesced_frames =
>  		bcmgenet_rdma_ring_readl(priv, 0, DMA_MBUF_DONE_THRESH);
>  	ec->rx_coalesce_usecs =
> -		bcmgenet_rdma_readl(priv, DMA_RING0_TIMEOUT) * 8192 / 1000;
> +		(bcmgenet_rdma_readl(priv, DMA_RING0_TIMEOUT) &
> +		 DMA_TIMEOUT_MASK) * 8192 / 1000;
> 
>  	for (i = 0; i <= priv->hw_params->rx_queues; i++) {
>  		ring = &priv->rx_rings[i];

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.