On 14/03/2022 12:37, Nikolay Aleksandrov wrote: > On 14/03/2022 11:52, Tobias Waldekranz wrote: >> Allow the user to switch from the current per-VLAN STP mode to an MST >> mode. >> >> Up to this point, per-VLAN STP states where always isolated from each >> other. This is in contrast to the MSTP standard (802.1Q-2018, Clause >> 13.5), where VLANs are grouped into MST instances (MSTIs), and the >> state is managed on a per-MSTI level, rather that at the per-VLAN >> level. >> >> Perhaps due to the prevalence of the standard, many switching ASICs >> are built after the same model. Therefore, add a corresponding MST >> mode to the bridge, which we can later add offloading support for in a >> straight-forward way. >> >> For now, all VLANs are fixed to MSTI 0, also called the Common >> Spanning Tree (CST). That is, all VLANs will follow the port-global >> state. >> >> Upcoming changes will make this actually useful by allowing VLANs to >> be mapped to arbitrary MSTIs and allow individual MSTI states to be >> changed. >> >> Signed-off-by: Tobias Waldekranz <tobias@xxxxxxxxxxxxxx> >> --- > [snip] >> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h >> index 48bc61ebc211..35b47f6b449a 100644 >> --- a/net/bridge/br_private.h >> +++ b/net/bridge/br_private.h >> @@ -178,6 +178,7 @@ enum { >> * @br_mcast_ctx: if MASTER flag set, this is the global vlan multicast context >> * @port_mcast_ctx: if MASTER flag unset, this is the per-port/vlan multicast >> * context >> + * @msti: if MASTER flag set, this holds the VLANs MST instance >> * @vlist: sorted list of VLAN entries >> * @rcu: used for entry destruction >> * >> @@ -210,6 +211,8 @@ struct net_bridge_vlan { >> struct net_bridge_mcast_port port_mcast_ctx; >> }; >> >> + u16 msti; >> + >> struct list_head vlist; >> >> struct rcu_head rcu; >> @@ -445,6 +448,7 @@ enum net_bridge_opts { >> BROPT_NO_LL_LEARN, >> BROPT_VLAN_BRIDGE_BINDING, >> BROPT_MCAST_VLAN_SNOOPING_ENABLED, >> + BROPT_MST_ENABLED, >> }; >> >> struct net_bridge { >> @@ -1765,6 +1769,29 @@ static inline bool br_vlan_state_allowed(u8 state, bool learn_allow) >> } >> #endif >> >> +/* br_mst.c */ >> +#ifdef CONFIG_BRIDGE_VLAN_FILTERING > > There is already such ifdef, you can embed all MST code inside it. > My bad, I somehow confused the function placement. This is good. :) Acked-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx>