All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com,
	Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Subject: [dpdk-dev] [PATCH v5 14/15] examples/qos_sched: add subport configuration flexibility
Date: Mon, 14 Oct 2019 18:23:46 +0100	[thread overview]
Message-ID: <20191014172347.139114-15-jasvinder.singh@intel.com> (raw)
In-Reply-To: <20191014172347.139114-1-jasvinder.singh@intel.com>

Modify qos sample app to allow different subports of the same port
to have different configuration in terms of number of pipes, pipe
queue sizes, etc.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
---
 examples/qos_sched/app_thread.c   |  20 ++-
 examples/qos_sched/cfg_file.c     | 229 ++++++++++++++++--------------
 examples/qos_sched/init.c         |  54 +++----
 examples/qos_sched/main.h         |   1 +
 examples/qos_sched/profile.cfg    |   5 +-
 examples/qos_sched/profile_ov.cfg |   5 +-
 examples/qos_sched/stats.c        |  44 +++---
 7 files changed, 203 insertions(+), 155 deletions(-)

diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c
index 18b734a14..dbc878b55 100644
--- a/examples/qos_sched/app_thread.c
+++ b/examples/qos_sched/app_thread.c
@@ -35,15 +35,25 @@ get_pkt_sched(struct rte_mbuf *m, uint32_t *subport, uint32_t *pipe,
 	uint16_t *pdata = rte_pktmbuf_mtod(m, uint16_t *);
 	uint16_t pipe_queue;
 
+	/* Outer VLAN ID*/
 	*subport = (rte_be_to_cpu_16(pdata[SUBPORT_OFFSET]) & 0x0FFF) &
-			(port_params.n_subports_per_port - 1); /* Outer VLAN ID*/
+		(port_params.n_subports_per_port - 1);
+
+	/* Inner VLAN ID */
 	*pipe = (rte_be_to_cpu_16(pdata[PIPE_OFFSET]) & 0x0FFF) &
-			(port_params.n_pipes_per_subport - 1); /* Inner VLAN ID */
+		(subport_params[*subport].n_pipes_per_subport_enabled - 1);
+
 	pipe_queue = active_queues[(pdata[QUEUE_OFFSET] >> 8) % n_active_queues];
+
+	/* Traffic class (Destination IP) */
 	*traffic_class = pipe_queue > RTE_SCHED_TRAFFIC_CLASS_BE ?
-			RTE_SCHED_TRAFFIC_CLASS_BE : pipe_queue; /* Destination IP */
-	*queue = pipe_queue - *traffic_class; /* Destination IP */
-	*color = pdata[COLOR_OFFSET] & 0x03; /* Destination IP */
+			RTE_SCHED_TRAFFIC_CLASS_BE : pipe_queue;
+
+	/* Traffic class queue (Destination IP) */
+	*queue = pipe_queue - *traffic_class;
+
+	/* Color (Destination IP) */
+	*color = pdata[COLOR_OFFSET] & 0x03;
 
 	return 0;
 }
diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c
index 45bf599e4..c6d3f5ab6 100644
--- a/examples/qos_sched/cfg_file.c
+++ b/examples/qos_sched/cfg_file.c
@@ -24,14 +24,10 @@ int
 cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params)
 {
 	const char *entry;
-	int j;
 
 	if (!cfg || !port_params)
 		return -1;
 
-	memset(active_queues, 0, sizeof(active_queues));
-	n_active_queues = 0;
-
 	entry = rte_cfgfile_get_entry(cfg, "port", "frame overhead");
 	if (entry)
 		port_params->frame_overhead = (uint32_t)atoi(entry);
@@ -40,106 +36,6 @@ cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params
 	if (entry)
 		port_params->n_subports_per_port = (uint32_t)atoi(entry);
 
-	entry = rte_cfgfile_get_entry(cfg, "port", "number of pipes per subport");
-	if (entry)
-		port_params->n_pipes_per_subport = (uint32_t)atoi(entry);
-
-	entry = rte_cfgfile_get_entry(cfg, "port", "queue sizes");
-	if (entry) {
-		char *next;
-
-		for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
-			port_params->qsize[j] = (uint16_t)strtol(entry, &next, 10);
-			if (next == NULL)
-				break;
-			entry = next;
-		}
-
-		for (j = 0; j < RTE_SCHED_TRAFFIC_CLASS_BE; j++)
-			if (port_params->qsize[j]) {
-				active_queues[n_active_queues] = j;
-				n_active_queues++;
-			}
-
-		if (port_params->qsize[RTE_SCHED_TRAFFIC_CLASS_BE])
-			for (j = 0; j < RTE_SCHED_BE_QUEUES_PER_PIPE; j++) {
-				active_queues[n_active_queues] =
-					RTE_SCHED_TRAFFIC_CLASS_BE + j;
-				n_active_queues++;
-			}
-	}
-
-#ifdef RTE_SCHED_RED
-	for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
-		char str[32];
-
-		/* Parse WRED min thresholds */
-		snprintf(str, sizeof(str), "tc %d wred min", j);
-		entry = rte_cfgfile_get_entry(cfg, "red", str);
-		if (entry) {
-			char *next;
-			int k;
-			/* for each packet colour (green, yellow, red) */
-			for (k = 0; k < RTE_COLORS; k++) {
-				port_params->red_params[j][k].min_th
-					= (uint16_t)strtol(entry, &next, 10);
-				if (next == NULL)
-					break;
-				entry = next;
-			}
-		}
-
-		/* Parse WRED max thresholds */
-		snprintf(str, sizeof(str), "tc %d wred max", j);
-		entry = rte_cfgfile_get_entry(cfg, "red", str);
-		if (entry) {
-			char *next;
-			int k;
-			/* for each packet colour (green, yellow, red) */
-			for (k = 0; k < RTE_COLORS; k++) {
-				port_params->red_params[j][k].max_th
-					= (uint16_t)strtol(entry, &next, 10);
-				if (next == NULL)
-					break;
-				entry = next;
-			}
-		}
-
-		/* Parse WRED inverse mark probabilities */
-		snprintf(str, sizeof(str), "tc %d wred inv prob", j);
-		entry = rte_cfgfile_get_entry(cfg, "red", str);
-		if (entry) {
-			char *next;
-			int k;
-			/* for each packet colour (green, yellow, red) */
-			for (k = 0; k < RTE_COLORS; k++) {
-				port_params->red_params[j][k].maxp_inv
-					= (uint8_t)strtol(entry, &next, 10);
-
-				if (next == NULL)
-					break;
-				entry = next;
-			}
-		}
-
-		/* Parse WRED EWMA filter weights */
-		snprintf(str, sizeof(str), "tc %d wred weight", j);
-		entry = rte_cfgfile_get_entry(cfg, "red", str);
-		if (entry) {
-			char *next;
-			int k;
-			/* for each packet colour (green, yellow, red) */
-			for (k = 0; k < RTE_COLORS; k++) {
-				port_params->red_params[j][k].wq_log2
-					= (uint8_t)strtol(entry, &next, 10);
-				if (next == NULL)
-					break;
-				entry = next;
-			}
-		}
-	}
-#endif /* RTE_SCHED_RED */
-
 	return 0;
 }
 
@@ -155,7 +51,7 @@ cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe_params
 		return -1;
 
 	profiles = rte_cfgfile_num_sections(cfg, "pipe profile", sizeof("pipe profile") - 1);
-	port_params.n_pipe_profiles = profiles;
+	subport_params[0].n_pipe_profiles = profiles;
 
 	for (j = 0; j < profiles; j++) {
 		char pipe_name[32];
@@ -253,12 +149,121 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo
 		return -1;
 
 	memset(app_pipe_to_profile, -1, sizeof(app_pipe_to_profile));
+	memset(active_queues, 0, sizeof(active_queues));
+	n_active_queues = 0;
+
+#ifdef RTE_SCHED_RED
+	char sec_name[CFG_NAME_LEN];
+	struct rte_red_params red_params[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS];
+
+	snprintf(sec_name, sizeof(sec_name), "red");
+
+	if (rte_cfgfile_has_section(cfg, sec_name)) {
+
+		for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) {
+			char str[32];
+
+			/* Parse WRED min thresholds */
+			snprintf(str, sizeof(str), "tc %d wred min", i);
+			entry = rte_cfgfile_get_entry(cfg, sec_name, str);
+			if (entry) {
+				char *next;
+				/* for each packet colour (green, yellow, red) */
+				for (j = 0; j < RTE_COLORS; j++) {
+					red_params[i][j].min_th
+						= (uint16_t)strtol(entry, &next, 10);
+					if (next == NULL)
+						break;
+					entry = next;
+				}
+			}
+
+			/* Parse WRED max thresholds */
+			snprintf(str, sizeof(str), "tc %d wred max", i);
+			entry = rte_cfgfile_get_entry(cfg, "red", str);
+			if (entry) {
+				char *next;
+				/* for each packet colour (green, yellow, red) */
+				for (j = 0; j < RTE_COLORS; j++) {
+					red_params[i][j].max_th
+						= (uint16_t)strtol(entry, &next, 10);
+					if (next == NULL)
+						break;
+					entry = next;
+				}
+			}
+
+			/* Parse WRED inverse mark probabilities */
+			snprintf(str, sizeof(str), "tc %d wred inv prob", i);
+			entry = rte_cfgfile_get_entry(cfg, "red", str);
+			if (entry) {
+				char *next;
+				/* for each packet colour (green, yellow, red) */
+				for (j = 0; j < RTE_COLORS; j++) {
+					red_params[i][j].maxp_inv
+						= (uint8_t)strtol(entry, &next, 10);
+
+					if (next == NULL)
+						break;
+					entry = next;
+				}
+			}
+
+			/* Parse WRED EWMA filter weights */
+			snprintf(str, sizeof(str), "tc %d wred weight", i);
+			entry = rte_cfgfile_get_entry(cfg, "red", str);
+			if (entry) {
+				char *next;
+				/* for each packet colour (green, yellow, red) */
+				for (j = 0; j < RTE_COLORS; j++) {
+					red_params[i][j].wq_log2
+						= (uint8_t)strtol(entry, &next, 10);
+					if (next == NULL)
+						break;
+					entry = next;
+				}
+			}
+		}
+	}
+#endif /* RTE_SCHED_RED */
 
 	for (i = 0; i < MAX_SCHED_SUBPORTS; i++) {
 		char sec_name[CFG_NAME_LEN];
 		snprintf(sec_name, sizeof(sec_name), "subport %d", i);
 
 		if (rte_cfgfile_has_section(cfg, sec_name)) {
+			entry = rte_cfgfile_get_entry(cfg, sec_name,
+				"number of pipes per subport");
+			if (entry)
+				subport_params[i].n_pipes_per_subport_enabled =
+					(uint32_t)atoi(entry);
+
+			entry = rte_cfgfile_get_entry(cfg, sec_name, "queue sizes");
+			if (entry) {
+				char *next;
+
+				for (j = 0; j < RTE_SCHED_TRAFFIC_CLASS_BE; j++) {
+					subport_params[i].qsize[j] =
+						(uint16_t)strtol(entry, &next, 10);
+					if (subport_params[i].qsize[j] != 0) {
+						active_queues[n_active_queues] = j;
+						n_active_queues++;
+					}
+					if (next == NULL)
+						break;
+					entry = next;
+				}
+
+				subport_params[i].qsize[RTE_SCHED_TRAFFIC_CLASS_BE] =
+					(uint16_t)strtol(entry, &next, 10);
+
+				for (j = 0; j < RTE_SCHED_BE_QUEUES_PER_PIPE; j++) {
+					active_queues[n_active_queues] =
+						RTE_SCHED_TRAFFIC_CLASS_BE + j;
+					n_active_queues++;
+				}
+			}
+
 			entry = rte_cfgfile_get_entry(cfg, sec_name, "tb rate");
 			if (entry)
 				subport_params[i].tb_rate = (uint32_t)atoi(entry);
@@ -362,6 +367,20 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo
 					}
 				}
 			}
+#ifdef RTE_SCHED_RED
+			for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) {
+				for (k = 0; k < RTE_COLORS; k++) {
+					subport_params[i].red_params[j][k].min_th =
+						red_params[j][k].min_th;
+					subport_params[i].red_params[j][k].max_th =
+						red_params[j][k].max_th;
+					subport_params[i].red_params[j][k].maxp_inv =
+						red_params[j][k].maxp_inv;
+					subport_params[i].red_params[j][k].wq_log2 =
+						red_params[j][k].wq_log2;
+				}
+			}
+#endif
 		}
 	}
 
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 32e6e1ba2..0a17e0d4d 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -180,18 +180,6 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
 	return 0;
 }
 
-static struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = {
-	{
-		.tb_rate = 1250000000,
-		.tb_size = 1000000,
-
-		.tc_rate = {1250000000, 1250000000, 1250000000, 1250000000,
-			1250000000, 1250000000, 1250000000, 1250000000, 1250000000,
-			1250000000, 1250000000, 1250000000, 1250000000},
-		.tc_period = 10,
-	},
-};
-
 static struct rte_sched_pipe_params pipe_profiles[MAX_SCHED_PIPE_PROFILES] = {
 	{ /* Profile #0 */
 		.tb_rate = 305175,
@@ -208,19 +196,21 @@ static struct rte_sched_pipe_params pipe_profiles[MAX_SCHED_PIPE_PROFILES] = {
 	},
 };
 
-struct rte_sched_port_params port_params = {
-	.name = "port_scheduler_0",
-	.socket = 0, /* computed */
-	.rate = 0, /* computed */
-	.mtu = 6 + 6 + 4 + 4 + 2 + 1500,
-	.frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT,
-	.n_subports_per_port = 1,
-	.n_pipes_per_subport = 4096,
-	.qsize = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
-	.pipe_profiles = pipe_profiles,
-	.n_pipe_profiles = sizeof(pipe_profiles) / sizeof(struct rte_sched_pipe_params),
-	.n_max_pipe_profiles = MAX_SCHED_PIPE_PROFILES,
+struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS] = {
+	{
+		.tb_rate = 1250000000,
+		.tb_size = 1000000,
 
+		.tc_rate = {1250000000, 1250000000, 1250000000, 1250000000,
+			1250000000, 1250000000, 1250000000, 1250000000, 1250000000,
+			1250000000, 1250000000, 1250000000, 1250000000},
+		.tc_period = 10,
+		.n_pipes_per_subport_enabled = 4096,
+		.qsize = {64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
+		.pipe_profiles = pipe_profiles,
+		.n_pipe_profiles = sizeof(pipe_profiles) /
+			sizeof(struct rte_sched_pipe_params),
+		.n_max_pipe_profiles = MAX_SCHED_PIPE_PROFILES,
 #ifdef RTE_SCHED_RED
 	.red_params = {
 		/* Traffic Class 0 Colors Green / Yellow / Red */
@@ -289,6 +279,17 @@ struct rte_sched_port_params port_params = {
 		[12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9},
 	},
 #endif /* RTE_SCHED_RED */
+	},
+};
+
+struct rte_sched_port_params port_params = {
+	.name = "port_scheduler_0",
+	.socket = 0, /* computed */
+	.rate = 0, /* computed */
+	.mtu = 6 + 6 + 4 + 4 + 2 + 1500,
+	.frame_overhead = RTE_SCHED_FRAME_OVERHEAD_DEFAULT,
+	.n_subports_per_port = 1,
+	.n_pipes_per_subport = MAX_SCHED_PIPES,
 };
 
 static struct rte_sched_port *
@@ -323,7 +324,10 @@ app_init_sched_port(uint32_t portid, uint32_t socketid)
 					subport, err);
 		}
 
-		for (pipe = 0; pipe < port_params.n_pipes_per_subport; pipe++) {
+		uint32_t n_pipes_per_subport =
+			subport_params[subport].n_pipes_per_subport_enabled;
+
+		for (pipe = 0; pipe < n_pipes_per_subport; pipe++) {
 			if (app_pipe_to_profile[subport][pipe] != -1) {
 				err = rte_sched_pipe_config(port, subport, pipe,
 						app_pipe_to_profile[subport][pipe]);
diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h
index d8f890b64..baa2b3ead 100644
--- a/examples/qos_sched/main.h
+++ b/examples/qos_sched/main.h
@@ -152,6 +152,7 @@ uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE];
 uint32_t n_active_queues;
 
 extern struct rte_sched_port_params port_params;
+extern struct rte_sched_subport_params subport_params[MAX_SCHED_SUBPORTS];
 
 int app_parse_args(int argc, char **argv);
 int app_init(void);
diff --git a/examples/qos_sched/profile.cfg b/examples/qos_sched/profile.cfg
index 335561370..61b8b7071 100644
--- a/examples/qos_sched/profile.cfg
+++ b/examples/qos_sched/profile.cfg
@@ -20,11 +20,12 @@
 [port]
 frame overhead = 24
 number of subports per port = 1
-number of pipes per subport = 4096
-queue sizes = 64 64 64 64 64 64 64 64 64 64 64 64 64
 
 ; Subport configuration
 [subport 0]
+number of pipes per subport = 4096
+queue sizes = 64 64 64 64 64 64 64 64 64 64 64 64 64
+
 tb rate = 1250000000           ; Bytes per second
 tb size = 1000000              ; Bytes
 
diff --git a/examples/qos_sched/profile_ov.cfg b/examples/qos_sched/profile_ov.cfg
index 394987399..ab509d28d 100644
--- a/examples/qos_sched/profile_ov.cfg
+++ b/examples/qos_sched/profile_ov.cfg
@@ -5,11 +5,12 @@
 [port]
 frame overhead = 24
 number of subports per port = 1
-number of pipes per subport = 32
-queue sizes = 64 64 64 64 64 64 64 64 64 64 64 64 64
 
 ; Subport configuration
 [subport 0]
+number of pipes per subport = 32
+queue sizes = 64 64 64 64 64 64 64 64 64 64 64 64 64
+
 tb rate = 8400000           ; Bytes per second
 tb size = 100000            ; Bytes
 
diff --git a/examples/qos_sched/stats.c b/examples/qos_sched/stats.c
index e62e4a2f6..ce34b6c7c 100644
--- a/examples/qos_sched/stats.c
+++ b/examples/qos_sched/stats.c
@@ -24,7 +24,7 @@ qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc,
 
 	if (i == nb_pfc ||
 		subport_id >= port_params.n_subports_per_port ||
-		pipe_id >= port_params.n_pipes_per_subport  ||
+		pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled  ||
 		tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE ||
 		q >= RTE_SCHED_BE_QUEUES_PER_PIPE ||
 		(tc < RTE_SCHED_TRAFFIC_CLASS_BE && q > 0))
@@ -32,7 +32,7 @@ qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id, uint8_t tc,
 
 	port = qos_conf[i].sched_port;
 	for (i = 0; i < subport_id; i++)
-		queue_id += port_params.n_pipes_per_subport *
+		queue_id += subport_params[i].n_pipes_per_subport_enabled *
 				RTE_SCHED_QUEUES_PER_PIPE;
 	if (tc < RTE_SCHED_TRAFFIC_CLASS_BE)
 		queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE + tc;
@@ -69,14 +69,16 @@ qavg_tcpipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
 	}
 
 	if (i == nb_pfc || subport_id >= port_params.n_subports_per_port ||
-		pipe_id >= port_params.n_pipes_per_subport ||
+		pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled ||
 		tc >= RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE)
 		return -1;
 
 	port = qos_conf[i].sched_port;
 
 	for (i = 0; i < subport_id; i++)
-		queue_id += port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_PIPE;
+		queue_id +=
+			subport_params[i].n_pipes_per_subport_enabled *
+			RTE_SCHED_QUEUES_PER_PIPE;
 
 	queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE + tc;
 
@@ -123,13 +125,13 @@ qavg_pipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id)
 
 	if (i == nb_pfc ||
 		subport_id >= port_params.n_subports_per_port ||
-		pipe_id >= port_params.n_pipes_per_subport)
+		pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled)
 		return -1;
 
 	port = qos_conf[i].sched_port;
 
 	for (i = 0; i < subport_id; i++)
-		queue_id += port_params.n_pipes_per_subport *
+		queue_id += subport_params[i].n_pipes_per_subport_enabled *
 				RTE_SCHED_QUEUES_PER_PIPE;
 
 	queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE;
@@ -177,13 +179,17 @@ qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc)
 
 	for (i = 0; i < subport_id; i++)
 		subport_queue_id +=
-			port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_PIPE;
+			subport_params[i].n_pipes_per_subport_enabled *
+			RTE_SCHED_QUEUES_PER_PIPE;
 
 	average = 0;
 
 	for (count = 0; count < qavg_ntimes; count++) {
+		uint32_t n_pipes_per_subport =
+			subport_params[subport_id].n_pipes_per_subport_enabled;
+
 		part_average = 0;
-		for (i = 0; i < port_params.n_pipes_per_subport; i++) {
+		for (i = 0; i < n_pipes_per_subport; i++) {
 			if (tc < RTE_SCHED_TRAFFIC_CLASS_BE) {
 				queue_id = subport_queue_id +
 					i * RTE_SCHED_QUEUES_PER_PIPE + tc;
@@ -203,10 +209,11 @@ qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc)
 		}
 
 		if (tc < RTE_SCHED_TRAFFIC_CLASS_BE)
-			average += part_average / (port_params.n_pipes_per_subport);
+			average += part_average /
+				(subport_params[subport_id].n_pipes_per_subport_enabled);
 		else
-			average +=
-				part_average / (port_params.n_pipes_per_subport) *
+			average += part_average /
+				(subport_params[subport_id].n_pipes_per_subport_enabled) *
 				RTE_SCHED_BE_QUEUES_PER_PIPE;
 
 		usleep(qavg_period);
@@ -240,14 +247,17 @@ qavg_subport(uint16_t port_id, uint32_t subport_id)
 	port = qos_conf[i].sched_port;
 
 	for (i = 0; i < subport_id; i++)
-		subport_queue_id += port_params.n_pipes_per_subport *
+		subport_queue_id += subport_params[i].n_pipes_per_subport_enabled *
 			RTE_SCHED_QUEUES_PER_PIPE;
 
 	average = 0;
 
 	for (count = 0; count < qavg_ntimes; count++) {
+		uint32_t n_pipes_per_subport =
+			subport_params[subport_id].n_pipes_per_subport_enabled;
+
 		part_average = 0;
-		for (i = 0; i < port_params.n_pipes_per_subport; i++) {
+		for (i = 0; i < n_pipes_per_subport; i++) {
 			queue_id = subport_queue_id + i * RTE_SCHED_QUEUES_PER_PIPE;
 
 			for (j = 0; j < RTE_SCHED_QUEUES_PER_PIPE; j++) {
@@ -258,7 +268,8 @@ qavg_subport(uint16_t port_id, uint32_t subport_id)
 		}
 
 		average += part_average /
-			(port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_PIPE);
+			(subport_params[subport_id].n_pipes_per_subport_enabled *
+			RTE_SCHED_QUEUES_PER_PIPE);
 		usleep(qavg_period);
 	}
 
@@ -322,12 +333,13 @@ pipe_stat(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id)
 
 	if (i == nb_pfc ||
 		subport_id >= port_params.n_subports_per_port ||
-		pipe_id >= port_params.n_pipes_per_subport)
+		pipe_id >= subport_params[subport_id].n_pipes_per_subport_enabled)
 		return -1;
 
 	port = qos_conf[i].sched_port;
 	for (i = 0; i < subport_id; i++)
-		queue_id += port_params.n_pipes_per_subport * RTE_SCHED_QUEUES_PER_PIPE;
+		queue_id += subport_params[i].n_pipes_per_subport_enabled *
+			RTE_SCHED_QUEUES_PER_PIPE;
 
 	queue_id += pipe_id * RTE_SCHED_QUEUES_PER_PIPE;
 
-- 
2.21.0


  parent reply	other threads:[~2019-10-14 16:26 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 14:45 [dpdk-dev] [PATCH 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 02/15] sched: modify internal structs for subport config Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 04/15] shced: add pipe config to subport level Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 06/15] sched: modify pkt enqueue for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 09/15] sched: update pkt dequeue for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 10/15] sched: update queue stats read for " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 12/15] net/softnic: add subport config flexibility to TM function Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 13/15] ip_pipeline: " Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 15/15] sched: remove redundant code Jasvinder Singh
2019-09-09 10:05 ` [dpdk-dev] [PATCH v2 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 04/15] shced: add pipe config to subport level Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 13/15] ip_pipeline: " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 15/15] sched: remove redundant code Jasvinder Singh
2019-09-23 13:06   ` [dpdk-dev] [PATCH v2 00/15] sched: subport level configuration of pipe nodes Dumitrescu, Cristian
2019-09-24 20:01     ` Singh, Jasvinder
2019-09-26  8:52   ` [dpdk-dev] [PATCH v3 " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 13/15] ip_pipeline: " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 15/15] sched: remove redundant code Jasvinder Singh
2019-10-14 12:09     ` [dpdk-dev] [PATCH v4 00/17] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 01/17] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 02/17] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 03/17] sched: remove pipe params config from port level Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 04/17] sched: add pipe config to subport level Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 05/17] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 06/17] sched: modify pkt enqueue " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 07/17] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 08/17] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 09/17] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 10/17] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 11/17] test/sched: modify tests for subport " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 12/17] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 13/17] ip_pipeline: " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 14/17] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 15/17] sched: remove redundant code Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 16/17] sched: add support for 64 bit values Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 17/17] sched: modify internal structs and functions " Jasvinder Singh
2019-10-14 14:23       ` [dpdk-dev] [PATCH v4 00/17] sched: subport level configuration of pipe nodes Dumitrescu, Cristian
2019-10-14 16:26         ` Singh, Jasvinder
2019-10-14 17:23       ` [dpdk-dev] [PATCH v5 00/15] " Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-24 16:44           ` Thomas Monjalon
2019-10-24 17:47             ` Singh, Jasvinder
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 13/15] ip_pipeline: " Jasvinder Singh
2019-10-14 17:23         ` Jasvinder Singh [this message]
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 15/15] sched: remove redundant code Jasvinder Singh
2019-10-24 18:46         ` [dpdk-dev] [PATCH v6 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 13/15] ip_pipeline: " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 15/15] sched: remove redundant code Jasvinder Singh
2019-10-25 10:51           ` [dpdk-dev] [PATCH v7 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 13/15] ip_pipeline: " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 15/15] sched: remove redundant code Jasvinder Singh
2019-10-25 15:54             ` [dpdk-dev] [PATCH v7 00/15] sched: subport level configuration of pipe nodes Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191014172347.139114-15-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=lukaszx.krakowiak@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.