mirror of https://gitee.com/openkylin/linux.git
mlxsw: Introduce mlxsw_reg_spms_vid_pack helper and use it
Introduce separate helper for packing SPMS VIDs, as it can be used for multiple VIDs and not only for one as previous SPMS pack function provided. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fa6ad058bc
commit
ebb7963f9b
|
@ -192,11 +192,15 @@ enum mlxsw_reg_spms_state {
|
|||
*/
|
||||
MLXSW_ITEM_BIT_ARRAY(reg, spms, state, 0x04, 0x400, 2);
|
||||
|
||||
static inline void mlxsw_reg_spms_pack(char *payload, u8 local_port, u16 vid,
|
||||
enum mlxsw_reg_spms_state state)
|
||||
static inline void mlxsw_reg_spms_pack(char *payload, u8 local_port)
|
||||
{
|
||||
MLXSW_REG_ZERO(spms, payload);
|
||||
mlxsw_reg_spms_local_port_set(payload, local_port);
|
||||
}
|
||||
|
||||
static inline void mlxsw_reg_spms_vid_pack(char *payload, u16 vid,
|
||||
enum mlxsw_reg_spms_state state)
|
||||
{
|
||||
mlxsw_reg_spms_state_set(payload, vid, state);
|
||||
}
|
||||
|
||||
|
|
|
@ -923,7 +923,8 @@ static int mlxsw_sx_port_stp_state_set(struct mlxsw_sx_port *mlxsw_sx_port,
|
|||
spms_pl = kmalloc(MLXSW_REG_SPMS_LEN, GFP_KERNEL);
|
||||
if (!spms_pl)
|
||||
return -ENOMEM;
|
||||
mlxsw_reg_spms_pack(spms_pl, mlxsw_sx_port->local_port, vid, state);
|
||||
mlxsw_reg_spms_pack(spms_pl, mlxsw_sx_port->local_port);
|
||||
mlxsw_reg_spms_vid_pack(spms_pl, vid, state);
|
||||
err = mlxsw_reg_write(mlxsw_sx->core, MLXSW_REG(spms), spms_pl);
|
||||
kfree(spms_pl);
|
||||
return err;
|
||||
|
|
Loading…
Reference in New Issue