netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: phy: Don't disable irqs on shutdown if WoL is enabled
@ 2023-08-04  7:17 Uwe Kleine-König
  2023-08-08 21:53 ` Jakub Kicinski
  2023-08-09 13:58 ` Vladimir Oltean
  0 siblings, 2 replies; 15+ messages in thread
From: Uwe Kleine-König @ 2023-08-04  7:17 UTC (permalink / raw)
  To: Ioana Ciornei, Florian Fainelli, Russell King (Oracle)
  Cc: Andrew Lunn, Heiner Kallweit, Jakub Kicinski, netdev,
	linux-kernel, Ioana Ciornei, Alexandru Ardelean, Andre Edich,
	Antoine Tenart, Baruch Siach, Christophe Leroy, Divya Koppera,
	Hauke Mehrtens, Jerome Brunet, Kavya Sree Kotagiri, Linus Walleij,
	Marco Felsch, Marek Vasut, Martin Blumenstingl, Mathias Kresin,
	Maxim Kochetkov, Michael Walle, Neil Armstrong, Nisar Sayed,
	Oleksij Rempel, Philippe Schenker, Willy Liu, Yuiko Oshino

Most PHYs signal WoL using an interrupt. So disabling interrupts breaks
WoL at least on PHYs covered by the marvell driver. So skip disabling
irqs on shutdown if WoL is enabled.

While at it also explain the motivation that irqs are disabled at all.

Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

while I'm not sure that disabling interrupts is a good idea in general,
this change at least should fix the WoL case. Note that this change is
only compile tested as next doesn't boot on my test machine (because of
https://git.kernel.org/linus/b3574f579ece24439c90e9a179742c61205fbcfa)
and 6.1 (which is the other kernel I have running) doesn't know about
.wol_enabled. I don't want to delay this fix until I bisected this new
issue.

Assuming this patch is eligible for backporting to stable, maybe point
out that it depends on v6.5-rc1~163^2~286^2~2 ("net: phy: Allow drivers
to always call into ->suspend()"). Didn't try to backport that.

Best regards
Uwe

 drivers/net/phy/phy_device.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 61921d4dbb13..6d1526bdd1d7 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3340,6 +3340,15 @@ static void phy_shutdown(struct device *dev)
 	if (phydev->state == PHY_READY || !phydev->attached_dev)
 		return;
 
+	/* Most phys signal WoL via the irq line. So for these irqs shouldn't be
+	 * disabled.
+	 */
+	if (phydev->wol_enabled)
+		return;
+
+	/* On shutdown disable irqs to prevent an irq storm on systems where the
+	 * irq line is shared by several devices.
+	 */
 	phy_disable_interrupts(phydev);
 }
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-08-10 11:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04  7:17 [PATCH] net: phy: Don't disable irqs on shutdown if WoL is enabled Uwe Kleine-König
2023-08-08 21:53 ` Jakub Kicinski
2023-08-08 21:59   ` Florian Fainelli
2023-08-08 22:56     ` Russell King (Oracle)
2023-08-09 14:21       ` Ioana Ciornei
2023-08-09 14:29         ` Russell King (Oracle)
2023-08-09 15:44           ` Ioana Ciornei
2023-08-09 16:01             ` Russell King (Oracle)
2023-08-09 16:21               ` Andrew Lunn
2023-08-09 17:04                 ` Florian Fainelli
2023-08-09 19:15                 ` Russell King (Oracle)
2023-08-10 11:01                   ` Ioana Ciornei
2023-08-09 13:58 ` Vladimir Oltean
2023-08-09 15:35   ` Florian Fainelli
2023-08-10  6:32     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).