diff mbox series

[net,2/3] net: lan743x: support WOL in MAC even when PHY does not

Message ID 20240226080934.46003-3-Raju.Lakkaraju@microchip.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: lan743x: Fixes for multiple WOL related issues | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 956 this patch: 956
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: pabeni@redhat.com edumazet@google.com
netdev/build_clang success Errors and warnings before: 973 this patch: 973
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes fail Problems with Fixes tag: 2
netdev/build_allmodconfig_warn success Errors and warnings before: 973 this patch: 973
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: b53e0334a397 ("net: lan743x: support WOL in MAC even when PHY does not")'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-26--15-00 (tests: 1456)

Commit Message

Raju Lakkaraju - I30499 Feb. 26, 2024, 8:09 a.m. UTC
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(-)

Comments

Horatiu Vultur Feb. 26, 2024, 8:28 a.m. UTC | #1
The 02/26/2024 13:39, Raju Lakkaraju wrote:
> 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")
> 
Please no spaces between the tags. And you should not split on multiple
line Fixes tag.

> 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
>
Andrew Lunn Feb. 27, 2024, 1:42 a.m. UTC | #2
> > +		if (ret == -EOPNOTSUPP)
> > +			netif_info(adapter, drv, adapter->netdev,
> > +				   "phy does not support WOL\n");

netdev_dbg(). We don't really care who is doing WoL, if its the MAC,
the PHY, or a bit of both. So there is no need to spam the log with
this.
Raju Lakkaraju - I30499 Feb. 29, 2024, 4:52 a.m. UTC | #3
Hi Horatiu,

> -----Original Message-----
> From: Horatiu Vultur - M31836 <Horatiu.Vultur@microchip.com>
> Sent: Monday, February 26, 2024 1:59 PM
> To: Raju Lakkaraju - I30499 <Raju.Lakkaraju@microchip.com>
> Cc: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org; linux-
> kernel@vger.kernel.org; Bryan Whitehead - C21958
> <Bryan.Whitehead@microchip.com>; richardcochran@gmail.com;
> UNGLinuxDriver <UNGLinuxDriver@microchip.com>
> Subject: Re: [PATCH net 2/3] net: lan743x: support WOL in MAC even when
> PHY does not
> 
> The 02/26/2024 13:39, Raju Lakkaraju wrote:
> > 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")
> >
> Please no spaces between the tags. And you should not split on multiple line
> Fixes tag.
> 

I will fix this issue.

> > 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
> >
> 
> --
> /Horatiu

Thanks,
Raju
diff mbox series

Patch

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 */