test: move to app directory
[dpdk.git] / app / test-pmd / cmdline_tm.c
index 7c1601f..1012084 100644 (file)
@@ -234,6 +234,7 @@ static void cmd_show_port_tm_cap_parsed(void *parsed_result,
                return;
 
        memset(&cap, 0, sizeof(struct rte_tm_capabilities));
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_capabilities_get(port_id, &cap, &error);
        if (ret) {
                print_err_msg(&error);
@@ -374,6 +375,7 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,
                return;
 
        memset(&lcap, 0, sizeof(struct rte_tm_level_capabilities));
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_level_capabilities_get(port_id, level_id, &lcap, &error);
        if (ret) {
                print_err_msg(&error);
@@ -498,6 +500,7 @@ static void cmd_show_port_tm_node_cap_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Node id must be valid */
        ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
        if (ret != 0) {
@@ -615,6 +618,7 @@ static void cmd_show_port_tm_node_stats_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Port status */
        if (!port_is_started(port_id)) {
                printf(" Port %u not started (error)\n", port_id);
@@ -727,6 +731,7 @@ static void cmd_show_port_tm_node_type_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -766,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;
 };
 
@@ -802,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,
@@ -832,8 +847,11 @@ 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));
-       sp.peak.rate = res->tb_rate;
-       sp.peak.size = res->tb_size;
+       memset(&error, 0, sizeof(struct rte_tm_error));
+       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);
@@ -856,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,
        },
@@ -919,6 +939,7 @@ static void cmd_del_port_tm_node_shaper_profile_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_shaper_profile_delete(port_id, shaper_id, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -1004,6 +1025,7 @@ static void cmd_add_port_tm_node_shared_shaper_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Command type: add */
        if ((strcmp(res->cmd_type, "add") == 0) &&
                (port_is_started(port_id))) {
@@ -1098,6 +1120,7 @@ static void cmd_del_port_tm_node_shared_shaper_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_shared_shaper_delete(port_id, shared_shaper_id, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -1133,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;
 };
@@ -1183,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,
@@ -1203,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,
@@ -1223,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,
@@ -1254,6 +1277,7 @@ static void cmd_add_port_tm_node_wred_profile_parsed(void *parsed_result,
                return;
 
        memset(&wp, 0, sizeof(struct rte_tm_wred_params));
+       memset(&error, 0, sizeof(struct rte_tm_error));
 
        /* WRED Params  (Green Color)*/
        color = RTE_TM_GREEN;
@@ -1369,6 +1393,7 @@ static void cmd_del_port_tm_node_wred_profile_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_wred_profile_delete(port_id, wred_profile_id, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -1455,6 +1480,7 @@ static void cmd_set_port_tm_node_shaper_profile_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Port status */
        if (!port_is_started(port_id)) {
                printf(" Port %u not started (error)\n", port_id);
@@ -1571,6 +1597,7 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
                return;
 
        memset(&np, 0, sizeof(struct rte_tm_node_params));
+       memset(&error, 0, sizeof(struct rte_tm_error));
 
        /* Node parameters */
        if (res->parent_node_id < 0)
@@ -1731,6 +1758,7 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
                return;
 
        memset(&np, 0, sizeof(struct rte_tm_node_params));
+       memset(&error, 0, sizeof(struct rte_tm_error));
 
        /* Node parameters */
        if (res->parent_node_id < 0)
@@ -1848,6 +1876,7 @@ static void cmd_del_port_tm_node_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Port status */
        if (port_is_started(port_id)) {
                printf(" Port %u not stopped (error)\n", port_id);
@@ -1937,6 +1966,7 @@ static void cmd_set_port_tm_node_parent_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        /* Port status */
        if (!port_is_started(port_id)) {
                printf(" Port %u not started (error)\n", port_id);
@@ -2012,6 +2042,7 @@ static void cmd_suspend_port_tm_node_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_node_suspend(port_id, node_id, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -2076,6 +2107,7 @@ static void cmd_resume_port_tm_node_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_node_resume(port_id, node_id, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -2147,6 +2179,7 @@ static void cmd_port_tm_hierarchy_commit_parsed(void *parsed_result,
        else
                clean_on_fail = 0;
 
+       memset(&error, 0, sizeof(struct rte_tm_error));
        ret = rte_tm_hierarchy_commit(port_id, clean_on_fail, &error);
        if (ret != 0) {
                print_err_msg(&error);
@@ -2157,7 +2190,7 @@ static void cmd_port_tm_hierarchy_commit_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_port_tm_hierarchy_commit = {
        .f = cmd_port_tm_hierarchy_commit_parsed,
        .data = NULL,
-       .help_str = "Set port tm node shaper profile",
+       .help_str = "Commit port tm hierarchy",
        .tokens = {
                (void *)&cmd_port_tm_hierarchy_commit_port,
                (void *)&cmd_port_tm_hierarchy_commit_tm,
@@ -2168,3 +2201,263 @@ cmdline_parse_inst_t cmd_port_tm_hierarchy_commit = {
                NULL,
        },
 };
+
+/* *** Port TM Mark IP ECN *** */
+struct cmd_port_tm_mark_ip_ecn_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t tm;
+       cmdline_fixed_string_t mark;
+       cmdline_fixed_string_t ip_ecn;
+       uint16_t port_id;
+       uint16_t green;
+       uint16_t yellow;
+       uint16_t red;
+};
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_set =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                                set, "set");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                                port, "port");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_tm =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result, tm,
+                                "tm");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_mark =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                                mark, "mark");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_ecn_ip_ecn =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                                ip_ecn, "ip_ecn");
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                             port_id, UINT16);
+
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_green =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                             green, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_yellow =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                             yellow, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_ecn_red =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_ecn_result,
+                               red, UINT16);
+
+static void cmd_port_tm_mark_ip_ecn_parsed(void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_port_tm_mark_ip_ecn_result *res = parsed_result;
+       struct rte_tm_error error;
+       portid_t port_id = res->port_id;
+       int green = res->green;
+       int yellow = res->yellow;
+       int red = res->red;
+       int ret;
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return;
+
+       memset(&error, 0, sizeof(struct rte_tm_error));
+       ret = rte_tm_mark_ip_ecn(port_id, green, yellow, red, &error);
+       if (ret != 0) {
+               print_err_msg(&error);
+               return;
+       }
+}
+
+cmdline_parse_inst_t cmd_port_tm_mark_ip_ecn = {
+       .f = cmd_port_tm_mark_ip_ecn_parsed,
+       .data = NULL,
+       .help_str = "set port tm mark ip_ecn <port> <green> <yellow> <red>",
+       .tokens = {
+               (void *)&cmd_port_tm_mark_ip_ecn_set,
+               (void *)&cmd_port_tm_mark_ip_ecn_port,
+               (void *)&cmd_port_tm_mark_ip_ecn_tm,
+               (void *)&cmd_port_tm_mark_ip_ecn_mark,
+               (void *)&cmd_port_tm_mark_ip_ecn_ip_ecn,
+               (void *)&cmd_port_tm_mark_ip_ecn_port_id,
+               (void *)&cmd_port_tm_mark_ip_ecn_green,
+               (void *)&cmd_port_tm_mark_ip_ecn_yellow,
+               (void *)&cmd_port_tm_mark_ip_ecn_red,
+               NULL,
+       },
+};
+
+
+/* *** Port TM Mark IP DSCP *** */
+struct cmd_port_tm_mark_ip_dscp_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t tm;
+       cmdline_fixed_string_t mark;
+       cmdline_fixed_string_t ip_dscp;
+       uint16_t port_id;
+       uint16_t green;
+       uint16_t yellow;
+       uint16_t red;
+};
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_set =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                                set, "set");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                                port, "port");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_tm =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result, tm,
+                                "tm");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_mark =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                                mark, "mark");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_ip_dscp_ip_dscp =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                                ip_dscp, "ip_dscp");
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                             port_id, UINT16);
+
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_green =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                               green, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_yellow =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                               yellow, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_ip_dscp_red =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_ip_dscp_result,
+                               red, UINT16);
+
+static void cmd_port_tm_mark_ip_dscp_parsed(void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_port_tm_mark_ip_dscp_result *res = parsed_result;
+       struct rte_tm_error error;
+       portid_t port_id = res->port_id;
+       int green = res->green;
+       int yellow = res->yellow;
+       int red = res->red;
+       int ret;
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return;
+
+       memset(&error, 0, sizeof(struct rte_tm_error));
+       ret = rte_tm_mark_ip_dscp(port_id, green, yellow, red, &error);
+       if (ret != 0) {
+               print_err_msg(&error);
+               return;
+       }
+}
+
+cmdline_parse_inst_t cmd_port_tm_mark_ip_dscp = {
+       .f = cmd_port_tm_mark_ip_dscp_parsed,
+       .data = NULL,
+       .help_str = "set port tm mark ip_dscp <port> <green> <yellow> <red>",
+       .tokens = {
+               (void *)&cmd_port_tm_mark_ip_dscp_set,
+               (void *)&cmd_port_tm_mark_ip_dscp_port,
+               (void *)&cmd_port_tm_mark_ip_dscp_tm,
+               (void *)&cmd_port_tm_mark_ip_dscp_mark,
+               (void *)&cmd_port_tm_mark_ip_dscp_ip_dscp,
+               (void *)&cmd_port_tm_mark_ip_dscp_port_id,
+               (void *)&cmd_port_tm_mark_ip_dscp_green,
+               (void *)&cmd_port_tm_mark_ip_dscp_yellow,
+               (void *)&cmd_port_tm_mark_ip_dscp_red,
+               NULL,
+       },
+};
+
+
+/* *** Port TM Mark VLAN_DEI *** */
+struct cmd_port_tm_mark_vlan_dei_result {
+       cmdline_fixed_string_t set;
+       cmdline_fixed_string_t port;
+       cmdline_fixed_string_t tm;
+       cmdline_fixed_string_t mark;
+       cmdline_fixed_string_t vlan_dei;
+       uint16_t port_id;
+       uint16_t green;
+       uint16_t yellow;
+       uint16_t red;
+};
+
+cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_set =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                                set, "set");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_port =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                                port, "port");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_tm =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result, tm,
+                                "tm");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_mark =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                                mark, "mark");
+
+cmdline_parse_token_string_t cmd_port_tm_mark_vlan_dei_vlan_dei =
+       TOKEN_STRING_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                                vlan_dei, "vlan_dei");
+cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_port_id =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                             port_id, UINT16);
+
+cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_green =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                               green, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_yellow =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                               yellow, UINT16);
+cmdline_parse_token_num_t cmd_port_tm_mark_vlan_dei_red =
+       TOKEN_NUM_INITIALIZER(struct cmd_port_tm_mark_vlan_dei_result,
+                               red, UINT16);
+
+static void cmd_port_tm_mark_vlan_dei_parsed(void *parsed_result,
+       __attribute__((unused)) struct cmdline *cl,
+       __attribute__((unused)) void *data)
+{
+       struct cmd_port_tm_mark_vlan_dei_result *res = parsed_result;
+       struct rte_tm_error error;
+       portid_t port_id = res->port_id;
+       int green = res->green;
+       int yellow = res->yellow;
+       int red = res->red;
+       int ret;
+       if (port_id_is_invalid(port_id, ENABLED_WARN))
+               return;
+
+       memset(&error, 0, sizeof(struct rte_tm_error));
+       ret = rte_tm_mark_vlan_dei(port_id, green, yellow, red, &error);
+       if (ret != 0) {
+               print_err_msg(&error);
+               return;
+       }
+}
+
+cmdline_parse_inst_t cmd_port_tm_mark_vlan_dei = {
+       .f = cmd_port_tm_mark_vlan_dei_parsed,
+       .data = NULL,
+       .help_str = "set port tm mark vlan_dei <port> <green> <yellow> <red>",
+       .tokens = {
+               (void *)&cmd_port_tm_mark_vlan_dei_set,
+               (void *)&cmd_port_tm_mark_vlan_dei_port,
+               (void *)&cmd_port_tm_mark_vlan_dei_tm,
+               (void *)&cmd_port_tm_mark_vlan_dei_mark,
+               (void *)&cmd_port_tm_mark_vlan_dei_vlan_dei,
+               (void *)&cmd_port_tm_mark_vlan_dei_port_id,
+               (void *)&cmd_port_tm_mark_vlan_dei_green,
+               (void *)&cmd_port_tm_mark_vlan_dei_yellow,
+               (void *)&cmd_port_tm_mark_vlan_dei_red,
+               NULL,
+       },
+};