Re: [PATCH v2 net-next 1/8] net: bridge: vlan: notify switchdev only when something changed

Vladimir Oltean
2022-02-15T00:05:40Z

On Tue, Feb 15, 2022 at 01:31:04AM +0200, Vladimir Oltean wrote:
> +/* return true if anything will change as a result of __vlan_add_flags,
> + * false otherwise
> + */
> +static bool __vlan_flags_would_change(struct net_bridge_vlan *v, u16 flags)
> +{
> + struct net_bridge_vlan_group *vg;
> + u16 old_flags = v->flags;
> + bool pvid_changed;
>
> - return ret || !!(old_flags ^ v->flags);
> + if (br_vlan_is_master(v))
> + vg = br_vlan_group(v->br);
> + else
> + vg = nbp_vlan_group(v->port);
> +
> + if (flags & BRIDGE_VLAN_INFO_PVID)
> + pvid_changed = (vg->pvid == v->vid);
> + else
> + pvid_changed = (vg->pvid != v->vid);

Yikes, I was planning to fix this but I forgot. The conditions are in
reverse, it should be:

if (flags & BRIDGE_VLAN_INFO_PVID)
pvid_changed = (vg->pvid != v->vid);
else
pvid_changed = (vg->pvid == v->vid);

> +
> + return pvid_changed || !!(old_flags ^ v->flags);
> }