#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))))
#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) \
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;
}
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);
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;
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);