From: Ido Schimmel <idosch@nvidia.com>
To: Алексей <ioctl@ya.ru>
Cc: razor@blackwall.org, bridge@lists.linux.dev
Subject: Re: [PATCH bridge] Allow MSTI 0 state setting the same way as non-zero MSTI
Date: Tue, 15 Sep 2026 16:07:01 +0300 [thread overview]
Message-ID: <20260915130701.GA656073@shredder> (raw)
In-Reply-To: <4150481789460597@ddf99c15-6b70-4f37-97c6-5b57e045b15b>
On Tue, Sep 15, 2026 at 11:23:17AM +0300, Алексей wrote:
> 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 <ioctl@yandex.ru>
>
> 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;
1. This is going to conflict with:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=18a6fe05fb6e18de29fa90d388bb34044114b3d8
2. switchdev_port_attr_set() can block and msti 0 can be set from
softIRQ context, so you will get sleeping in an atomic context splat.
3. This is not how a patch is supposed to be submitted. Please refer to
the kernel docs regarding this and look at other bridge patches for
reference.
The code seems fine as-is.
>
> 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
prev parent reply other threads:[~2026-09-15 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 8:23 [PATCH bridge] Allow MSTI 0 state setting the same way as non-zero MSTI Алексей
2026-09-15 13:07 ` Ido Schimmel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915130701.GA656073@shredder \
--to=idosch@nvidia.com \
--cc=bridge@lists.linux.dev \
--cc=ioctl@ya.ru \
--cc=razor@blackwall.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.