[dpdk-dev] [PATCH 02/27] sched: update subport and pipe data structures

Lukasz Krakowiak lukaszx.krakowiak at intel.com
Tue May 28 14:05:28 CEST 2019


From: Jasvinder Singh <jasvinder.singh at intel.com>

Update public data structures for subport and pipe to allow configuration
flexiblity for pipe traffic classes and queues, and subport level
configuration of the pipe parameters.

Signed-off-by: Jasvinder Singh <jasvinder.singh at intel.com>
Signed-off-by: Abraham Tovar <abrahamx.tovar at intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak at intel.com>
---
 app/test/test_sched.c        |  2 +-
 examples/qos_sched/init.c    |  2 +-
 lib/librte_sched/rte_sched.h | 76 ++++++++++++++++++++++--------------
 3 files changed, 49 insertions(+), 31 deletions(-)

diff --git a/app/test/test_sched.c b/app/test/test_sched.c
index 4eed8dbde..460eb53ec 100644
--- a/app/test/test_sched.c
+++ b/app/test/test_sched.c
@@ -40,7 +40,7 @@ static struct rte_sched_pipe_params pipe_profile[] = {
 		.tc_rate = {305175, 305175, 305175, 305175},
 		.tc_period = 40,
 
-		.wrr_weights = {1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1},
+		.wrr_weights = {1, 1, 1, 1,  1, 1, 1, 1},
 	},
 };
 
diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index 37c2b95fd..f44a07cd6 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -186,7 +186,7 @@ static struct rte_sched_pipe_params pipe_profiles[RTE_SCHED_PIPE_PROFILES_PER_PO
 		.tc_ov_weight = 1,
 #endif
 
-		.wrr_weights = {1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1,  1, 1, 1, 1},
+		.wrr_weights = {1, 1, 1, 1,  1, 1, 1, 1},
 	},
 };
 
diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index cf7695f27..71728f725 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -117,6 +117,33 @@ extern "C" {
 #define RTE_SCHED_FRAME_OVERHEAD_DEFAULT      24
 #endif
 
+/*
+ * Pipe configuration parameters. The period and credits_per_period
+ * parameters are measured in bytes, with one byte meaning the time
+ * duration associated with the transmission of one byte on the
+ * physical medium of the output port, with pipe or pipe traffic class
+ * rate (measured as percentage of output port rate) determined as
+ * credits_per_period divided by period. One credit represents one
+ * byte.
+ */
+struct rte_sched_pipe_params {
+	/* Pipe token bucket */
+	uint32_t tb_rate; /**< Rate (measured in bytes per second) */
+	uint32_t tb_size; /**< Size (measured in credits) */
+
+	/* Pipe traffic classes */
+	uint32_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+	/**< Traffic class rates (measured in bytes per second) */
+	uint32_t tc_period;
+	/**< Enforcement period (measured in milliseconds) */
+#ifdef RTE_SCHED_SUBPORT_TC_OV
+	uint8_t tc_ov_weight; /**< Weight Traffic class 3 oversubscription */
+#endif
+
+	/* Pipe queues */
+	uint8_t  wrr_weights[RTE_SCHED_WRR_QUEUES_PER_PIPE]; /**< WRR weights */
+};
+
 /*
  * Subport configuration parameters. The period and credits_per_period
  * parameters are measured in bytes, with one byte meaning the time
@@ -128,14 +155,32 @@ extern "C" {
  */
 struct rte_sched_subport_params {
 	/* Subport token bucket */
-	uint32_t tb_rate;                /**< Rate (measured in bytes per second) */
-	uint32_t tb_size;                /**< Size (measured in credits) */
+	uint32_t tb_rate; /**< Rate (measured in bytes per second) */
+	uint32_t tb_size; /**< Size (measured in credits) */
 
 	/* Subport traffic classes */
 	uint32_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
 	/**< Traffic class rates (measured in bytes per second) */
 	uint32_t tc_period;
 	/**< Enforcement period for rates (measured in milliseconds) */
+
+	uint32_t n_subport_pipes;    /**< Number of subport_pipes */
+	uint16_t qsize[RTE_SCHED_QUEUES_PER_PIPE];
+	/**< Packet queue size for each traffic class.
+	 * All queues which are not needed,  have zero size. All the pipes
+	 * within the same subport share the similar configuration for the
+	 * queues.
+	 */
+	struct rte_sched_pipe_params *pipe_profiles;
+	/**< Pipe profile table.
+	 * Every pipe is configured using one of the profiles from this table.
+	 */
+	uint32_t n_pipe_profiles; /**< Profiles in the pipe profile table */
+#ifdef RTE_SCHED_RED
+	struct rte_red_params
+		red_params[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS];
+		/**< RED parameters */
+#endif
 };
 
 /** Subport statistics */
@@ -158,33 +203,6 @@ struct rte_sched_subport_stats {
 #endif
 };
 
-/*
- * Pipe configuration parameters. The period and credits_per_period
- * parameters are measured in bytes, with one byte meaning the time
- * duration associated with the transmission of one byte on the
- * physical medium of the output port, with pipe or pipe traffic class
- * rate (measured as percentage of output port rate) determined as
- * credits_per_period divided by period. One credit represents one
- * byte.
- */
-struct rte_sched_pipe_params {
-	/* Pipe token bucket */
-	uint32_t tb_rate;                /**< Rate (measured in bytes per second) */
-	uint32_t tb_size;                /**< Size (measured in credits) */
-
-	/* Pipe traffic classes */
-	uint32_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
-	/**< Traffic class rates (measured in bytes per second) */
-	uint32_t tc_period;
-	/**< Enforcement period (measured in milliseconds) */
-#ifdef RTE_SCHED_SUBPORT_TC_OV
-	uint8_t tc_ov_weight;		 /**< Weight Traffic class 3 oversubscription */
-#endif
-
-	/* Pipe queues */
-	uint8_t  wrr_weights[RTE_SCHED_QUEUES_PER_PIPE]; /**< WRR weights */
-};
-
 /** Queue statistics */
 struct rte_sched_queue_stats {
 	/* Packets */
-- 
2.20.1



More information about the dev mailing list