Thread (16 messages) 16 messages, 4 authors, 4d ago

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

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-07-18 14:06:29
Also in: regressions

 {
 	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help