Support for RTL838x based managed switches

@anon13997276 I just tried, thank you so much
Only ram-booted official image for now

Going to compile and try OpenWRT in a few days
(I didn't had experience with UBoot previously )

Thank you again!

1 Like

Seem a good idea

I was trying to at least copying partition A to partition B (hoping for flash being treated a generic memory)

RTL9300# flshow
=============== FLASH Partition Layout ===============
Index  Name       Size       Address
------------------------------------------------------
 0     LOADER     0xe0000    0xb4000000-0xb40dffff
 1     BDINFO     0x10000    0xb40e0000-0xb40effff
 2     SYSINFO    0x10000    0xb40f0000-0xb40fffff
 3     JFFS2_CFG  0x100000   0xb4100000-0xb41fffff
 4     JFFS2_LOG  0x100000   0xb4200000-0xb42fffff
 5     RUNTIME1   0x680000   0xb4300000-0xb497ffff
 6     RUNTIME2   0x680000   0xb4980000-0xb4ffffff
======================================================

RTL9300# cp.b 0xb4300000 0xb4980000 0x680000

But it seem doing nothing

Is there a proper UBoot procedure? (So I can later flash it again)
Or should I dump the partitions from inside linux?

Edit:

Probably i should use something like:

sf read 0x84f00000 0x300000 0x680000
sf write 0x84f00000 0x980000 0x680000

Thanks,
Luca

Installed the "recently removed" OpenWrt 22.03-rc3 snapshot on a Zyxel 1900 HP24v1 and played with some DSA and LAN/WAN switch settings but do have some questions.

  • Is it correct as in bug or feature that although port 1 is not working on vlan1 but vlan100 like the other Zyxels 8/10 models, this vlan100 is not visible in /etc/config/network nor LUCI or brtcl show?

  • Is it also correct that there is no ipv4 DHCP server on the switch.1 default LAN active in 22.03-rc3, which by default has been active on the br-lan for regular OpenWrt devices?

  • It was noted that using this device as router would be slow, in my situation a 75/10 Mbit download/upload went down to 20/10 with ~50%cpu usage. Needed mac spoofing which did work but is it really this slow?

Rebooting back into Zyxel OS 2.70 located on the 2nd (backup) partition and vice-versa is all working as expected. Also upgrading zyxel OS itself and factory reset it still keeps the dual OS with OpenWrt working.

fw_printsys #bootpartition=0 #boots openwrt
fw_setsys bootpartition 1 #boots zyxel firmware from backup

EDIT: SFP+DAC3M mikrotik module 10GB 3meter DAC also detected/ping working on port25/26 :smiley:

[  171.323618] sfp sfp-p25: module MIKROTIK                          rev      sn MCS17L31975      dc 171219  
[  186.735567] sfp sfp-p25: module removed
[  190.411150] RTL8380 Link change: status: 1, ports 4000000
[  190.863451] sfp sfp-p26: module MIKROTIK                          rev      sn MCS17L31975      dc 171219  
[  190.925614] rtl83xx-switch switch@1b000000 lan26: Link is Up - 1Gbps/Full - flow control off
[  190.935141] switch: port 18(lan26) entered blocking state
[  190.941350] switch: port 18(lan26) entered forwarding state
[  266.161458] RTL8380 Link change: status: 1, ports 4000000
[  266.168648] rtl83xx-switch switch@1b000000 lan26: Link is Down
[  266.175293] switch: port 18(lan26) entered disabled state
[  266.205611] sfp sfp-p26: module removed
[  271.389522] RTL8380 Link change: status: 1, ports 1000000
[  271.763472] sfp sfp-p25: module MIKROTIK                          rev      sn MCS17L31975      dc 171219  
[  271.825573] rtl83xx-switch switch@1b000000 lan25: Link is Up - 1Gbps/Full - flow control off
[  271.835108] switch: port 17(lan25) entered blocking state
[  271.841319] switch: port 17(lan25) entered forwarding state

ethtool lan25
Settings for lan25:
	Supported ports: [ ]
	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: Direct Attach Copper
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes

EDIT:2 SFP Fiber dual-mode CISCO-FINISAR FTLF8524P2BNL-C2 1Gbit also detected/working :smiley:

[  626.453502] sfp sfp-p26: module CISCO-FINISAR    FTLF8524P2BNL-C2 rev D    sn FNS140702S9      dc 100207  
[  632.728277] RTL8380 Link change: status: 1, ports 1000000
[  632.734437] rtl83xx-switch switch@1b000000 lan25: Link is Down
[  632.742307] switch: port 17(lan25) entered disabled state
[  664.024618] RTL8380 Link change: status: 1, ports 4000000
[  664.031952] rtl83xx-switch switch@1b000000 lan26: Link is Up - 1Gbps/Full - flow control off
[  664.041621] switch: port 18(lan26) entered blocking state
[  664.047839] switch: port 18(lan26) entered forwarding state
[  872.475695] sfp sfp-p25: module removed
[  925.036592] RTL8380 Link change: status: 1, ports 4000000
[  925.042753] rtl83xx-switch switch@1b000000 lan26: Link is Down
[  925.050552] switch: port 18(lan26) entered disabled state
[  946.746165] sfp sfp-p26: module removed
[  950.653448] sfp sfp-p25: module CISCO-FINISAR    FTLF8524P2BNL-C2 rev D    sn FNS140702S9      dc 100207  
[  959.860412] RTL8380 Link change: status: 1, ports 1000000
[  959.867638] rtl83xx-switch switch@1b000000 lan25: Link is Up - 1Gbps/Full - flow control off
[  959.877306] switch: port 17(lan25) entered blocking state
[  959.883369] switch: port 17(lan25) entered forwarding state

ethtool lan25
Settings for lan25:
	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: yes

EDIT3: SFP dual-mode fibermodules that required autoneg off in mikrotik ROS/SWOS won't work but got detected ethtool -s 25/26 autoneg off doesn't help :frowning: offcourse also disabled autoneg on Mikrotik switch (both sides)

HP finisar 1GB (maybe fake)
SFP+ Optic 10GB

[ 1156.393460] sfp sfp-p25: module FINISAR CORP.    FTRJ-8519-7D-CSC rev  sn P5C0Z8J          dc 040319  
[ 1259.345290] RTL8380 Link change: status: 1, ports 10000
[ 1259.352331] rtl83xx-switch switch@1b000000 lan17: Link is Down
[ 1259.359114] switch: port 9(lan17) entered disabled state
[ 1259.368670] rtl83xx-switch switch@1b000000 lan17: Link is Up - 1Gbps/Full - flow control rx/tx
[ 1259.378575] switch: port 9(lan17) entered blocking state
[ 1259.384550] switch: port 9(lan17) entered forwarding state
[ 1259.804729] rtl83xx-switch switch@1b000000 lan17: Link is Down
[ 1259.811492] switch: port 9(lan17) entered disabled state
[ 1343.549297] RTL8380 Link change: status: 1, ports 10000
[ 1344.045979] rtl83xx-switch switch@1b000000 lan17: Link is Up - 1Gbps/Full - flow control rx/tx
[ 1344.055830] switch: port 9(lan17) entered blocking state
[ 1344.061803] switch: port 9(lan17) entered forwarding state
[ 1597.526611] sfp sfp-p25: Unable to ascertain link mode
[ 1597.532401] rtl83xx-switch switch@1b000000 lan25: selection of interface failed, advertisement 0000000,00000000,00006400
[ 1813.563986] sfp sfp-p25: Unable to ascertain link mode
[ 1813.569910] rtl83xx-switch switch@1b000000 lan25: selection of interface failed, advertisement 0000000,00000000,00006400
[ 1854.613062] sfp sfp-p25: Unable to ascertain link mode
[ 1854.619018] rtl83xx-switch switch@1b000000 lan25: selection of interface failed, advertisement 0000000,00000000,00006400
[ 2084.225624] sfp sfp-p25: module removed
[ 2085.933449] sfp sfp-p25: module FINISAR CORP.    FTRJ-8519-7D-CSC rev  sn P5C0Z8J          dc 040319  
[ 2278.613477] sfp sfp-p26: module OEM              S+31DLC10D       rev A6.1 sn SG35E408094377   dc 180307  
[ 2278.624467] rtl83xx-switch switch@1b000000 lan26: validation with support 0000000,00000000,00006440 failed: -22
[ 2305.725642] sfp sfp-p25: module removed
[ 2345.380577] RTL8380 Link change: status: 1, ports 4000000
[ 2352.755933] RTL8380 Link change: status: 1, ports 10000
[ 2352.761893] rtl83xx-switch switch@1b000000 lan17: Link is Down
[ 2352.769737] switch: port 9(lan17) entered disabled state
[ 2352.779443] rtl83xx-switch switch@1b000000 lan17: Link is Up - 1Gbps/Full - flow control rx/tx
[ 2352.790435] switch: port 9(lan17) entered blocking state
[ 2352.796573] switch: port 9(lan17) entered forwarding state
[ 2352.845278] rtl83xx-switch switch@1b000000 lan17: Link is Down
[ 2352.852037] switch: port 9(lan17) entered disabled state
[ 2400.121532] RTL8380 Link change: status: 1, ports 4000000
[ 2487.322121] RTL8380 Link change: status: 1, ports 4000000
[ 2487.492811] RTL8380 Link change: status: 1, ports 4000000
[ 2489.668829] RTL8380 Link change: status: 1, ports 4000000
[ 2490.016232] RTL8380 Link change: status: 1, ports 4000000
[ 2529.160929] RTL8380 Link change: status: 1, ports 10000
[ 2529.646022] rtl83xx-switch switch@1b000000 lan17: Link is Up - 1Gbps/Full - flow control rx/tx
[ 2529.655855] switch: port 9(lan17) entered blocking state
[ 2529.661823] switch: port 9(lan17) entered forwarding state
[ 2631.649165] RTL8380 Link change: status: 1, ports 4000000
[ 2631.850462] RTL8380 Link change: status: 1, ports 4000000
[ 2660.253485] sfp sfp-p25: module OEM              S+31DLC10D       rev A6.1 sn SG35E408094377   dc 180307  
[ 2660.264450] rtl83xx-switch switch@1b000000 lan25: validation with support 0000000,00000000,00006440 failed: -22

EDIT4:
Looking longer at the dmesg logs just makes me think why sfp-ports 25/26 show also up as port 17/18. Also note that I'm using ethernet copper rj45 ethernet port 17(shows as port9 in log) on the switch to login for shell/web access...

Boot the OpenWrt initramfs image from memory and create the backup from there. Don't try to copy things around or any other flash write operation before doing this. That's an unnecessary risk.

Yes. There might be some room for improvement in the ethernet driver, but it will always be "slow". It's for switch management.

2 Likes

@bmork I am still on the EEE issue. The problem is much more complicated than I thought. The issue you have seen, i.e. that it is required to toggle EEE once the cable has been unplugged exists on all SoC-PHY combinations, it is not unique to the GS1900-10HP with RTL8382+RTL8218B. I see this on the XS19300 (with RTL931x+RTL8221) and for the XGS1210 (RTL9302 + RTL8218D). For the RTL8281B this is not the only pain point. EEE is configured via MMD registers, but SoC-supported MMD access for the combination RTL8382+RTL8218B first had bugs, and then still did not work, instead manual manipulation of MMD access registers 13/14 seems necessary. Now I am playing around with different sequences of turning EEE on and off and various EEE modes (PHY-controlled and MAC-controlled). The good news is that it is in principle possible to make this work: the OEM system has none of these problems...

1 Like

I'm trying to get the SFP ports to work on my HPE 1920-16G, but it isn't working properly. The result varies depending on whether the bootloader already initialized networking (the bootloader on this device starts networking when the menu is entered, otherwise it boots without enabling networking).

Now I also added the GPIOs for the SFPs (excluding TX fault which is unconnected, and TX disable which is connected to the RTL8214FC). But the link issue is still there, just with slightly different behavior.

Here are the results for a few different cases I tried:

  • Without GPIO, networking enabled in bootloader:
    Link working initially.
    After /etc/init.d/network restart same state as if networking was not enabled in bootloader.

    Details
    # dmesg | grep lan20
    [   14.341268] rtl83xx-switch switch@1b000000 lan20 (uninitialized): PHY [mdio-bus:1b] driver [Realtek RTL8214FC] (irq=POLL)
    [   55.790904] rtl83xx-switch switch@1b000000 lan20: configuring for phy/qsgmii link mode
    [   55.818027] 8021q: adding VLAN 0 to HW filter on device lan20
    [   55.952744] switch: port 13(lan20) entered blocking state
    [   55.970747] switch: port 13(lan20) entered disabled state
    [   55.989516] device lan20 entered promiscuous mode
    [   57.061515] rtl83xx-switch switch@1b000000 lan20: Link is Up - 10Mbps/Half - flow control off
    [   57.135482] switch: port 13(lan20) entered blocking state
    [   57.153531] switch: port 13(lan20) entered forwarding state
    [   57.503744] rtl83xx-switch switch@1b000000 lan20: Link is Down
    [   57.682100] switch: port 13(lan20) entered disabled state
    [   58.182809] rtl83xx-switch switch@1b000000 lan20: Link is Up - 10Mbps/Half - flow control off
    [   58.287350] switch: port 13(lan20) entered blocking state
    [   58.305375] switch: port 13(lan20) entered forwarding state
    
    # ip link | grep lan20
    22: lan20@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch state UP mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/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/Half 1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Link partner advertised link modes:  10baseT/Half 
    	Link partner advertised pause frame use: No
    	Link partner advertised auto-negotiation: Yes
    	Link partner advertised FEC modes: Not reported
    	Speed: 10Mb/s
    	Duplex: Half
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: on
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: yes
    
  • Without GPIO, networking not enabled in bootloader:
    Link not working initially, but works after ethtool -s lan20 speed 1000 duplex full autoneg off port fibre && ifconfig lan20 down && ifconfig lan20 up.

    Details
    # dmesg | grep lan20
    [   14.495347] rtl83xx-switch switch@1b000000 lan20 (uninitialized): PHY [mdio-bus:1b] driver [Realtek RTL8214FC] (irq=POLL)
    [   56.068857] rtl83xx-switch switch@1b000000 lan20: configuring for phy/qsgmii link mode
    [   56.095617] 8021q: adding VLAN 0 to HW filter on device lan20
    [   56.184719] switch: port 13(lan20) entered blocking state
    [   56.202790] switch: port 13(lan20) entered disabled state
    [   56.221546] device lan20 entered promiscuous mode
    
    # ip link | grep lan20
    22: lan20@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/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/Half 1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Speed: Unknown!
    	Duplex: Unknown! (255)
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: on
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: no
    
    # ethtool -s lan20 speed 1000 duplex full autoneg off port fibre && ifconfig lan20 down && ifconfig lan20 up
    [  231.793368] rtl8380_rtl8214fc_media_set: port 27, set_fibre: 1
    [  231.823910] Current media 3
    [  231.833258] Powering off COPPER
    [  231.895265] Powering on FIBRE
    [  231.970200] switch: port 13(lan20) entered disabled state
    [  232.020310] rtl83xx-switch switch@1b000000 lan20: configuring for phy/qsgmii link mode
    [  232.058000] 8021q: adding VLAN 0 to HW filter on device lan20
    [  232.077155] RTL8380 Link change: status: 1, ports 8000000
    [  232.109901] rtl83xx-switch switch@1b000000 lan20: Link is Up - 1Gbps/Full - flow control off
    [  232.138083] switch: port 13(lan20) entered blocking state
    [  232.156125] switch: port 13(lan20) entered forwarding state
    
    # ip link | grep lan20
    22: lan20@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch state UP mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/Full 
    	Supported pause frame use: Symmetric Receive-only
    	Supports auto-negotiation: Yes
    	Supported FEC modes: Not reported
    	Advertised link modes:  1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: No
    	Advertised FEC modes: Not reported
    	Speed: 1000Mb/s
    	Duplex: Full
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: off
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: yes
    
  • With GPIO, networking enabled in bootloader:
    LED shows that link is up (including blinking when other end is transmitting), but no packets are actually received.
    After /etc/init.d/network restart same state as if networking was not enabled in bootloader.

    Details
    # dmesg | grep lan20
    [   14.819813] rtl83xx-switch switch@1b000000 lan20 (uninitialized): switched to inband/1000base-x link mode
    [   14.852075] rtl83xx-switch switch@1b000000 lan20 (uninitialized): PHY [mdio-bus:1b] driver [Realtek RTL8214FC] (irq=POLL)
    [   56.573788] rtl83xx-switch switch@1b000000 lan20: configuring for inband/1000base-x link mode
    [   56.602864] 8021q: adding VLAN 0 to HW filter on device lan20
    [   56.733239] switch: port 13(lan20) entered blocking state
    [   56.751253] switch: port 13(lan20) entered disabled state
    [   56.770164] device lan20 entered promiscuous mode
    
    # ip link | grep lan20
    22: lan20@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/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/Half 1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Link partner advertised link modes:  10baseT/Half 
    	Link partner advertised pause frame use: No
    	Link partner advertised auto-negotiation: Yes
    	Link partner advertised FEC modes: Not reported
    	Speed: 10Mb/s
    	Duplex: Half
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: on
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: no
    
  • With GPIO, networking not enabled in bootloader:
    Link not working, but after ethtool -s lan20 port fibre && ifconfig lan20 down && ifconfig lan20 up the LED shows a link (although no packets are received as above).

    Details
    # dmesg | grep lan20
    [   14.981657] rtl83xx-switch switch@1b000000 lan20 (uninitialized): switched to inband/1000base-x link mode
    [   15.013877] rtl83xx-switch switch@1b000000 lan20 (uninitialized): PHY [mdio-bus:1b] driver [Realtek RTL8214FC] (irq=POLL)
    [   56.648450] rtl83xx-switch switch@1b000000 lan20: configuring for inband/1000base-x link mode
    [   56.677333] 8021q: adding VLAN 0 to HW filter on device lan20
    [   56.768443] switch: port 13(lan20) entered blocking state
    [   56.786485] switch: port 13(lan20) entered disabled state
    [   56.805536] device lan20 entered promiscuous mode
    
    # ip link | grep lan20
    22: lan20@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/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/Half 1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Speed: Unknown!
    	Duplex: Unknown! (255)
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: on
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: no
    
    # ethtool -s lan20 port fibre && ifconfig lan20 down && ifconfig lan20 up
    [  121.948162] rtl8380_rtl8214fc_media_set: port 27, set_fibre: 1
    [  121.978601] Current media 3
    [  121.987939] Powering off COPPER
    [  122.050053] Powering on FIBRE
    [  122.129463] switch: port 13(lan20) entered disabled state
    [  122.172878] rtl83xx-switch switch@1b000000 lan20: configuring for inband/1000base-x link mode
    [  122.212595] 8021q: adding VLAN 0 to HW filter on device lan20
    [  122.252690] RTL8380 Link change: status: 1, ports 8000000
    [  122.280483] RTL8380 Link change: status: 1, ports 8000000
    [  122.315601] RTL8380 Link change: status: 1, ports 8000000
    [  123.462221] RTL8380 Link change: status: 1, ports 8000000
    [  123.513076] RTL8380 Link change: status: 1, ports 8000000
    [  123.697888] RTL8380 Link change: status: 1, ports 8000000
    [  123.738519] RTL8380 Link change: status: 1, ports 8000000
    
    # ip link | grep lan20
    22: lan20@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	Supported ports: [ TP MII FIBRE ]
    	Supported link modes:   10baseT/Half 10baseT/Full 
    	                        100baseT/Half 100baseT/Full 
    	                        1000baseT/Half 1000baseT/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/Half 1000baseT/Full 
    	Advertised pause frame use: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Link partner advertised link modes:  10baseT/Half 
    	Link partner advertised pause frame use: No
    	Link partner advertised auto-negotiation: Yes
    	Link partner advertised FEC modes: Not reported
    	Speed: 10Mb/s
    	Duplex: Half
    	Port: Twisted Pair
    	PHYAD: 27
    	Transceiver: external
    	Auto-negotiation: on
    	MDI-X: Unknown
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: no
    
  • With GPIO, without phy-handle in device tree, networking enabled in bootloader:
    Link working, but no way to control it (always stays up, even after /etc/init.d/network restart).

    Details
    # dmesg | grep lan20
    [   14.718128] rtl83xx-switch switch@1b000000 lan20 (uninitialized): switched to inband/1000base-x link mode
    [   56.337105] rtl83xx-switch switch@1b000000 lan20: configuring for inband/1000base-x link mode
    [   56.365754] 8021q: adding VLAN 0 to HW filter on device lan20
    [   56.438107] switch: port 13(lan20) entered blocking state
    [   56.456148] switch: port 13(lan20) entered disabled state
    [   56.474924] device lan20 entered promiscuous mode
    [   57.426405] rtl83xx-switch switch@1b000000 lan20: Link is Up - 1Gbps/Full - flow control off
    [   57.531997] switch: port 13(lan20) entered blocking state
    [   57.550025] switch: port 13(lan20) entered forwarding state
    [   57.863066] rtl83xx-switch switch@1b000000 lan20: Link is Down
    [   57.947157] switch: port 13(lan20) entered disabled state
    [   57.984315] rtl83xx-switch switch@1b000000 lan20: Link is Up - 1Gbps/Full - flow control off
    [   58.097225] switch: port 13(lan20) entered blocking state
    [   58.115271] switch: port 13(lan20) entered forwarding state
    
    # ip link | grep lan20
    22: lan20@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master switch state UP mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	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: No
    	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: yes
    
  • With GPIO, without phy-handle in device tree, networking not enabled in bootloader:
    Link not working, no way to enable it.

    Details
    # dmesg | grep lan20
    [   14.871746] rtl83xx-switch switch@1b000000 lan20 (uninitialized): switched to inband/1000base-x link mode
    [   56.336873] rtl83xx-switch switch@1b000000 lan20: configuring for inband/1000base-x link mode
    [   56.365526] 8021q: adding VLAN 0 to HW filter on device lan20
    [   56.467328] switch: port 13(lan20) entered blocking state
    [   56.485400] switch: port 13(lan20) entered disabled state
    [   56.504200] device lan20 entered promiscuous mode
    
    # ip link | grep lan20
    22: lan20@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master switch state LOWERLAYERDOWN mode DEFAULT group default qlen 1000
    
    # ethtool lan20
    Settings for lan20:
    	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: No
    	Advertised auto-negotiation: Yes
    	Advertised FEC modes: Not reported
    	Speed: 10Mb/s
    	Duplex: Half
    	Port: FIBRE
    	PHYAD: 0
    	Transceiver: internal
    	Auto-negotiation: on
    	Supports Wake-on: d
    	Wake-on: d
    	Link detected: no
    

Does anyone have an idea what is going on here?

I'm a bit confused about the results with/without phy-handle in the device tree. Is it correct that phy-handle should also be specified for the SFP ports?

One thing I noticed is that there is special handling for in-band auto-negotiation in the DSA driver, but it looks like it is specific to the built-in SerDes. So I'm wondering if RTL8214FC is actually supposed to fully work with SFP right now?

The minimum you need to get an SFP port going is working I2C so that the module is detected and this makes the kernel bring the network interface up. The GPIOs are not as important, provided that the TX disable pin is somehow set to never disable the laser. This part is quite "mechanical": module powered and TX disable not asserted will enable the laser and you should be able to see the light e.g. with your smartphone camera coming out the fiber cable. The phy handle is always necessary if you want to influence the link. What the RTL8214FC PHY does is to take 4 1.25GBit fiber (1000BX) links and combine them into a 5GBit QSGMII link to the SoC in order to support the 4 SFP ports. In principle this can be set up by the bootloader, but if you want e.g. to change to a 100MBit link, the PHY needs to do that. And of course the PHY needs to be configured initially to do 1000BX, it might default to some Ethernet mode.
In several other routers the RTL8214FC works quite nicely, even the possibility to switch between fiber and Ethernet works. My worry here is the TX disable pin connected to the RTL8214FC, there is no hint how this is controlled.

I just bought a Netgear GS308T and was very surprised that the LEDs don't work. I thought the device was dead until I discovered that the LEDs were just not working. Thus, I'm trying to add support for the LEDs: The bi-color power LED was easily identified and is similar to the GS110TPP except that there is just amber and green.

However, I need some assistance with the port LEDs: They are bi-color LEDs, one for each of the 8 ports. How can I identify/set their configuration, is this already supported by the DTS?

I believe @svanheule has some code laying around for driving the LEDs but unsure about the state of it. GS108T V3 suffers from the same problem.

I do, but it's pretty stale and depends on an MFD implementation of the SoC's switchcore:

1 Like

So, here comes finally the answer to your issue: It is an interoperablitiy issue between the RTL8218B (internal in RTL838x) SoC or external RTL8218B/D PHYs and several other PHYs.

It does not seem to be fixable, unfortunately. I complete rewrote all of the EEE code, to test this one needs to apply:

6fbc7c5001 realtek: Improve EEE suport in PHY drivers
0035dae116 realtek: Add EEE support for RTL931X
3a1ad31315 realtek: improve EEE handling
bf755b2120 realtek: Fix bugs in MMD-register access on RTL838x

from my rtl8214qf_merge branch. It brings in particular support for displaying LPI timers and uses standard MMD register r/w to setup EEE and read its status. All of this is now based on SDK 4 code, and no longer on the bits and pieces originally found in the u-boot source code. Unfortunately there is a statement in the RTL8218B driver which says:

     * For Marvell EEE IOP issue, Need to take care to RTL8218B

and then the necessary code is missing. What happens is that the Autonegotiation fails, as whitenessed by

Link partner advertised EEE link modes:  Not reported

I tested with the OEM firmware on the TP-link T2500G-10TS which has the same HW as the GS1900-10HP and see the same behaviour.

So then I did my own IOP testing:


		GS1900-10HP	XGS1210				XGS1210		Edgecore	XGS1250
		RTL8218B	RTL8218D	        RTL8226     RTL8221B	AQR113C
	
RTL8218B	OK		OK				    OK		    OK		    No Link
										
RTL8218D	OK		OK				    OK		    OK		    No Link

RTL8221B	OK		OK								            OK
												                2.5G not rep

RTL8226		OK		OK				    OK

AQR113C	    No link. No link. 			OK		    OK
										            2.5G not rep

AQC100	  Unplug: req.	  Unplug: req.	 OK				OK
  		  remote on/off	  remote on/off  2.5G not rep			2.5/5G not rep
		  Initially OK     Initially OK

Edimax EU-4307
R8169		OK		OK				    OK
no EEE API in 5.10						2.5G not rep
but default is on								

Columns: Switch with OpenWRT and the above patches.
Lines: Variuous connection partners with OEM firmware or a desktop Linux. AQC100 sits on an Intel PCI module in my Desktop. The EU-4307 is a USB adapter. Both are on debian testing with 5.10.

It looks like Realtek is compatible with itself. The AQC100 from Marvel does not like the RTL8218B/D, it requires disabling/enabling it whenever the cable is unplugged as you reported for the Pi.
The AQR113C is having trouble with OpenWRT. Note that we are using the 5.10 (5.18 does not change this) default driver. We in principle have much improved SDK code available to fix this. There is very poor EEE support in Linux for the 2.5/5GBit modes up to current kernels.

1 Like

did some limited testing on my Netgear GS108Tv3 only. cherry-picked the listed commits to current master, ut ended up just copying the phy driver from your branch instead of fighting all the conflicts.

I only have remote access at the moment so I can unplug cables. And I also cannot reboot any of the already connected devices (one is my server/router and the other is the PoE switch powering the Netgear). But the tests I've done look good. I'm unable to get into the state where the reported link partner modes are wrong/missing.

And whatever you did seems to have fixed the bug related to --show-eee on lan1 on the GS108Tv3. I can now do that without breaking networking.

This looks very good to me so far.

4 Likes

Hm, that doesn't look as if LED support for the port LEDs was just a missing DTS entry...I don't quite understand why the LEDs are not hardware-controlled on this device, is there no option to enable hardware control apart from your WiP-branch?

The control registers for the port LEDs are in the switchcore, and since that's a terrible mess of registers it's difficult/impossible to write an independent driver for it.

One possible alternative, is to modify the bootcmd in the u-boot-env. If you prefix that with rtk network on, then the switch will always be initialised by the bootloader, thus enabling the port LEDs.
For example, if bootcmd=boota:

setenv bootcmd rtk network on\; boota

Or the equivalent operation to set bootcmd from OpenWrt.

1 Like

Would/should this work on the GS108T v3 too?

Seems to me it should work on any device. As long as rtk network on initialises the port LEDs, they will behave the same when Linux is running. Our drivers don't touch the relevant registers, at least not on rtl838x and rtl839x IIRC.

1 Like

Just tested, and indeed it does bring the LEDs to life. For that the u-boot env partition needs to be writable though :stuck_out_tongue:. Sent in a patch for that :slight_smile:.

Is this just for the port LEDs? So the GS308T and GS310TP dts are still missing support for the status LED. The LED code for the GS110TPP may work for the GS308T and GS310TP status LED. May have time to try that this weekend.

I already did that for the GS308T (read a few posts back) and created a PR! I will try the U-Boot hack for the port LEDs this weekend.

Ref: https://github.com/openwrt/openwrt/pull/10065