mlxsw: Introduce mlxsw_reg_spms_vid_pack helper and use it
authorJiri Pirko <jiri@mellanox.com>
Thu, 15 Oct 2015 15:43:26 +0000 (17:43 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Oct 2015 06:27:55 +0000 (23:27 -0700)
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>
drivers/net/ethernet/mellanox/mlxsw/reg.h
drivers/net/ethernet/mellanox/mlxsw/switchx2.c

index 6fca13a65a75cb227ee717765f1585fc37b3ee27..7595cf1ce384f6438e51fdd07e4199a75a93dfb5 100644 (file)
@@ -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);
 }
 
index 698b182c77a3976c34f22a6af735572ac511dd48..7d5c851a7b9bdb8f5506bad93e347cd69374e02b 100644 (file)
@@ -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;