OSDN Git Service

net: bridge: add helper to replay VLANs installed on port
authorVladimir Oltean <vladimir.oltean@nxp.com>
Mon, 22 Mar 2021 23:51:46 +0000 (01:51 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 23 Mar 2021 21:49:05 +0000 (14:49 -0700)
commit22f67cdfae6aaa7e841ced17207391fb368c8e9e
tree1ebe81f3493d70492e9586308b6c6527e60164d0
parent04846f903b53b32d29453e865646309db29f255a
net: bridge: add helper to replay VLANs installed on port

Currently this simple setup with DSA:

ip link add br0 type bridge vlan_filtering 1
ip link add bond0 type bond
ip link set bond0 master br0
ip link set swp0 master bond0

will not work because the bridge has created the PVID in br_add_if ->
nbp_vlan_init, and it has notified switchdev of the existence of VLAN 1,
but that was too early, since swp0 was not yet a lower of bond0, so it
had no reason to act upon that notification.

We need a helper in the bridge to replay the switchdev VLAN objects that
were notified since the bridge port creation, because some of them may
have been missed.

As opposed to the br_mdb_replay function, the vg->vlan_list write side
protection is offered by the rtnl_mutex which is sleepable, so we don't
need to queue up the objects in atomic context, we can replay them right
away.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/if_bridge.h
net/bridge/br_vlan.c