From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0B2FA00C2; Thu, 9 Dec 2021 10:13:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75D3441153; Thu, 9 Dec 2021 10:13:55 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DDC5A4114F for ; Thu, 9 Dec 2021 10:13:53 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1B97bVtI009761 for ; Thu, 9 Dec 2021 01:13:53 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=OXdDSggP02nKgXDagyv+YW3IWIVjV4pD113LnQDJrDs=; b=N/ARAjEtJ6gyMEcx14iLhE8yLE9o1dOPEJJEUsjUX4KISnJgy+ALMvwfQNm1Jdu1uJic XQgWrW4elh57gdPdOXRvOZZrEceTksxlciiFPiZSKLYE/LxBcl0Mt4xBY9shWeqYWCge eJc/wO58Kfj3UUBITRlaWbOQkHfV/ojmjaNhcl8AH/8BjNmogtpkC9+kXDPF4Fc+pVeb pf7TXLYcJaUX0iPw+CmS5B0eetj00/ev8J41VzLy2NP+57beBIPgawfxsE5/BniIqt/s bx4pYFKhLs1vFLhbsoPrzJJvzFo53OtwGd3ltC9TITFsk/HWFUI63Vt3+dALkoitKc3P 6g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3cudjt0anp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 09 Dec 2021 01:13:53 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 9 Dec 2021 01:13:50 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 9 Dec 2021 01:13:50 -0800 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id D8CCB3F7054; Thu, 9 Dec 2021 01:13:48 -0800 (PST) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao CC: , Gowrishankar Muthukrishnan , Shijith Thotton Subject: [PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup Date: Thu, 9 Dec 2021 14:43:36 +0530 Message-ID: <20211209091342.27017-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20211209091342.27017-1-ndabilpuram@marvell.com> References: <20211209091342.27017-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 4XI0upMOH6miyX_1-EWKBbzNDEVM2KMd X-Proofpoint-GUID: 4XI0upMOH6miyX_1-EWKBbzNDEVM2KMd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-09_04,2021-12-08_01,2021-12-02_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Gowrishankar Muthukrishnan In shaper profiles cleanup, KW reports infinite loop although existing loop condition is alright. False positive may be due to tqh_first not checked in loop, hence switching to FOREACH_SAFE to make KW happy. Signed-off-by: Gowrishankar Muthukrishnan Signed-off-by: Shijith Thotton --- drivers/common/cnxk/roc_nix_tm.c | 8 ++++---- drivers/common/cnxk/roc_platform.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_tm.c b/drivers/common/cnxk/roc_nix_tm.c index b3d8ebd..fe9e83f 100644 --- a/drivers/common/cnxk/roc_nix_tm.c +++ b/drivers/common/cnxk/roc_nix_tm.c @@ -17,16 +17,16 @@ bitmap_ctzll(uint64_t slab) void nix_tm_clear_shaper_profiles(struct nix *nix) { - struct nix_tm_shaper_profile *shaper_profile; + struct nix_tm_shaper_profile *shaper_profile, *tmp; + struct nix_tm_shaper_profile_list *list; - shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list); - while (shaper_profile != NULL) { + list = &nix->shaper_profile_list; + PLT_TAILQ_FOREACH_SAFE(shaper_profile, list, shaper, tmp) { if (shaper_profile->ref_cnt) plt_warn("Shaper profile %u has non zero references", shaper_profile->id); TAILQ_REMOVE(&nix->shaper_profile_list, shaper_profile, shaper); nix_tm_shaper_profile_free(shaper_profile); - shaper_profile = TAILQ_FIRST(&nix->shaper_profile_list); } } diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h index 61d4781..3648e84 100644 --- a/drivers/common/cnxk/roc_platform.h +++ b/drivers/common/cnxk/roc_platform.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "roc_bits.h" @@ -53,6 +54,7 @@ #define BITMASK_ULL GENMASK_ULL #define PLT_ALIGN_CEIL RTE_ALIGN_CEIL #define PLT_INIT RTE_INIT +#define PLT_TAILQ_FOREACH_SAFE RTE_TAILQ_FOREACH_SAFE /** Divide ceil */ #define PLT_DIV_CEIL(x, y) \ -- 2.8.4