Support for RTL838x based managed switches

Does the ethernet port work in general? Did you reboot your laptop?

Yes, ethernet port works when I link it to router. I believe I did reboot the laptop but not every time.

What about the system LED, how does it behave when you plug in the switch?

The LED on the router side is working when I plug the switch to it.

He asked for the system LED of the switch. When you power the switch on, what does it do?

Regarding to the router <-> switch connection. At the same time you're unable connect your laptop to the switch? Do you specify a static ip on the ethernet connection?

yes; it should go off and then start blinking. if it never blinks then OpenWrt doesn't boot at all and you need serial to recover.

:face_with_raised_eyebrow:

Some very serious confusion is starting here ... Looking at this patch and comparing with this documentation you will need an additional gigamanic-super-duper-interrupt-bridge-device for the RTL930X.

Or simply convert timer interrupts to 7 & 8 as mentioned in the DT documentation of my timer commit.

Sysupgrading to a recent snapshot resolved my connectivity issues. Sorry I did not test on the older version further.

I have encountered a new issue on the GS308T: I am experiencing high download latency >700ms and low Mbps (only ~70-90Mbps out of my plan's 500Mbps) when speed testing through the switch. When connecting directly to my modem or router, the speed test results are >450Mbps and <50ms latency.

You need to provide a bit more information. Please post the network and firewall configurations of the switch (without sensitive information of course). A small connection diagram would be helpful, too.

Thank you everyone! I redid all the cycles by reseting/rebooting, plug/unplug, and trial and error. FInally I can shh to 192.168.1.1. But I am not sure what really happened.

I almost gave up. Your kindness and help encourage me to keep trying. really appreciate it.

Are you using your switch as a router? That poor MIPS SoC wasn't designed to handle that. Your Realtek switch can switch 1 Gbps without breaking a sweat. But it was never designed for routing. Don't do that please...

I just uploaded a branch with some code I have been experimenting with on my HPE 1920-48G: https://github.com/janh/openwrt/tree/hpe-1920-48g

One big issue with this device is that it hangs in prom_init_cmdline. When I remove that function, it boots fine. I'm not sure what is going on here (but I assume it has to do with the bootloader not actually passing any arguments to the kernel).

Aside from that, this branch also contains a few more general changes that should be useful for other devices. This includes changes to reduce logging and also a cond_resched call in rtl83xx_port_fdb_dump, as that can actually block for more than a second even without printing any log messages.

There is also some unfinished code to get the RTL8214FC working on RTL8393. It doesn't do any PHY patching at this point, as that seems to work quite different from RTL838x, and a separate firmware file would be needed. Other than TX disable not working, I didn't notice any missing functionality though.

2 Likes

My network is quite simple: modem > router (192.168.1.1) > switch (192.168.1.2) > pc. I also have a pi-hole (192.168.1.111) connected to my router for DNS.

All of my configs are very close to default. I only changed the switch, gateway, and DNS IP. Firewall config is untouched.

/etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'xxx'

config device 'switch'
	option name 'switch'
	option type 'bridge'
	option macaddr 'xxx'

config bridge-vlan 'lan_vlan'
	option device 'switch'
	option vlan '1'
	option ports 'lan1 lan2 lan3 lan4 lan5 lan6 lan7 lan8'

config device
	option name 'switch.1'
	option macaddr 'xxx'

config interface 'lan'
	option device 'switch.1'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.1.2'
	option dns '192.168.1.111'
	option gateway '192.168.1.1'

etc/config/firewall

config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	list   network		'lan'
	option input		ACCEPT
	option output		ACCEPT
	option forward		ACCEPT

config zone
	option name		wan
	list   network		'wan'
	list   network		'wan6'
	option input		REJECT
	option output		ACCEPT
	option forward		REJECT
	option masq		1
	option mtu_fix		1

config forwarding
	option src		lan
	option dest		wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

config rule
	option name		Allow-IGMP
	option src		wan
	option proto		igmp
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://github.com/openwrt/openwrt/issues/5066
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-MLD
	option src		wan
	option proto		icmp
	option src_ip		xxx::/10
	list icmp_type		'130/0'
	list icmp_type		'131/0'
	list icmp_type		'132/0'
	list icmp_type		'143/0'
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	list icmp_type		router-advertisement
	list icmp_type		neighbour-advertisement
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		echo-reply
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

config rule
	option name		Allow-IPSec-ESP
	option src		wan
	option dest		lan
	option proto		esp
	option target		ACCEPT

config rule
	option name		Allow-ISAKMP
	option src		wan
	option dest		lan
	option dest_port	500
	option proto		udp
	option target		ACCEPT

Are you using your switch as a router? ... But it was never designed for routing. Don't do that please...

No. Please see my above reply.

Disabling the firewall will spare you a few CPU cycles, and you don't need it on a switch. Nothing in dmesg or logread?

I have a suspicion. Run this on your switch and post the output.
for i in $(seq 1 8); do echo lan$i |tr -d '\n'; ethtool lan$i|grep 'Link detected'|tr -d '\n'; ethtool lan$i|grep 'Speed'; done

That makes sense. I disabled the firewall. No change.

I don't see any errors in dmesg or logread.

[175747.710000] RTL8380 Link change: status: 1, ports 400
[175748.310000] rtl83xx-switch switch@1b000000 lan3: Link is Up - 1Gbps/Full - flow control rx/tx
[175748.320000] switch: port 3(lan3) entered blocking state
[175748.320000] switch: port 3(lan3) entered forwarding state

edit: added speed test screenshot
f

lan1	Link detected: yes	Speed: 1000Mb/s
lan2	Link detected: no	Speed: Unknown!
lan3	Link detected: yes	Speed: 1000Mb/s
lan4	Link detected: no	Speed: Unknown!
lan5	Link detected: no	Speed: Unknown!
lan6	Link detected: no	Speed: Unknown!
lan7	Link detected: no	Speed: Unknown!
lan8	Link detected: no	Speed: Unknown!

Ok, not what I'd expected to see. Anyway, your router, what make and model is it?
You could try this: for i in $(seq 1 8); do ethtool -A lan$i autoneg off rx off tx off; done

It's an Asus RT-AC68U. I'm aware that it doesn't support VLANs. And I plan to replace it with an x86 pc running opnsense. I am testing OpenWrt on the switch before committing to migrating from my current router in hopes of avoiding long downtime.

output:

autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting
autoneg unmodified, ignoring
rx unmodified, ignoring
tx unmodified, ignoring
no pause parameters changed, aborting