[2/2] sched: fix to manage TC OV at runtime

Message ID 20220407145153.238969-2-marcinx.danilewicz@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/2] sched: enable/disable TC OV at runtime |

Checks

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

Commit Message

Danilewicz, MarcinX April 7, 2022, 2:51 p.m. UTC
  Added changes after review and increased throughput.

Signed-off-by: Marcin Danilewicz <marcinx.danilewicz@intel.com>
  

Comments

Thomas Monjalon April 14, 2022, 9:53 a.m. UTC | #1
07/04/2022 16:51, Marcin Danilewicz:
> Added changes after review and increased throughput.
> 
> Signed-off-by: Marcin Danilewicz <marcinx.danilewicz@intel.com>

I think these changes should be squashed with the first patch.

You need to version your patches also:
this one should have been v2, next one should be v3.
And while at it, the best is to provide a changelog
to make clear what was improved compared to last version.

Please do not forget to Cc maintainers of sched.
Probably they can help you to get the right formatting.
  

Patch

diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index 1d05089d00..6e7d81df46 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -155,7 +155,6 @@  struct rte_sched_subport {
 	uint64_t tc_credits[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
 
 	/* TC oversubscription */
-	uint8_t is_tc_ov_enabled;
 	uint64_t tc_ov_wm;
 	uint64_t tc_ov_wm_min;
 	uint64_t tc_ov_wm_max;
@@ -214,6 +213,9 @@  struct rte_sched_subport {
 	uint8_t *bmp_array;
 	struct rte_mbuf **queue_array;
 	uint8_t memory[0] __rte_cache_aligned;
+
+	/* TC oversubscription activation */
+	int is_tc_ov_enabled;
 } __rte_cache_aligned;
 
 struct rte_sched_port {
@@ -1187,7 +1189,7 @@  rte_sched_subport_tc_ov_config(struct rte_sched_port *port,
 	}
 
 	s = port->subports[subport_id];
-	s->is_tc_ov_enabled = tc_ov_enable;
+	s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0;
 
 	if (s->is_tc_ov_enabled) {
 		/* TC oversubscription */
@@ -1294,6 +1296,9 @@  rte_sched_subport_config(struct rte_sched_port *port,
 		s->n_pipe_profiles = params->n_pipe_profiles;
 		s->n_max_pipe_profiles = params->n_max_pipe_profiles;
 
+		/* TC over-subscription is disabled by default */
+		s->is_tc_ov_enabled = 0;
+
 #ifdef RTE_SCHED_CMAN
 		if (params->cman_params != NULL) {
 			s->cman_enabled = true;
@@ -1356,9 +1361,6 @@  rte_sched_subport_config(struct rte_sched_port *port,
 
 		for (i = 0; i < RTE_SCHED_PORT_N_GRINDERS; i++)
 			s->grinder_base_bmp_pos[i] = RTE_SCHED_PIPE_INVALID;
-
-		/* TC over-subscription is disabled by default */
-		s->is_tc_ov_enabled = 0;
 	}
 
 	{
@@ -2514,12 +2516,15 @@  grinder_schedule(struct rte_sched_port *port,
 	uint32_t pkt_len = pkt->pkt_len + port->frame_overhead;
 	uint32_t be_tc_active;
 
-	if (unlikely(subport->is_tc_ov_enabled)) {
+	switch (subport->is_tc_ov_enabled) {
+	case 1:
 		if (!grinder_credits_check_with_tc_ov(port, subport, pos))
 			return 0;
-	} else {
+		break;
+	case 0:
 		if (!grinder_credits_check(port, subport, pos))
 			return 0;
+		break;
 	}
 
 	/* Advance port time */