On Fri, Feb 14, 2020 at 12:31:52PM -0600, Dan Murphy wrote:
GrygoriiHow do you know the speed that the PHY downshifted to?
On 2/14/20 12:32 PM, Grygorii Strashko wrote:
I think it's good idea to have this message as just wrong cable might beOK I will try to find a way to give some sort of message.
used.
But this notifier make no sense in it current form - it will produce
noise in case of forced 100m/10M.
FYI. PHY sequence to update link:
phy_state_machine()
|-phy_check_link_status()
 |-phy_link_down/up()
ÂÂÂ |- .phy_link_change()->phy_link_change()
ÂÂÂÂ|-adjust_link() ----> netdev callback
|-phydev->drv->link_change_notify(phydev);
So, log output has to be done or in .read_status() or
some info has to be saved in .read_status() and then re-used in
.link_change_notify().
If the speed and duplex are available in some PHY specific status
register, then one way you can detect downshift is to decode the
negotiated speed/duplex from the advertisements (specifically the LPA
read from the registers and the advertisement that we should be
advertising - some PHYs modify their registers when downshifting) and
check whether it matches the negotiated parameters in the PHY
specific status register.
Alternatively, if the PHY modifies the advertisement register on
downshift, comparing the advertisement register with what it should
be will tell you if downshift has occurred.