[PATCH v3] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 11 +- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 359 insertions(+), 141 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 8eb29c1525..1740a1d053 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -#undef RTE_SCHED_CMAN - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..3284b4d252 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,11 +229,14 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; + + if (subport_p->cman_params != NULL) + return; + subport_p->cman_params->cman_mode = cman_p.cman_mode; for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { @@ -261,7 +264,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,9 +278,7 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sched_cman_params cman_params = { - .cman_mode = RTE_SCHED_CMAN_RED, .red_params = { }, };
[PATCH v4] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 11 +- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 359 insertions(+), 141 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 8eb29c1525..1740a1d053 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -#undef RTE_SCHED_CMAN - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..3284b4d252 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,11 +229,14 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; + + if (subport_p->cman_params != NULL) + return; + subport_p->cman_params->cman_mode = cman_p.cman_mode; for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { @@ -261,7 +264,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,9 +278,7 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sched_cman_params cman_params = { - .cman_mode = RTE_SCHED_CMAN_RED, .red_params = { }, };
[PATCH v5] ched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 11 +- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 359 insertions(+), 141 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..3284b4d252 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,11 +229,14 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; + + if (subport_p->cman_params != NULL) + return; + subport_p->cman_params->cman_mode = cman_p.cman_mode; for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { @@ -261,7 +264,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,9 +278,7 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sched_cman_params cman_params = { - .cman_mode = RT
[PATCH v6] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 11 +- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 359 insertions(+), 141 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..3284b4d252 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,11 +229,14 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; + + if (subport_p->cman_params != NULL) + return; + subport_p->cman_params->cman_mode = cman_p.cman_mode; for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { @@ -261,7 +264,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,9 +278,7 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sched_cman_params cman_params = { -
[PATCH v7] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed v7 changes from comments --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 11 +- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 135 + examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 295 insertions(+), 210 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3e4bed81e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN -#define WRED_SUPPORTED 1 -#else #define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..3284b4d252 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,11 +229,14 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; + + if (subport_p->cman_params != NULL) + return; + subport_p->cman_params->cman_mode = cman_p.cman_mode; for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { @@ -261,7 +264,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,9 +278,7 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sched_cman_pa
[PATCH v8] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed v7 changes from comments v8 with changes from comments --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 47 +--- examples/qos_sched/cfg_file.h| 5 - examples/qos_sched/init.c| 76 +--- examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 135 + examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 296 insertions(+), 320 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3e4bed81e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN -#define WRED_SUPPORTED 1 -#else #define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..7f4114bd56 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -23,6 +23,8 @@ uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE]; uint32_t n_active_queues; +struct rte_sched_cman_params cman_params; + int cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params) { @@ -229,40 +231,6 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN -void set_subport_cman_params(struct rte_sched_subport_params *subport_p, - struct rte_sched_cman_params cman_p) -{ - int j, k; - subport_p->cman_params->cman_mode = cman_p.cman_mode; - - for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { - if (subport_p->cman_params->cman_mode == - RTE_SCHED_CMAN_RED) { - for (k = 0; k < RTE_COLORS; k++) { - subport_p->cman_params
[PATCH v9] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed v7 changes from comments v8 with changes from comments v9 changes from comments tmgr.c cman_params set to null qos_sched/cfg_file.c removed redundant cman_params to NULL assignement subport_params[].cman_params assigned only when CMAN enabled --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 6 +- examples/qos_sched/cfg_file.c| 49 +--- examples/qos_sched/cfg_file.h| 5 - examples/qos_sched/init.c| 76 +--- examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 135 + examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 298 insertions(+), 322 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3e4bed81e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN -#define WRED_SUPPORTED 1 -#else #define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..18bee1e0fc 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN - .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ + .cman_params = NULL, }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..deaa28d391 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -23,6 +23,8 @@ uint32_t active_queues[RTE_SCHED_QUEUES_PER_PIPE]; uint32_t n_active_queues; +struct rte_sched_cman_params cman_params; + int cfg_load_port(struct rte_cfgfile *cfg, struct rte_sched_port_params *port_params) { @@ -229,40 +231,6 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN -void set_subport_cman_params(struct rte_sched_subport_params *subport_p, - struct rte_sched_cman_params cman_p) -{ - int j, k; - subport_p->cman_params->cman_mode = cman_p.cman_mode; - - for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { -
[PATCH v10] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed v7 changes from comments v8 with changes from comments v9 changes from comments tmgr.c cman_params set to null qos_sched/cfg_file.c removed redundant cman_params to NULL assignement subport_params[].cman_params assigned only when CMAN enabled v10 removed ip_pipelin app build error from change in tmgr.c --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 75 +--- examples/qos_sched/cfg_file.c| 49 +--- examples/qos_sched/cfg_file.h| 5 - examples/qos_sched/init.c| 76 +--- examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 135 + examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 298 insertions(+), 391 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3e4bed81e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN -#define WRED_SUPPORTED 1 -#else #define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..2432b56aee 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,77 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN -static struct rte_sched_cman_params cman_params = { - .red_params = { - /* Traffic Class 0 Colors Green / Yellow / Red */ - [0][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [0][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [0][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 1 - Colors Green / Yellow / Red */ - [1][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [1][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [1][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 2 - Colors Green / Yellow / Red */ - [2][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [2][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [2][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 3 - Colors Green / Yellow / Red */ - [3][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [3][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [3][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 4 - Colors Green / Yellow / Red */ - [4][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [4][1] = {.min_th
[PATCH] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 14 +-- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 53 ++--- lib/sched/rte_sched.h| 1 + 12 files changed, 370 insertions(+), 140 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 8eb29c1525..1740a1d053 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -#undef RTE_SCHED_CMAN - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..efff1dbb01 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,13 +229,15 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; subport_p->cman_params->cman_mode = cman_p.cman_mode; + if (subport_p->cman_params->cman_mode == RTE_SCHED_CMAN_NONE) + return; + for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { if (subport_p->cman_params->cman_mode == RTE_SCHED_CMAN_RED) { @@ -261,7 +263,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,12 +277,14 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_SCHED_CMAN struct rte_sche
[PATCH v2] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Log: v2 change in rte_sched.h to avoid ABI breakage. Signed-off-by: Marcin Danilewicz --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 4 - examples/qos_sched/cfg_file.c| 14 +-- examples/qos_sched/cfg_file.h| 2 - examples/qos_sched/init.c| 4 - examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 130 ++--- examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 53 ++--- lib/sched/rte_sched.h| 2 + 12 files changed, 371 insertions(+), 140 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 8eb29c1525..1740a1d053 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -#undef RTE_SCHED_CMAN - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3a5fd676e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN #define WRED_SUPPORTED 1 -#else -#define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..e68e9961be 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,7 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN static struct rte_sched_cman_params cman_params = { .red_params = { /* Traffic Class 0 Colors Green / Yellow / Red */ @@ -86,7 +85,6 @@ static struct rte_sched_cman_params cman_params = { [12][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, }, }; -#endif /* RTE_SCHED_CMAN */ static uint32_t n_pipe_profiles; @@ -96,9 +94,7 @@ static const struct rte_sched_subport_params subport_params_default = { .pipe_profiles = pipe_profile, .n_pipe_profiles = 0, /* filled at run time */ .n_max_pipe_profiles = RTE_DIM(pipe_profile), -#ifdef RTE_SCHED_CMAN .cman_params = &cman_params, -#endif /* RTE_SCHED_CMAN */ }; static struct tmgr_port_list tmgr_port_list; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index 450482f07d..efff1dbb01 100644 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -229,13 +229,15 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg, return 0; } -#ifdef RTE_SCHED_CMAN void set_subport_cman_params(struct rte_sched_subport_params *subport_p, struct rte_sched_cman_params cman_p) { int j, k; subport_p->cman_params->cman_mode = cman_p.cman_mode; + if (subport_p->cman_params->cman_mode == RTE_SCHED_CMAN_NONE) + return; + for (j = 0; j < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; j++) { if (subport_p->cman_params->cman_mode == RTE_SCHED_CMAN_RED) { @@ -261,7 +263,6 @@ void set_subport_cman_params(struct rte_sched_subport_params *subport_p, } } } -#endif int cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subport_params) @@ -276,12 +277,14 @@ cfg_load_subport(struct rte_cfgfile *cfg, struct rte_sched_subport_params *subpo memset(active_queues, 0, sizeof(active_queues)); n_active_queues = 0; -#ifdef RTE_
[PATCH v3] sched: enable/disable TC OV at runtime
Hi Megha, Marcin, > Yes, I agree this would be the ideal way to drive this change, but the > problem is that modifying the existing subport parameter structure would > represent an API change. This would require a deprecation notice, and the > patch would be blocked until 22.11 release. Are you willing to wait until > 22.11? If not, then adding the configuration function for this flag is the > next best thing. Are we making any plans for that? > > Also the name of the feature should not be abbreviated in the patch title. > > In original code, this feature has always been disabled as it impacts >> performance. > > So, in my opinion we should keep it disabled by default and let user enable > > it > > when required. > > > In the original code, yes, it had to be explicitly enabled through a > build-time flag. This was not the best option, and this is precisely what we > are trying to fix with this patch. > But on the other hand all the users of these library that I know use it with > the TC oversubscription turned on. Functionality is more important for them > than performance. Hence my vote now is to enable it by default; those users > that prefer performance over functionality can easily turn this feature off > with no issues. That was plan for this patch and yet another change to remove API change is awaiting. But when we publish this change. BR, /Marcin -- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
[PATCH v4] sched: enable traffic class oversubscription conditionally
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. History lod: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4 - changes from comments Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 189 +++--- lib/sched/rte_sched.h | 18 lib/sched/version.map | 3 + 3 files changed, 178 insertions(+), 32 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..6e7d81df46 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 { @@ -1165,6 +1168,45 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + struct rte_sched_subport_profile *profile; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0; + + if (s->is_tc_ov_enabled) { + /* TC oversubscription */ + s->tc_ov_wm_min = port->mtu; + s->tc_ov_period_id = 0; + s->tc_ov = 0; + s->tc_ov_n = 0; + s->tc_ov_rate = 0; + + profile = port->subport_profiles + s->profile; + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, + s->pipe_tc_be_rate_max); + s->tc_ov_wm = s->tc_ov_wm_max; + } + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,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; @@ -1316,13 +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 oversubscription */ - s->tc_ov_wm_min = port->mtu; - s->tc_ov_period_id = 0; - s->tc_ov = 0; - s->tc_ov_n = 0; - s->tc_ov_rate = 0; } { @@ -1342,9 +1380,6 @@ rte_sched_subport_config(struct rte_sched_port *port, else profile->tc_credits_per_period[i] = 0; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, - s->pipe_tc_be_rate_max); - s->tc_ov_wm = s->tc_ov_wm_max; s->profile = subport_profile_id; } @@ -1417,17 +1452,20 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - /* Unplug pipe from its subport */ - s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc_be_rate; - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + if (s->is_tc_ov_enabled) { + uint32_t tc_be_ov = s->tc_ov; - if (s->tc_ov != tc_be_ov) { - RTE_LOG(DEBUG, SCHED, - "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + /* Unplug pipe from its subport */ + s->tc_ov_n -= params
[PATCH v4] sched: enable traffic class oversubscription conditionally
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4 - changes from comments Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 189 +++--- lib/sched/rte_sched.h | 18 lib/sched/version.map | 3 + 3 files changed, 178 insertions(+), 32 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..6e7d81df46 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 { @@ -1165,6 +1168,45 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + struct rte_sched_subport_profile *profile; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0; + + if (s->is_tc_ov_enabled) { + /* TC oversubscription */ + s->tc_ov_wm_min = port->mtu; + s->tc_ov_period_id = 0; + s->tc_ov = 0; + s->tc_ov_n = 0; + s->tc_ov_rate = 0; + + profile = port->subport_profiles + s->profile; + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, + s->pipe_tc_be_rate_max); + s->tc_ov_wm = s->tc_ov_wm_max; + } + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,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; @@ -1316,13 +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 oversubscription */ - s->tc_ov_wm_min = port->mtu; - s->tc_ov_period_id = 0; - s->tc_ov = 0; - s->tc_ov_n = 0; - s->tc_ov_rate = 0; } { @@ -1342,9 +1380,6 @@ rte_sched_subport_config(struct rte_sched_port *port, else profile->tc_credits_per_period[i] = 0; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, - s->pipe_tc_be_rate_max); - s->tc_ov_wm = s->tc_ov_wm_max; s->profile = subport_profile_id; } @@ -1417,17 +1452,20 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - /* Unplug pipe from its subport */ - s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc_be_rate; - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + if (s->is_tc_ov_enabled) { + uint32_t tc_be_ov = s->tc_ov; - if (s->tc_ov != tc_be_ov) { - RTE_LOG(DEBUG, SCHED, - "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + /* Unplug pipe from its subport */ + s->tc_ov_n -= params->tc_ov_weight; +
[PATCH v5] sched: enable traffic class oversubscription conditionally
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 96 +-- lib/sched/rte_sched.h | 18 lib/sched/version.map | 3 ++ 3 files changed, 114 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..eb71b27c99 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1254,6 +1257,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 enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2324,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2393,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_index = grinder->tc_index; + uint64_t pkt_len = pkt->pkt_len + port->frame_overhead; + uint64_t subport_tb_credits = subport->tb_credits; + uint64_t subport_tc_credits = subport->tc_credits[tc_index]; + uint64_t pipe_tb_credits = pipe->tb_credits; + uint64_t pipe_tc_credits = pipe->tc_credits[tc_index]; + int enough_credits; + + /* Check pipe and subport credits */ + enough_credits = (pkt_len <= subport_tb_credits) && + (pkt_len <= subport_tc_credits) && + (pkt_len <= pipe_tb_credits) && + (pkt_len <= pipe_tc_credits); + + if (!enough_credits) + return 0; + + /* Update pipe and subport credits */ + subport->tb_credits -= pkt_len; + subport->tc_credits[tc_index] -= pkt_len; + pipe->tb_credits -= pkt_len; + pipe->tc_credits[tc_index] -= pkt_len; + + return 1; +} + +static inline int +grinder_cr
[PATCH v6] sched: enable traffic class oversubscription conditionally
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments - v6 - removed rte_sched_subport_tc_ov_config declaration and map Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 96 +-- 1 file changed, 93 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..eb71b27c99 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1254,6 +1257,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 enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2324,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2393,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_index = grinder->tc_index; + uint64_t pkt_len = pkt->pkt_len + port->frame_overhead; + uint64_t subport_tb_credits = subport->tb_credits; + uint64_t subport_tc_credits = subport->tc_credits[tc_index]; + uint64_t pipe_tb_credits = pipe->tb_credits; + uint64_t pipe_tc_credits = pipe->tc_credits[tc_index]; + int enough_credits; + + /* Check pipe and subport credits */ + enough_credits = (pkt_len <= subport_tb_credits) && + (pkt_len <= subport_tc_credits) && + (pkt_len <= pipe_tb_credits) && + (pkt_len <= pipe_tc_credits); + + if (!enough_credits) + return 0; + + /* Update pipe and subport credits */ + subport->tb_credits -= pkt_len; + subport->tc_credits[tc_index] -= pkt_len; + pipe->tb_credits -= pkt_len; + pipe->tc_credits[tc_index] -= pkt_len; + + return 1; +} + +static inline int +grinder_credits_check_with_tc_
[PATCH v7] sched: enable traffic class oversubscription conditionally
Added new flag to enable or disable TC oversubscription for best effort traffic class at subport level. By default TC OV is disabled. Signed-off-by: Marcin Danilewicz History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments - v6 - removed rte_sched_subport_tc_ov_config declaration and map - v7 - changes from comments on v6 --- lib/sched/rte_sched.c | 93 +-- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..19aab877f0 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1254,6 +1257,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 enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2324,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2393,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_index = grinder->tc_index; + uint64_t pkt_len = pkt->pkt_len + port->frame_overhead; + uint64_t subport_tb_credits = subport->tb_credits; + uint64_t subport_tc_credits = subport->tc_credits[tc_index]; + uint64_t pipe_tb_credits = pipe->tb_credits; + uint64_t pipe_tc_credits = pipe->tc_credits[tc_index]; + int enough_credits; + + /* Check pipe and subport credits */ + enough_credits = (pkt_len <= subport_tb_credits) && + (pkt_len <= subport_tc_credits) && + (pkt_len <= pipe_tb_credits) && + (pkt_len <= pipe_tc_credits); + + if (!enough_credits) + return 0; + + /* Update pipe and subport credits */ + subport->tb_credits -= pkt_len; + subport->tc_credits[tc_index] -= pkt_len; + pipe->tb_credits -= pkt_len; + pipe->tc_credits[tc_index] -= pkt_len; + + return 1; +} + +static inline int +grinder_credits_check_with_tc_ov(stru
[PATCH v8] sched: enable traffic class oversubscription conditionally
Added new flag to enable or disable TC oversubscription for best effort traffic class at subport level. By default TC OV is disabled. Signed-off-by: Marcin Danilewicz --- History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments - v6 - removed rte_sched_subport_tc_ov_config declaration and map - v7 - changes from comments on v6 --- lib/sched/rte_sched.c | 93 +-- 1 file changed, 90 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..19aab877f0 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1254,6 +1257,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 enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2324,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2393,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_index = grinder->tc_index; + uint64_t pkt_len = pkt->pkt_len + port->frame_overhead; + uint64_t subport_tb_credits = subport->tb_credits; + uint64_t subport_tc_credits = subport->tc_credits[tc_index]; + uint64_t pipe_tb_credits = pipe->tb_credits; + uint64_t pipe_tc_credits = pipe->tc_credits[tc_index]; + int enough_credits; + + /* Check pipe and subport credits */ + enough_credits = (pkt_len <= subport_tb_credits) && + (pkt_len <= subport_tc_credits) && + (pkt_len <= pipe_tb_credits) && + (pkt_len <= pipe_tc_credits); + + if (!enough_credits) + return 0; + + /* Update pipe and subport credits */ + subport->tb_credits -= pkt_len; + subport->tc_credits[tc_index] -= pkt_len; + pipe->tb_credits -= pkt_len; + pipe->tc_credits[tc_index] -= pkt_len; + + return 1; +} + +static inline int +grinder_credits_check_with_tc_ov(stru
[PATCH v9] sched: enable traffic class oversubscription conditionally
Added new API for flag to enable or disable TC oversubscription for best effort traffic class at subport level. By default TC OV is enabled. Signed-off-by: Marcin Danilewicz --- History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments - v6 - removed rte_sched_subport_tc_ov_config declaration and map - v7 - changes from comments on v6 - v8, v9 - changes from comments on v7 --- lib/sched/rte_sched.c | 118 -- lib/sched/rte_sched.h | 18 +++ lib/sched/version.map | 3 ++ 3 files changed, 136 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..599c7e9536 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1165,6 +1168,31 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->tc_ov_enabled = tc_ov_enable ? 1 : 0; + + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,6 +1282,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 oversubscription is enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2349,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2418,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_index = grinder->tc_index; +
[PATCH v10] sched: enable traffic class oversubscription conditionally
Added new API for flag to enable or disable TC oversubscription for best effort traffic class at subport level. By default TC OV is enabled. Signed-off-by: Marcin Danilewicz --- History: - v1 - TC OV disabled by default - v2 - throughput improvements - v3, v4, v5 - changes from comments - v6 - removed rte_sched_subport_tc_ov_config declaration and map - v7 - changes from comments on v6 - v8, v9 - changes from comments on v7 - v10 - changes from comments on v9 --- lib/sched/rte_sched.c | 118 -- lib/sched/rte_sched.h | 18 +++ lib/sched/version.map | 3 ++ 3 files changed, 136 insertions(+), 3 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..599c7e9536 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 tc_ov_enabled; } __rte_cache_aligned; struct rte_sched_port { @@ -1165,6 +1168,31 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->tc_ov_enabled = tc_ov_enable ? 1 : 0; + + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,6 +1282,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 oversubscription is enabled by default */ + s->tc_ov_enabled = 1; + #ifdef RTE_SCHED_CMAN if (params->cman_params != NULL) { s->cman_enabled = true; @@ -2318,6 +2349,45 @@ grinder_credits_update(struct rte_sched_port *port, pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ + if (unlikely(port->time >= subport->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + subport->tc_credits[i] = sp->tc_credits_per_period[i]; + + subport->tc_time = port->time + sp->tc_period; + } + + /* Pipe TCs */ + if (unlikely(port->time >= pipe->tc_time)) { + for (i = 0; i < RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE; i++) + pipe->tc_credits[i] = params->tc_credits_per_period[i]; + pipe->tc_time = port->time + params->tc_period; + } +} + +static inline void +grinder_credits_update_with_tc_ov(struct rte_sched_port *port, + struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_sched_pipe_profile *params = grinder->pipe_params; + struct rte_sched_subport_profile *sp = grinder->subport_params; + uint64_t n_periods; + uint32_t i; + + /* Subport TB */ + n_periods = (port->time - subport->tb_time) / sp->tb_period; + subport->tb_credits += n_periods * sp->tb_credits_per_period; + subport->tb_credits = RTE_MIN(subport->tb_credits, sp->tb_size); + subport->tb_time += n_periods * sp->tb_period; + + /* Pipe TB */ + n_periods = (port->time - pipe->tb_time) / params->tb_period; + pipe->tb_credits += n_periods * params->tb_credits_per_period; + pipe->tb_credits = RTE_MIN(pipe->tb_credits, params->tb_size); + pipe->tb_time += n_periods * params->tb_period; + /* Subport TCs */ if (unlikely(port->time >= subport->tc_time)) { subport->tc_ov_wm = @@ -2348,6 +2418,39 @@ grinder_credits_update(struct rte_sched_port *port, static inline int grinder_credits_check(struct rte_sched_port *port, struct rte_sched_subport *subport, uint32_t pos) +{ + struct rte_sched_grinder *grinder = subport->grinder + pos; + struct rte_sched_pipe *pipe = grinder->pipe; + struct rte_mbuf *pkt = grinder->pkt; + uint32_t tc_i
[PATCH v11] sched: enable CMAN at runtime
Added changes to enable CMAN (RED or PIE) at init from profile configuration file. By default CMAN code is enable but not in use, when there is no RED or PIE profile configured. Signed-off-by: Marcin Danilewicz --- Log: v2 change in rte_sched.h to avoid ABI breakage. v3 changes from comments v4 rebase to 22.07-rc1 v5 rebase to main latest v6 commit message fixed v7 changes from comments v8 with changes from comments v9 changes from comments tmgr.c cman_params set to null qos_sched/cfg_file.c removed redundant cman_params to NULL assignement subport_params[].cman_params assigned only when CMAN enabled v10 removed ip_pipeline app build error from change in tmgr.c v11 added cman_enabled flag instead of testing cman_params.cman_mode variable --- config/rte_config.h | 3 - drivers/net/softnic/rte_eth_softnic_tm.c | 12 -- examples/ip_pipeline/tmgr.c | 75 +--- examples/qos_sched/cfg_file.c| 51 ++-- examples/qos_sched/cfg_file.h| 5 - examples/qos_sched/init.c| 76 +--- examples/qos_sched/main.h| 2 - examples/qos_sched/profile.cfg | 135 + examples/qos_sched/profile_pie.cfg | 142 ++ examples/qos_sched/profile_red.cfg | 143 +++ lib/sched/rte_sched.c| 47 +--- 11 files changed, 300 insertions(+), 391 deletions(-) create mode 100644 examples/qos_sched/profile_pie.cfg create mode 100644 examples/qos_sched/profile_red.cfg diff --git a/config/rte_config.h b/config/rte_config.h index 46549cb062..ae56a86394 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -88,9 +88,6 @@ /* rte_power defines */ #define RTE_MAX_LCORE_FREQS 64 -/* rte_sched defines */ -// RTE_SCHED_CMAN is not set - /* rte_graph defines */ #define RTE_GRAPH_BURST_SIZE 256 #define RTE_LIBRTE_GRAPH_STATS 1 diff --git a/drivers/net/softnic/rte_eth_softnic_tm.c b/drivers/net/softnic/rte_eth_softnic_tm.c index 6a7766ba1c..3e4bed81e9 100644 --- a/drivers/net/softnic/rte_eth_softnic_tm.c +++ b/drivers/net/softnic/rte_eth_softnic_tm.c @@ -420,11 +420,7 @@ pmd_tm_node_type_get(struct rte_eth_dev *dev, return 0; } -#ifdef RTE_SCHED_CMAN -#define WRED_SUPPORTED 1 -#else #define WRED_SUPPORTED 0 -#endif #define STATS_MASK_DEFAULT \ (RTE_TM_STATS_N_PKTS | \ @@ -2300,8 +2296,6 @@ tm_tc_wred_profile_get(struct rte_eth_dev *dev, uint32_t tc_id) return NULL; } -#ifdef RTE_SCHED_CMAN - static void wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) { @@ -2325,12 +2319,6 @@ wred_profiles_set(struct rte_eth_dev *dev, uint32_t subport_id) } } -#else - -#define wred_profiles_set(dev, subport_id) - -#endif - static struct tm_shared_shaper * tm_tc_shared_shaper_get(struct rte_eth_dev *dev, struct tm_node *tc_node) { diff --git a/examples/ip_pipeline/tmgr.c b/examples/ip_pipeline/tmgr.c index b138e885cf..2432b56aee 100644 --- a/examples/ip_pipeline/tmgr.c +++ b/examples/ip_pipeline/tmgr.c @@ -17,77 +17,6 @@ static uint32_t n_subport_profiles; static struct rte_sched_pipe_params pipe_profile[TMGR_PIPE_PROFILE_MAX]; -#ifdef RTE_SCHED_CMAN -static struct rte_sched_cman_params cman_params = { - .red_params = { - /* Traffic Class 0 Colors Green / Yellow / Red */ - [0][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [0][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [0][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 1 - Colors Green / Yellow / Red */ - [1][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [1][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [1][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 2 - Colors Green / Yellow / Red */ - [2][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [2][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [2][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 3 - Colors Green / Yellow / Red */ - [3][0] = {.min_th = 48, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [3][1] = {.min_th = 40, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - [3][2] = {.min_th = 32, .max_th = 64, .maxp_inv = 10, .wq_log2 = 9}, - - /* Traffic Class 4 - Colors Green / Yellow / Red */ - [4][0
[dpdk][PATCH 1/2] sched: enable/disable TC OV at runtime
From: Megha Ajmera Added new API to enable or disable TC over subscription for best effort traffic class at subport level. By default TC OV is disabled for subport. Signed-off-by: Megha Ajmera diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..1d05089d00 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -155,6 +155,7 @@ 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; @@ -1165,6 +1166,45 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + struct rte_sched_subport_profile *profile; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->is_tc_ov_enabled = tc_ov_enable; + + if (s->is_tc_ov_enabled) { + /* TC oversubscription */ + s->tc_ov_wm_min = port->mtu; + s->tc_ov_period_id = 0; + s->tc_ov = 0; + s->tc_ov_n = 0; + s->tc_ov_rate = 0; + + profile = port->subport_profiles + s->profile; + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, + s->pipe_tc_be_rate_max); + s->tc_ov_wm = s->tc_ov_wm_max; + } + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1317,12 +1357,8 @@ 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 oversubscription */ - s->tc_ov_wm_min = port->mtu; - s->tc_ov_period_id = 0; - s->tc_ov = 0; - s->tc_ov_n = 0; - s->tc_ov_rate = 0; + /* TC over-subscription is disabled by default */ + s->is_tc_ov_enabled = 0; } { @@ -1342,9 +1378,6 @@ rte_sched_subport_config(struct rte_sched_port *port, else profile->tc_credits_per_period[i] = 0; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, - s->pipe_tc_be_rate_max); - s->tc_ov_wm = s->tc_ov_wm_max; s->profile = subport_profile_id; } @@ -1417,17 +1450,20 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - /* Unplug pipe from its subport */ - s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc_be_rate; - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + if (s->is_tc_ov_enabled) { + uint32_t tc_be_ov = s->tc_ov; - if (s->tc_ov != tc_be_ov) { - RTE_LOG(DEBUG, SCHED, - "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + /* Unplug pipe from its subport */ + s->tc_ov_n -= params->tc_ov_weight; + s->tc_ov_rate -= pipe_tc_be_rate; + s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + + if (s->tc_ov != tc_be_ov) { + RTE_LOG(DEBUG, SCHED, + "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", + subport_id, subport_tc_be_rate, s->tc_ov_rate); + } } /* Reset the pipe */ @@ -1460,19 +1496,22 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - s->tc_ov_n += params->tc_ov_weight; - s->tc_ov_r
[dpdk][PATCH 2/2] sched: fix to manage TC OV at runtime
Added changes after review and increased throughput. Signed-off-by: Marcin Danilewicz 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 */ -- 2.25.1 -- Intel Research and Development Ireland Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
[PATCH v3] sched: enable/disable TC OV at runtime
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 189 +++--- lib/sched/rte_sched.h | 18 lib/sched/version.map | 3 + 3 files changed, 178 insertions(+), 32 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..6e7d81df46 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 { @@ -1165,6 +1168,45 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + struct rte_sched_subport_profile *profile; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0; + + if (s->is_tc_ov_enabled) { + /* TC oversubscription */ + s->tc_ov_wm_min = port->mtu; + s->tc_ov_period_id = 0; + s->tc_ov = 0; + s->tc_ov_n = 0; + s->tc_ov_rate = 0; + + profile = port->subport_profiles + s->profile; + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, + s->pipe_tc_be_rate_max); + s->tc_ov_wm = s->tc_ov_wm_max; + } + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,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; @@ -1316,13 +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 oversubscription */ - s->tc_ov_wm_min = port->mtu; - s->tc_ov_period_id = 0; - s->tc_ov = 0; - s->tc_ov_n = 0; - s->tc_ov_rate = 0; } { @@ -1342,9 +1380,6 @@ rte_sched_subport_config(struct rte_sched_port *port, else profile->tc_credits_per_period[i] = 0; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, - s->pipe_tc_be_rate_max); - s->tc_ov_wm = s->tc_ov_wm_max; s->profile = subport_profile_id; } @@ -1417,17 +1452,20 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - /* Unplug pipe from its subport */ - s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc_be_rate; - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + if (s->is_tc_ov_enabled) { + uint32_t tc_be_ov = s->tc_ov; - if (s->tc_ov != tc_be_ov) { - RTE_LOG(DEBUG, SCHED, - "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + /* Unplug pipe from its subport */ + s->tc_ov_n -= params->tc_ov_weight; + s->tc_ov_rate -= pipe_tc_be_rate; + s->tc_ov = s->tc_ov_rate > subport_t
[PATCH v3] sched: enable/disable TC OV at runtime
Added new API to enable or disable TC over subscription for best effort traffic class at subport level. Added changes after review and increased throughput. By default TC OV is disabled. Signed-off-by: Marcin Danilewicz --- lib/sched/rte_sched.c | 189 +++--- lib/sched/rte_sched.h | 18 lib/sched/version.map | 3 + 3 files changed, 178 insertions(+), 32 deletions(-) diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c index ec74bee939..6e7d81df46 100644 --- a/lib/sched/rte_sched.c +++ b/lib/sched/rte_sched.c @@ -213,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 { @@ -1165,6 +1168,45 @@ rte_sched_cman_config(struct rte_sched_port *port, } #endif +int +rte_sched_subport_tc_ov_config(struct rte_sched_port *port, + uint32_t subport_id, + bool tc_ov_enable) +{ + struct rte_sched_subport *s; + struct rte_sched_subport_profile *profile; + + if (port == NULL) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter port\n", __func__); + return -EINVAL; + } + + if (subport_id >= port->n_subports_per_port) { + RTE_LOG(ERR, SCHED, + "%s: Incorrect value for parameter subport id\n", __func__); + return -EINVAL; + } + + s = port->subports[subport_id]; + s->is_tc_ov_enabled = tc_ov_enable ? 1 : 0; + + if (s->is_tc_ov_enabled) { + /* TC oversubscription */ + s->tc_ov_wm_min = port->mtu; + s->tc_ov_period_id = 0; + s->tc_ov = 0; + s->tc_ov_n = 0; + s->tc_ov_rate = 0; + + profile = port->subport_profiles + s->profile; + s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, + s->pipe_tc_be_rate_max); + s->tc_ov_wm = s->tc_ov_wm_max; + } + return 0; +} + int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, @@ -1254,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; @@ -1316,13 +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 oversubscription */ - s->tc_ov_wm_min = port->mtu; - s->tc_ov_period_id = 0; - s->tc_ov = 0; - s->tc_ov_n = 0; - s->tc_ov_rate = 0; } { @@ -1342,9 +1380,6 @@ rte_sched_subport_config(struct rte_sched_port *port, else profile->tc_credits_per_period[i] = 0; - s->tc_ov_wm_max = rte_sched_time_ms_to_bytes(profile->tc_period, - s->pipe_tc_be_rate_max); - s->tc_ov_wm = s->tc_ov_wm_max; s->profile = subport_profile_id; } @@ -1417,17 +1452,20 @@ rte_sched_pipe_config(struct rte_sched_port *port, double pipe_tc_be_rate = (double) params->tc_credits_per_period[RTE_SCHED_TRAFFIC_CLASS_BE] / (double) params->tc_period; - uint32_t tc_be_ov = s->tc_ov; - /* Unplug pipe from its subport */ - s->tc_ov_n -= params->tc_ov_weight; - s->tc_ov_rate -= pipe_tc_be_rate; - s->tc_ov = s->tc_ov_rate > subport_tc_be_rate; + if (s->is_tc_ov_enabled) { + uint32_t tc_be_ov = s->tc_ov; - if (s->tc_ov != tc_be_ov) { - RTE_LOG(DEBUG, SCHED, - "Subport %u Best-effort TC oversubscription is OFF (%.4lf >= %.4lf)\n", - subport_id, subport_tc_be_rate, s->tc_ov_rate); + /* Unplug pipe from its subport */ + s->tc_ov_n -= params->tc_ov_weight; + s->tc_ov_rate -= pipe_tc_be_rate; + s->tc_ov = s->tc_ov_rate > subport_t