From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7147DA00C3; Fri, 15 May 2020 10:36:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AA3A41D945; Fri, 15 May 2020 10:36:08 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 4AA01262E for ; Fri, 15 May 2020 10:36:07 +0200 (CEST) From: Suanming Mou To: Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko Cc: dev@dpdk.org, rasland@mellanox.com Date: Fri, 15 May 2020 16:36:03 +0800 Message-Id: <1589531763-320086-1-git-send-email-suanmingm@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix shared counter search with nested index X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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 71da5fb..deb4469 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -4467,15 +4467,15 @@ struct field_modify_info modify_tcp[] = { 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]; -- 1.8.3.1