Thread (26 messages) 26 messages, 5 authors, 2024-03-13
STALE809d
Revisions (6)
  1. v1 current
  2. v1 [diff vs current]
  3. v3 [diff vs current]
  4. v3 [diff vs current]
  5. v4 [diff vs current]
  6. v5 [diff vs current]

[PATCH net 3/3] net: lan743x: Address problems with wake option flags configuration sequences

From: Raju Lakkaraju <hidden>
Date: 2024-02-26 08:11:42
Also in: lkml
Subsystem: microchip lan743x ethernet driver, networking drivers, the rest · Maintainers: Bryan Whitehead, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Wake options handling has been reworked as follows:
a. We only enable secure on magic packet when both secure and magic wol
   options are requested together.
b. If secure-on magic packet had been previously enabled, and a subsequent
   command does not include it, we add it. This was done to workaround a
   problem with the 'pm-suspend' application which is unaware of secure-on
   magic packet being enabled and can unintentionally disable it prior to
   putting the system into suspend.

Fixes: 6b3768ac8e2b3 ("net: lan743x: Add support to Secure-ON WOL")
Signed-off-by: Raju Lakkaraju <redacted>
---
 drivers/net/ethernet/microchip/lan743x_ethtool.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index 4899582b3d1d..cda4df2ac1cd 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -1165,6 +1165,16 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
 	struct lan743x_adapter *adapter = netdev_priv(netdev);
 	int ret;
 
+	if (wol->wolopts && wol->wolopts != adapter->wolopts &&
+	    adapter->wolopts & WAKE_MAGICSECURE) {
+		wol->wolopts |= WAKE_MAGICSECURE;
+		netif_warn(adapter, drv, adapter->netdev,
+			   "Ensure secure-on magic packet remains enabled if not explicitly disabled\n");
+	}
+
+	if ((wol->wolopts & WAKE_MAGICSECURE) && !(wol->wolopts & WAKE_MAGIC))
+		return -EINVAL;
+
 	if (netdev->phydev) {
 		ret = phy_ethtool_set_wol(netdev->phydev, wol);
 		if (ret != -EOPNOTSUPP && ret != 0)
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help