[dpdk-dev] [PATCH v2 27/28] sched: code cleanup

Jasvinder Singh jasvinder.singh at intel.com
Tue Jun 25 17:32:16 CEST 2019


Remove redundant macros and fields from the data structures.

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>
---
 lib/librte_sched/rte_sched.c | 43 ------------------------------------
 lib/librte_sched/rte_sched.h | 25 +++------------------
 2 files changed, 3 insertions(+), 65 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index cc1dcf7ab..b214e4283 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -193,7 +193,6 @@ struct rte_sched_pipe {
 	/* TC oversubscription */
 	uint32_t tc_ov_credits;
 	uint8_t tc_ov_period_id;
-	uint8_t reserved[3];
 } __rte_cache_aligned;
 
 struct rte_sched_queue {
@@ -211,18 +210,10 @@ struct rte_sched_queue_extra {
 struct rte_sched_port {
 	/* User parameters */
 	uint32_t n_subports_per_port;
-	uint32_t n_pipes_per_subport;
-	uint32_t n_pipes_per_subport_log2;
 	int socket;
 	uint32_t rate;
 	uint32_t mtu;
 	uint32_t frame_overhead;
-	uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
-	uint32_t n_pipe_profiles;
-	uint32_t pipe_tc3_rate_max;
-#ifdef RTE_SCHED_RED
-	struct rte_red_config red_config[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS];
-#endif
 
 	/* Timing */
 	uint64_t time_cpu_cycles;     /* Current CPU time measured in CPU cyles */
@@ -230,50 +221,17 @@ struct rte_sched_port {
 	uint64_t time;                /* Current NIC TX time measured in bytes */
 	struct rte_reciprocal inv_cycles_per_byte; /* CPU cycles per byte */
 
-	/* Scheduling loop detection */
-	uint32_t pipe_loop;
-	uint32_t pipe_exhaustion;
-
-	/* Bitmap */
-	struct rte_bitmap *bmp;
-	uint32_t grinder_base_bmp_pos[RTE_SCHED_PORT_N_GRINDERS] __rte_aligned_16;
-
 	/* Grinders */
-	struct rte_sched_grinder grinder[RTE_SCHED_PORT_N_GRINDERS];
-	uint32_t busy_grinders;
 	struct rte_mbuf **pkts_out;
 	uint32_t n_pkts_out;
 	uint32_t subport_id;
 
 	uint32_t max_subport_pipes_log2;   /* Max number of subport pipes */
 
-	/* Queue base calculation */
-	uint32_t qsize_add[RTE_SCHED_QUEUES_PER_PIPE];
-	uint32_t qsize_sum;
-
 	/* Large data structures */
-	struct rte_sched_subport *subport;
-	struct rte_sched_pipe *pipe;
-	struct rte_sched_queue *queue;
-	struct rte_sched_queue_extra *queue_extra;
-	struct rte_sched_pipe_profile *pipe_profiles;
-	uint8_t *bmp_array;
-	struct rte_mbuf **queue_array;
 	struct rte_sched_subport *subports[0];
-	uint8_t memory[0] __rte_cache_aligned;
 } __rte_cache_aligned;
 
-enum rte_sched_port_array {
-	e_RTE_SCHED_PORT_ARRAY_SUBPORT = 0,
-	e_RTE_SCHED_PORT_ARRAY_PIPE,
-	e_RTE_SCHED_PORT_ARRAY_QUEUE,
-	e_RTE_SCHED_PORT_ARRAY_QUEUE_EXTRA,
-	e_RTE_SCHED_PORT_ARRAY_PIPE_PROFILES,
-	e_RTE_SCHED_PORT_ARRAY_BMP_ARRAY,
-	e_RTE_SCHED_PORT_ARRAY_QUEUE_ARRAY,
-	e_RTE_SCHED_PORT_ARRAY_TOTAL,
-};
-
 enum rte_sched_subport_array {
 	e_RTE_SCHED_SUBPORT_ARRAY_PIPE = 0,
 	e_RTE_SCHED_SUBPORT_ARRAY_QUEUE,
@@ -2458,7 +2416,6 @@ grinder_next_pipe(struct rte_sched_subport *subport, uint32_t pos)
 	return 1;
 }
 
-
 static inline void
 grinder_wrr_load(struct rte_sched_subport *subport, uint32_t pos)
 {
diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index 1f690036d..8fe6ea904 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -82,7 +82,6 @@ extern "C" {
  */
 #define RTE_SCHED_BE_QUEUES_PER_PIPE    8
 
-#define RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS    4
 /** Number of traffic classes per pipe (as well as subport).
  *
  * @see struct rte_sched_subport_params
@@ -91,13 +90,6 @@ extern "C" {
 #define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE    \
 (RTE_SCHED_QUEUES_PER_PIPE - RTE_SCHED_BE_QUEUES_PER_PIPE + 1)
 
-/** Maximum number of pipe profiles that can be defined per subport.
- * Compile-time configurable.
- */
-#ifndef RTE_SCHED_PIPE_PROFILES_PER_PORT
-#define RTE_SCHED_PIPE_PROFILES_PER_PORT      256
-#endif
-
 /*
  * Ethernet framing overhead. Overhead fields per Ethernet frame:
  * 1. Preamble:                             7 bytes;
@@ -126,6 +118,7 @@ extern "C" {
 struct rte_sched_pipe_params {
 	/** Token bucket rate (measured in bytes per second) */
 	uint32_t tb_rate;
+
 	/** Token bucket size (measured in credits) */
 	uint32_t tb_size;
 
@@ -134,6 +127,7 @@ struct rte_sched_pipe_params {
 
 	/** Enforcement period (measured in milliseconds) */
 	uint32_t tc_period;
+
 #ifdef RTE_SCHED_SUBPORT_TC_OV
 	/** Best-effort traffic class oversubscription weight */
 	uint8_t tc_ov_weight;
@@ -185,11 +179,11 @@ struct rte_sched_subport_params {
 
 	/** Max profiles allowed in the pipe profile table */
 	uint32_t n_max_pipe_profiles;
+
 #ifdef RTE_SCHED_RED
 	/** RED parameters */
 	struct rte_red_params
 		red_params[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE][RTE_COLORS];
-
 #endif
 };
 
@@ -254,19 +248,6 @@ struct rte_sched_port_params {
 
 	/** Number of subports */
 	uint32_t n_subports_per_port;
-	uint32_t n_pipes_per_subport;    /**< Number of pipes per subport */
-	uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
-	/**< Packet queue size for each traffic class.
-	 * All queues within the same pipe traffic class have the same
-	 * size. Queues from different pipes serving the same traffic
-	 * class have the same size. */
-	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
 };
 
 /*
-- 
2.21.0



More information about the dev mailing list