Commit 69be01f3 authored by Nogah Frankel's avatar Nogah Frankel Committed by David S. Miller

mlxsw: spectrum: Make port flood update more generic

Currently, there is a per port flood update function only for the UC
table. Make the function  more generic by changing the table type to be
an input.
Signed-off-by: default avatarNogah Frankel <nogahf@mellanox.com>
Signed-off-by: default avatarYotam Gigi <yotamg@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eaa7df3c
...@@ -219,7 +219,8 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -219,7 +219,8 @@ static int __mlxsw_sp_port_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
return err; return err;
} }
static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, static int mlxsw_sp_port_flood_table_set(struct mlxsw_sp_port *mlxsw_sp_port,
enum mlxsw_sp_flood_table table,
bool set) bool set)
{ {
struct net_device *dev = mlxsw_sp_port->dev; struct net_device *dev = mlxsw_sp_port->dev;
...@@ -231,15 +232,12 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -231,15 +232,12 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
u16 vfid = mlxsw_sp_fid_to_vfid(fid); u16 vfid = mlxsw_sp_fid_to_vfid(fid);
return __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vfid, return __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vfid,
vfid, vfid, table, set);
MLXSW_SP_FLOOD_TABLE_UC,
set);
} }
for_each_set_bit(vid, mlxsw_sp_port->active_vlans, VLAN_N_VID) { for_each_set_bit(vid, mlxsw_sp_port->active_vlans, VLAN_N_VID) {
err = __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid, err = __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid,
MLXSW_SP_FLOOD_TABLE_UC, table, set);
set);
if (err) { if (err) {
last_visited_vid = vid; last_visited_vid = vid;
goto err_port_flood_set; goto err_port_flood_set;
...@@ -250,8 +248,8 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -250,8 +248,8 @@ static int mlxsw_sp_port_uc_flood_set(struct mlxsw_sp_port *mlxsw_sp_port,
err_port_flood_set: err_port_flood_set:
for_each_set_bit(vid, mlxsw_sp_port->active_vlans, last_visited_vid) for_each_set_bit(vid, mlxsw_sp_port->active_vlans, last_visited_vid)
__mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid, __mlxsw_sp_port_flood_table_set(mlxsw_sp_port, vid, vid, table,
MLXSW_SP_FLOOD_TABLE_UC, !set); !set);
netdev_err(dev, "Failed to configure unicast flooding\n"); netdev_err(dev, "Failed to configure unicast flooding\n");
return err; return err;
} }
...@@ -311,7 +309,8 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -311,7 +309,8 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
return 0; return 0;
if ((uc_flood ^ brport_flags) & BR_FLOOD) { if ((uc_flood ^ brport_flags) & BR_FLOOD) {
err = mlxsw_sp_port_uc_flood_set(mlxsw_sp_port, err = mlxsw_sp_port_flood_table_set(mlxsw_sp_port,
MLXSW_SP_FLOOD_TABLE_UC,
!mlxsw_sp_port->uc_flood); !mlxsw_sp_port->uc_flood);
if (err) if (err)
return err; return err;
...@@ -332,7 +331,8 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -332,7 +331,8 @@ static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
err_port_learning_set: err_port_learning_set:
if ((uc_flood ^ brport_flags) & BR_FLOOD) if ((uc_flood ^ brport_flags) & BR_FLOOD)
mlxsw_sp_port_uc_flood_set(mlxsw_sp_port, mlxsw_sp_port_flood_table_set(mlxsw_sp_port,
MLXSW_SP_FLOOD_TABLE_UC,
mlxsw_sp_port->uc_flood); mlxsw_sp_port->uc_flood);
return err; return 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