mirror of https://gitee.com/openkylin/linux.git
mlxsw: spectrum_switchdev: Don't batch learning operations
We no longer batch VLAN operations, so there's no need to set the learning state for a range of VLANs. Use a common function to set the learning state for a Port-VLAN, thereby making the code saner more receptive for upcoming changes. 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
45bfe6b433
commit
7cbc4277c7
|
@ -666,9 +666,8 @@ int mlxsw_sp_port_vid_to_fid_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl);
|
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
||||||
u16 vid_begin, u16 vid_end,
|
bool learn_enable)
|
||||||
bool learn_enable)
|
|
||||||
{
|
{
|
||||||
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
|
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
|
||||||
char *spvmlr_pl;
|
char *spvmlr_pl;
|
||||||
|
@ -677,20 +676,13 @@ int __mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
spvmlr_pl = kmalloc(MLXSW_REG_SPVMLR_LEN, GFP_KERNEL);
|
spvmlr_pl = kmalloc(MLXSW_REG_SPVMLR_LEN, GFP_KERNEL);
|
||||||
if (!spvmlr_pl)
|
if (!spvmlr_pl)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
mlxsw_reg_spvmlr_pack(spvmlr_pl, mlxsw_sp_port->local_port, vid_begin,
|
mlxsw_reg_spvmlr_pack(spvmlr_pl, mlxsw_sp_port->local_port, vid, vid,
|
||||||
vid_end, learn_enable);
|
learn_enable);
|
||||||
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvmlr), spvmlr_pl);
|
err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvmlr), spvmlr_pl);
|
||||||
kfree(spvmlr_pl);
|
kfree(spvmlr_pl);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
|
||||||
bool learn_enable)
|
|
||||||
{
|
|
||||||
return __mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, vid,
|
|
||||||
learn_enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port)
|
mlxsw_sp_port_system_port_mapping_set(struct mlxsw_sp_port *mlxsw_sp_port)
|
||||||
{
|
{
|
||||||
|
|
|
@ -442,9 +442,6 @@ int __mlxsw_sp_port_headroom_set(struct mlxsw_sp_port *mlxsw_sp_port, int mtu,
|
||||||
int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
int mlxsw_sp_port_ets_maxrate_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
enum mlxsw_reg_qeec_hr hr, u8 index,
|
enum mlxsw_reg_qeec_hr hr, u8 index,
|
||||||
u8 next_index, u32 maxrate);
|
u8 next_index, u32 maxrate);
|
||||||
int __mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
|
||||||
u16 vid_begin, u16 vid_end,
|
|
||||||
bool learn_enable);
|
|
||||||
int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
int mlxsw_sp_port_vid_stp_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
||||||
u8 state);
|
u8 state);
|
||||||
int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
int mlxsw_sp_port_vid_learning_set(struct mlxsw_sp_port *mlxsw_sp_port, u16 vid,
|
||||||
|
|
|
@ -322,13 +322,11 @@ static int mlxsw_sp_port_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
|
if (mlxsw_sp_port_is_vport(mlxsw_sp_port)) {
|
||||||
vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
|
vid = mlxsw_sp_vport_vid_get(mlxsw_sp_port);
|
||||||
|
|
||||||
return __mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, vid,
|
return mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, set);
|
||||||
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_vid_learning_set(mlxsw_sp_port, vid, vid,
|
err = mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, set);
|
||||||
set);
|
|
||||||
if (err)
|
if (err)
|
||||||
goto err_port_vid_learning_set;
|
goto err_port_vid_learning_set;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +335,7 @@ static int mlxsw_sp_port_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
|
||||||
|
|
||||||
err_port_vid_learning_set:
|
err_port_vid_learning_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)
|
||||||
__mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, vid, !set);
|
mlxsw_sp_port_vid_learning_set(mlxsw_sp_port, vid, !set);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue