From cfbdc3f9383aec93c1fd1a66fca8e1c2faa74441 Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Tue, 20 Oct 2020 11:02:27 +0800 Subject: [PATCH] net/mlx5: rename flow counter macro Add the MLX5_ prefix to the defined counter macro names. Signed-off-by: Suanming Mou Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.h | 22 +++++++++++----------- drivers/net/mlx5/mlx5_flow_dv.c | 10 +++++----- drivers/net/mlx5/mlx5_flow_verbs.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 2598fa2663..9638ab23cd 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -276,19 +276,19 @@ struct mlx5_drop { #define IS_SHARED_CNT(cnt) (!!((cnt) & MLX5_CNT_SHARED_OFFSET)) #define IS_BATCH_CNT(cnt) (((cnt) & (MLX5_CNT_SHARED_OFFSET - 1)) >= \ MLX5_CNT_BATCH_OFFSET) -#define CNT_SIZE (sizeof(struct mlx5_flow_counter)) -#define CNTEXT_SIZE (sizeof(struct mlx5_flow_counter_ext)) -#define AGE_SIZE (sizeof(struct mlx5_age_param)) -#define CNT_POOL_TYPE_EXT (1 << 0) -#define CNT_POOL_TYPE_AGE (1 << 1) +#define MLX5_CNT_SIZE (sizeof(struct mlx5_flow_counter)) +#define MLX5_CNTEXT_SIZE (sizeof(struct mlx5_flow_counter_ext)) +#define MLX5_AGE_SIZE (sizeof(struct mlx5_age_param)) +#define MLX5_CNT_POOL_TYPE_EXT (1 << 0) +#define MLX5_CNT_POOL_TYPE_AGE (1 << 1) -#define IS_EXT_POOL(pool) (((pool)->type) & CNT_POOL_TYPE_EXT) -#define IS_AGE_POOL(pool) (((pool)->type) & CNT_POOL_TYPE_AGE) +#define IS_EXT_POOL(pool) (((pool)->type) & MLX5_CNT_POOL_TYPE_EXT) +#define IS_AGE_POOL(pool) (((pool)->type) & MLX5_CNT_POOL_TYPE_AGE) #define MLX5_CNT_LEN(pool) \ - (CNT_SIZE + \ - (IS_AGE_POOL(pool) ? AGE_SIZE : 0) + \ - (IS_EXT_POOL(pool) ? CNTEXT_SIZE : 0)) + (MLX5_CNT_SIZE + \ + (IS_AGE_POOL(pool) ? MLX5_AGE_SIZE : 0) + \ + (IS_EXT_POOL(pool) ? MLX5_CNTEXT_SIZE : 0)) #define MLX5_POOL_GET_CNT(pool, index) \ ((struct mlx5_flow_counter *) \ ((uint8_t *)((pool) + 1) + (index) * (MLX5_CNT_LEN(pool)))) @@ -306,7 +306,7 @@ struct mlx5_drop { #define MLX5_CNT_TO_CNT_EXT(pool, cnt) \ ((struct mlx5_flow_counter_ext *)\ ((uint8_t *)((cnt) + 1) + \ - (IS_AGE_POOL(pool) ? AGE_SIZE : 0))) + (IS_AGE_POOL(pool) ? MLX5_AGE_SIZE : 0))) #define MLX5_GET_POOL_CNT_EXT(pool, offset) \ MLX5_CNT_TO_CNT_EXT(pool, MLX5_POOL_GET_CNT((pool), (offset))) #define MLX5_CNT_TO_AGE(cnt) \ diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 067ef0f6e3..d302a831c4 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4787,9 +4787,9 @@ flow_dv_pool_create(struct rte_eth_dev *dev, struct mlx5_devx_obj *dcs, uint32_t fallback = priv->counter_fallback; uint32_t size = sizeof(*pool); - size += MLX5_COUNTERS_PER_POOL * CNT_SIZE; - size += (!fallback ? 0 : MLX5_COUNTERS_PER_POOL * CNTEXT_SIZE); - size += (!age ? 0 : MLX5_COUNTERS_PER_POOL * AGE_SIZE); + size += MLX5_COUNTERS_PER_POOL * MLX5_CNT_SIZE; + size += (!fallback ? 0 : MLX5_COUNTERS_PER_POOL * MLX5_CNTEXT_SIZE); + size += (!age ? 0 : MLX5_COUNTERS_PER_POOL * MLX5_AGE_SIZE); pool = mlx5_malloc(MLX5_MEM_ZERO, size, 0, SOCKET_ID_ANY); if (!pool) { rte_errno = ENOMEM; @@ -4797,7 +4797,7 @@ flow_dv_pool_create(struct rte_eth_dev *dev, struct mlx5_devx_obj *dcs, } pool->raw = NULL; pool->type = 0; - pool->type |= (!age ? 0 : CNT_POOL_TYPE_AGE); + pool->type |= (!age ? 0 : MLX5_CNT_POOL_TYPE_AGE); pool->query_gen = 0; pool->min_dcs = dcs; rte_spinlock_init(&pool->sl); @@ -4822,7 +4822,7 @@ flow_dv_pool_create(struct rte_eth_dev *dev, struct mlx5_devx_obj *dcs, if (base > cmng->max_id) cmng->max_id = base + MLX5_COUNTERS_PER_POOL - 1; cmng->last_pool_idx = pool->index; - pool->type |= CNT_POOL_TYPE_EXT; + pool->type |= MLX5_CNT_POOL_TYPE_EXT; } rte_spinlock_unlock(&cmng->pool_update_sl); return pool; diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 1fd5972d16..0bb17b5e01 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -302,7 +302,7 @@ flow_verbs_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id) pool = mlx5_malloc(MLX5_MEM_ZERO, size, 0, SOCKET_ID_ANY); if (!pool) return 0; - pool->type |= CNT_POOL_TYPE_EXT; + pool->type |= MLX5_CNT_POOL_TYPE_EXT; for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) { cnt = MLX5_POOL_GET_CNT(pool, i); TAILQ_INSERT_HEAD(&pool->counters[0], cnt, next); -- 2.20.1