openwrt-mirror/target/linux
Markus Stockhausen ded18a3683 realtek: dsa: enhance pcs_get_state() for RTL83xx
Currently the SerDes driven SFP ports give strange ethtool readings
on RTL83xx devices. Especially duplex and speed are shown even if
no link is up and running. That leads to confusion because the MAC
reports arbitrary values.

Enhance the readout by refactoring the pcs_get_state() function.
Calculate speed/duplex/pause only if link is detected. Additionally
add reporting of 10G for SFP+ on RTL839x.

ethtool for empty SFP cage before/after

root@OpenWrt:~# ethtool lan9
Settings for lan9:
        Supported ports: [ MII ]
        Supported link modes:   1000baseT/Full
                                1000baseKX/Full
                                1000baseX/Full
                                1000baseT1/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseT/Full
                                1000baseKX/Full
                                1000baseX/Full
                                1000baseT1/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

root@OpenWrt:~# ethtool lan9
Settings for lan9:
        Supported ports: [ MII ]
        Supported link modes:   1000baseT/Full
                                1000baseKX/Full
                                1000baseX/Full
                                1000baseT1/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseT/Full
                                1000baseKX/Full
                                1000baseX/Full
                                1000baseT1/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

ethtool with inserted but NOT connected 1G module before/after

root@OpenWrt:~# ethtool lan9
Settings for lan9:
        Supported ports: [ FIBRE ]
        Supported link modes:   1000baseX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseX/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

root@OpenWrt:~# ethtool lan9
Settings for lan9:
        Supported ports: [ FIBRE ]
        Supported link modes:   1000baseX/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseX/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: FIBRE
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/19524
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-07-26 13:23:42 +02:00
..
airoha kernel: bump 6.6 to 6.6.98 2025-07-16 09:40:36 +02:00
apm821xx apm821xx: kmod-ata-dwc: Make kernel module depend on target 2025-07-26 01:11:21 +02:00
armsr armsr: Make kernel modules depend on target 2025-07-26 01:11:21 +02:00
at91 treewide: strip trailing whitespace 2025-05-20 00:47:37 +02:00
ath79 ath79: add support for Dell SonicPoint ACi APL27-0B1 2025-07-13 01:03:36 +02:00
bcm27xx bcm27xx: Make kernel modules depend on target 2025-07-26 01:11:21 +02:00
bcm47xx treewide: strip trailing whitespace 2025-05-20 00:47:37 +02:00
bcm53xx kernel: bump 6.6 to 6.6.97 2025-07-12 16:47:58 +02:00
bcm4908 bcm63xx-cfe: install into image staging dir 2025-04-13 10:44:19 +02:00
bmips kernel: bump 6.12 to 6.12.39 2025-07-19 11:59:56 +02:00
d1 kernel: remove duplicate PREEMPT settings 2025-06-08 15:59:55 +02:00
gemini kernel: bump 6.12 to 6.12.35 2025-06-28 22:47:48 +02:00
generic kernel: Reorder kernel configuration 2025-07-26 01:11:21 +02:00
imx generic: 6.12: add new config symbols 2025-07-13 15:27:54 +02:00
ipq40xx ipq40xx: enable 6.12 testing kernel 2025-07-20 15:33:03 +02:00
ipq806x ipq806x: add support for IgniteNet SunSpot AC Wave2 2025-06-25 02:07:02 +01:00
ixp4xx ixp4xx: Switch to kernel v6.12 2025-06-03 01:45:40 +02:00
kirkwood kirkwood: add kmod-ata-ahci as default to ix4-200d 2025-07-19 17:58:41 +02:00
lantiq lantiq: enable 6.12 testing kernel 2025-07-18 12:31:00 +01:00
layerscape kernel: bump 6.6 to 6.6.88 2025-05-03 19:57:53 +02:00
loongarch64 loongarch64: add 6.12 as testing kernel 2025-07-12 23:17:00 +02:00
malta malta: drop 6.6 support 2025-07-20 23:37:37 +02:00
mediatek mediatek: Remove modules.builtin file 2025-07-22 00:01:38 +02:00
mpc85xx kernel: backport GCC15 fix for powerpc 2025-07-07 17:20:53 +02:00
mvebu mvebu: Use common files folder 2025-07-19 18:34:58 +02:00
mxs mxs: drop 6.6 support 2025-05-24 16:15:53 +02:00
octeon octeon: ubnt-*: Add device specific DTS pruning 2025-07-09 10:39:29 +02:00
omap kernel: Activate CONFIG_NET_SWITCHDEV in generic config 2025-03-15 13:54:59 +01:00
pistachio kernel: remove duplicate PREEMPT settings 2025-06-08 15:59:55 +02:00
qoriq kernel: Activate CONFIG_NET_SWITCHDEV in generic config 2025-03-15 13:54:59 +01:00
qualcommax kernel: bump 6.12 to 6.12.39 2025-07-19 11:59:56 +02:00
qualcommbe kernel: Reorder kernel configuration 2025-07-26 01:11:21 +02:00
ramips kernel: bump 6.12 to 6.12.40 2025-07-26 01:00:09 +02:00
realtek realtek: dsa: enhance pcs_get_state() for RTL83xx 2025-07-26 13:23:42 +02:00
rockchip rockchip: fix eMMC corruption on NanoPC-T6 with A3A444 chips 2025-07-21 23:39:20 +02:00
sifiveu kernel: remove duplicate PREEMPT settings 2025-06-08 15:59:55 +02:00
siflower kernel: bump 6.6 to 6.6.94 2025-06-21 13:54:17 +02:00
starfive kernel: bump 6.12 to 6.12.36 2025-07-12 16:47:58 +02:00
stm32 generic: 6.12: add new config symbols 2025-07-13 15:27:54 +02:00
sunxi generic: 6.12: add new config symbols 2025-07-13 15:27:54 +02:00
tegra tegra: add 6.12 as testing kernel 2025-07-13 00:49:37 +02:00
uml kernel: bump 6.12 to 6.12.33 2025-06-12 12:42:15 +02:00
x86 x86: Activate CONFIG_DRM_ACCEL 2025-07-26 01:11:21 +02:00
zynq kernel: filter out compiler opts from config 2024-11-17 14:55:16 +01:00
Makefile linux: fix missing default packages in profiles.json 2024-11-17 19:29:06 +01:00