[4/4] examples/qos_sched: remove limit on core ids

Message ID 20230203100533.10377-5-bruce.richardson@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series small fixes and improvements for qos_sched example |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-aarch64-unit-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Bruce Richardson Feb. 3, 2023, 10:05 a.m. UTC
  The qos_sched app was limited to using lcores between 0 and 64 only,
even if RTE_MAX_LCORE was set to a higher value (as it is by default).
Remove some of the checks on the lcore ids in order to support running
with core ids > 64.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 examples/qos_sched/args.c | 72 ++-------------------------------------
 examples/qos_sched/main.h | 10 +-----
 2 files changed, 4 insertions(+), 78 deletions(-)
  

Comments

Cristian Dumitrescu Feb. 17, 2023, 4:20 p.m. UTC | #1
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Friday, February 3, 2023 10:06 AM
> To: dev@dpdk.org
> Cc: Singh, Jasvinder <jasvinder.singh@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Subject: [PATCH 4/4] examples/qos_sched: remove limit on core ids
> 
> The qos_sched app was limited to using lcores between 0 and 64 only,
> even if RTE_MAX_LCORE was set to a higher value (as it is by default).
> Remove some of the checks on the lcore ids in order to support running
> with core ids > 64.
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  

Patch

diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c
index b2959499ae..e97273152a 100644
--- a/examples/qos_sched/args.c
+++ b/examples/qos_sched/args.c
@@ -24,7 +24,6 @@ 
 
 static uint32_t app_main_core = 1;
 static uint32_t app_numa_mask;
-static uint64_t app_used_core_mask = 0;
 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;
@@ -82,43 +81,6 @@  app_usage(const char *prgname)
 }
 
 
-/* returns core mask used by DPDK */
-static uint64_t
-app_eal_core_mask(void)
-{
-	uint64_t cm = 0;
-	uint32_t i;
-
-	for (i = 0; i < APP_MAX_LCORE; i++) {
-		if (rte_lcore_has_role(i, ROLE_RTE))
-			cm |= (1ULL << i);
-	}
-
-	cm |= (1ULL << rte_get_main_lcore());
-
-	return cm;
-}
-
-
-/* returns total number of cores presented in a system */
-static uint32_t
-app_cpu_core_count(void)
-{
-	int i, len;
-	char path[PATH_MAX];
-	uint32_t ncores = 0;
-
-	for (i = 0; i < APP_MAX_LCORE; i++) {
-		len = snprintf(path, sizeof(path), SYS_CPU_DIR, i);
-		if (len <= 0 || (unsigned)len >= sizeof(path))
-			continue;
-
-		if (access(path, F_OK) == 0)
-			ncores++;
-	}
-
-	return ncores;
-}
 
 /* returns:
 	 number of values parsed
@@ -261,15 +223,6 @@  app_parse_flow_conf(const char *conf_str)
 	app_used_tx_port_mask |= mask;
 	app_used_port_mask |= mask;
 
-	mask = 1lu << pconf->rx_core;
-	app_used_core_mask |= mask;
-
-	mask = 1lu << pconf->wt_core;
-	app_used_core_mask |= mask;
-
-	mask = 1lu << pconf->tx_core;
-	app_used_core_mask |= mask;
-
 	nb_pfc++;
 
 	return 0;
@@ -322,7 +275,7 @@  app_parse_args(int argc, char **argv)
 	int opt, ret;
 	int option_index;
 	char *prgname = argv[0];
-	uint32_t i, nb_lcores;
+	uint32_t i;
 
 	static struct option lgopts[] = {
 		{OPT_PFC, 1, NULL, OPT_PFC_NUM},
@@ -425,23 +378,6 @@  app_parse_args(int argc, char **argv)
 			}
 	}
 
-	/* check main core index validity */
-	for (i = 0; i <= app_main_core; i++) {
-		if (app_used_core_mask & RTE_BIT64(app_main_core)) {
-			RTE_LOG(ERR, APP, "Main core index is not configured properly\n");
-			app_usage(prgname);
-			return -1;
-		}
-	}
-	app_used_core_mask |= RTE_BIT64(app_main_core);
-
-	if ((app_used_core_mask != app_eal_core_mask()) ||
-			(app_main_core != rte_get_main_lcore())) {
-		RTE_LOG(ERR, APP, "EAL core mask not configured properly, must be %" PRIx64
-				" instead of %" PRIx64 "\n" , app_used_core_mask, app_eal_core_mask());
-		return -1;
-	}
-
 	if (nb_pfc == 0) {
 		RTE_LOG(ERR, APP, "Packet flow not configured!\n");
 		app_usage(prgname);
@@ -449,15 +385,13 @@  app_parse_args(int argc, char **argv)
 	}
 
 	/* sanity check for cores assignment */
-	nb_lcores = app_cpu_core_count();
-
 	for(i = 0; i < nb_pfc; i++) {
-		if (qos_conf[i].rx_core >= nb_lcores) {
+		if (qos_conf[i].rx_core >= RTE_MAX_LCORE) {
 			RTE_LOG(ERR, APP, "pfc %u: invalid RX lcore index %u\n", i + 1,
 					qos_conf[i].rx_core);
 			return -1;
 		}
-		if (qos_conf[i].wt_core >= nb_lcores) {
+		if (qos_conf[i].wt_core >= RTE_MAX_LCORE) {
 			RTE_LOG(ERR, APP, "pfc %u: invalid WT lcore index %u\n", i + 1,
 					qos_conf[i].wt_core);
 			return -1;
diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h
index d8f3e32c83..bc647ec595 100644
--- a/examples/qos_sched/main.h
+++ b/examples/qos_sched/main.h
@@ -37,15 +37,7 @@  extern "C" {
 #define TX_HTHRESH 0  /**< Default values of TX host threshold reg. */
 #define TX_WTHRESH 0  /**< Default values of TX write-back threshold reg. */
 
-#ifndef APP_MAX_LCORE
-#if (RTE_MAX_LCORE > 64)
-#define APP_MAX_LCORE 64
-#else
-#define APP_MAX_LCORE RTE_MAX_LCORE
-#endif
-#endif
-
-#define MAX_DATA_STREAMS (APP_MAX_LCORE/2)
+#define MAX_DATA_STREAMS RTE_MAX_LCORE/2
 #define MAX_SCHED_SUBPORTS		8
 #define MAX_SCHED_PIPES		4096
 #define MAX_SCHED_PIPE_PROFILES		256