[PATCH v2 4/5] realtek: Fix failsafe mode

Birger Koblitz mail at birger-koblitz.de
Sat Jun 26 14:17:25 PDT 2021


Hi Hauke,

it looks as if there could be a more elegant solution to this, tomn just posted
this on the forum:
https://forum.openwrt.org/t/support-for-rtl838x-based-managed-switches/57875
I did not have time to test it so far, though.

Birger

On 22/06/2021 00:45, Hauke Mehrtens wrote:
> The RTL8380-RTL9300 switches only forward packets when VLAN ID 1 is
> configured. Do not use the standard failsafe configuration for DSA
> accessing the default port directly, but configure a switch on the lan1
> interface instead.
> 
> This will add the VLAN ID 1 configuration to the switch:
> $ bridge vlan show
> port              vlan-id
> lan1              1 PVID Egress Untagged
> switch            1 PVID Egress Untagged
> 
> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> ---
>   .../lib/preinit/05_set_preinit_iface_realtek        | 13 +++++++++++++
>   .../lib/preinit/98_remove_preinit_realtek           |  6 ++++++
>   2 files changed, 19 insertions(+)
>   create mode 100644 target/linux/realtek/base-files/lib/preinit/05_set_preinit_iface_realtek
>   create mode 100644 target/linux/realtek/base-files/lib/preinit/98_remove_preinit_realtek
> 
> diff --git a/target/linux/realtek/base-files/lib/preinit/05_set_preinit_iface_realtek b/target/linux/realtek/base-files/lib/preinit/05_set_preinit_iface_realtek
> new file mode 100644
> index 000000000000..e2a7cf5a69e9
> --- /dev/null
> +++ b/target/linux/realtek/base-files/lib/preinit/05_set_preinit_iface_realtek
> @@ -0,0 +1,13 @@
> +set_preinit_iface() {
> +
> +	# Create a switch on lan1 to configure the VLAN 1.
> +	# Without configuring VLAN ID 1 RTL8380 - RTL9300 will not
> +	# forward packets.
> +	ip link add name switch type bridge vlan_filtering 1
> +	ip link set dev lan1 master switch
> +	ip link set lan1 up
> +
> +	pi_ifname=switch
> +}
> +
> +boot_hook_add preinit_main set_preinit_iface
> diff --git a/target/linux/realtek/base-files/lib/preinit/98_remove_preinit_realtek b/target/linux/realtek/base-files/lib/preinit/98_remove_preinit_realtek
> new file mode 100644
> index 000000000000..dc5fdb059b9b
> --- /dev/null
> +++ b/target/linux/realtek/base-files/lib/preinit/98_remove_preinit_realtek
> @@ -0,0 +1,6 @@
> +remove_switch() {
> +	# delete switch created in 05_set_preinit_iface_realtek again
> +	ip link del name switch
> +}
> +
> +boot_hook_add preinit_main remove_switch
> 



More information about the openwrt-devel mailing list