test/fib: add autotests
[dpdk.git] / app / test-pmd / cmdline_tm.c
index b430797..d62a4f5 100644 (file)
@@ -296,7 +296,7 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
        printf("cap.cman_wred_context_shared_n_contexts_per_node_max %" PRIu32
                "\n", cap.cman_wred_context_shared_n_contexts_per_node_max);
 
-       for (i = 0; i < RTE_TM_COLORS; i++) {
+       for (i = 0; i < RTE_COLORS; i++) {
                printf("cap.mark_vlan_dei_supported %" PRId32 "\n",
                        cap.mark_vlan_dei_supported[i]);
                printf("cap.mark_ip_ecn_tcp_supported %" PRId32 "\n",
@@ -642,22 +642,22 @@ static void cmd_show_port_tm_node_stats_parsed(void *parsed_result,
                        stats.n_bytes);
        if (stats_mask & RTE_TM_STATS_N_PKTS_GREEN_DROPPED)
                printf("\tPkts dropped (green): %" PRIu64 "\n",
-                       stats.leaf.n_pkts_dropped[RTE_TM_GREEN]);
+                       stats.leaf.n_pkts_dropped[RTE_COLOR_GREEN]);
        if (stats_mask & RTE_TM_STATS_N_PKTS_YELLOW_DROPPED)
                printf("\tPkts dropped (yellow): %" PRIu64 "\n",
-                       stats.leaf.n_pkts_dropped[RTE_TM_YELLOW]);
+                       stats.leaf.n_pkts_dropped[RTE_COLOR_YELLOW]);
        if (stats_mask & RTE_TM_STATS_N_PKTS_RED_DROPPED)
                printf("\tPkts dropped (red): %" PRIu64 "\n",
-                       stats.leaf.n_pkts_dropped[RTE_TM_RED]);
+                       stats.leaf.n_pkts_dropped[RTE_COLOR_RED]);
        if (stats_mask & RTE_TM_STATS_N_BYTES_GREEN_DROPPED)
                printf("\tBytes dropped (green): %" PRIu64 "\n",
-                       stats.leaf.n_bytes_dropped[RTE_TM_GREEN]);
+                       stats.leaf.n_bytes_dropped[RTE_COLOR_GREEN]);
        if (stats_mask & RTE_TM_STATS_N_BYTES_YELLOW_DROPPED)
                printf("\tBytes dropped (yellow): %" PRIu64 "\n",
-                       stats.leaf.n_bytes_dropped[RTE_TM_YELLOW]);
+                       stats.leaf.n_bytes_dropped[RTE_COLOR_YELLOW]);
        if (stats_mask & RTE_TM_STATS_N_BYTES_RED_DROPPED)
                printf("\tBytes dropped (red): %" PRIu64 "\n",
-                       stats.leaf.n_bytes_dropped[RTE_TM_RED]);
+                       stats.leaf.n_bytes_dropped[RTE_COLOR_RED]);
        if (stats_mask & RTE_TM_STATS_N_PKTS_QUEUED)
                printf("\tPkts queued: %" PRIu64 "\n",
                        stats.leaf.n_pkts_queued);
@@ -771,8 +771,10 @@ struct cmd_add_port_tm_node_shaper_profile_result {
        cmdline_fixed_string_t profile;
        uint16_t port_id;
        uint32_t shaper_id;
-       uint64_t tb_rate;
-       uint64_t tb_size;
+       uint64_t cmit_tb_rate;
+       uint64_t cmit_tb_size;
+       uint64_t peak_tb_rate;
+       uint64_t peak_tb_size;
        uint32_t pktlen_adjust;
 };
 
@@ -807,14 +809,22 @@ cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_shaper_id =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_shaper_profile_result,
                        shaper_id, UINT32);
-cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_tb_rate =
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_cmit_tb_rate =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_shaper_profile_result,
-                       tb_rate, UINT64);
-cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_tb_size =
+                       cmit_tb_rate, UINT64);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_cmit_tb_size =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_shaper_profile_result,
-                       tb_size, UINT64);
+                       cmit_tb_size, UINT64);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_peak_tb_rate =
+       TOKEN_NUM_INITIALIZER(
+               struct cmd_add_port_tm_node_shaper_profile_result,
+                       peak_tb_rate, UINT64);
+cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_peak_tb_size =
+       TOKEN_NUM_INITIALIZER(
+               struct cmd_add_port_tm_node_shaper_profile_result,
+                       peak_tb_size, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_shaper_profile_pktlen_adjust =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_shaper_profile_result,
@@ -838,8 +848,10 @@ static void cmd_add_port_tm_node_shaper_profile_parsed(void *parsed_result,
        /* Private shaper profile params */
        memset(&sp, 0, sizeof(struct rte_tm_shaper_params));
        memset(&error, 0, sizeof(struct rte_tm_error));
-       sp.peak.rate = res->tb_rate;
-       sp.peak.size = res->tb_size;
+       sp.committed.rate = res->cmit_tb_rate;
+       sp.committed.size = res->cmit_tb_size;
+       sp.peak.rate = res->peak_tb_rate;
+       sp.peak.size = res->peak_tb_size;
        sp.pkt_length_adjust = pkt_len_adjust;
 
        ret = rte_tm_shaper_profile_add(port_id, shaper_id, &sp, &error);
@@ -862,8 +874,10 @@ cmdline_parse_inst_t cmd_add_port_tm_node_shaper_profile = {
                (void *)&cmd_add_port_tm_node_shaper_profile_profile,
                (void *)&cmd_add_port_tm_node_shaper_profile_port_id,
                (void *)&cmd_add_port_tm_node_shaper_profile_shaper_id,
-               (void *)&cmd_add_port_tm_node_shaper_profile_tb_rate,
-               (void *)&cmd_add_port_tm_node_shaper_profile_tb_size,
+               (void *)&cmd_add_port_tm_node_shaper_profile_cmit_tb_rate,
+               (void *)&cmd_add_port_tm_node_shaper_profile_cmit_tb_size,
+               (void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_rate,
+               (void *)&cmd_add_port_tm_node_shaper_profile_peak_tb_size,
                (void *)&cmd_add_port_tm_node_shaper_profile_pktlen_adjust,
                NULL,
        },
@@ -1142,18 +1156,18 @@ struct cmd_add_port_tm_node_wred_profile_result {
        uint16_t port_id;
        uint32_t wred_profile_id;
        cmdline_fixed_string_t color_g;
-       uint16_t min_th_g;
-       uint16_t max_th_g;
+       uint64_t min_th_g;
+       uint64_t max_th_g;
        uint16_t maxp_inv_g;
        uint16_t wq_log2_g;
        cmdline_fixed_string_t color_y;
-       uint16_t min_th_y;
-       uint16_t max_th_y;
+       uint64_t min_th_y;
+       uint64_t max_th_y;
        uint16_t maxp_inv_y;
        uint16_t wq_log2_y;
        cmdline_fixed_string_t color_r;
-       uint16_t min_th_r;
-       uint16_t max_th_r;
+       uint64_t min_th_r;
+       uint64_t max_th_r;
        uint16_t maxp_inv_r;
        uint16_t wq_log2_r;
 };
@@ -1192,11 +1206,11 @@ cmdline_parse_token_string_t cmd_add_port_tm_node_wred_profile_color_g =
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_min_th_g =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       min_th_g, UINT16);
+                       min_th_g, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_max_th_g =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       max_th_g, UINT16);
+                       max_th_g, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_maxp_inv_g =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
@@ -1212,11 +1226,11 @@ cmdline_parse_token_string_t cmd_add_port_tm_node_wred_profile_color_y =
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_min_th_y =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       min_th_y, UINT16);
+                       min_th_y, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_max_th_y =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       max_th_y, UINT16);
+                       max_th_y, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_maxp_inv_y =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
@@ -1232,11 +1246,11 @@ cmdline_parse_token_string_t cmd_add_port_tm_node_wred_profile_color_r =
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_min_th_r =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       min_th_r, UINT16);
+                       min_th_r, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_max_th_r =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
-                       max_th_r, UINT16);
+                       max_th_r, UINT64);
 cmdline_parse_token_num_t cmd_add_port_tm_node_wred_profile_maxp_inv_r =
        TOKEN_NUM_INITIALIZER(
                struct cmd_add_port_tm_node_wred_profile_result,
@@ -1253,7 +1267,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
 {
        struct cmd_add_port_tm_node_wred_profile_result *res = parsed_result;
        struct rte_tm_wred_params wp;
-       enum rte_tm_color color;
+       enum rte_color color;
        struct rte_tm_error error;
        uint32_t wred_profile_id = res->wred_profile_id;
        portid_t port_id = res->port_id;
@@ -1266,7 +1280,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
        memset(&error, 0, sizeof(struct rte_tm_error));
 
        /* WRED Params  (Green Color)*/
-       color = RTE_TM_GREEN;
+       color = RTE_COLOR_GREEN;
        wp.red_params[color].min_th = res->min_th_g;
        wp.red_params[color].max_th = res->max_th_g;
        wp.red_params[color].maxp_inv = res->maxp_inv_g;
@@ -1274,14 +1288,14 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
 
 
        /* WRED Params  (Yellow Color)*/
-       color = RTE_TM_YELLOW;
+       color = RTE_COLOR_YELLOW;
        wp.red_params[color].min_th = res->min_th_y;
        wp.red_params[color].max_th = res->max_th_y;
        wp.red_params[color].maxp_inv = res->maxp_inv_y;
        wp.red_params[color].wq_log2 = res->wq_log2_y;
 
        /* WRED Params  (Red Color)*/
-       color = RTE_TM_RED;
+       color = RTE_COLOR_RED;
        wp.red_params[color].min_th = res->min_th_r;
        wp.red_params[color].max_th = res->max_th_r;
        wp.red_params[color].maxp_inv = res->maxp_inv_r;