realtek: dsa: rtl93xx: Support multi spanning tree states
authorIssam Hamdi <[email protected]>
Tue, 15 Jul 2025 18:22:26 +0000 (20:22 +0200)
committerHauke Mehrtens <[email protected]>
Sat, 15 Nov 2025 15:21:16 +0000 (16:21 +0100)
commit6c15c5d5eb7c3c58107573c6341581559acb812f
treedc93e7b2ac5c29ec8ac60ebe656213c57e56ae5d
parent5e77a81877dd987f143d38f9cd1cdad7453a3acc
realtek: dsa: rtl93xx: Support multi spanning tree states

The MSTP support (usually implemented by mstpd) requires from the kernel
that a VLAN can associated with an MSTI. At the moment, all these VLANs
just get the msti 0 harcoded on creation. But the
vlan_tables_read()+vlan_tables_write() helper already allow the
modification of the MSTI and only require a minimal hook to expose this
functionality.

It is also necessary to adjust the (M)STP states per MSTI and not only per
port (or for the CIST). The rtl83xx_port_stp_state_set() function was in
theory already capable to modify other MSTIs than CIST - if the msti would
not have been hardcoded to 0.

The userspace can trigger these modifications using netlink:

* (Re)associating VLANs with an MSTI:

      bridge vlan global set dev <BR> vid <X> msti <Y>

* Setting the port state in a given MSTI:

      bridge mst set dev <PORT> msti <Y> state <Z>

Signed-off-by: Issam Hamdi <[email protected]>
Co-developed-by: Sven Eckelmann <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20421
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c