mbox series

[net,0/3] net: phy: realtek: fix status when link is down

Message ID cover.1736951652.git.daniel@makrotopia.org (mailing list archive)
Headers show
Series net: phy: realtek: fix status when link is down | expand

Message

Daniel Golle Jan. 15, 2025, 2:43 p.m. UTC
The .read_status method for RealTek RTL822x PHYs (both C22 and C45) has
multilpe issues which result in reporting bogus link partner advertised
modes as well as speed and duplex while the link is down and no cable
is plugged in.

Example: ethtool after disconnecting a 1000M/Full capable link partner,
now with no wire plugged:

Settings for lan1:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
                            2500baseT/Full
    Supported pause frame use: Symmetric Receive-only
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full
                            100baseT/Half 100baseT/Full
                            1000baseT/Full
                            2500baseT/Full
    Advertised pause frame use: Symmetric Receive-only
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Link partner advertised link modes:  1000baseT/Full
    Link partner advertised pause frame use: No
    Link partner advertised auto-negotiation: No
    Link partner advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Auto-negotiation: on
    Port: Twisted Pair
    PHYAD: 7
    Transceiver: external
    MDI-X: Unknown
    Supports Wake-on: d
    Wake-on: d
    Link detected: no

Fix this by making sure all of the fields populated by
rtl822x_c45_read_status() or rtl822x_read_status() get reset, also in
case the link is down.

Daniel Golle (3):
  net: phy: realtek: clear 1000Base-T lpa bits if link is down
  net: phy: realtek: clear master_slave_state if link is down
  net: phy: realtek: always clear 10gbase-t link partner advertisement

 drivers/net/phy/realtek.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

Comments

Heiner Kallweit Jan. 15, 2025, 5:19 p.m. UTC | #1
On 15.01.2025 15:43, Daniel Golle wrote:
> The .read_status method for RealTek RTL822x PHYs (both C22 and C45) has
> multilpe issues which result in reporting bogus link partner advertised
> modes as well as speed and duplex while the link is down and no cable
> is plugged in.
> 
> Example: ethtool after disconnecting a 1000M/Full capable link partner,
> now with no wire plugged:
> 
> Settings for lan1:
>     Supported ports: [ TP ]
>     Supported link modes:   10baseT/Half 10baseT/Full
>                             100baseT/Half 100baseT/Full
>                             1000baseT/Full
>                             2500baseT/Full
>     Supported pause frame use: Symmetric Receive-only
>     Supports auto-negotiation: Yes
>     Supported FEC modes: Not reported
>     Advertised link modes:  10baseT/Half 10baseT/Full
>                             100baseT/Half 100baseT/Full
>                             1000baseT/Full
>                             2500baseT/Full
>     Advertised pause frame use: Symmetric Receive-only
>     Advertised auto-negotiation: Yes
>     Advertised FEC modes: Not reported
>     Link partner advertised link modes:  1000baseT/Full
>     Link partner advertised pause frame use: No
>     Link partner advertised auto-negotiation: No
>     Link partner advertised FEC modes: Not reported
>     Speed: 1000Mb/s
>     Duplex: Full
>     Auto-negotiation: on
>     Port: Twisted Pair
>     PHYAD: 7
>     Transceiver: external
>     MDI-X: Unknown
>     Supports Wake-on: d
>     Wake-on: d
>     Link detected: no
> 
> Fix this by making sure all of the fields populated by
> rtl822x_c45_read_status() or rtl822x_read_status() get reset, also in
> case the link is down.
> 
> Daniel Golle (3):
>   net: phy: realtek: clear 1000Base-T lpa bits if link is down
>   net: phy: realtek: clear master_slave_state if link is down
>   net: phy: realtek: always clear 10gbase-t link partner advertisement
> 
>  drivers/net/phy/realtek.c | 29 ++++++++++++++---------------
>  1 file changed, 14 insertions(+), 15 deletions(-)
> 
Note that the Realtek PHY driver has just been moved to its own subdirectory.
So you have to rebase your patch set.
Jakub Kicinski Jan. 15, 2025, 6:06 p.m. UTC | #2
On Wed, 15 Jan 2025 18:19:44 +0100 Heiner Kallweit wrote:
> Note that the Realtek PHY driver has just been moved to its own subdirectory.
> So you have to rebase your patch set.

Maybe not just yet. This is for net, and the rename was in net-next.
But as you may be alluding to 6.13 is likely to get released this
weekend, so the distinction will stop being relevant.

Let's keep rebasing on net for now, without anticipating the merge.

nit: subject should have said v2