Re: [PATCH v2 net-next 02/10] net: bridge: mst: Allow changing a VLAN's MSTI

From: Tobias Waldekranz
Date: Mon Mar 07 2022 - 09:54:34 EST


On Fri, Mar 04, 2022 at 00:27, Vladimir Oltean <olteanv@xxxxxxxxx> wrote:
> On Tue, Mar 01, 2022 at 11:03:13AM +0100, Tobias Waldekranz wrote:
>> Allow a VLAN to move out of the CST (MSTI 0), to an independent tree.
>>
>> The user manages the VID to MSTI mappings via a global VLAN
>> setting. The proposed iproute2 interface would be:
>>
>> bridge vlan global set dev br0 vid <VID> msti <MSTI>
>>
>> Changing the state in non-zero MSTIs is still not supported, but will
>> be addressed in upcoming changes.
>>
>> Signed-off-by: Tobias Waldekranz <tobias@xxxxxxxxxxxxxx>
>> ---
>
>> +static void br_mst_vlan_sync_state(struct net_bridge_vlan *pv, u16 msti)
>> +{
>> + struct net_bridge_vlan_group *vg = nbp_vlan_group(pv->port);
>> + struct net_bridge_vlan *v;
>> +
>> + list_for_each_entry(v, &vg->vlan_list, vlist) {
>> + /* If this port already has a defined state in this
>> + * MSTI (through some other VLAN membership), inherit
>> + * it.
>> + */
>> + if (v != pv && v->brvlan->msti == msti) {
>> + br_mst_vlan_set_state(pv->port, pv, v->state);
>> + return;
>> + }
>> + }
>> +
>> + /* Otherwise, start out in a new MSTI with all ports disabled. */
>> + return br_mst_vlan_set_state(pv->port, pv, BR_STATE_DISABLED);
>> +}
>> +
>> +int br_mst_vlan_set_msti(struct net_bridge_vlan *mv, u16 msti)
>> +{
>> + struct net_bridge_vlan_group *vg;
>> + struct net_bridge_vlan *pv;
>> + struct net_bridge_port *p;
>
> No attempt to detect non-changes to the MSTI, and exit early? In a later
> patch you will also notify switchdev uselessly because of this.

Yeah you're right. Will fix in v3. Thanks