netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com,
	joabreu@synopsys.com, davem@davemloft.net, kuba@kernel.org,
	f.fainelli@gmail.com, netdev@vger.kernel.org, linux-imx@nxp.com,
	Jisheng.Zhang@synaptics.com
Subject: Re: [PATCH net] net: stmmac: fix MAC WoL unwork if PHY doesn't support WoL
Date: Wed, 7 Apr 2021 14:35:18 +0200	[thread overview]
Message-ID: <YG2nBgdbc4fVQ0tF@lunn.ch> (raw)
In-Reply-To: <20210407104404.5781-1-qiangqing.zhang@nxp.com>

On Wed, Apr 07, 2021 at 06:44:04PM +0800, Joakim Zhang 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.
> 
> Fixes: commit 1d8e5b0f3f2c ("net: stmmac: Support WOL with phy")
> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 208cae344ffa..f46d9c69168f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1103,7 +1103,9 @@ static int stmmac_init_phy(struct net_device *dev)
>  	}
>  
>  	phylink_ethtool_get_wol(priv->phylink, &wol);
> -	device_set_wakeup_capable(priv->device, !!wol.supported);
> +
> +	if (!priv->plat->pmt)
> +		device_set_wakeup_capable(priv->device, !!wol.supported);
  
It seems like a better fix would be to call stmmac_get_wol(), That
should set wol taking into account both pmt and phy.  But i would also
say stmmac_get_wol() and stmmac_set_wol() are broken. They should
combine capabilities, not be either pmt or phy.

       Andrew

  reply	other threads:[~2021-04-07 12:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 10:44 [PATCH net] net: stmmac: fix MAC WoL unwork if PHY doesn't support WoL Joakim Zhang
2021-04-07 12:35 ` Andrew Lunn [this message]
2021-04-09  8:19   ` Joakim Zhang

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=YG2nBgdbc4fVQ0tF@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=qiangqing.zhang@nxp.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).