From a95decbc9da8b18c252239aa6accde4573a8d08c Mon Sep 17 00:00:00 2001 From: Suanming Mou Date: Fri, 15 May 2020 16:36:03 +0800 Subject: [PATCH] net/mlx5: fix shared flow counter lookup Currently, the shared counter search uses the wrong nested index which is used by the pool index. The incorrect nested index using causes the search go to incorrect counter pool is not existed. Add the counter index to fix the incorrect nested use case. Fixes: 4001d7ad26d4 ("net/mlx5: change Direct Verbs counter to indexed") Signed-off-by: Suanming Mou Acked-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_dv.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 71da5fbefe..deb44692e5 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4467,15 +4467,15 @@ static struct mlx5_flow_counter_ext * flow_dv_counter_shared_search(struct mlx5_pools_container *cont, uint32_t id, struct mlx5_flow_counter_pool **ppool) { - static struct mlx5_flow_counter_ext *cnt; + struct mlx5_flow_counter_ext *cnt; struct mlx5_flow_counter_pool *pool; - uint32_t i; + uint32_t i, j; uint32_t n_valid = rte_atomic16_read(&cont->n_valid); for (i = 0; i < n_valid; i++) { pool = cont->pools[i]; - for (i = 0; i < MLX5_COUNTERS_PER_POOL; ++i) { - cnt = MLX5_GET_POOL_CNT_EXT(pool, i); + for (j = 0; j < MLX5_COUNTERS_PER_POOL; ++j) { + cnt = MLX5_GET_POOL_CNT_EXT(pool, j); if (cnt->ref_cnt && cnt->shared && cnt->id == id) { if (ppool) *ppool = cont->pools[i]; -- 2.20.1