[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <877cd674-dbb8-4786-891e-1652eee16f46@lunn.ch>
Date: Sat, 14 Oct 2023 19:14:57 +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 v3 3/7] net: dsa: microchip: ksz9477: add Wake
on LAN support
> + * ksz9477_get_wol - Get Wake-on-LAN settings for a specified port.
> + * @dev: The device structure.
> + * @port: The port number.
> + * @wol: Pointer to ethtool Wake-on-LAN settings structure.
> + *
> + * This function checks the PME Pin Control Register to see if PME Pin Output
> + * Enable is set, indicating PME is enabled. If enabled, it sets the supported
> + * and active WoL flags.
I'm missing something here: Why would the PME Pin Output Enable not be
set?
I also wounder if there should be one additional test. Is the MAC
address on the user interface the same as the one programmed in the
switch? If it is different supported should not be set.
> +void ksz9477_get_wol(struct ksz_device *dev, int port,
> + struct ethtool_wolinfo *wol)
> +{
> + u8 pme_ctrl, pme_conf;
> + int ret;
> +
> + ret = ksz_read8(dev, REG_SW_PME_CTRL, &pme_conf);
> + if (ret)
> + return;
> +
> + if (!(pme_conf & PME_ENABLE))
> + return;
> +
> + wol->supported = WAKE_MAGIC;
> +
> + ret = ksz_pread8(dev, port, REG_PORT_PME_CTRL, &pme_ctrl);
> + if (ret)
> + return;
> +
> + if (pme_ctrl & PME_WOL_MAGICPKT)
> + wol->wolopts |= WAKE_MAGIC;
> +}
> +static void ksz_get_wol(struct dsa_switch *ds, int port,
> + struct ethtool_wolinfo *wol)
> +{
> + struct ksz_device *dev = ds->priv;
> +
> + memset(wol, 0, sizeof(*wol));
Drivers should not need this, i would expect the core to zero the
structure.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists