[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c0403dc3-db3b-4167-8abb-d920299762e7@lunn.ch>
Date: Tue, 17 Oct 2023 03:36:03 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Vladimir Oltean <olteanv@...il.com>,
Woojung Huh <woojung.huh@...rochip.com>,
Arun Ramadoss <arun.ramadoss@...rochip.com>,
Conor Dooley <conor+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Rob Herring <robh+dt@...nel.org>, kernel@...gutronix.de,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
UNGLinuxDriver@...rochip.com,
"Russell King (Oracle)" <linux@...linux.org.uk>,
devicetree@...r.kernel.org
Subject: Re: [PATCH net-next v4 5/9] net: dsa: microchip: ksz9477: Add Wake
on Magic Packet support
> @@ -155,6 +158,14 @@ int ksz9477_set_wol(struct ksz_device *dev, int port,
> if (ret)
> return ret;
>
> + if (wol->wolopts & WAKE_MAGIC) {
> + ret = ksz_switch_macaddr_get(dev->ds, port, NULL);
> + if (ret)
> + return ret;
> +
> + pme_ctrl |= PME_WOL_MAGICPKT;
> + }
There is no matching ksz_switch_macaddr_put() here when the user turns
WAKE_MAGIC off. Ideally you need to keep track of the WoL state per
port, and when the user disables it, release the MAC address.
> +
> if (wol->wolopts & WAKE_PHY)
> pme_ctrl |= PME_WOL_LINKUP | PME_WOL_ENERGY;
>
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index 3f7c86e545a7..4601aaca5179 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -3569,6 +3569,7 @@ static int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
> const unsigned char *addr)
> {
> struct dsa_port *dp = dsa_to_port(ds, port);
> + struct ethtool_wolinfo wol;
>
> if (dp->hsr_dev) {
> dev_err(ds->dev,
> @@ -3577,6 +3578,14 @@ static int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
> return -EBUSY;
> }
>
> + ksz_get_wol(ds, dp->index, &wol);
> + if (wol.wolopts & WAKE_MAGIC) {
> + dev_err(ds->dev,
> + "Cannot change MAC address on port %d with active Wake on Magic Packet\n",
> + port);
This is not really an error, as in something went wrong. Its just a
hardware restriction. So dev_warn() would be better, or nothing at all
in the logs.
Andrew
Powered by blists - more mailing lists