lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zfrp4bwpC-ywjZ6_@nanopsycho>
Date: Wed, 20 Mar 2024 14:51:29 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
	pabeni@...hat.com, edumazet@...gle.com,
	linux-kernel@...r.kernel.org, bryan.whitehead@...rochip.com,
	UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net V2 2/2] net: lan743x: support WOL in MAC even when
 PHY does not

Wed, Mar 20, 2024 at 05:21:07AM CET, Raju.Lakkaraju@...rochip.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@...rochip.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
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ