Skip to content

Commit

Permalink
mlxsw: spectrum_switchdev: Update the mdb of mrouter port change
Browse files Browse the repository at this point in the history
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 <nogahf@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Nogah Frankel authored and David S. Miller committed Sep 21, 2017
1 parent 3fba877 commit 3ddda11
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ mlxsw_sp_bridge_mdb_mc_enable_sync(struct mlxsw_sp_port *mlxsw_sp_port,
struct mlxsw_sp_bridge_device
*bridge_device);

static void
mlxsw_sp_port_mrouter_update_mdb(struct mlxsw_sp_port *mlxsw_sp_port,
struct mlxsw_sp_bridge_port *bridge_port,
bool add);

static struct mlxsw_sp_bridge_device *
mlxsw_sp_bridge_device_find(const struct mlxsw_sp_bridge *bridge,
const struct net_device *br_dev)
Expand Down Expand Up @@ -747,6 +752,8 @@ static int mlxsw_sp_port_attr_mrouter_set(struct mlxsw_sp_port *mlxsw_sp_port,
if (err)
return err;

mlxsw_sp_port_mrouter_update_mdb(mlxsw_sp_port, bridge_port,
is_port_mrouter);
out:
bridge_port->mrouter = is_port_mrouter;
return 0;
Expand Down Expand Up @@ -1517,6 +1524,22 @@ mlxsw_sp_bridge_mdb_mc_enable_sync(struct mlxsw_sp_port *mlxsw_sp_port,
}
}

static void
mlxsw_sp_port_mrouter_update_mdb(struct mlxsw_sp_port *mlxsw_sp_port,
struct mlxsw_sp_bridge_port *bridge_port,
bool add)
{
struct mlxsw_sp_bridge_device *bridge_device;
struct mlxsw_sp_mid *mid;

bridge_device = bridge_port->bridge_device;

list_for_each_entry(mid, &bridge_device->mids_list, list) {
if (!test_bit(mlxsw_sp_port->local_port, mid->ports_in_mid))
mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, add);
}
}

static int mlxsw_sp_port_obj_add(struct net_device *dev,
const struct switchdev_obj *obj,
struct switchdev_trans *trans)
Expand Down

0 comments on commit 3ddda11

Please sign in to comment.