From: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
<edumazet@google.com>, <linux-kernel@vger.kernel.org>,
<bryan.whitehead@microchip.com>, <UNGLinuxDriver@microchip.com>
Subject: [PATCH net V1 2/2] net: lan743x: support WOL in MAC even when PHY does not
Date: Tue, 19 Mar 2024 11:21:09 +0530 [thread overview]
Message-ID: <20240319055110.764002-3-Raju.Lakkaraju@microchip.com> (raw)
In-Reply-To: <20240319055110.764002-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>
---
Change List:
------------
- Change the "phy does not support WOL" print from netif_info() to
netif_dbg()
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 8a6ae171e375..7509a19269c3 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_dbg(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-03-19 5:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 5:51 [PATCH net V1 0/2] net: lan743x: Fixes for multiple WOL related issues Raju Lakkaraju
2024-03-19 5:51 ` [PATCH net V1 1/2] net: lan743x: disable WOL upon resume to restore full data path operation Raju Lakkaraju
2024-03-19 5:51 ` Raju Lakkaraju [this message]
2024-03-19 5:51 ` [PATCH net V1 3/3] net: lan743x: Address problems with wake option flags configuration sequences Raju Lakkaraju
2024-03-19 6:00 ` Raju.Lakkaraju
2024-03-19 17:26 ` Jakub Kicinski
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=20240319055110.764002-3-Raju.Lakkaraju@microchip.com \
--to=raju.lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).