mlxsw: spectrum: Use existing flood setup when adding VLANs
When a VLAN is added on a bridge port we should use the existing unicast
flood configuration of the port instead of assuming it's enabled.
Fixes: 0293038e0c
("mlxsw: spectrum: Add support for flood control")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f1de7a28d5
commit
aad8b6bae7
|
@ -167,8 +167,8 @@ static int mlxsw_sp_port_attr_stp_state_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
u16 idx_begin, u16 idx_end, bool set,
|
u16 idx_begin, u16 idx_end, bool uc_set,
|
||||||
bool only_uc)
|
bool bm_set)
|
||||||
{
|
{
|
||||||
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
|
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
|
||||||
u16 local_port = mlxsw_sp_port->local_port;
|
u16 local_port = mlxsw_sp_port->local_port;
|
||||||
|
@ -187,28 +187,22 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin,
|
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin,
|
||||||
table_type, range, local_port, set);
|
table_type, range, local_port, uc_set);
|
||||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
||||||
if (err)
|
if (err)
|
||||||
goto buffer_out;
|
goto buffer_out;
|
||||||
|
|
||||||
/* Flooding control allows one to decide whether a given port will
|
|
||||||
* flood unicast traffic for which there is no FDB entry.
|
|
||||||
*/
|
|
||||||
if (only_uc)
|
|
||||||
goto buffer_out;
|
|
||||||
|
|
||||||
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin,
|
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_BM, idx_begin,
|
||||||
table_type, range, local_port, set);
|
table_type, range, local_port, bm_set);
|
||||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_flood_bm_set;
|
goto err_flood_bm_set;
|
||||||
else
|
|
||||||
goto buffer_out;
|
goto buffer_out;
|
||||||
|
|
||||||
err_flood_bm_set:
|
err_flood_bm_set:
|
||||||
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin,
|
mlxsw_reg_sftr_pack(sftr_pl, MLXSW_SP_FLOOD_TABLE_UC, idx_begin,
|
||||||
table_type, range, local_port, !set);
|
table_type, range, local_port, !uc_set);
|
||||||
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl);
|
||||||
buffer_out:
|
buffer_out:
|
||||||
kfree(sftr_pl);
|
kfree(sftr_pl);
|
||||||
|
@ -257,8 +251,7 @@ int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid,
|
||||||
* the start of the vFIDs range.
|
* the start of the vFIDs range.
|
||||||
*/
|
*/
|
||||||
vfid = mlxsw_sp_fid_to_vfid(fid);
|
vfid = mlxsw_sp_fid_to_vfid(fid);
|
||||||
return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set,
|
return __mlxsw_sp_port_flood_set(mlxsw_sp_vport, vfid, vfid, set, set);
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
|
@ -520,7 +513,7 @@ static int mlxsw_sp_port_fid_join(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end,
|
err = __mlxsw_sp_port_flood_set(mlxsw_sp_port, fid_begin, fid_end,
|
||||||
true, false);
|
mlxsw_sp_port->uc_flood, true);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_port_flood_set;
|
goto err_port_flood_set;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue