@@ -28,6 +28,7 @@ enum switchdev_attr_id {
SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED,
SWITCHDEV_ATTR_ID_BRIDGE_MROUTER,
SWITCHDEV_ATTR_ID_MRP_PORT_ROLE,
+ SWITCHDEV_ATTR_ID_VLAN_MSTID,
};
struct switchdev_brport_flags {
@@ -35,6 +36,14 @@ struct switchdev_brport_flags {
unsigned long mask;
};
+struct switchdev_vlan_attr {
+ u16 vid;
+
+ union {
+ u16 mstid;
+ };
+};
+
struct switchdev_attr {
struct net_device *orig_dev;
enum switchdev_attr_id id;
@@ -50,6 +59,7 @@ struct switchdev_attr {
u16 vlan_protocol; /* BRIDGE_VLAN_PROTOCOL */
bool mc_disabled; /* MC_DISABLED */
u8 mrp_port_role; /* MRP_PORT_ROLE */
+ struct switchdev_vlan_attr vlan_attr; /* VLAN_* */
} u;
};
@@ -173,6 +173,26 @@ static int br_vlan_mst_migrate(struct net_bridge_vlan *v, u16 mstid)
old_mst = rtnl_dereference(v->mst);
rcu_assign_pointer(v->mst, mst);
+ if (br_vlan_is_master(v)) {
+ struct switchdev_attr attr = {
+ .id = SWITCHDEV_ATTR_ID_VLAN_MSTID,
+ .flags = SWITCHDEV_F_DEFER,
+ .orig_dev = br->dev,
+ .u.vlan_attr = {
+ .vid = v->vid,
+ .mstid = mstid,
+ },
+ };
+ int err;
+
+ err = switchdev_port_attr_set(br->dev, &attr, NULL);
+ if (err && err != -EOPNOTSUPP) {
+ rcu_assign_pointer(v->mst, old_mst);
+ br_vlan_mst_put(mst);
+ return err;
+ }
+ }
+
if (old_mst)
br_vlan_mst_put(old_mst);
Whenever a VLAN moves to a new MSTID, send a switchdev notification so that switchdevs can track a bridge's VID to MSTID mapping. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> --- include/net/switchdev.h | 10 ++++++++++ net/bridge/br_vlan.c | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+)