All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V5 net] net: stmmac: Fix MAC WoL not working if PHY does not support WoL
@ 2021-05-10  6:55 Joakim Zhang
  2021-05-11 23:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Joakim Zhang @ 2021-05-10  6:55 UTC (permalink / raw)
  To: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	f.fainelli, andrew
  Cc: Jisheng.Zhang, netdev, linux-imx

Both get and set WoL will check device_can_wakeup(), if MAC supports PMT, it
will set device wakeup capability. After commit 1d8e5b0f3f2c ("net: stmmac:
Support WOL with phy"), device wakeup capability will be overwrite in
stmmac_init_phy() according to phy's Wol feature. If phy doesn't support WoL,
then MAC will lose wakeup capability. To fix this issue, only overwrite device
wakeup capability when MAC doesn't support PMT.

For STMMAC now driver checks MAC's WoL capability if MAC supports PMT, if
not support, driver will check PHY's WoL capability.

Fixes: 1d8e5b0f3f2c ("net: stmmac: Support WOL with phy")
Reviewed-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 345b4c6d1fd4..fea3bf07ae89 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1196,7 +1196,6 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv)
  */
 static int stmmac_init_phy(struct net_device *dev)
 {
-	struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
 	struct stmmac_priv *priv = netdev_priv(dev);
 	struct device_node *node;
 	int ret;
@@ -1222,8 +1221,12 @@ static int stmmac_init_phy(struct net_device *dev)
 		ret = phylink_connect_phy(priv->phylink, phydev);
 	}
 
-	phylink_ethtool_get_wol(priv->phylink, &wol);
-	device_set_wakeup_capable(priv->device, !!wol.supported);
+	if (!priv->plat->pmt) {
+		struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
+
+		phylink_ethtool_get_wol(priv->phylink, &wol);
+		device_set_wakeup_capable(priv->device, !!wol.supported);
+	}
 
 	return ret;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V5 net] net: stmmac: Fix MAC WoL not working if PHY does not support WoL
  2021-05-10  6:55 [PATCH V5 net] net: stmmac: Fix MAC WoL not working if PHY does not support WoL Joakim Zhang
@ 2021-05-11 23:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-11 23:00 UTC (permalink / raw)
  To: Joakim Zhang
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, davem, kuba,
	f.fainelli, andrew, Jisheng.Zhang, netdev, linux-imx

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Mon, 10 May 2021 14:55:09 +0800 you wrote:
> Both get and set WoL will check device_can_wakeup(), if MAC supports PMT, it
> will set device wakeup capability. After commit 1d8e5b0f3f2c ("net: stmmac:
> Support WOL with phy"), device wakeup capability will be overwrite in
> stmmac_init_phy() according to phy's Wol feature. If phy doesn't support WoL,
> then MAC will lose wakeup capability. To fix this issue, only overwrite device
> wakeup capability when MAC doesn't support PMT.
> 
> [...]

Here is the summary with links:
  - [V5,net] net: stmmac: Fix MAC WoL not working if PHY does not support WoL
    https://git.kernel.org/netdev/net/c/576f9eacc680

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-11 23:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10  6:55 [PATCH V5 net] net: stmmac: Fix MAC WoL not working if PHY does not support WoL Joakim Zhang
2021-05-11 23:00 ` patchwork-bot+netdevbpf

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.