From: Weijun Pan <wpan3636@gmail.com>
To: dev@dpdk.org
Cc: hemant.agrawal@nxp.com, sachin.saxena@nxp.com, jun.yang@nxp.com,
stable@dpdk.org, stephen@networkplumber.org, thomas@monjalon.net,
david.marchand@redhat.com, Weijun Pan <wpan36@wisc.edu>
Subject: [PATCH v2] bus/fslmc: convert queue storage macros to inline functions
Date: Sun, 28 Jun 2026 10:25:53 -0500 [thread overview]
Message-ID: <20260628152553.46342-1-wpan3636@gmail.com> (raw)
In-Reply-To: <20260407141928.9426-1-wpan36@wisc.edu>
From: Weijun Pan <wpan36@wisc.edu>
The queue storage allocation and free helpers are implemented as macros
which declare local variables in the caller scope. This can cause shadow
warnings when -Wshadow is enabled.
Convert them to static inline functions to avoid macro-local variable
scope issues without changing behavior.
Bugzilla ID: 1744
Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org
Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 75 ++++++++++++++-----------
1 file changed, 42 insertions(+), 33 deletions(-)
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index e625a5c035..d09dd5d1f9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -202,39 +202,48 @@ struct swp_active_dqs {
uint64_t reserved[7];
};
-#define dpaa2_queue_storage_alloc(q, num) \
-({ \
- int ret = 0, i; \
- \
- for (i = 0; i < (num); i++) { \
- (q)->q_storage[i] = rte_zmalloc(NULL, \
- sizeof(struct queue_storage_info_t), \
- RTE_CACHE_LINE_SIZE); \
- if (!(q)->q_storage[i]) { \
- ret = -ENOBUFS; \
- break; \
- } \
- ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
- if (ret) \
- break; \
- } \
- ret; \
-})
-
-#define dpaa2_queue_storage_free(q, num) \
-({ \
- if (q) { \
- int i; \
- \
- for (i = 0; i < (num); i++) { \
- if ((q)->q_storage[i]) { \
- dpaa2_free_dq_storage((q)->q_storage[i]); \
- rte_free((q)->q_storage[i]); \
- (q)->q_storage[i] = NULL; \
- } \
- } \
- } \
-})
+int dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage);
+void dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage);
+
+static inline int
+dpaa2_queue_storage_alloc(struct dpaa2_queue *q, int num)
+{
+ int ret = 0, i;
+
+ for (i = 0; i < num; i++) {
+ q->q_storage[i] = rte_zmalloc(NULL,
+ sizeof(struct queue_storage_info_t),
+ RTE_CACHE_LINE_SIZE);
+ if (!q->q_storage[i]) {
+ ret = -ENOBUFS;
+ break;
+ }
+
+ ret = dpaa2_alloc_dq_storage(q->q_storage[i]);
+ if (ret)
+ break;
+ }
+
+ return ret;
+}
+
+static inline void
+dpaa2_queue_storage_free(struct dpaa2_queue *q, int num)
+{
+ int i;
+
+ if (!q)
+ return;
+
+ for (i = 0; i < num; i++) {
+ if (q->q_storage[i]) {
+ dpaa2_free_dq_storage(q->q_storage[i]);
+ rte_free(q->q_storage[i]);
+ q->q_storage[i] = NULL;
+ }
+ }
+}
+
#define NUM_MAX_SWP 64
--
2.34.1
next prev parent reply other threads:[~2026-06-28 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 14:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
2026-04-07 14:19 ` [PATCH] raw/ifpga: replace printf calls with logging Weijun Pan
2026-06-28 15:25 ` Weijun Pan [this message]
2026-06-29 5:59 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Hemant Agrawal
2026-06-29 10:41 ` David Marchand
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=20260628152553.46342-1-wpan3636@gmail.com \
--to=wpan3636@gmail.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=jun.yang@nxp.com \
--cc=sachin.saxena@nxp.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
--cc=wpan36@wisc.edu \
/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