[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240226080934.46003-4-Raju.Lakkaraju@microchip.com>
Date: Mon, 26 Feb 2024 13:39:34 +0530
From: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
To: <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <linux-kernel@...r.kernel.org>,
<bryan.whitehead@...rochip.com>, <richardcochran@...il.com>,
<UNGLinuxDriver@...rochip.com>
Subject: [PATCH net 3/3] net: lan743x: Address problems with wake option flags configuration sequences
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 <Raju.Lakkaraju@...rochip.com>
---
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
Powered by blists - more mailing lists