Hello!

For now kernel rejects setting MSTI 0 instance state in the same way as another 
instances.
I.e. any non-zero instance state can be set with the following command:
# bridge mst set dev <dev> msti <instance> state <state>

While MST 0 instance state cannot be set in the same way and requires another 
command:
# bridge link set dev <dev> state <state>

This look a little bit inconsistent.
The following change fixes it:

---
Allow setting the MSTI 0 state the same way as non-zero MSTI. 

Signed-off-by: Aleksey S. Kazantsev <[email protected]>

diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c
index 43a300ae6bfa..852e21b88c69 100644
--- a/net/bridge/br_mst.c
+++ b/net/bridge/br_mst.c
@@ -112,14 +112,12 @@ int br_mst_set_state(struct net_bridge_port *p, u16 msti, 
u8 state,
        if (!vg)
                goto out;
 
-       /* MSTI 0 (CST) state changes are notified via the regular
+       /* MSTI 0 (CST) state changes are also can be notified via the regular
         * SWITCHDEV_ATTR_ID_PORT_STP_STATE.
         */
-       if (msti) {
-               err = switchdev_port_attr_set(p->dev, &attr, extack);
-               if (err && err != -EOPNOTSUPP)
-                       goto out;
-       }
+       err = switchdev_port_attr_set(p->dev, &attr, extack);
+       if (err && err != -EOPNOTSUPP)
+               goto out;
 
        err = 0;
        list_for_each_entry_rcu(v, &vg->vlan_list, vlist) {
@@ -294,7 +292,7 @@ int br_mst_fill_info(struct sk_buff *skb,
 
 static const struct nla_policy br_mst_nl_policy[IFLA_BRIDGE_MST_ENTRY_MAX + 1] 
= {
        [IFLA_BRIDGE_MST_ENTRY_MSTI] = NLA_POLICY_RANGE(NLA_U16,
-                                                  1, /* 0 reserved for CST */
+                                                  0,
                                                   VLAN_N_VID - 1),
        [IFLA_BRIDGE_MST_ENTRY_STATE] = NLA_POLICY_RANGE(NLA_U8,
                                                    BR_STATE_DISABLED,
--

Aleksey Kazantsev

Reply via email to