[PATCH v2] bus/fslmc: convert queue storage macros to inline functions
Weijun Pan
wpan3636 at gmail.com
Sun Jun 28 17:25:53 CEST 2026
From: Weijun Pan <wpan36 at 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 at nxp.com
Cc: stable at dpdk.org
Signed-off-by: Weijun Pan <wpan36 at 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
More information about the dev
mailing list