From: Jiri Pirko <jiri@resnulli.us>
To: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
Cc: netdev@vger.kernel.org, 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: Re: [PATCH net V2 2/2] net: lan743x: support WOL in MAC even when PHY does not
Date: Wed, 20 Mar 2024 14:51:29 +0100 [thread overview]
Message-ID: <Zfrp4bwpC-ywjZ6_@nanopsycho> (raw)
In-Reply-To: <20240320042107.903051-3-Raju.Lakkaraju@microchip.com>
Wed, Mar 20, 2024 at 05:21:07AM CET, Raju.Lakkaraju@microchip.com wrote:
>Allow WOL support if MAC supports it, even if the PHY does not support it
Sentences like this one usually end with "."
>
>Fixes: e9e13b6adc338 ("lan743x: fix for potential NULL pointer dereference with bare card")
>Signed-off-by: Raju Lakkaraju <Raju.Lakkaraju@microchip.com>
>---
>Change List:
>------------
>V1 -> V2:
> - Repost - No change
>V0 -> V1:
> - 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;
You use "ret" only in "if (netdev->phydev) {" scope, move it there.
>+
>+ 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");
How about to chenge the flow to:
ret = phy_ethtool_set_wol(netdev->phydev, wol);
if (ret == -EOPNOTSUPP)
netif_dbg(adapter, drv, adapter->netdev,
"phy does not support WOL\n");
else if (ret)
return ret;
to avoid double check of EOPNOTSUPP?
> }
>
> 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-20 13:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-20 4:21 [PATCH net V2 0/2] net: lan743x: Fixes for multiple WOL related issues Raju Lakkaraju
2024-03-20 4:21 ` [PATCH net V2 1/2] net: lan743x: disable WOL upon resume to restore full data path operation Raju Lakkaraju
2024-03-20 13:53 ` Jiri Pirko
2024-03-20 4:21 ` [PATCH net V2 2/2] net: lan743x: support WOL in MAC even when PHY does not Raju Lakkaraju
2024-03-20 13:51 ` Jiri Pirko [this message]
2024-03-20 22:53 ` Andrew Lunn
2024-03-20 22:59 ` Florian Fainelli
2024-04-05 8:17 ` Raju.Lakkaraju
2024-04-05 17:12 ` Andrew Lunn
2024-04-23 11:05 ` Raju.Lakkaraju
2024-04-23 19:10 ` Andrew Lunn
2024-04-24 5:58 ` Ronnie.Kunin
2024-04-24 6:07 ` Ronnie.Kunin
2024-04-24 12:13 ` Andrew Lunn
2024-04-25 11:37 ` Raju.Lakkaraju
2024-04-25 14:13 ` Andrew Lunn
2024-04-26 7:43 ` Ronnie.Kunin
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=Zfrp4bwpC-ywjZ6_@nanopsycho \
--to=jiri@resnulli.us \
--cc=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.