From: Andrew Lunn <andrew@lunn.ch>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: davem@davemloft.net, "Jakub Kicinski" <kuba@kernel.org>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
thomas.petazzoni@bootlin.com,
"Herve Codina" <herve.codina@bootlin.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH net-next 4/7] net: freescale: ucc_geth: Fix WOL configuration
Date: Thu, 7 Nov 2024 18:49:00 +0100 [thread overview]
Message-ID: <83151aa4-62e9-4be9-ae64-a728be004dae@lunn.ch> (raw)
In-Reply-To: <20241107170255.1058124-5-maxime.chevallier@bootlin.com>
On Thu, Nov 07, 2024 at 06:02:51PM +0100, Maxime Chevallier wrote:
> The get/set_wol ethtool ops rely on querying the PHY for its WoL
> capabilities, checking for the presence of a PHY and a PHY interrupts
> isn't enough. Address that by cleaning up the WoL configuration
> sequence.
>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> .../net/ethernet/freescale/ucc_geth_ethtool.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
> index fb5254d7d1ba..2a085f8f34b2 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth_ethtool.c
> @@ -346,26 +346,37 @@ static void uec_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
> struct ucc_geth_private *ugeth = netdev_priv(netdev);
> struct phy_device *phydev = netdev->phydev;
>
> - if (phydev && phydev->irq)
> - wol->supported |= WAKE_PHY;
> + wol->supported = 0;
> + wol->wolopts = 0;
> +
> + if (phydev)
> + phy_ethtool_get_wol(phydev, wol);
> +
> if (qe_alive_during_sleep())
> wol->supported |= WAKE_MAGIC;
So get WoL will return whatever methods the PHY supports, plus
WAKE_MAGIC is added because i assume the MAC can do that. So depending
on the PHY, it could be the full list:
#define WAKE_PHY (1 << 0)
#define WAKE_UCAST (1 << 1)
#define WAKE_MCAST (1 << 2)
#define WAKE_BCAST (1 << 3)
#define WAKE_ARP (1 << 4)
#define WAKE_MAGIC (1 << 5)
#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
#define WAKE_FILTER (1 << 7)
>
> - wol->wolopts = ugeth->wol_en;
> + wol->wolopts |= ugeth->wol_en;
> }
>
> static int uec_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
> {
> struct ucc_geth_private *ugeth = netdev_priv(netdev);
> struct phy_device *phydev = netdev->phydev;
> + int ret = 0;
>
> if (wol->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
> return -EINVAL;
> - else if (wol->wolopts & WAKE_PHY && (!phydev || !phydev->irq))
> + else if ((wol->wolopts & WAKE_PHY) && !phydev)
> return -EINVAL;
> else if (wol->wolopts & WAKE_MAGIC && !qe_alive_during_sleep())
> return -EINVAL;
>
> + if (wol->wolopts & WAKE_PHY)
> + ret = phy_ethtool_set_wol(phydev, wol);
Here, the code only calls into the PHY for WAKE_PHY, when in fact the
PHY could be handling WAKE_UCAST, WAKE_MCAST, WAKE_ARP etc.
So these conditions are wrong. It could we be that X years ago when
this code was added only WAKE_PHY and WAKE_MAGIC existed?
Andrew
next prev parent reply other threads:[~2024-11-07 17:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 17:02 [PATCH net-next 0/7] net: freescale: ucc_geth: Phylink conversion Maxime Chevallier
2024-11-07 17:02 ` [PATCH net-next 1/7] net: freescale: ucc_geth: Drop support for the "interface" DT property Maxime Chevallier
2024-11-07 17:34 ` Andrew Lunn
2024-11-07 17:02 ` [PATCH net-next 2/7] net: freescale: ucc_geth: split adjust_link for phylink conversion Maxime Chevallier
2024-11-07 17:36 ` Andrew Lunn
2024-11-07 17:51 ` Russell King (Oracle)
2024-11-07 18:03 ` Maxime Chevallier
2024-11-07 17:02 ` [PATCH net-next 3/7] net: freescale: ucc_geth: Use netdev->phydev to access the PHY Maxime Chevallier
2024-11-07 17:37 ` Andrew Lunn
2024-11-07 17:02 ` [PATCH net-next 4/7] net: freescale: ucc_geth: Fix WOL configuration Maxime Chevallier
2024-11-07 17:49 ` Andrew Lunn [this message]
2024-11-07 18:16 ` Maxime Chevallier
2024-11-07 17:02 ` [PATCH net-next 5/7] net: freescale: ucc_geth: Simplify frame length check Maxime Chevallier
2024-11-07 17:50 ` Andrew Lunn
2024-11-07 17:02 ` [PATCH net-next 6/7] net: freescale: ucc_geth: Hardcode the preamble length to 7 bytes Maxime Chevallier
2024-11-07 17:51 ` Andrew Lunn
2024-11-07 17:02 ` [PATCH net-next 7/7] net: freescale: ucc_geth: phylink conversion Maxime Chevallier
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=83151aa4-62e9-4be9-ae64-a728be004dae@lunn.ch \
--to=andrew@lunn.ch \
--cc=christophe.leroy@csgroup.eu \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herve.codina@bootlin.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=u.kleine-koenig@baylibre.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
all inboxes | Powered by JetHome®