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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20231019045005.GC3595737@pengutronix.de>
Date:   Thu, 19 Oct 2023 06:50:05 +0200
From:   Oleksij Rempel <o.rempel@...gutronix.de>
To:     Florian Fainelli <f.fainelli@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Andrew Lunn <andrew@...n.ch>,
        Eric Dumazet <edumazet@...gle.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 v5 5/9] net: dsa: microchip: ksz9477: Add Wake
 on Magic Packet support

On Wed, Oct 18, 2023 at 11:20:50AM -0700, Florian Fainelli wrote:
> On 10/18/23 04:39, Oleksij Rempel wrote:
> > Introduce Wake on Magic Packet (WoL) functionality to the ksz9477
> > driver.
> > 
> > Major changes include:
> > 
> > 1. Extending the `ksz9477_handle_wake_reason` function to identify Magic
> >     Packet wake events alongside existing wake reasons.
> > 
> > 2. Updating the `ksz9477_get_wol` and `ksz9477_set_wol` functions to
> >     handle WAKE_MAGIC alongside the existing WAKE_PHY option, and to
> >     program the switch's MAC address register accordingly when Magic
> >     Packet wake-up is enabled. This change will prevent WAKE_MAGIC
> >     activation if the related port has a different MAC address compared
> >     to a MAC address already used by HSR or an already active WAKE_MAGIC
> >     on another port.
> > 
> > 3. Adding a restriction in `ksz_port_set_mac_address` to prevent MAC
> >     address changes on ports with active Wake on Magic Packet, as the
> >     switch's MAC address register is utilized for this feature.
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> 
> This looks good to me, just one suggestion below
> 
> [snip]
> 
> > +	if (pme_ctrl_old == pme_ctrl)
> > +		return 0;
> > +
> > +	/* To keep reference count of MAC address, we should do this
> > +	 * operation only on change of WOL settings.
> > +	 */
> > +	if (!(pme_ctrl_old & PME_WOL_MAGICPKT) &&
> > +	    (pme_ctrl & PME_WOL_MAGICPKT)) {
> 
> Maybe use a temporary variable for that condition since you re-use it below
> in case you failed to perform the write of the pme_ctrl value. It would be
> more readable IMHO, something like:
> 
> 	bool magicpkt_was_disabled = !(pme_ctrl_old & PME_WOL_MAGICPKT) &&
> (pme_ctrl & PME_WOL_MAGICPKT));

Sounds good. I'll update it.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ