[PATCH v2 03/23] examples/dma: resolve shadow variable warnings
Stephen Hemminger
stephen at networkplumber.org
Tue Apr 7 17:15:59 CEST 2026
Fix shadow variable warnings by:
- Renaming 'copy_mode' parameter to 'mode' in dma_parse_copy_mode()
- Removing 'nb_queues' parameter from port_init() and using the
global variable directly, since it's always called with the
global nb_queues value
../examples/dma/dmafwd.c:593:33: warning: declaration of 'copy_mode'
shadows a global declaration [-Wshadow]
../examples/dma/dmafwd.c:881:68: warning: declaration of 'nb_queues'
shadows a global declaration [-Wshadow]
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
examples/dma/dmafwd.c | 10 +++++-----
examples/dma/meson.build | 1 -
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c
index 5ba0aaa40b..a8ed09e6ae 100644
--- a/examples/dma/dmafwd.c
+++ b/examples/dma/dmafwd.c
@@ -590,11 +590,11 @@ dma_parse_portmask(const char *portmask)
}
static copy_mode_t
-dma_parse_copy_mode(const char *copy_mode)
+dma_parse_copy_mode(const char *mode)
{
- if (strcmp(copy_mode, COPY_MODE_SW) == 0)
+ if (strcmp(mode, COPY_MODE_SW) == 0)
return COPY_MODE_SW_NUM;
- else if (strcmp(copy_mode, COPY_MODE_DMA) == 0)
+ else if (strcmp(mode, COPY_MODE_DMA) == 0)
return COPY_MODE_DMA_NUM;
return COPY_MODE_INVALID_NUM;
@@ -878,7 +878,7 @@ config_port_max_pkt_len(struct rte_eth_conf *conf,
* coming from the mbuf_pool passed as a parameter.
*/
static inline void
-port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
+port_init(uint16_t portid, struct rte_mempool *mbuf_pool)
{
/* Configuring port to use RSS for multiple RX queues. 8< */
static const struct rte_eth_conf port_conf = {
@@ -1061,7 +1061,7 @@ main(int argc, char **argv)
/* Initialize each port. 8< */
cfg.nb_ports = 0;
RTE_ETH_FOREACH_DEV(portid)
- port_init(portid, dma_pktmbuf_pool, nb_queues);
+ port_init(portid, dma_pktmbuf_pool);
/* >8 End of initializing each port. */
/* Initialize port xstats */
diff --git a/examples/dma/meson.build b/examples/dma/meson.build
index 6a65de127e..124f9476fc 100644
--- a/examples/dma/meson.build
+++ b/examples/dma/meson.build
@@ -13,4 +13,3 @@ deps += ['argparse', 'dmadev']
sources = files(
'dmafwd.c',
)
-cflags += no_shadow_cflag
--
2.53.0
More information about the dev
mailing list