All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: phy: reconfigure PHY WOL in resume if WOL option still enabled
@ 2021-07-08  0:42 mohammad.athari.ismail
  2021-07-08  1:23 ` Andrew Lunn
  0 siblings, 1 reply; 12+ messages in thread
From: mohammad.athari.ismail @ 2021-07-08  0:42 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, David S . Miller, Russell King,
	Jakub Kicinski, Florian Fainelli
  Cc: netdev, linux-kernel, mohammad.athari.ismail

From: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>

When the PHY wakes up from suspend through WOL event, there is a need to
reconfigure the WOL if the WOL option still enabled. The main operation
is to clear the WOL event status. So that, subsequent WOL event can be
triggered properly.

This fix is needed especially for the PHY that operates in PHY_POLL mode
where there is no handler (such as interrupt handler) available to clear
the WOL event status.

Fixes: 611d779af7ca ("net: phy: fix MDIO bus PM PHY resuming")
Signed-off-by: Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>
---
 drivers/net/phy/phy_device.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 5d5f9a9ee768..d68703ce03b1 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -295,6 +295,7 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
 
 static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 {
+	struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
 	struct phy_device *phydev = to_phy_device(dev);
 	int ret;
 
@@ -314,6 +315,13 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 	if (ret < 0)
 		return ret;
 no_resume:
+	/* If the PHY has WOL option still enabled, reconfigure the WOL mainly
+	 * to clear the WOL event status.
+	 */
+	phy_ethtool_get_wol(phydev, &wol);
+	if (wol.wolopts)
+		phy_ethtool_set_wol(phydev, &wol);
+
 	if (phydev->attached_dev && phydev->adjust_link)
 		phy_start_machine(phydev);
 
-- 
2.17.1


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

end of thread, other threads:[~2021-07-09  9:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08  0:42 [PATCH net] net: phy: reconfigure PHY WOL in resume if WOL option still enabled mohammad.athari.ismail
2021-07-08  1:23 ` Andrew Lunn
2021-07-08  2:48   ` Florian Fainelli
2021-07-08 10:10     ` Ismail, Mohammad Athari
2021-07-08 16:41       ` Florian Fainelli
2021-07-08 23:20         ` Ismail, Mohammad Athari
2021-07-08 23:22           ` Florian Fainelli
2021-07-09  1:30             ` Andrew Lunn
2021-07-09  9:57         ` Russell King (Oracle)
2021-07-08 10:02   ` Ismail, Mohammad Athari
2021-07-08 13:11     ` Andrew Lunn
2021-07-08 23:11       ` Ismail, Mohammad Athari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.