[PATCH v2 16/23] examples/qos_sched: eliminate shadowed variables

Stephen Hemminger stephen at networkplumber.org
Tue Apr 7 17:16:12 CEST 2026


The port_params and subport_params are global variables,
then passed to load functions. The names clash so just use
the globals.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 examples/qos_sched/cfg_file.c  | 12 ++++++------
 examples/qos_sched/cfg_file.h  |  4 ++--
 examples/qos_sched/init.c      |  4 ++--
 examples/qos_sched/meson.build |  1 -
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c
index c75cf9db2e..3ca06c2ff9 100644
--- a/examples/qos_sched/cfg_file.c
+++ b/examples/qos_sched/cfg_file.c
@@ -41,20 +41,20 @@ int parse_u64(const char *entry, uint64_t *val)
 }
 
 int
-cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params)
+cfg_load_port(struct rte_cfgfile *cfg)
 {
 	const char *entry;
 
-	if (!cfg || !port_params)
+	if (!cfg)
 		return -1;
 
 	entry = rte_cfgfile_get_entry(cfg, "port", "frame overhead");
 	if (entry)
-		port_params->frame_overhead = (uint32_t)atoi(entry);
+		port_params.frame_overhead = (uint32_t)atoi(entry);
 
 	entry = rte_cfgfile_get_entry(cfg, "port", "number of subports per port");
 	if (entry)
-		port_params->n_subports_per_port = (uint32_t)atoi(entry);
+		port_params.n_subports_per_port = (uint32_t)atoi(entry);
 
 	return 0;
 }
@@ -279,13 +279,13 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg,
 }
 
 int
-cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params)
+cfg_load_subport(struct rte_cfgfile *cfg)
 {
 	bool cman_enabled = false;
 	const char *entry;
 	int i, j, k;
 
-	if (!cfg || !subport_params)
+	if (!cfg)
 		return -1;
 
 	memset(app_pipe_to_profile, -1, sizeof(app_pipe_to_profile));
diff --git a/examples/qos_sched/cfg_file.h b/examples/qos_sched/cfg_file.h
index 71d280718f..26552f1e30 100644
--- a/examples/qos_sched/cfg_file.h
+++ b/examples/qos_sched/cfg_file.h
@@ -10,11 +10,11 @@
 
 int parse_u64(const char *entry, uint64_t *val);
 
-int cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port);
+int cfg_load_port(struct rte_cfgfile *cfg);
 
 int cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe);
 
-int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport);
+int cfg_load_subport(struct rte_cfgfile *cfg);
 
 int cfg_load_subport_profile(struct rte_cfgfile *cfg,
 			     struct rte_sched_subport_profile_params
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index ace7279c67..561f9e0619 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -296,11 +296,11 @@ app_load_cfg_profile(const char *profile)
 	if (file == NULL)
 		rte_exit(EXIT_FAILURE, "Cannot load configuration profile %s\n", profile);
 
-	ret = cfg_load_port(file, &port_params);
+	ret = cfg_load_port(file);
 	if (ret)
 		goto _app_load_cfg_profile_error_return;
 
-	ret = cfg_load_subport(file, subport_params);
+	ret = cfg_load_subport(file);
 	if (ret)
 		goto _app_load_cfg_profile_error_return;
 
diff --git a/examples/qos_sched/meson.build b/examples/qos_sched/meson.build
index 4657c756a1..92657ce8a5 100644
--- a/examples/qos_sched/meson.build
+++ b/examples/qos_sched/meson.build
@@ -18,4 +18,3 @@ sources = files(
         'stats.c',
 )
 cflags += no_wvla_cflag
-cflags += no_shadow_cflag
-- 
2.53.0



More information about the dev mailing list