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] [thread-next>] [day] [month] [year] [list]
Date: Tue, 25 Jul 2023 14:05:36 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Mengyuan Lou <mengyuanlou@...-swift.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
	"Russell King (Oracle)" <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next 2/2] net: phy: add keep_data_connection to
 struct phydev

+ Jakub Kicinski, "Russell King (Oracle)", "David S. Miller", Paolo Abeni,
  Eric Dumazet, Heiner Kallweit, Andrew Lunn

On Mon, Jul 24, 2023 at 05:24:59PM +0800, Mengyuan Lou wrote:
> Add flag keep_data_connection to struct phydev indicating whether
> phy need to keep data connection.
> Phy_suspend() will use it to decide whether PHY can be suspended
> or not.

This feels like a bug fix.
What is the behaviour of the system without this change?

> Signed-off-by: Mengyuan Lou <mengyuanlou@...-swift.com>
> ---
>  drivers/net/phy/phy_device.c | 6 ++++--
>  include/linux/phy.h          | 3 +++
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 0c2014accba7..4fe26660458e 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -1860,8 +1860,10 @@ int phy_suspend(struct phy_device *phydev)
>  
>  	phy_ethtool_get_wol(phydev, &wol);
>  	phydev->wol_enabled = wol.wolopts || (netdev && netdev->wol_enabled);
> -	/* If the device has WOL enabled, we cannot suspend the PHY */
> -	if (phydev->wol_enabled && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND))
> +	phydev->keep_data_connection = phydev->wol_enabled ||
> +				       (netdev && netdev->ncsi_enabled);
> +	/* We cannot suspend the PHY, when phy and mac need to receive packets. */
> +	if (phydev->keep_data_connection && !(phydrv->flags & PHY_ALWAYS_CALL_SUSPEND))

As it stands, it seems that keep_data_connection is only used in this
function. Could it be a local variable rather than field of struct
phy_device.

That said, I think Russell and Andrew will likely have a deeper insight here.

>  		return -EBUSY;
>  
>  	if (!phydrv || !phydrv->suspend)
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 11c1e91563d4..bda646e7cc23 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -554,6 +554,8 @@ struct macsec_ops;
>   * @mac_managed_pm: Set true if MAC driver takes of suspending/resuming PHY
>   * @wol_enabled: Set to true if the PHY or the attached MAC have Wake-on-LAN
>   * 		 enabled.
> + * @keep_data_connection: Set to true if the PHY or the attached MAC need
> + *                        physical connection to receive packets.
>   * @state: State of the PHY for management purposes
>   * @dev_flags: Device-specific flags used by the PHY driver.
>   *
> @@ -651,6 +653,7 @@ struct phy_device {
>  	unsigned is_on_sfp_module:1;
>  	unsigned mac_managed_pm:1;
>  	unsigned wol_enabled:1;
> +	unsigned keep_data_connection:1;
>  
>  	unsigned autoneg:1;
>  	/* The most recently read link state */
> -- 
> 2.41.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ