@@ -901,6 +901,9 @@ struct dsa_switch_ops {
struct netlink_ext_ack *extack);
int (*port_vlan_del)(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan);
+ int (*vlan_mstid_set)(struct dsa_switch *ds,
+ const struct switchdev_attr *attr);
+
/*
* Forwarding database
*/
@@ -173,7 +173,7 @@ 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)) {
+ if (!old_mst || br_vlan_is_master(v)) {
struct switchdev_attr attr = {
.id = SWITCHDEV_ATTR_ID_VLAN_MSTID,
.flags = SWITCHDEV_F_DEFER,
@@ -204,6 +204,7 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
struct netlink_ext_ack *extack);
bool dsa_port_skip_vlan_configuration(struct dsa_port *dp);
int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock);
+int dsa_port_vlan_mstid(struct dsa_port *dp, const struct switchdev_attr *attr);
int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
bool targeted_match);
int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
@@ -729,6 +729,16 @@ int dsa_port_bridge_flags(struct dsa_port *dp,
return 0;
}
+int dsa_port_vlan_mstid(struct dsa_port *dp, const struct switchdev_attr *attr)
+{
+ struct dsa_switch *ds = dp->ds;
+
+ if (!ds->ops->vlan_mstid_set)
+ return -EOPNOTSUPP;
+
+ return ds->ops->vlan_mstid_set(ds, attr);
+}
+
int dsa_port_mtu_change(struct dsa_port *dp, int new_mtu,
bool targeted_match)
{
@@ -314,6 +314,12 @@ static int dsa_slave_port_attr_set(struct net_device *dev, const void *ctx,
ret = dsa_port_bridge_flags(dp, attr->u.brport_flags, extack);
break;
+ case SWITCHDEV_ATTR_ID_VLAN_MSTID:
+ if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
+ return -EOPNOTSUPP;
+
+ ret = dsa_port_vlan_mstid(dp, attr);
+ break;
default:
ret = -EOPNOTSUPP;
break;
Add the usual trampoline functionality from the generic DSA layer down to the drivers for VLAN MST migrations. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> --- include/net/dsa.h | 3 +++ net/bridge/br_vlan.c | 2 +- net/dsa/dsa_priv.h | 1 + net/dsa/port.c | 10 ++++++++++ net/dsa/slave.c | 6 ++++++ 5 files changed, 21 insertions(+), 1 deletion(-)