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 2/3] net: lan743x: support WOL in MAC even when PHY does not
Date: Mon, 26 Feb 2024 13:39:33 +0530 [thread overview]
Message-ID: <20240226080934.46003-3-Raju.Lakkaraju@microchip.com> (raw)
In-Reply-To: <20240226080934.46003-1-Raju.Lakkaraju@microchip.com>
Allow WOL support if MAC supports it, even if the PHY does not support it
Fixes: e9e13b6adc338 ("lan743x: fix for potential NULL pointer dereference
with bare card")
Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
---
drivers/net/ethernet/microchip/lan743x_ethtool.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
index a2b3f4433ca8..4899582b3d1d 100644
--- a/drivers/net/ethernet/microchip/lan743x_ethtool.c
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -1163,6 +1163,17 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
struct ethtool_wolinfo *wol)
{
struct lan743x_adapter *adapter = netdev_priv(netdev);
+ int ret;
+
+ if (netdev->phydev) {
+ ret = phy_ethtool_set_wol(netdev->phydev, wol);
+ if (ret != -EOPNOTSUPP && ret != 0)
+ return ret;
+
+ if (ret == -EOPNOTSUPP)
+ netif_info(adapter, drv, adapter->netdev,
+ "phy does not support WOL\n");
+ }
adapter->wolopts = 0;
if (wol->wolopts & WAKE_UCAST)
@@ -1187,8 +1198,7 @@ static int lan743x_ethtool_set_wol(struct net_device *netdev,
device_set_wakeup_enable(&adapter->pdev->dev, (bool)wol->wolopts);
- return netdev->phydev ? phy_ethtool_set_wol(netdev->phydev, wol)
- : -ENETDOWN;
+ return 0;
}
#endif /* CONFIG_PM */
--
2.34.1
next prev 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 ` Raju Lakkaraju [this message]
2024-02-26 8:28 ` [PATCH net 2/3] net: lan743x: support WOL in MAC even when PHY does not Horatiu Vultur
2024-02-27 1:42 ` Andrew Lunn
2024-02-29 4:52 ` Raju.Lakkaraju
2024-02-26 8:09 ` [PATCH net 3/3] net: lan743x: Address problems with wake option flags configuration sequences Raju Lakkaraju
2024-02-27 1:58 ` 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-3-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).