|
@@ -159,19 +159,27 @@ static int dsa_switch_vlan_add(struct dsa_switch *ds,
|
|
{
|
|
{
|
|
const struct switchdev_obj_port_vlan *vlan = info->vlan;
|
|
const struct switchdev_obj_port_vlan *vlan = info->vlan;
|
|
struct switchdev_trans *trans = info->trans;
|
|
struct switchdev_trans *trans = info->trans;
|
|
|
|
+ DECLARE_BITMAP(members, ds->num_ports);
|
|
|
|
+ int port, err;
|
|
|
|
|
|
- /* Do not care yet about other switch chips of the fabric */
|
|
|
|
- if (ds->index != info->sw_index)
|
|
|
|
- return 0;
|
|
|
|
|
|
+ /* Build a mask of VLAN members */
|
|
|
|
+ bitmap_zero(members, ds->num_ports);
|
|
|
|
+ if (ds->index == info->sw_index)
|
|
|
|
+ set_bit(info->port, members);
|
|
|
|
|
|
if (switchdev_trans_ph_prepare(trans)) {
|
|
if (switchdev_trans_ph_prepare(trans)) {
|
|
if (!ds->ops->port_vlan_prepare || !ds->ops->port_vlan_add)
|
|
if (!ds->ops->port_vlan_prepare || !ds->ops->port_vlan_add)
|
|
return -EOPNOTSUPP;
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
- return ds->ops->port_vlan_prepare(ds, info->port, vlan, trans);
|
|
|
|
|
|
+ for_each_set_bit(port, members, ds->num_ports) {
|
|
|
|
+ err = ds->ops->port_vlan_prepare(ds, port, vlan, trans);
|
|
|
|
+ if (err)
|
|
|
|
+ return err;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- ds->ops->port_vlan_add(ds, info->port, vlan, trans);
|
|
|
|
|
|
+ for_each_set_bit(port, members, ds->num_ports)
|
|
|
|
+ ds->ops->port_vlan_add(ds, port, vlan, trans);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -181,14 +189,13 @@ static int dsa_switch_vlan_del(struct dsa_switch *ds,
|
|
{
|
|
{
|
|
const struct switchdev_obj_port_vlan *vlan = info->vlan;
|
|
const struct switchdev_obj_port_vlan *vlan = info->vlan;
|
|
|
|
|
|
- /* Do not care yet about other switch chips of the fabric */
|
|
|
|
- if (ds->index != info->sw_index)
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
if (!ds->ops->port_vlan_del)
|
|
if (!ds->ops->port_vlan_del)
|
|
return -EOPNOTSUPP;
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
- return ds->ops->port_vlan_del(ds, info->port, vlan);
|
|
|
|
|
|
+ if (ds->index == info->sw_index)
|
|
|
|
+ return ds->ops->port_vlan_del(ds, info->port, vlan);
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int dsa_switch_event(struct notifier_block *nb,
|
|
static int dsa_switch_event(struct notifier_block *nb,
|