Skip to contentSkip to conversation

examples/qos_sched: fix unused but set global errors

PATCH In review Stephen Hemminger 2 participants 3 messages Sep 3 – Sep 4

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 examples/qos_sched: fix unused but set global errors

The QoS sched example tracks numa and port mask but never uses them. Remove the dead code.

clang 23 reports:
qos_sched/args.c:26:17: error: variable 'app_numa_mask' set but not used
[-Werror,-Wunused-but-set-global]
qos_sched/args.c:27:17: error: variable 'app_used_port_mask' set but not used
[-Werror,-Wunused-but-set-global]

Fixes de3cfa2c9823 ("sched: initial import")
---
 examples/qos_sched/args.c | 5 -----
 examples/qos_sched/init.c | 1 -
 2 files changed, 6 deletions(-)
examples/qos_sched/args.c +0 -5
index 886542b3c1..04e2a0e03c 100644
@@ -23,8 +23,6 @@
 #define SYS_CPU_DIR "/sys/devices/system/cpu/cpu%u/topology/"
 
 static uint32_t app_main_core = 1;
-static uint32_t app_numa_mask;
-static uint64_t app_used_port_mask = 0;
 static uint64_t app_used_rx_port_mask = 0;
 static uint64_t app_used_tx_port_mask = 0;
 
@@ -214,7 +212,6 @@ app_parse_flow_conf(const char *conf_str)
 		return -1;
 	}
 	app_used_rx_port_mask |= mask;
-	app_used_port_mask |= mask;
 
 	mask = 1lu << pconf->tx_port;
 	if (app_used_tx_port_mask & mask) {
@@ -223,7 +220,6 @@ app_parse_flow_conf(const char *conf_str)
 		return -1;
 	}
 	app_used_tx_port_mask |= mask;
-	app_used_port_mask |= mask;
 
 	nb_pfc++;
 
@@ -404,7 +400,6 @@ app_parse_args(int argc, char **argv)
 			RTE_LOG(ERR, APP, "pfc %u: RX and WT must be on the same socket\n", i + 1);
 			return -1;
 		}
-		app_numa_mask |= 1 << rte_lcore_to_socket_id(qos_conf[i].rx_core);
 	}
 
 	return 0;
examples/qos_sched/init.c +0 -1
index 561f9e0619..9f4b2e0082 100644
@@ -19,7 +19,6 @@
 #include "main.h"
 #include "cfg_file.h"
 
-uint32_t app_numa_mask = 0;
 static uint32_t app_inited_port_mask = 0;
 
 int app_pipe_to_profile[MAX_SCHED_SUBPORTS][MAX_SCHED_PIPES];
Signature · 1 line
2.53.0
#1 lore raw

PATCH 2/2 examples/vhost: remove unused but set globals

The vhost example tracks number of queues but never uses the variables. Remove num_queues and the num_vmdq_queues intermediate that only fed it.

clang 23 reports:
vhost/main.c:86:17: error: variable 'num_queues' set but not used
[-Werror,-Wunused-but-set-global]

Fixes d19533e86f1d ("examples/vhost: copy old vhost example")
---
 examples/vhost/main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
examples/vhost/main.c +2 -5
index 5978a50cfe..114e5f547c 100644
@@ -82,8 +82,7 @@ static uint32_t enabled_port_mask = 0;
 /* Promiscuous mode */
 static uint32_t promiscuous;
 
-/* number of devices/queues to support*/
-static uint32_t num_queues = 0;
+/* number of devices to support */
 static uint32_t num_devices;
 
 static int mergeable;
@@ -162,7 +161,7 @@ static struct rte_eth_conf vmdq_conf_default = {
 static unsigned lcore_ids[RTE_MAX_LCORE];
 static uint16_t ports[RTE_MAX_ETHPORTS];
 static unsigned num_ports = 0; /**< The number of ports specified in command line */
-static uint16_t num_pf_queues, num_vmdq_queues;
+static uint16_t num_pf_queues;
 static uint16_t vmdq_pool_base, vmdq_queue_base;
 static uint16_t queues_per_pool;
 
@@ -465,8 +464,6 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
 	/* NIC queues are divided into pf queues and vmdq queues.  */
 	num_pf_queues = dev_info.max_rx_queues - dev_info.vmdq_queue_num;
 	queues_per_pool = dev_info.vmdq_queue_num / dev_info.max_vmdq_pools;
-	num_vmdq_queues = num_devices * queues_per_pool;
-	num_queues = num_pf_queues + num_vmdq_queues;
 	vmdq_queue_base = dev_info.vmdq_queue_base;
 	vmdq_pool_base  = dev_info.vmdq_pool_base;
 	printf("pf queue num: %u, configured vmdq pool num: %u, each vmdq pool has %u queues\n",
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH 2/2] examples/vhost: remove unused but set globals

Quoted 10 lines · Stephen Hemminger

The vhost example tracks number of queues but never uses the variables. Remove num_queues and the num_vmdq_queues intermediate that only fed it.

clang 23 reports:
vhost/main.c:86:17: error: variable 'num_queues' set but not used
[-Werror,-Wunused-but-set-global]

Fixes d19533e86f1d ("examples/vhost: copy old vhost example")
$ git grep num_queues 84b02d16c53981e9163a3f1600651a533770553a^ --
examples/vhost/main.c
84b02d16c53981e9163a3f1600651a533770553a^:examples/vhost/main.c:static
uint32_t num_queues = 0;
84b02d16c53981e9163a3f1600651a533770553a^:examples/vhost/main.c:
 num_queues = dev_info.max_rx_queues;
84b02d16c53981e9163a3f1600651a533770553a^:examples/vhost/main.c:
 rx_rings = (uint16_t)num_queues,
84b02d16c53981e9163a3f1600651a533770553a^:examples/vhost/main.c:
         = dev->device_fh * (num_queues / num_devices);
$ git grep num_queues 84b02d16c53981e9163a3f1600651a533770553a --
examples/vhost/main.c
84b02d16c53981e9163a3f1600651a533770553a:examples/vhost/main.c:static
uint32_t num_queues = 0;
84b02d16c53981e9163a3f1600651a533770553a:examples/vhost/main.c:
num_queues = num_pf_queues + num_vmdq_queues;

The last usage of this variable was removed with:

Fixes 84b02d16c539 ("examples/vhost: support new VMDQ API for i40e")
Quoted 3 lines

Otherwise, lgtm.

Signature · 1 line
David Marchand