[dpdk-dev] [PATCH v2 7/8] net/mlx5: rename flow counter macro

Suanming Mou suanmingm at nvidia.com
Tue Oct 20 05:02:27 CEST 2020


Add the MLX5_ prefix to the defined counter macro names.

Signed-off-by: Suanming Mou <suanmingm at nvidia.com>
Acked-by: Matan Azrad <matan at nvidia.com>
---
 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 2598fa2..9638ab2 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 067ef0f..d302a83 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4787,9 +4787,9 @@ struct field_modify_info modify_tcp[] = {
 	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 @@ struct field_modify_info modify_tcp[] = {
 	}
 	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 @@ struct field_modify_info modify_tcp[] = {
 		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 1fd5972..0bb17b5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -302,7 +302,7 @@
 		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);
-- 
1.8.3.1



More information about the dev mailing list