mlxsw: reg: Make flow counter set type enum to be shared
authorArkadi Sharshevsky <arkadis@mellanox.com>
Thu, 24 Aug 2017 06:40:07 +0000 (08:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Aug 2017 16:33:16 +0000 (09:33 -0700)
This is done as a preparation before introducing support for neighbor
counters. The flow counter's type enum is used by many registers, yet,
until now it was used only by mgpc and thus it was private. This patch
updates the namespace for more generic usage.

Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com>
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/spectrum.c

index 7e8ba546c3a4440261d2e8e3378a34666805bbce..bcf55f6f94f375c9992b9758e128d8487ee7a45f 100644 (file)
@@ -5000,6 +5000,15 @@ enum mlxsw_reg_rauht_trap_id {
  */
 MLXSW_ITEM32(reg, rauht, trap_id, 0x60, 0, 9);
 
+enum mlxsw_reg_flow_counter_set_type {
+       /* No count */
+       MLXSW_REG_FLOW_COUNTER_SET_TYPE_NO_COUNT = 0x00,
+       /* Count packets and bytes */
+       MLXSW_REG_FLOW_COUNTER_SET_TYPE_PACKETS_BYTES = 0x03,
+       /* Count only packets */
+       MLXSW_REG_FLOW_COUNTER_SET_TYPE_PACKETS = 0x05,
+};
+
 /* reg_rauht_counter_set_type
  * Counter set type for flow counters
  * Access: RW
@@ -6041,15 +6050,6 @@ static inline void mlxsw_reg_mpsc_pack(char *payload, u8 local_port, bool e,
 
 MLXSW_REG_DEFINE(mgpc, MLXSW_REG_MGPC_ID, MLXSW_REG_MGPC_LEN);
 
-enum mlxsw_reg_mgpc_counter_set_type {
-       /* No count */
-       MLXSW_REG_MGPC_COUNTER_SET_TYPE_NO_COUT = 0x00,
-       /* Count packets and bytes */
-       MLXSW_REG_MGPC_COUNTER_SET_TYPE_PACKETS_BYTES = 0x03,
-       /* Count only packets */
-       MLXSW_REG_MGPC_COUNTER_SET_TYPE_PACKETS = 0x05,
-};
-
 /* reg_mgpc_counter_set_type
  * Counter set type.
  * Access: OP
@@ -6089,7 +6089,7 @@ MLXSW_ITEM64(reg, mgpc, packet_counter, 0x10, 0, 64);
 
 static inline void mlxsw_reg_mgpc_pack(char *payload, u32 counter_index,
                                       enum mlxsw_reg_mgpc_opcode opcode,
-                                      enum mlxsw_reg_mgpc_counter_set_type set_type)
+                                      enum mlxsw_reg_flow_counter_set_type set_type)
 {
        MLXSW_REG_ZERO(mgpc, payload);
        mlxsw_reg_mgpc_counter_index_set(payload, counter_index);
index 6e641db16702d52b49de450bf35d1e96a7d7adfa..5332b8f0b3f71cc966098723c7ce7f6fef9ee25f 100644 (file)
@@ -382,7 +382,7 @@ int mlxsw_sp_flow_counter_get(struct mlxsw_sp *mlxsw_sp,
        int err;
 
        mlxsw_reg_mgpc_pack(mgpc_pl, counter_index, MLXSW_REG_MGPC_OPCODE_NOP,
-                           MLXSW_REG_MGPC_COUNTER_SET_TYPE_PACKETS_BYTES);
+                           MLXSW_REG_FLOW_COUNTER_SET_TYPE_PACKETS_BYTES);
        err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(mgpc), mgpc_pl);
        if (err)
                return err;
@@ -397,7 +397,7 @@ static int mlxsw_sp_flow_counter_clear(struct mlxsw_sp *mlxsw_sp,
        char mgpc_pl[MLXSW_REG_MGPC_LEN];
 
        mlxsw_reg_mgpc_pack(mgpc_pl, counter_index, MLXSW_REG_MGPC_OPCODE_CLEAR,
-                           MLXSW_REG_MGPC_COUNTER_SET_TYPE_PACKETS_BYTES);
+                           MLXSW_REG_FLOW_COUNTER_SET_TYPE_PACKETS_BYTES);
        return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(mgpc), mgpc_pl);
 }