net/mlx5: rename flow counter macro
Add the MLX5_ prefix to the defined counter macro names. Signed-off-by: Suanming Mou <suanmingm@nvidia.com> Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
parent
e7138997e0
commit
cfbdc3f938
@ -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) \
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user