Re: [REGRESSION][BISECTED] stmmac: suspend hangs since 1b9707e6f1a9 ("net: stmmac: enable RPS and RBU interrupts")

Andrew Lunn <[email protected]> Sat, 18 Jul 2026 16:06:26 +0200
Newsgroups dev.linux.lists.regressions,org.kernel.vger.netdev
Message-ID <[email protected]>
>  {
>  	u8 rx_channels_count = priv->plat->rx_queues_to_use;
>  	u8 tx_channels_count = priv->plat->tx_queues_to_use;
> +	u8 max_chan = max(rx_channels_count, tx_channels_count);
>  	u8 chan;
>  
> -	for (chan = 0; chan < rx_channels_count; chan++)
> -		stmmac_stop_rx_dma(priv, chan);
> -
> -	for (chan = 0; chan < tx_channels_count; chan++)
> -		stmmac_stop_tx_dma(priv, chan);
> +	for (chan = 0; chan < max_chan; chan++) {
> +		if (chan < rx_channels_count)
> +			stmmac_stop_rx_dma(priv, chan);
> +		if (chan < tx_channels_count)
> +			stmmac_stop_tx_dma(priv, chan);
> +		stmmac_deinit_chan(priv, priv->ioaddr, chan);
> +	}

It is a personal preference, but i would keep the code simple, stupid,
KISS.

Keep the two loops as they are. And add a third loop calling
stmmac_deinit_chan(). That then mirrors the code in
stmmac_init_dma_engine() which also has three loops.

I would also rename max_chan to dma_csr_ch so it has the same name as
in stmmac_init_dma_engine(). As i said, stmmac has pretty bad naming,
mirror functions are not obvious, but when adding new code, we should
try to do better.

    Andrew