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]
Message-ID: <65db2d1b-10aa-4bf6-8205-3ede6726d87b@lunn.ch>
Date: Mon, 13 Jan 2025 22:59:05 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Gerhard Engleder <gerhard@...leder-embedded.com>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
	edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
	netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 4/5] tsnep: Select speed for loopback

On Fri, Jan 10, 2025 at 03:48:27PM +0100, Gerhard Engleder wrote:
> Use 100 Mbps only if the PHY is configured to this speed. Otherwise use
> always the maximum speed of 1000 Mbps.
> 
> Signed-off-by: Gerhard Engleder <gerhard@...leder-embedded.com>
> ---
>  drivers/net/ethernet/engleder/tsnep_main.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
> index 5c501e4f9e3e..45b9f5780902 100644
> --- a/drivers/net/ethernet/engleder/tsnep_main.c
> +++ b/drivers/net/ethernet/engleder/tsnep_main.c
> @@ -229,8 +229,19 @@ static void tsnep_phy_link_status_change(struct net_device *netdev)
>  static int tsnep_phy_loopback(struct tsnep_adapter *adapter, bool enable)
>  {
>  	int retval;
> +	int speed;
>  
> -	retval = phy_loopback(adapter->phydev, enable, 0);
> +	if (enable) {
> +		if (adapter->phydev->autoneg == AUTONEG_DISABLE &&
> +		    adapter->phydev->speed == SPEED_100)
> +			speed = SPEED_100;
> +		else
> +			speed = SPEED_1000;
> +	} else {
> +		speed = 0;
> +	}
> +
> +	retval = phy_loopback(adapter->phydev, enable, speed);

If phy_loopback() returns -EOPNOTSUPP, don't you want to retry without
a speed? There is no guarantee the PHY paired with this MAC does
support setting the loopback speed.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ