[v3,1/9] sched: add support profile data structure
diff mbox series

Message ID 1600274633-371993-2-git-send-email-savinay.dharmappa@intel.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • Enable dynamic config of subport bandwidth
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Savinay Dharmappa Sept. 16, 2020, 4:43 p.m. UTC
Add subport profile data structure to support dynamic configuration
of subport bandwidth

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 lib/librte_sched/rte_sched.c | 10 ++++++++++
 lib/librte_sched/rte_sched.h | 25 +++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

Patch
diff mbox series

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 0fa0741..dc5beb2 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -101,6 +101,16 @@  enum grinder_state {
 	e_GRINDER_READ_MBUF
 };
 
+struct rte_sched_subport_profile {
+	/* Token bucket (TB) */
+	uint64_t tb_period;
+	uint64_t tb_credits_per_period;
+	uint64_t tb_size;
+
+	uint64_t tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+	uint64_t tc_period;
+};
+
 struct rte_sched_grinder {
 	/* Pipe cache */
 	uint16_t pcache_qmask[RTE_SCHED_GRINDER_PCACHE_SIZE];
diff --git a/lib/librte_sched/rte_sched.h b/lib/librte_sched/rte_sched.h
index 8a5a93c..39339b7 100644
--- a/lib/librte_sched/rte_sched.h
+++ b/lib/librte_sched/rte_sched.h
@@ -192,6 +192,20 @@  struct rte_sched_subport_params {
 #endif
 };
 
+struct rte_sched_subport_profile_params {
+	/** Token bucket rate (measured in bytes per second) */
+	uint64_t tb_rate;
+
+	/** Token bucket size (measured in credits) */
+	uint64_t tb_size;
+
+	/** Traffic class rates (measured in bytes per second) */
+	uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
+
+	/** Enforcement period for rates (measured in milliseconds) */
+	uint64_t tc_period;
+};
+
 /** Subport statistics */
 struct rte_sched_subport_stats {
 	/** Number of packets successfully written */
@@ -254,6 +268,17 @@  struct rte_sched_port_params {
 	/** Number of subports */
 	uint32_t n_subports_per_port;
 
+	/** subport profile table.
+	 * Every pipe is configured using one of the profiles from this table.
+	 */
+	struct rte_sched_subport_profile_params *subport_profiles;
+
+	/** Profiles in the pipe profile table */
+	uint32_t n_subport_profiles;
+
+	/** Max allowed profiles in the pipe profile table */
+	uint32_t n_max_subport_profiles;
+
 	/** Maximum number of subport pipes.
 	 * This parameter is used to reserve a fixed number of bits
 	 * in struct rte_mbuf::sched.queue_id for the pipe_id for all