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 46CC0A04B6; Wed, 19 Jan 2022 17:20:42 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBAE241168; Wed, 19 Jan 2022 17:20:41 +0100 (CET) Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by mails.dpdk.org (Postfix) with ESMTP id 0DDCF41165 for ; Wed, 19 Jan 2022 17:20:41 +0100 (CET) Received: by mail-io1-f51.google.com with SMTP id z19so3465585ioj.1 for ; Wed, 19 Jan 2022 08:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1YkF+6iJEpBkIirAGysy73mnqiEJe0iHD2FW3DuZ4Y4=; b=LiaAtA/BjETA9KqEfqMkEipMBlqOPGKh3f1ly1qB9nlLRl6NEQhnXZgtx0znqtxVvA H8oLYNIOVRAhhBq3qLCY1nLYK7wB+kMJUiE2Ooo5O4eh1KLXSyNFKjTed1nTkbx8KsFA yXE6a8M86+fVyhAHaSI4f0tCe4mgBkX6wu2LIMuqmXy1Bu7HdZzc9PT6pTUKT5VsjIa4 MCs91hD9WsKnPy0ttLcA/P58lVSTO1tFe9paX9QCcFEM94jV4WtdxyKgdH8mBqi0JQ6+ KsGWRROJidTj3NdZVvgAASGk0Q3IJgjxFXpVmbpLO4cIDkOAEND6Po7s4ouTW5bUkuTN KlJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1YkF+6iJEpBkIirAGysy73mnqiEJe0iHD2FW3DuZ4Y4=; b=XP+kajCqQ+24Fe0SvMl+TdNd6upCHfCK5qB7Ok2ms1nu3iB1lkaDsNyjOmChyTVKXR zTwlajdKTjsT7cOAh89un05fkPihgGr4gvIRNFD2fHF/YvIdTKOa4nKcS6fV3Z5hV2zW q60nMNXUjBfk6LqUC9X59fvWpJ3RDkXwKihQa92FQi+Ve6waXoLh9AIAWUcO8Jp8WDHm vVhcRczGaL5LWYuaJZhpEuAH0ooMR6bozm2zDqfCWycM1hWZCDxLIoiwHishGftQDO70 jBhK8NvWzak8cjjeRsxtCKXWg9wIishEBKwczY3IA9b1dAP1dTZmht0/t6kIJOFbEbyp GKWw== X-Gm-Message-State: AOAM531x/vOk2rLWV06EToSVT62+ml0G+Gzn24jrMEr4V/CcIbV/P6J5 zfY9ZyDC0wEGpDeBJsYx1vSw2XpNc4BpjjF6nl8= X-Google-Smtp-Source: ABdhPJwSK/whJ0LfukiobCrCc/TPInveTXtlFiRCkh02W+l8gxBaR/nieNfjPfyPcWNEwo4d2/+LbxdhxC8c47V9b10= X-Received: by 2002:a02:7048:: with SMTP id f69mr14339748jac.79.1642609240308; Wed, 19 Jan 2022 08:20:40 -0800 (PST) MIME-Version: 1.0 References: <20211209091342.27017-1-ndabilpuram@marvell.com> <20211209091342.27017-2-ndabilpuram@marvell.com> In-Reply-To: <20211209091342.27017-2-ndabilpuram@marvell.com> From: Jerin Jacob Date: Wed, 19 Jan 2022 21:50:14 +0530 Message-ID: Subject: Re: [PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup To: Nithin Dabilpuram , Ferruh Yigit Cc: Jerin Jacob , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev , Gowrishankar Muthukrishnan , Shijith Thotton Content-Type: text/plain; charset="UTF-8" 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 On Thu, Dec 9, 2021 at 2:44 PM Nithin Dabilpuram wrote: > > 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 Acked-by: Jerin Jacob Applied to dpdk-next-net-mrvl/for-next-net. Thanks Changed the git log to: common/cnxk: use for loop in shaper profiles cleanup In shaper profiles cleanup, Klockwork static analyzer tool 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 Klockwork happy. > --- > 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 >