Skip to content

Commit 3ddda11

Browse files
Nogah Frankeldavem330
authored andcommitted
mlxsw: spectrum_switchdev: Update the mdb of mrouter port change
Whenever a port starts / stops being mrouter, update all the mdb entries in the HW to flood / stop flooding mc packets there. The change should happen only if the port is not in the mid. (If it is, the mid should flood mc packets to this port anyway) Signed-off-by: Nogah Frankel <[email protected]> Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3fba877 commit 3ddda11

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ mlxsw_sp_bridge_mdb_mc_enable_sync(struct mlxsw_sp_port *mlxsw_sp_port,
130130
struct mlxsw_sp_bridge_device
131131
*bridge_device);
132132

133+
static void
134+
mlxsw_sp_port_mrouter_update_mdb(struct mlxsw_sp_port *mlxsw_sp_port,
135+
struct mlxsw_sp_bridge_port *bridge_port,
136+
bool add);
137+
133138
static struct mlxsw_sp_bridge_device *
134139
mlxsw_sp_bridge_device_find(const struct mlxsw_sp_bridge *bridge,
135140
const struct net_device *br_dev)
@@ -747,6 +752,8 @@ static int mlxsw_sp_port_attr_mrouter_set(struct mlxsw_sp_port *mlxsw_sp_port,
747752
if (err)
748753
return err;
749754

755+
mlxsw_sp_port_mrouter_update_mdb(mlxsw_sp_port, bridge_port,
756+
is_port_mrouter);
750757
out:
751758
bridge_port->mrouter = is_port_mrouter;
752759
return 0;
@@ -1517,6 +1524,22 @@ mlxsw_sp_bridge_mdb_mc_enable_sync(struct mlxsw_sp_port *mlxsw_sp_port,
15171524
}
15181525
}
15191526

1527+
static void
1528+
mlxsw_sp_port_mrouter_update_mdb(struct mlxsw_sp_port *mlxsw_sp_port,
1529+
struct mlxsw_sp_bridge_port *bridge_port,
1530+
bool add)
1531+
{
1532+
struct mlxsw_sp_bridge_device *bridge_device;
1533+
struct mlxsw_sp_mid *mid;
1534+
1535+
bridge_device = bridge_port->bridge_device;
1536+
1537+
list_for_each_entry(mid, &bridge_device->mids_list, list) {
1538+
if (!test_bit(mlxsw_sp_port->local_port, mid->ports_in_mid))
1539+
mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, add);
1540+
}
1541+
}
1542+
15201543
static int mlxsw_sp_port_obj_add(struct net_device *dev,
15211544
const struct switchdev_obj *obj,
15221545
struct switchdev_trans *trans)

0 commit comments

Comments
 (0)