From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33390C433E0 for ; Fri, 15 May 2020 08:36:10 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id DA3F82054F for ; Fri, 15 May 2020 08:36:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA3F82054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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