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: <YDmYIb0O5DZkL+X3@lunn.ch>
Date:   Sat, 27 Feb 2021 01:53:53 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Huazhong Tan <tanhuazhong@...wei.com>
Cc:     f.fainelli@...il.com, hkallweit1@...il.com, davem@...emloft.net,
        kuba@...nel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Guangbin Huang <huangguangbin2@...wei.com>
Subject: Re: [PATCH net] net: phy: fix save wrong speed and duplex problem if
 autoneg is on

On Fri, Feb 26, 2021 at 03:44:42PM +0800, Huazhong Tan wrote:
> From: Guangbin Huang <huangguangbin2@...wei.com>
> 
> If phy uses generic driver and autoneg is on, enter command
> "ethtool -s eth0 speed 50" will not change phy speed actually, but
> command "ethtool eth0" shows speed is 50Mb/s because phydev->speed
> has been set to 50 and no update later.
> 
> And duplex setting has same problem too.
> 
> However, if autoneg is on, phy only changes speed and duplex according to
> phydev->advertising, but not phydev->speed and phydev->duplex. So in this
> case, phydev->speed and phydev->duplex don't need to be set in function
> phy_ethtool_ksettings_set() if autoneg is on.
> 
> Signed-off-by: Guangbin Huang <huangguangbin2@...wei.com>
> Signed-off-by: Huazhong Tan <tanhuazhong@...wei.com>

I'm not sure, but i think this happens after

commit 51e2a3846eab18711f4eb59cd0a4c33054e2980a
Author: Trent Piepho <tpiepho@...escale.com>
Date:   Wed Sep 24 10:55:46 2008 +0000

    PHY: Avoid unnecessary aneg restarts
    
    The PHY's aneg is configured and restarted whenever the link is brought up,
    e.g. when DHCP is started after the kernel has booted.  This can take the
    link down for several seconds while auto-negotiation is redone.
    
    If the advertised features haven't changed, then it shouldn't be necessary
    to bring down the link and start auto-negotiation over again.
    
    genphy_config_advert() is enhanced to return 0 when the advertised features
    haven't been changed and >0 when they have been.
    
    genphy_config_aneg() then uses this information to not call
    genphy_restart_aneg() if there has been no change.

Before then, i think autoneg was unconditionally restarted, and so the
speed would get overwritten when autoneg completed. After this patch,
since autoneg is not being changed when only speed is set, autoneg is
not triggered.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ