netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>,
	<linux-kernel@vger.kernel.org>, <bryan.whitehead@microchip.com>,
	<richardcochran@gmail.com>, <UNGLinuxDriver@microchip.com>
Subject: [PATCH net 3/3] net: lan743x: Address problems with wake option flags configuration sequences
Date: Mon, 26 Feb 2024 13:39:34 +0530	[thread overview]
Message-ID: <20240226080934.46003-4-Raju.Lakkaraju@microchip.com> (raw)
In-Reply-To: <20240226080934.46003-1-Raju.Lakkaraju@microchip.com>

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@microchip.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


  parent reply	other threads:[~2024-02-26  8:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26  8:09 [PATCH net 0/3] net: lan743x: Fixes for multiple WOL related issues Raju Lakkaraju
2024-02-26  8:09 ` [PATCH net 1/3] net: lan743x: disable WOL upon resume to restore full data path operation Raju Lakkaraju
2024-02-26  8:27   ` Horatiu Vultur
2024-02-29  4:51     ` Raju.Lakkaraju
2024-02-27  1:38   ` Andrew Lunn
2024-02-29  4:57     ` Raju.Lakkaraju
2024-02-26  8:09 ` [PATCH net 2/3] net: lan743x: support WOL in MAC even when PHY does not Raju Lakkaraju
2024-02-26  8:28   ` Horatiu Vultur
2024-02-27  1:42     ` Andrew Lunn
2024-02-29  4:52     ` Raju.Lakkaraju
2024-02-26  8:09 ` Raju Lakkaraju [this message]
2024-02-27  1:58   ` [PATCH net 3/3] net: lan743x: Address problems with wake option flags configuration sequences Andrew Lunn
2024-02-29  8:59     ` Raju.Lakkaraju
2024-02-29 15:06       ` Andrew Lunn
2024-03-01 10:22         ` Raju.Lakkaraju
2024-03-04 11:20           ` Raju.Lakkaraju
2024-03-06 23:19           ` Andrew Lunn
2024-03-06 23:53   ` Andrew Lunn
2024-03-08  8:20     ` Raju.Lakkaraju
2024-03-08 18:56       ` Ronnie.Kunin
2024-03-12 21:40         ` Andrew Lunn
2024-03-13  0:22           ` Ronnie.Kunin
2024-03-13  0:53             ` Florian Fainelli
2024-03-13 19:52               ` Andrew Lunn
2024-03-13 20:34                 ` Ronnie.Kunin
2024-03-13 20:39                 ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240226080934.46003-4-Raju.Lakkaraju@microchip.com \
    --to=raju.lakkaraju@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).