Commit 846fd8a0 authored by Nogah Frankel's avatar Nogah Frankel Committed by David S. Miller

mlxsw: spectrum_switchdev: Don't write mids to the HW when mc is disabled

Don't write multicast related data to the HW when mc is disabled.
Also, don't allocate mid id to new mids (so the remove function could know
that they weren't wrote to the HW)
Signed-off-by: default avatarNogah Frankel <nogahf@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 061e55bf
...@@ -1290,6 +1290,9 @@ mlxsw_sp_mc_write_mdb_entry(struct mlxsw_sp *mlxsw_sp, ...@@ -1290,6 +1290,9 @@ mlxsw_sp_mc_write_mdb_entry(struct mlxsw_sp *mlxsw_sp,
static int mlxsw_sp_mc_remove_mdb_entry(struct mlxsw_sp *mlxsw_sp, static int mlxsw_sp_mc_remove_mdb_entry(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_mid *mid) struct mlxsw_sp_mid *mid)
{ {
if (!mid->in_hw)
return 0;
clear_bit(mid->mid, mlxsw_sp->bridge->mids_bitmap); clear_bit(mid->mid, mlxsw_sp->bridge->mids_bitmap);
mid->in_hw = false; mid->in_hw = false;
return mlxsw_sp_port_mdb_op(mlxsw_sp, mid->addr, mid->fid, mid->mid, return mlxsw_sp_port_mdb_op(mlxsw_sp, mid->addr, mid->fid, mid->mid,
...@@ -1319,11 +1322,15 @@ mlxsw_sp_mid *__mlxsw_sp_mc_alloc(struct mlxsw_sp *mlxsw_sp, ...@@ -1319,11 +1322,15 @@ mlxsw_sp_mid *__mlxsw_sp_mc_alloc(struct mlxsw_sp *mlxsw_sp,
ether_addr_copy(mid->addr, addr); ether_addr_copy(mid->addr, addr);
mid->fid = fid; mid->fid = fid;
mid->in_hw = false; mid->in_hw = false;
if (!bridge_device->multicast_enabled)
goto out;
if (!mlxsw_sp_mc_write_mdb_entry(mlxsw_sp, mid)) if (!mlxsw_sp_mc_write_mdb_entry(mlxsw_sp, mid))
goto err_write_mdb_entry; goto err_write_mdb_entry;
out:
list_add_tail(&mid->list, &bridge_device->mids_list); list_add_tail(&mid->list, &bridge_device->mids_list);
return mid; return mid;
err_write_mdb_entry: err_write_mdb_entry:
...@@ -1391,6 +1398,9 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1391,6 +1398,9 @@ static int mlxsw_sp_port_mdb_add(struct mlxsw_sp_port *mlxsw_sp_port,
} }
set_bit(mlxsw_sp_port->local_port, mid->ports_in_mid); set_bit(mlxsw_sp_port->local_port, mid->ports_in_mid);
if (!bridge_device->multicast_enabled)
return 0;
err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, true); err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, true);
if (err) { if (err) {
netdev_err(dev, "Unable to set SMID\n"); netdev_err(dev, "Unable to set SMID\n");
...@@ -1476,9 +1486,12 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -1476,9 +1486,12 @@ __mlxsw_sp_port_mdb_del(struct mlxsw_sp_port *mlxsw_sp_port,
struct net_device *dev = mlxsw_sp_port->dev; struct net_device *dev = mlxsw_sp_port->dev;
int err; int err;
err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false); if (bridge_port->bridge_device->multicast_enabled) {
if (err) err = mlxsw_sp_port_smid_set(mlxsw_sp_port, mid->mid, false);
netdev_err(dev, "Unable to remove port from SMID\n");
if (err)
netdev_err(dev, "Unable to remove port from SMID\n");
}
err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid); err = mlxsw_sp_port_remove_from_mid(mlxsw_sp_port, mid);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment