lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231016102254.f7u7vrk52siqoihd@skbuf>
Date:   Mon, 16 Oct 2023 13:22:54 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Andrew Lunn <andrew@...n.ch>,
        Eric Dumazet <edumazet@...gle.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.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 7/7] net: dsa: microchip: do not shut down
 the switch if WoL is active

On Fri, Oct 13, 2023 at 02:24:05PM +0200, Oleksij Rempel wrote:
> For Wake on Lan we should not reconfigure, reset or power down the
> switch on shut down sequence.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz9477_i2c.c |  3 +++
>  drivers/net/dsa/microchip/ksz_common.c  | 18 ++++++++++++++++++
>  drivers/net/dsa/microchip/ksz_common.h  |  2 ++
>  drivers/net/dsa/microchip/ksz_spi.c     |  3 +++
>  4 files changed, 26 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
> index 2710afad4f3a..fe818742051c 100644
> --- a/drivers/net/dsa/microchip/ksz9477_i2c.c
> +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
> @@ -66,6 +66,9 @@ static void ksz9477_i2c_shutdown(struct i2c_client *i2c)
>  	if (!dev)
>  		return;
>  
> +	if (ksz_wol_is_active(dev))
> +		return;
> +
>  	if (dev->dev_ops->reset)
>  		dev->dev_ops->reset(dev);

The rest of the code used to read:

	dsa_switch_shutdown(dev->ds);

	i2c_set_clientdata(i2c, NULL);
}

and that part is non-optional. Please only skip the dev->dev_ops->reset()
call if ksz_wol_is_active().

>  static void ksz_set_xmii(struct ksz_device *dev, int port,
>  			 phy_interface_t interface)
>  {
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index 80679f38ee12..84b1eed8cd2a 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -397,6 +397,8 @@ bool ksz_get_gbit(struct ksz_device *dev, int port);
>  phy_interface_t ksz_get_xmii(struct ksz_device *dev, int port, bool gbit);
>  extern const struct ksz_chip_data ksz_switch_chips[];
>  
> +bool ksz_wol_is_active(struct ksz_device *dev);
> +
>  /* Common register access functions */
>  static inline struct regmap *ksz_regmap_8(struct ksz_device *dev)
>  {
> diff --git a/drivers/net/dsa/microchip/ksz_spi.c b/drivers/net/dsa/microchip/ksz_spi.c
> index 279338451621..c5d9c3d86ddb 100644
> --- a/drivers/net/dsa/microchip/ksz_spi.c
> +++ b/drivers/net/dsa/microchip/ksz_spi.c
> @@ -114,6 +114,9 @@ static void ksz_spi_shutdown(struct spi_device *spi)
>  	if (!dev)
>  		return;
>  
> +	if (ksz_wol_is_active(dev))
> +		return;
> +
>  	if (dev->dev_ops->reset)
>  		dev->dev_ops->reset(dev);

Same here. Maybe introducing a common ksz_switch_shutdown() would be
appropriate.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ