mirror of
https://github.com/immortalwrt/immortalwrt.git
synced 2025-08-11 06:11:53 +08:00

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>