aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorBarry Spinney <spinney@ezchip.com>2016-04-15 17:08:42 -0400
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-04-25 10:55:24 +0300
commitd75d31b8fffbdbc8cad82ec50a47d6d3f24d5f14 (patch)
tree3c9a1b870dbf14490c2df825e8432c9b3ba5e7b1 /example
parent7f2ee12caa61bd8006f58d57b94703adeef1f8d2 (diff)
api: tm: define and implement revised api definitions
Normally we would split this into four separate parts, but because they are interdependent, they need to be in the same patch for bisectability. API changes: 1) Add VLAN and IP TOS marking functions. 2) Added the requirements and capabilities architecture. Added separate record types for describing ODP application requirements vs TM implementation capabilities. This also involved adding per level requirements and capabilities. 3) Egress parameters are now separate from the requirements 4) Doxygen formatting cleanup. 5) Added _destroy functions for all of the profiles. 6) Added odp_tm_node_disconnect and odp_tm_queue_disconnect fcns. 7) Added odp_tm_node_info, odp_tm_queue_info and odp_tm_node_fanin_info functions and associated record types. 8) Removed the odp_tm_periodic_update fcn. linux-generic implementation changes: Only changes were implementing the new and revised API changes. validation test changes: 1) Replaced the printf with test_debug.h LOG_ERR. 2) Added a lot more LOG_ERR calls for debugging - especially for errors in test termination code. 3) Changed create_tm_system to use the new capabilities and requirements API architecture. 4) Added lots of code to destroy tm_queues, tm_nodes and profiles. example changes: 1) Changed create_tm_system to use the new capabilities and requirements API architecture. 2) Renamed Kbps and Mbps to KBPS MBPS. Signed-off-by: Barry Spinney <spinney@mellanox.com> Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'example')
-rw-r--r--example/traffic_mgmt/odp_traffic_mgmt.c71
1 files changed, 43 insertions, 28 deletions
diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c
index d646a06ff..e94095495 100644
--- a/example/traffic_mgmt/odp_traffic_mgmt.c
+++ b/example/traffic_mgmt/odp_traffic_mgmt.c
@@ -27,9 +27,10 @@
#define NUM_TM_QUEUES (NUM_USERS * APPS_PER_USER * TM_QUEUES_PER_APP)
#define TM_QUEUES_PER_USER (TM_QUEUES_PER_APP * APPS_PER_USER)
#define TM_QUEUES_PER_CLASS (USERS_PER_SVC_CLASS * TM_QUEUES_PER_USER)
+#define MAX_NODES_PER_LEVEL (NUM_USERS * APPS_PER_USER)
-#define Kbps 1000
-#define Mbps 1000000
+#define KBPS 1000
+#define MBPS 1000000
#define PERCENT(percent) (100 * percent)
#define FALSE 0
@@ -62,7 +63,7 @@ static const odp_platform_init_t PLATFORM_PARAMS = {
static profile_params_set_t COMPANY_PROFILE_PARAMS = {
.shaper_params = {
- .commit_bps = 50 * Mbps, .commit_burst = 1000000,
+ .commit_bps = 50 * MBPS, .commit_burst = 1000000,
.peak_bps = 0, .peak_burst = 0,
.dual_rate = FALSE, .shaper_len_adjust = 20
},
@@ -95,8 +96,8 @@ static profile_params_set_t COMPANY_PROFILE_PARAMS = {
static profile_params_set_t COS0_PROFILE_PARAMS = {
.shaper_params = {
- .commit_bps = 1 * Mbps, .commit_burst = 100000,
- .peak_bps = 4 * Mbps, .peak_burst = 200000,
+ .commit_bps = 1 * MBPS, .commit_burst = 100000,
+ .peak_bps = 4 * MBPS, .peak_burst = 200000,
.dual_rate = FALSE, .shaper_len_adjust = 20
},
@@ -128,8 +129,8 @@ static profile_params_set_t COS0_PROFILE_PARAMS = {
static profile_params_set_t COS1_PROFILE_PARAMS = {
.shaper_params = {
- .commit_bps = 500 * Kbps, .commit_burst = 50000,
- .peak_bps = 1500 * Kbps, .peak_burst = 150000,
+ .commit_bps = 500 * KBPS, .commit_burst = 50000,
+ .peak_bps = 1500 * KBPS, .peak_burst = 150000,
.dual_rate = FALSE, .shaper_len_adjust = 20
},
@@ -161,8 +162,8 @@ static profile_params_set_t COS1_PROFILE_PARAMS = {
static profile_params_set_t COS2_PROFILE_PARAMS = {
.shaper_params = {
- .commit_bps = 200 * Kbps, .commit_burst = 20000,
- .peak_bps = 400 * Kbps, .peak_burst = 40000,
+ .commit_bps = 200 * KBPS, .commit_burst = 20000,
+ .peak_bps = 400 * KBPS, .peak_burst = 40000,
.dual_rate = FALSE, .shaper_len_adjust = 20
},
@@ -194,7 +195,7 @@ static profile_params_set_t COS2_PROFILE_PARAMS = {
static profile_params_set_t COS3_PROFILE_PARAMS = {
.shaper_params = {
- .commit_bps = 100 * Kbps, .commit_burst = 5000,
+ .commit_bps = 100 * KBPS, .commit_burst = 5000,
.peak_bps = 0, .peak_burst = 0,
.dual_rate = FALSE, .shaper_len_adjust = 20
},
@@ -501,24 +502,38 @@ static int config_company_node(const char *company_name)
static int create_and_config_tm(void)
{
- odp_tm_params_t params;
- uint32_t err_cnt;
-
- odp_tm_params_init(&params);
- params.capability.max_tm_queues = 10 * NUM_TM_QUEUES;
- params.capability.max_priority = 3;
- params.capability.max_levels = 3;
- params.capability.tm_queue_shaper_supported = TRUE;
- params.capability.tm_node_shaper_supported = TRUE;
- params.capability.red_supported = TRUE;
- params.capability.hierarchical_red_supported = TRUE;
- params.capability.weights_supported = TRUE;
- params.capability.fair_queuing_supported = TRUE;
- params.egress.egress_kind = ODP_TM_EGRESS_FN;
- params.egress.egress_fcn = tester_egress_fcn;
-
- odp_tm_test = odp_tm_create("TM test", &params);
- err_cnt = init_profile_sets();
+ odp_tm_level_requirements_t *per_level;
+ odp_tm_requirements_t requirements;
+ odp_tm_egress_t egress;
+ uint32_t level, err_cnt;
+
+ odp_tm_requirements_init(&requirements);
+ odp_tm_egress_init(&egress);
+
+ requirements.max_tm_queues = 10 * NUM_TM_QUEUES;
+ requirements.num_levels = 3;
+ requirements.tm_queue_shaper_needed = true;
+ requirements.tm_queue_wred_needed = true;
+
+ for (level = 0; level < 3; level++) {
+ per_level = &requirements.per_level[level];
+ per_level->max_num_tm_nodes = MAX_NODES_PER_LEVEL;
+ per_level->max_fanin_per_node = 64;
+ per_level->max_priority = 3;
+ per_level->min_weight = 1;
+ per_level->max_weight = 255;
+ per_level->tm_node_shaper_needed = true;
+ per_level->tm_node_wred_needed = true;
+ per_level->tm_node_dual_slope_needed = true;
+ per_level->fair_queuing_needed = true;
+ per_level->weights_needed = true;
+ }
+
+ egress.egress_kind = ODP_TM_EGRESS_FN;
+ egress.egress_fcn = tester_egress_fcn;
+
+ odp_tm_test = odp_tm_create("TM test", &requirements, &egress);
+ err_cnt = init_profile_sets();
if (err_cnt != 0)
printf("%s init_profile_sets encountered %u errors\n",
__func__, err_cnt);