summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2025-09-22 15:26:29 +0300
committerSerge Semin <fancer.lancer@gmail.com>2026-08-13 20:36:53 +0300
commitf5217b89a59fae16008e37532068e71b51bd2b5a (patch)
tree4bd888fa716d06e02b8e45446c35cd87da1bd06e
parent83c9a3b84b8f576e5890029029c60b993c0c9305 (diff)
downloadlinux-f5217b89a59fae16008e37532068e71b51bd2b5a.tar.gz
linux-f5217b89a59fae16008e37532068e71b51bd2b5a.zip
net: stmmac: Fix spurious MAC IRQs on device open
The MAC IRQs are enabled early on the NET-device open stage by means of the stmmac_core_init() method execution. But the IRQ-line is requested only after the main part of the DMA/MAC blocks are initialized and even after the PHY-link is set up. That causes the unhandled IRQs being caught in case if the MAC IRQ is really shared. Let's fix that by performing the IRQ-line request procedure earlier - before the PHY-link is brought up thus making sure that all the link-related IRQs will happen afterwards and won't be missed. Note this change is also required for the DW MAC GPI IRQs handling in the shared IRQ-line manner. Fixes: 523f11b5d4fd ("net: stmmac: move hardware setup for stmmac_open to new function") Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b1c509035276..e0d94e7d7a00 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4265,12 +4265,15 @@ static int __stmmac_open(struct net_device *dev,
stmmac_init_coalesce(priv);
- phylink_start(priv->phylink);
-
+ /* Request IRQs before any PHY/DMA/etc IRQs are activated to prevent
+ * the spurious IRQs getting by the handlers of the shared MAC IRQ.
+ */
ret = stmmac_request_irq(dev);
if (ret)
goto irq_error;
+ phylink_start(priv->phylink);
+
stmmac_enable_all_queues(priv);
netif_tx_start_all_queues(priv->dev);
stmmac_enable_all_dma_irq(priv);
@@ -4278,8 +4281,6 @@ static int __stmmac_open(struct net_device *dev,
return 0;
irq_error:
- phylink_stop(priv->phylink);
-
for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);