DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nithin Dabilpuram <ndabilpuram@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
	Shijith Thotton <sthotton@marvell.com>
Subject: [PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup
Date: Thu, 9 Dec 2021 14:43:36 +0530	[thread overview]
Message-ID: <20211209091342.27017-2-ndabilpuram@marvell.com> (raw)
In-Reply-To: <20211209091342.27017-1-ndabilpuram@marvell.com>

From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>

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 <gmuthukrishn@marvell.com>
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 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 <rte_pci.h>
 #include <rte_spinlock.h>
 #include <rte_string_fns.h>
+#include <rte_tailq.h>
 #include <rte_telemetry.h>
 
 #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


  reply	other threads:[~2021-12-09  9:13 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  9:13 [PATCH 1/8] common/cnxk: fix shift offset for tl3 length disable Nithin Dabilpuram
2021-12-09  9:13 ` Nithin Dabilpuram [this message]
2022-01-19 16:20   ` [PATCH 2/8] common/cnxk: use for loop in shaper profiles cleanup Jerin Jacob
2021-12-09  9:13 ` [PATCH 3/8] common/cnxk: change order of frag sizes and infos Nithin Dabilpuram
2022-01-19 16:25   ` Jerin Jacob
2022-01-21 10:03   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 4/8] common/cnxk: reset stale values on error debug registers Nithin Dabilpuram
2022-01-19 16:25   ` Jerin Jacob
2021-12-09  9:13 ` [PATCH 5/8] common/cnxk: always use single qint with NIX Nithin Dabilpuram
2022-01-19 16:28   ` Jerin Jacob
2021-12-09  9:13 ` [PATCH 6/8] common/cnxk: handle issues from static analysis Nithin Dabilpuram
2022-01-19 16:44   ` Jerin Jacob
2022-01-21 10:05   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 7/8] net/cnxk: improve inbound inline error handling for cn9k Nithin Dabilpuram
2022-01-21 10:06   ` Ferruh Yigit
2021-12-09  9:13 ` [PATCH 8/8] net/cnxk: synchronize inline session create and destroy Nithin Dabilpuram
2022-01-19 16:45   ` Jerin Jacob
2022-01-19 16:15 ` [PATCH 1/8] common/cnxk: fix shift offset for tl3 length disable Jerin Jacob
2022-01-21 10:08   ` Ferruh Yigit
2022-01-21 10:24     ` Nithin Kumar Dabilpuram
2022-01-21 12:04 ` [PATCH v2 01/10] common/cnxk: fix shift offset for TL3 " Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 02/10] common/cnxk: use for loop in shaper profiles cleanup Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 03/10] common/cnxk: fix byte order of frag sizes and infos Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 04/10] common/cnxk: reset stale values on error debug registers Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 05/10] common/cnxk: always use single interrupt ID with NIX Nithin Dabilpuram
2022-01-21 17:16     ` Kevin Traynor
2022-01-23  7:45       ` Jerin Jacob
2022-01-21 12:04   ` [PATCH v2 06/10] common/cnxk: fix null pointer dereferences Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 07/10] common/cnxk: fix uninitialized variable issues Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 08/10] net/cnxk: improve inbound inline error handling for cn9k Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 09/10] common/cnxk: set UDP ports for IPsec UDP encapsulation Nithin Dabilpuram
2022-01-21 12:04   ` [PATCH v2 10/10] net/cnxk: synchronize inline session create and destroy Nithin Dabilpuram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211209091342.27017-2-ndabilpuram@marvell.com \
    --to=ndabilpuram@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gmuthukrishn@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=sthotton@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).