get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/113342/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 113342,
    "url": "https://patches.dpdk.org/api/patches/113342/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20220623125701.1136065-1-skori@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20220623125701.1136065-1-skori@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220623125701.1136065-1-skori@marvell.com",
    "date": "2022-06-23T12:57:01",
    "name": "[v5,1/1] app/testpmd: support different input color method",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "7d89f854a3ad4430dbc0e4f9bd69c235ab5b57f4",
    "submitter": {
        "id": 1318,
        "url": "https://patches.dpdk.org/api/people/1318/?format=api",
        "name": "Sunil Kumar Kori",
        "email": "skori@marvell.com"
    },
    "delegate": {
        "id": 3961,
        "url": "https://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20220623125701.1136065-1-skori@marvell.com/mbox/",
    "series": [
        {
            "id": 23733,
            "url": "https://patches.dpdk.org/api/series/23733/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=23733",
            "date": "2022-06-23T12:57:01",
            "name": "[v5,1/1] app/testpmd: support different input color method",
            "version": 5,
            "mbox": "https://patches.dpdk.org/series/23733/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/113342/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/113342/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C2EB2A0093;\n\tThu, 23 Jun 2022 14:57:16 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 673B740042;\n\tThu, 23 Jun 2022 14:57:16 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 8C2A84003F\n for <dev@dpdk.org>; Thu, 23 Jun 2022 14:57:14 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id\n 25N9wYU5025936;\n Thu, 23 Jun 2022 05:57:13 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3gvp0urq2k-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Thu, 23 Jun 2022 05:57:13 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Thu, 23 Jun 2022 05:57:11 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend\n Transport; Thu, 23 Jun 2022 05:57:12 -0700",
            "from localhost.localdomain (unknown [10.28.34.25])\n by maili.marvell.com (Postfix) with ESMTP id B7B065B6921;\n Thu, 23 Jun 2022 05:57:09 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=QK4G56CdoVNx1lTBdqrFcOgfLuKYG9EYRaYMHoUM8go=;\n b=b3bp74t27MKt6LJ50oh9dWDk28rUiZRVcTklFqOCT2jBhmFZX6yYGffWZicg772iq2RC\n 9mngo2wTcCFbXVPTO29zwJv5JlZFGKLJifSImAMnRV+LRlpKnBDgXnP2EpB6w9hBCFh/\n yv4IF8wuuo6NwFXknLu8jxGujlvPRlDk5L/Ok5FAv7XFYcjNmNkYE8aAs2ROeo+Ud4d8\n XUUQZI5uznOu0tsEaPguIevxSTlMA8d6pcYpadNSLJl2KeZiEOEvQy+Q54Bop19zCo8b\n 9hY7vZf1ZX9992xj7RNuAEmiaB2fJEAuCXB1ZCsV8ozbD9vu/2lPdLAUBpwF01ePiQPV xw==",
        "From": "<skori@marvell.com>",
        "To": "Xiaoyun Li <xiaoyun.li@intel.com>, Aman Singh <aman.deep.singh@intel.com>,\n Yuying Zhang <yuying.zhang@intel.com>, Cristian Dumitrescu\n <cristian.dumitrescu@intel.com>",
        "CC": "<dev@dpdk.org>, Sunil Kumar Kori <skori@marvell.com>",
        "Subject": "[PATCH v5 1/1] app/testpmd: support different input color method",
        "Date": "Thu, 23 Jun 2022 18:27:01 +0530",
        "Message-ID": "<20220623125701.1136065-1-skori@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220614100518.533931-1-skori@marvell.com>",
        "References": "<20220614100518.533931-1-skori@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "226zW5ey8AuJXZDlUI4D5uX_WjkMep84",
        "X-Proofpoint-ORIG-GUID": "226zW5ey8AuJXZDlUI4D5uX_WjkMep84",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1\n definitions=2022-06-23_05,2022-06-23_01,2022-06-22_01",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "From: Sunil Kumar Kori <skori@marvell.com>\n\nTo enable input coloring, based on VLAN or DSCP, patch adds\ncommand line interface to configure the following:\n\n - configuring input coloring using VLAN or DSCP while creating\n   meter i.e. during rte_mtr_create()\n\n - Update VLAN input coloring table at runtime.\n\n - configures protocol priorities.\n\n - retrieve protocol and priority information\n\nDepends-on: patch-22751 (\"ethdev: mtr: support protocol based input color selection\")\n\nSigned-off-by: Sunil Kumar Kori <skori@marvell.com>\nAcked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>\n---\nv4..v5:\n - Update testpmd user guide.\n\nv3..v4:\n - Replace strcmp with strcasecmp whereever is needed.\n \nv2..v3:\n - Rebased to branch ToT dpdk-next-net/main\n - Fix static keyword for newly added token parsing symbols\n\nv1..v2:\n - Rebased to branch dpdk-next-net\n - add CLIs for input coloring mechanism\n\n app/test-pmd/cmdline.c                      |   4 +\n app/test-pmd/cmdline_mtr.c                  | 552 +++++++++++++++++++-\n app/test-pmd/cmdline_mtr.h                  |   4 +\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  35 +-\n 4 files changed, 587 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex 9a7fd5fc35..ded7dfe656 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -14345,6 +14345,10 @@ static cmdline_parse_ctx_t builtin_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_del_port_meter_policy,\n \t(cmdline_parse_inst_t *)&cmd_set_port_meter_profile,\n \t(cmdline_parse_inst_t *)&cmd_set_port_meter_dscp_table,\n+\t(cmdline_parse_inst_t *)&cmd_set_port_meter_vlan_table,\n+\t(cmdline_parse_inst_t *)&cmd_set_port_meter_in_proto,\n+\t(cmdline_parse_inst_t *)&cmd_get_port_meter_in_proto,\n+\t(cmdline_parse_inst_t *)&cmd_get_port_meter_in_proto_prio,\n \t(cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask,\n \t(cmdline_parse_inst_t *)&cmd_show_port_meter_stats,\n \t(cmdline_parse_inst_t *)&cmd_mcast_addr,\ndiff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c\nindex 57050ec9af..b92e66cedb 100644\n--- a/app/test-pmd/cmdline_mtr.c\n+++ b/app/test-pmd/cmdline_mtr.c\n@@ -14,6 +14,7 @@\n #include \"cmdline_mtr.h\"\n \n #define PARSE_DELIMITER\t\t\t\t\" \\f\\n\\r\\t\\v\"\n+#define MAX_VLAN_TABLE_ENTRIES\t\t16\n #define MAX_DSCP_TABLE_ENTRIES\t\t64\n \n /** Display Meter Error Message */\n@@ -82,6 +83,122 @@ parse_uint(uint64_t *value, const char *str)\n \treturn 0;\n }\n \n+static int\n+parse_input_color_table_entries(char *str, enum rte_color **dscp_table,\n+\tenum rte_color **vlan_table)\n+{\n+\tenum rte_color *vlan, *dscp;\n+\tchar *token;\n+\tint i = 0;\n+\n+\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\tif (token == NULL)\n+\t\treturn 0;\n+\n+\t/* Allocate memory for dscp table */\n+\tdscp = (enum rte_color *)malloc(MAX_DSCP_TABLE_ENTRIES *\n+\t\tsizeof(enum rte_color));\n+\tif (dscp == NULL)\n+\t\treturn -1;\n+\n+\twhile (1) {\n+\t\tif (strcasecmp(token, \"G\") == 0)\n+\t\t\tdscp[i++] = RTE_COLOR_GREEN;\n+\t\telse if (strcasecmp(token, \"Y\") == 0)\n+\t\t\tdscp[i++] = RTE_COLOR_YELLOW;\n+\t\telse if (strcasecmp(token, \"R\") == 0)\n+\t\t\tdscp[i++] = RTE_COLOR_RED;\n+\t\telse {\n+\t\t\tfree(dscp);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (i == MAX_DSCP_TABLE_ENTRIES)\n+\t\t\tbreak;\n+\n+\t\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\t\tif (token == NULL) {\n+\t\t\tfree(dscp);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\t*dscp_table = dscp;\n+\n+\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\tif (token == NULL)\n+\t\treturn 0;\n+\n+\t/* Allocate memory for vlan table */\n+\tvlan = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES *\n+\t\tsizeof(enum rte_color));\n+\tif (vlan == NULL)\n+\t\treturn -1;\n+\n+\ti = 0;\n+\twhile (1) {\n+\t\tif (strcasecmp(token, \"G\") == 0)\n+\t\t\tvlan[i++] = RTE_COLOR_GREEN;\n+\t\telse if (strcasecmp(token, \"Y\") == 0)\n+\t\t\tvlan[i++] = RTE_COLOR_YELLOW;\n+\t\telse if (strcasecmp(token, \"R\") == 0)\n+\t\t\tvlan[i++] = RTE_COLOR_RED;\n+\t\telse {\n+\t\t\tfree(vlan);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (i == MAX_VLAN_TABLE_ENTRIES)\n+\t\t\tbreak;\n+\n+\t\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\t\tif (token == NULL) {\n+\t\t\tfree(vlan);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\t*vlan_table = vlan;\n+\treturn 0;\n+}\n+\n+static int\n+parse_vlan_table_entries(char *str, enum rte_color **vlan_table)\n+{\n+\tchar *token;\n+\tint i = 0;\n+\n+\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\tif (token == NULL)\n+\t\treturn 0;\n+\n+\t/* Allocate memory for vlan table */\n+\t*vlan_table = (enum rte_color *)malloc(MAX_VLAN_TABLE_ENTRIES *\n+\t\tsizeof(enum rte_color));\n+\tif (*vlan_table == NULL)\n+\t\treturn -1;\n+\n+\twhile (1) {\n+\t\tif (strcasecmp(token, \"G\") == 0)\n+\t\t\t(*vlan_table)[i++] = RTE_COLOR_GREEN;\n+\t\telse if (strcasecmp(token, \"Y\") == 0)\n+\t\t\t(*vlan_table)[i++] = RTE_COLOR_YELLOW;\n+\t\telse if (strcasecmp(token, \"R\") == 0)\n+\t\t\t(*vlan_table)[i++] = RTE_COLOR_RED;\n+\t\telse {\n+\t\t\tfree(*vlan_table);\n+\t\t\treturn -1;\n+\t\t}\n+\t\tif (i == MAX_VLAN_TABLE_ENTRIES)\n+\t\t\tbreak;\n+\n+\t\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\t\tif (token == NULL) {\n+\t\t\tfree(*vlan_table);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\treturn 0;\n+}\n+\n static int\n parse_dscp_table_entries(char *str, enum rte_color **dscp_table)\n {\n@@ -124,9 +241,30 @@ parse_dscp_table_entries(char *str, enum rte_color **dscp_table)\n \treturn 0;\n }\n \n+static int\n+parse_default_input_color_str(char *str, uint64_t *def_inp_color)\n+{\n+\tchar *token;\n+\n+\ttoken = strtok_r(str, PARSE_DELIMITER, &str);\n+\tif (token == NULL)\n+\t\treturn 0;\n+\n+\tif (strcasecmp(token, \"G\") == 0)\n+\t\t*def_inp_color = RTE_COLOR_GREEN;\n+\telse if (strcasecmp(token, \"Y\") == 0)\n+\t\t*def_inp_color = RTE_COLOR_YELLOW;\n+\telse if (strcasecmp(token, \"R\") == 0)\n+\t\t*def_inp_color = RTE_COLOR_RED;\n+\telse\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n static int\n parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,\n-\tenum rte_color **dscp_table)\n+\tenum rte_color **vlan_table, enum rte_color **dscp_table)\n {\n \tchar *token;\n \tuint64_t previous_mtr_color = 0;\n@@ -147,8 +285,7 @@ parse_meter_color_str(char *c_str, uint32_t *use_prev_meter_color,\n \t\treturn 0;\n \t}\n \n-\t/* Parse dscp table entries */\n-\tret = parse_dscp_table_entries(c_str, dscp_table);\n+\tret = parse_input_color_table_entries(c_str, dscp_table, vlan_table);\n \tif (ret != 0)\n \t\treturn -1;\n \n@@ -192,6 +329,43 @@ parse_multi_token_string(char *t_str, uint16_t *port_id,\n \treturn 0;\n }\n \n+static int\n+parse_multi_token_vlan_str(char *t_str, uint16_t *port_id, uint32_t *mtr_id,\n+\tenum rte_color **vlan_table)\n+{\n+\tuint64_t val;\n+\tchar *token;\n+\tint ret;\n+\n+\t/* First token: port id */\n+\ttoken = strtok_r(t_str, PARSE_DELIMITER, &t_str);\n+\tif (token ==  NULL)\n+\t\treturn -1;\n+\n+\tret = parse_uint(&val, token);\n+\tif (ret != 0 || val > UINT16_MAX)\n+\t\treturn -1;\n+\n+\t*port_id = val;\n+\n+\t/* Second token: meter id */\n+\ttoken = strtok_r(t_str, PARSE_DELIMITER, &t_str);\n+\tif (token == NULL)\n+\t\treturn 0;\n+\n+\tret = parse_uint(&val, token);\n+\tif (ret != 0 || val > UINT32_MAX)\n+\t\treturn -1;\n+\n+\t*mtr_id = val;\n+\n+\tret = parse_vlan_table_entries(t_str, vlan_table);\n+\tif (ret != 0)\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n /* *** Show Port Meter Capabilities *** */\n struct cmd_show_port_meter_cap_result {\n \tcmdline_fixed_string_t show;\n@@ -277,6 +451,10 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,\n \tprintf(\"cap.trtcm_rfc4115_packet_mode_supported %\" PRId32 \"\\n\",\n \t\tcap.trtcm_rfc4115_packet_mode_supported);\n \tprintf(\"cap.stats_mask %\" PRIx64 \"\\n\", cap.stats_mask);\n+\tprintf(\"cap.input_color_proto_mask 0x%\" PRIx64 \"\\n\",\n+\t\tcap.input_color_proto_mask);\n+\tprintf(\"cap.separate_input_color_table_per_port %\" PRId32 \"\\n\",\n+\t\tcap.separate_input_color_table_per_port);\n }\n \n cmdline_parse_inst_t cmd_show_port_meter_cap = {\n@@ -721,6 +899,7 @@ struct cmd_create_port_meter_result {\n \tcmdline_fixed_string_t r_action;\n \tuint64_t statistics_mask;\n \tuint32_t shared;\n+\tcmdline_fixed_string_t default_input_color;\n \tcmdline_multi_string_t meter_input_color;\n };\n \n@@ -754,6 +933,9 @@ static cmdline_parse_token_num_t cmd_create_port_meter_statistics_mask =\n static cmdline_parse_token_num_t cmd_create_port_meter_shared =\n \tTOKEN_NUM_INITIALIZER(struct cmd_create_port_meter_result,\n \t\tshared, RTE_UINT32);\n+static cmdline_parse_token_string_t cmd_create_port_meter_default_input_color =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,\n+\t\tdefault_input_color, \"R#Y#G#r#y#g\");\n static cmdline_parse_token_string_t cmd_create_port_meter_input_color =\n \tTOKEN_STRING_INITIALIZER(struct cmd_create_port_meter_result,\n \t\tmeter_input_color, TOKEN_STRING_MULTI);\n@@ -769,7 +951,10 @@ static void cmd_create_port_meter_parsed(void *parsed_result,\n \tuint32_t shared = res->shared;\n \tuint32_t use_prev_meter_color = 0;\n \tuint16_t port_id = res->port_id;\n+\tuint64_t def_inp_color = 0;\n \tenum rte_color *dscp_table = NULL;\n+\tenum rte_color *vlan_table = NULL;\n+\tchar *def_color_str = res->default_input_color;\n \tchar *c_str = res->meter_input_color;\n \tint ret;\n \n@@ -780,8 +965,18 @@ static void cmd_create_port_meter_parsed(void *parsed_result,\n \tmemset(&params, 0, sizeof(struct rte_mtr_params));\n \tparams.meter_profile_id = res->profile_id;\n \tparams.meter_policy_id = res->policy_id;\n+\n+\t/* Parse meter default input color string params */\n+\tret = parse_default_input_color_str(def_color_str, &def_inp_color);\n+\tif (ret) {\n+\t\tfprintf(stderr,\n+\t\t\t\" Meter default input color is invalid\\n\");\n+\t\treturn;\n+\t}\n+\n \t/* Parse meter input color string params */\n-\tret = parse_meter_color_str(c_str, &use_prev_meter_color, &dscp_table);\n+\tret = parse_meter_color_str(c_str, &use_prev_meter_color, &vlan_table,\n+\t\t&dscp_table);\n \tif (ret) {\n \t\tfprintf(stderr,\n \t\t\t\" Meter input color params string parse error\\n\");\n@@ -789,16 +984,20 @@ static void cmd_create_port_meter_parsed(void *parsed_result,\n \t}\n \n \tparams.use_prev_mtr_color = use_prev_meter_color;\n+\tparams.vlan_table = vlan_table;\n \tparams.dscp_table = dscp_table;\n+\tparams.default_input_color = def_inp_color;\n \n \tif (strcmp(res->meter_enable, \"yes\") == 0)\n \t\tparams.meter_enable = 1;\n \telse\n \t\tparams.meter_enable = 0;\n+\n \tparams.stats_mask = res->statistics_mask;\n \n \tret = rte_mtr_create(port_id, mtr_id, &params, shared, &error);\n \tif (ret != 0) {\n+\t\tfree(vlan_table);\n \t\tfree(dscp_table);\n \t\tprint_err_msg(&error);\n \t\treturn;\n@@ -809,8 +1008,10 @@ cmdline_parse_inst_t cmd_create_port_meter = {\n \t.f = cmd_create_port_meter_parsed,\n \t.data = NULL,\n \t.help_str = \"create port meter <port_id> <mtr_id> <profile_id> <policy_id> \"\n-\t\t\"<meter_enable>(yes|no) <stats_mask> <shared> <use_pre_meter_color> \"\n-\t\t\"[<dscp_tbl_entry0> <dscp_tbl_entry1> ...<dscp_tbl_entry63>]\",\n+\t\t\"<meter_enable>(yes|no) <stats_mask> <shared> \"\n+\t\t\"<default_input_color>(g|y|r) <use_pre_meter_color> \"\n+\t\t\"[<dscp_tbl_entry0> <dscp_tbl_entry1> ...<dscp_tbl_entry63>] \"\n+\t\t\"[<vlan_tbl_entry0> <vlan_tbl_entry1> ... <vlan_tbl_entry15>]\",\n \t.tokens = {\n \t\t(void *)&cmd_create_port_meter_create,\n \t\t(void *)&cmd_create_port_meter_port,\n@@ -822,6 +1023,7 @@ cmdline_parse_inst_t cmd_create_port_meter = {\n \t\t(void *)&cmd_create_port_meter_meter_enable,\n \t\t(void *)&cmd_create_port_meter_statistics_mask,\n \t\t(void *)&cmd_create_port_meter_shared,\n+\t\t(void *)&cmd_create_port_meter_default_input_color,\n \t\t(void *)&cmd_create_port_meter_input_color,\n \t\tNULL,\n \t},\n@@ -1224,6 +1426,344 @@ cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {\n \t},\n };\n \n+/* *** Set Port Meter VLAN Table *** */\n+struct cmd_set_port_meter_vlan_table_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t meter;\n+\tcmdline_fixed_string_t vlan_table;\n+\tcmdline_multi_string_t token_string;\n+};\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_vlan_table_set =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_vlan_table_result, set, \"set\");\n+static cmdline_parse_token_string_t cmd_set_port_meter_vlan_table_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_vlan_table_result, port, \"port\");\n+static cmdline_parse_token_string_t cmd_set_port_meter_vlan_table_meter =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_vlan_table_result, meter, \"meter\");\n+static cmdline_parse_token_string_t cmd_set_port_meter_vlan_table_vlan_table =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_vlan_table_result,\n+\t\tvlan_table, \"vlan table\");\n+static cmdline_parse_token_string_t cmd_set_port_meter_vlan_table_token_string =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_set_port_meter_vlan_table_result,\n+\t\ttoken_string, TOKEN_STRING_MULTI);\n+\n+static void cmd_set_port_meter_vlan_table_parsed(void *parsed_result,\n+\t__rte_unused struct cmdline *cl,\n+\t__rte_unused void *data)\n+{\n+\tstruct cmd_set_port_meter_vlan_table_result *res = parsed_result;\n+\tstruct rte_mtr_error error;\n+\tenum rte_color *vlan_table = NULL;\n+\tchar *t_str = res->token_string;\n+\tuint32_t mtr_id = 0;\n+\tuint16_t port_id;\n+\tint ret;\n+\n+\t/* Parse string */\n+\tret = parse_multi_token_vlan_str(t_str, &port_id, &mtr_id, &vlan_table);\n+\tif (ret) {\n+\t\tfprintf(stderr, \" Multi token string parse error\\n\");\n+\t\treturn;\n+\t}\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\tgoto free_table;\n+\n+\t/* Update Meter VLAN Table*/\n+\tret = rte_mtr_meter_vlan_table_update(port_id, mtr_id,\n+\t\tvlan_table, &error);\n+\tif (ret != 0)\n+\t\tprint_err_msg(&error);\n+\n+free_table:\n+\tfree(vlan_table);\n+}\n+\n+cmdline_parse_inst_t cmd_set_port_meter_vlan_table = {\n+\t.f = cmd_set_port_meter_vlan_table_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set port meter vlan table <port_id> <mtr_id> \"\n+\t\t\"[<vlan_tbl_entry0> <vlan_tbl_entry1> ... <vlan_tbl_entry15>]\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_port_meter_vlan_table_set,\n+\t\t(void *)&cmd_set_port_meter_vlan_table_port,\n+\t\t(void *)&cmd_set_port_meter_vlan_table_meter,\n+\t\t(void *)&cmd_set_port_meter_vlan_table_vlan_table,\n+\t\t(void *)&cmd_set_port_meter_vlan_table_token_string,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Set Port Meter input protocol *** */\n+struct cmd_set_port_meter_in_proto_result {\n+\tcmdline_fixed_string_t set;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t meter;\n+\tcmdline_fixed_string_t protocol;\n+\tcmdline_fixed_string_t proto;\n+\tuint32_t prio;\n+\tuint32_t mtr_id;\n+\tuint16_t port_id;\n+};\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_in_proto_set =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, set, \"set\");\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_in_proto_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, port, \"port\");\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_in_proto_meter =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, meter, \"meter\");\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_in_proto_protocol =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, protocol, \"proto\");\n+\n+static cmdline_parse_token_string_t cmd_set_port_meter_in_proto_proto =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, proto,\n+\t\t\"outer_vlan#inner_vlan#outer_ip#inner_ip\");\n+\n+static cmdline_parse_token_num_t cmd_set_port_meter_in_proto_prio =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, prio, RTE_UINT32);\n+\n+static cmdline_parse_token_num_t cmd_set_port_meter_in_proto_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, port_id, RTE_UINT16);\n+\n+static cmdline_parse_token_num_t cmd_set_port_meter_in_proto_mtr_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_set_port_meter_in_proto_result, mtr_id, RTE_UINT32);\n+\n+static void cmd_set_port_meter_in_proto_parsed(void *parsed_result,\n+\t__rte_unused struct cmdline *cl,\n+\t__rte_unused void *data)\n+{\n+\tstruct cmd_set_port_meter_in_proto_result *res = parsed_result;\n+\tenum rte_mtr_color_in_protocol proto;\n+\tstruct rte_mtr_error error;\n+\tint ret;\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tif (strcmp(res->proto, \"outer_vlan\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN;\n+\telse if (strcmp(res->proto, \"inner_vlan\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_INNER_VLAN;\n+\telse if (strcmp(res->proto, \"outer_ip\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_OUTER_IP;\n+\telse if (strcmp(res->proto, \"inner_ip\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_INNER_IP;\n+\telse {\n+\t\tprintf(\"Invalid protocol\\n\");\n+\t\treturn;\n+\t}\n+\n+\t/* Update Meter input proto and priority */\n+\tret = rte_mtr_color_in_protocol_set(res->port_id, res->mtr_id,\n+\t\tproto, res->prio, &error);\n+\tif (ret != 0)\n+\t\tprint_err_msg(&error);\n+}\n+\n+cmdline_parse_inst_t cmd_set_port_meter_in_proto = {\n+\t.f = cmd_set_port_meter_in_proto_parsed,\n+\t.data = NULL,\n+\t.help_str = \"set port meter proto <port_id> <mtr_id> <proto> \"\n+\t\t\"<prio>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_set_port_meter_in_proto_set,\n+\t\t(void *)&cmd_set_port_meter_in_proto_port,\n+\t\t(void *)&cmd_set_port_meter_in_proto_meter,\n+\t\t(void *)&cmd_set_port_meter_in_proto_protocol,\n+\t\t(void *)&cmd_set_port_meter_in_proto_port_id,\n+\t\t(void *)&cmd_set_port_meter_in_proto_mtr_id,\n+\t\t(void *)&cmd_set_port_meter_in_proto_proto,\n+\t\t(void *)&cmd_set_port_meter_in_proto_prio,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get Port Meter input protocol *** */\n+struct cmd_get_port_meter_in_proto_result {\n+\tcmdline_fixed_string_t get;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t meter;\n+\tcmdline_fixed_string_t protocol;\n+\tuint32_t mtr_id;\n+\tuint16_t port_id;\n+};\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_get =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, get, \"get\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, port, \"port\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_meter =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, meter, \"meter\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_protocol =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, protocol, \"proto\");\n+\n+static cmdline_parse_token_num_t cmd_get_port_meter_in_proto_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, port_id, RTE_UINT16);\n+\n+static cmdline_parse_token_num_t cmd_get_port_meter_in_proto_mtr_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_result, mtr_id, RTE_UINT32);\n+\n+static void cmd_get_port_meter_in_proto_parsed(void *parsed_result,\n+\t__rte_unused struct cmdline *cl,\n+\t__rte_unused void *data)\n+{\n+\tstruct cmd_set_port_meter_in_proto_result *res = parsed_result;\n+\tstruct rte_mtr_error error;\n+\tuint64_t proto_mask = 0;\n+\tint ret;\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\t/* Update Meter input proto and priority */\n+\tret = rte_mtr_color_in_protocol_get(res->port_id, res->mtr_id,\n+\t\t&proto_mask, &error);\n+\tif (ret != 0)\n+\t\tprint_err_msg(&error);\n+\n+\tprintf(\"Enabled protocols:\\n\");\n+\tif (proto_mask & RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN)\n+\t\tprintf(\"\\touter_vlan\\n\");\n+\tif (proto_mask & RTE_MTR_COLOR_IN_PROTO_INNER_VLAN)\n+\t\tprintf(\"\\tinner_vlan\\n\");\n+\tif (proto_mask & RTE_MTR_COLOR_IN_PROTO_OUTER_IP)\n+\t\tprintf(\"\\touter_ip\\n\");\n+\tif (proto_mask & RTE_MTR_COLOR_IN_PROTO_INNER_IP)\n+\t\tprintf(\"\\tinner_ip\\n\");\n+}\n+\n+cmdline_parse_inst_t cmd_get_port_meter_in_proto = {\n+\t.f = cmd_get_port_meter_in_proto_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get port meter proto <port_id> <mtr_id>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_port_meter_in_proto_get,\n+\t\t(void *)&cmd_get_port_meter_in_proto_port,\n+\t\t(void *)&cmd_get_port_meter_in_proto_meter,\n+\t\t(void *)&cmd_get_port_meter_in_proto_protocol,\n+\t\t(void *)&cmd_get_port_meter_in_proto_port_id,\n+\t\t(void *)&cmd_get_port_meter_in_proto_mtr_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Get Port Meter input protocol priority *** */\n+struct cmd_get_port_meter_in_proto_prio_result {\n+\tcmdline_fixed_string_t get;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t meter;\n+\tcmdline_fixed_string_t protocol;\n+\tcmdline_fixed_string_t proto;\n+\tuint32_t mtr_id;\n+\tuint16_t port_id;\n+};\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_prio_get =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, get, \"get\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_prio_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, port, \"port\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_prio_meter =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, meter, \"meter\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_prio_protocol =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, protocol,\n+\t\t\"proto_prio\");\n+\n+static cmdline_parse_token_string_t cmd_get_port_meter_in_proto_prio_proto =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, proto,\n+\t\t\"outer_vlan#inner_vlan#outer_ip#inner_ip\");\n+\n+static cmdline_parse_token_num_t cmd_get_port_meter_in_proto_prio_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, port_id,\n+\t\tRTE_UINT16);\n+\n+static cmdline_parse_token_num_t cmd_get_port_meter_in_proto_prio_mtr_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_get_port_meter_in_proto_prio_result, mtr_id,\n+\t\tRTE_UINT32);\n+\n+static void cmd_get_port_meter_in_proto_prio_parsed(void *parsed_result,\n+\t__rte_unused struct cmdline *cl,\n+\t__rte_unused void *data)\n+{\n+\tstruct cmd_get_port_meter_in_proto_prio_result *res = parsed_result;\n+\tenum rte_mtr_color_in_protocol proto;\n+\tstruct rte_mtr_error error;\n+\tuint32_t prio = 0;\n+\tint ret;\n+\n+\tif (port_id_is_invalid(res->port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tif (strcmp(res->proto, \"outer_vlan\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN;\n+\telse if (strcmp(res->proto, \"inner_vlan\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_INNER_VLAN;\n+\telse if (strcmp(res->proto, \"outer_ip\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_OUTER_IP;\n+\telse if (strcmp(res->proto, \"inner_ip\") == 0)\n+\t\tproto = RTE_MTR_COLOR_IN_PROTO_INNER_IP;\n+\telse {\n+\t\tprintf(\"Invalid protocol\\n\");\n+\t\treturn;\n+\t}\n+\n+\t/* Get Meter input proto and priority */\n+\tret = rte_mtr_color_in_protocol_priority_get(res->port_id, res->mtr_id,\n+\t\tproto, &prio, &error);\n+\tif (ret != 0)\n+\t\tprint_err_msg(&error);\n+}\n+\n+cmdline_parse_inst_t cmd_get_port_meter_in_proto_prio = {\n+\t.f = cmd_get_port_meter_in_proto_prio_parsed,\n+\t.data = NULL,\n+\t.help_str = \"get port meter proto_prio <port_id> <mtr_id> <proto>\",\n+\t.tokens = {\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_get,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_port,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_meter,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_protocol,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_port_id,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_mtr_id,\n+\t\t(void *)&cmd_get_port_meter_in_proto_prio_proto,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** Set Port Meter Stats Mask *** */\n struct cmd_set_port_meter_stats_mask_result {\n \tcmdline_fixed_string_t set;\ndiff --git a/app/test-pmd/cmdline_mtr.h b/app/test-pmd/cmdline_mtr.h\nindex 2415fc16c3..23eaa5bc03 100644\n--- a/app/test-pmd/cmdline_mtr.h\n+++ b/app/test-pmd/cmdline_mtr.h\n@@ -19,6 +19,10 @@ extern cmdline_parse_inst_t cmd_del_port_meter;\n extern cmdline_parse_inst_t cmd_del_port_meter_policy;\n extern cmdline_parse_inst_t cmd_set_port_meter_profile;\n extern cmdline_parse_inst_t cmd_set_port_meter_dscp_table;\n+extern cmdline_parse_inst_t cmd_set_port_meter_vlan_table;\n+extern cmdline_parse_inst_t cmd_set_port_meter_in_proto;\n+extern cmdline_parse_inst_t cmd_get_port_meter_in_proto;\n+extern cmdline_parse_inst_t cmd_get_port_meter_in_proto_prio;\n extern cmdline_parse_inst_t cmd_set_port_meter_stats_mask;\n extern cmdline_parse_inst_t cmd_show_port_meter_stats;\n void print_mtr_err_msg(struct rte_mtr_error *error);\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 0b7a53fdf1..4509a47ed4 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -2527,9 +2527,10 @@ create port meter\n Create new meter object for the ethernet device::\n \n    testpmd> create port meter (port_id) (mtr_id) (profile_id) \\\n-   (policy_id) (meter_enable) (stats_mask) (shared) \\\n+   (policy_id) (meter_enable) (stats_mask) (shared) (default_input_color) \\\n    (use_pre_meter_color) [(dscp_tbl_entry0) (dscp_tbl_entry1)...\\\n-   (dscp_tbl_entry63)]\n+   (dscp_tbl_entry63)] [(vlan_tbl_entry0) (vlan_tbl_entry1) ... \\\n+   (vlan_tbl_entry15)]\n \n where:\n \n@@ -2542,12 +2543,17 @@ where:\n   meter object.\n * ``shared``:  When this parameter has a non-zero value, the meter object is\n   shared by multiple flows. Otherwise, meter object is used by single flow.\n+* ``default_input_color``:  Default input color for incoming packets.\n+  If incoming packet misses DSCP or VLAN input color table then it will be used\n+  as input color.\n * ``use_pre_meter_color``: When this parameter has a non-zero value, the\n   input color for the current meter object is determined by the latest meter\n   object in the same flow. Otherwise, the current meter object uses the\n   *dscp_table* to determine the input color.\n * ``dscp_tbl_entryx``: DSCP table entry x providing meter providing input\n   color, 0 <= x <= 63.\n+* ``vlan_tbl_entryx``: VLAN table entry x providing meter input color,\n+  0 <= x <= 15.\n \n enable port meter\n ~~~~~~~~~~~~~~~~~\n@@ -2585,6 +2591,31 @@ Set meter dscp table for the ethernet device::\n    testpmd> set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0) \\\n    (dscp_tbl_entry1)...(dscp_tbl_entry63)]\n \n+set port meter vlan table\n+~~~~~~~~~~~~~~~~~~~~~~~~~\n+Set meter vlan table for the ethernet device::\n+\n+   testpmd> set port meter vlan table (port_id) (mtr_id) [(vlan_tbl_entry0) \\\n+   (vlan_tbl_entry1)...(vlan_tbl_entry15)]\n+\n+set port meter protocol\n+~~~~~~~~~~~~~~~~~~~~~~~\n+Set meter protocol and corresponding priority::\n+\n+   testpmd> set port meter proto (port_id) (mtr_id) (proto) (prio)\n+\n+get port meter protocol\n+~~~~~~~~~~~~~~~~~~~~~~~\n+Get meter protocol::\n+\n+   testpmd> get port meter proto (port_id) (mtr_id)\n+\n+get port meter protocol priority\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+Get priority associated to meter protocol::\n+\n+   testpmd> get port meter proto_prio (port_id) (mtr_id) (proto)\n+\n set port meter stats mask\n ~~~~~~~~~~~~~~~~~~~~~~~~~\n \n",
    "prefixes": [
        "v5",
        "1/1"
    ]
}