get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 28991,
    "url": "http://patches.dpdk.org/api/patches/28991/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20170920095653.110750-2-jasvinder.singh@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<20170920095653.110750-2-jasvinder.singh@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20170920095653.110750-2-jasvinder.singh@intel.com",
    "date": "2017-09-20T09:56:50",
    "name": "[dpdk-dev,v3,2/5] app/test-pmd: add CLI for TM capability and stats",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "51307011365053db6a04d1ad39dd13791344c277",
    "submitter": {
        "id": 285,
        "url": "http://patches.dpdk.org/api/people/285/?format=api",
        "name": "Jasvinder Singh",
        "email": "jasvinder.singh@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20170920095653.110750-2-jasvinder.singh@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/28991/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/28991/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 4B6561AEE9;\n\tWed, 20 Sep 2017 11:44:59 +0200 (CEST)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 6087D239\n\tfor <dev@dpdk.org>; Wed, 20 Sep 2017 11:44:54 +0200 (CEST)",
            "from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t20 Sep 2017 02:44:53 -0700",
            "from silpixa00381635.ir.intel.com (HELO\n\tsilpixa00381635.ger.corp.intel.com) ([10.237.222.149])\n\tby orsmga004.jf.intel.com with ESMTP; 20 Sep 2017 02:44:51 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.42,420,1500966000\"; d=\"scan'208\";a=\"130609043\"",
        "From": "Jasvinder Singh <jasvinder.singh@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "cristian.dumitrescu@intel.com, jingjing.wu@intel.com,\n\tpablo.de.lara.guarch@intel.com",
        "Date": "Wed, 20 Sep 2017 10:56:50 +0100",
        "Message-Id": "<20170920095653.110750-2-jasvinder.singh@intel.com>",
        "X-Mailer": "git-send-email 2.9.3",
        "In-Reply-To": "<20170920095653.110750-1-jasvinder.singh@intel.com>",
        "References": "<20170914115302.33995-1-jasvinder.singh@intel.com>\n\t<20170920095653.110750-1-jasvinder.singh@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 2/5] app/test-pmd: add CLI for TM capability\n\tand stats",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add following CLIs to testpmd application;\n- commands to display TM capability information.\n  (per port, per hierarchy level and per hierarchy node)\n- command to display hiearchy node type\n- stats collection\n\nSigned-off-by: Jasvinder Singh <jasvinder.singh@intel.com>\n---\nv3 change:\n- Implements feedback from Pablo[1]\n - move TM API related CLIs into cmdline_tm.c \n - split patch into small patches\n - replace link status check with testpmd fn port_is_started()\n\n[1]http://dpdk.org/ml/archives/dev/2017-September/075748.html\n\n app/test-pmd/Makefile     |   1 +\n app/test-pmd/cmdline.c    |  34 ++-\n app/test-pmd/cmdline_tm.c | 739 ++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 773 insertions(+), 1 deletion(-)\n create mode 100644 app/test-pmd/cmdline_tm.c",
    "diff": "diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile\nindex 2c50f68..d1252bc 100644\n--- a/app/test-pmd/Makefile\n+++ b/app/test-pmd/Makefile\n@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_IEEE1588) += ieee1588fwd.c\n \n ifeq ($(CONFIG_RTE_LIBRTE_PMD_SOFTNIC)$(CONFIG_RTE_LIBRTE_SCHED),yy)\n SRCS-y += tm.c\n+SRCS-y += cmdline_tm.c\n endif\n \n ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\ndiff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex ccdf239..6012c3a 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -230,6 +230,23 @@ static void cmd_help_long_parsed(void *parsed_result,\n \n \t\t\t\"clear vf stats (port_id) (vf_id)\\n\"\n \t\t\t\"    Reset a VF's statistics.\\n\\n\"\n+\n+#ifdef TM_MODE\n+\t\t\t\"show port tm cap (port_id)\\n\"\n+\t\t\t\"\tDisplay the port TM capability.\\n\\n\"\n+\n+\t\t\t\"show port tm level cap (port_id) (level_id)\\n\"\n+\t\t\t\"\tDisplay the port TM hierarchical level capability.\\n\\n\"\n+\n+\t\t\t\"show port tm node cap (port_id) (node_id)\\n\"\n+\t\t\t\"\tDisplay the port TM node capability.\\n\\n\"\n+\n+\t\t\t\"show port tm node type (port_id) (node_id)\\n\"\n+\t\t\t\"\tDisplay the port TM node type.\\n\\n\"\n+\n+\t\t\t\"show port tm node stats (port_id) (node_id) (clear)\\n\"\n+\t\t\t\"\tDisplay the port TM node stats.\\n\\n\"\n+#endif\n \t\t);\n \t}\n \n@@ -14189,7 +14206,15 @@ cmdline_parse_inst_t cmd_load_from_file = {\n \t},\n };\n \n-/* ******************************************************************************** */\n+#ifdef TM_MODE\n+extern cmdline_parse_inst_t cmd_show_port_tm_cap;\n+extern cmdline_parse_inst_t cmd_show_port_tm_level_cap;\n+extern cmdline_parse_inst_t cmd_show_port_tm_node_cap;\n+extern cmdline_parse_inst_t cmd_show_port_tm_node_type;\n+extern cmdline_parse_inst_t cmd_show_port_tm_node_stats;\n+#endif\n+\n+/* *********************************************************************** */\n \n /* list of instructions */\n cmdline_parse_ctx_t main_ctx[] = {\n@@ -14380,6 +14405,13 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_ptype_mapping_replace,\n \t(cmdline_parse_inst_t *)&cmd_ptype_mapping_reset,\n \t(cmdline_parse_inst_t *)&cmd_ptype_mapping_update,\n+#ifdef TM_MODE\n+\t(cmdline_parse_inst_t *)&cmd_show_port_tm_cap,\n+\t(cmdline_parse_inst_t *)&cmd_show_port_tm_level_cap,\n+\t(cmdline_parse_inst_t *)&cmd_show_port_tm_node_cap,\n+\t(cmdline_parse_inst_t *)&cmd_show_port_tm_node_type,\n+\t(cmdline_parse_inst_t *)&cmd_show_port_tm_node_stats,\n+#endif\n \tNULL,\n };\n \ndiff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c\nnew file mode 100644\nindex 0000000..a20942e\n--- /dev/null\n+++ b/app/test-pmd/cmdline_tm.c\n@@ -0,0 +1,739 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2017 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <cmdline_parse.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_parse_string.h>\n+\n+#include <rte_ethdev.h>\n+#include <rte_flow.h>\n+#include <rte_sched.h>\n+#include <rte_eth_softnic.h>\n+#include <rte_tm.h>\n+\n+#include \"testpmd.h\"\n+\n+/** Display TM Error Message */\n+static void\n+print_err_msg(struct rte_tm_error *error)\n+{\n+\tstatic const char *const errstrlist[] = {\n+\t\t[RTE_TM_ERROR_TYPE_NONE] = \"no error\",\n+\t\t[RTE_TM_ERROR_TYPE_UNSPECIFIED] = \"cause unspecified\",\n+\t\t[RTE_TM_ERROR_TYPE_CAPABILITIES]\n+\t\t\t= \"capability parameter null\",\n+\t\t[RTE_TM_ERROR_TYPE_LEVEL_ID] = \"level id\",\n+\t\t[RTE_TM_ERROR_TYPE_WRED_PROFILE]\n+\t\t\t= \"wred profile null\",\n+\t\t[RTE_TM_ERROR_TYPE_WRED_PROFILE_GREEN] = \"wred profile(green)\",\n+\t\t[RTE_TM_ERROR_TYPE_WRED_PROFILE_YELLOW]\n+\t\t\t= \"wred profile(yellow)\",\n+\t\t[RTE_TM_ERROR_TYPE_WRED_PROFILE_RED] = \"wred profile(red)\",\n+\t\t[RTE_TM_ERROR_TYPE_WRED_PROFILE_ID] = \"wred profile id\",\n+\t\t[RTE_TM_ERROR_TYPE_SHARED_WRED_CONTEXT_ID]\n+\t\t\t= \"shared wred context id\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE] = \"shaper profile null\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE]\n+\t\t\t= \"committed rate field (shaper profile)\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE]\n+\t\t\t= \"committed size field (shaper profile)\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE]\n+\t\t\t= \"peak rate field (shaper profile)\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE]\n+\t\t\t= \"peak size field (shaper profile)\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN]\n+\t\t\t= \"packet adjust length field (shaper profile)\",\n+\t\t[RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID] = \"shaper profile id\",\n+\t\t[RTE_TM_ERROR_TYPE_SHARED_SHAPER_ID] = \"shared shaper id\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID] = \"parent node id\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PRIORITY] = \"node priority\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_WEIGHT] = \"node weight\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS] = \"node parameter null\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID]\n+\t\t\t= \"shaper profile id field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID]\n+\t\t\t= \"shared shaper id field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS]\n+\t\t\t= \"num shared shapers field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE]\n+\t\t\t= \"wfq weght mode field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES]\n+\t\t\t= \"num strict priorities field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN]\n+\t\t\t= \"congestion management mode field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID] =\n+\t\t\t\"wred profile id field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID]\n+\t\t\t= \"shared wred context id field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS]\n+\t\t\t= \"num shared wred contexts field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_PARAMS_STATS]\n+\t\t\t= \"stats field (node params)\",\n+\t\t[RTE_TM_ERROR_TYPE_NODE_ID] = \"node id\",\n+\t};\n+\n+\tconst char *errstr;\n+\tchar buf[64];\n+\n+\tif ((unsigned int)error->type >= RTE_DIM(errstrlist) ||\n+\t\t!errstrlist[error->type])\n+\t\terrstr = \"unknown type\";\n+\telse\n+\t\terrstr = errstrlist[error->type];\n+\n+\tif (error->cause)\n+\t\tsnprintf(buf, sizeof(buf), \"cause: %p, \", error->cause);\n+\n+\tprintf(\"%s: %s%s (error %d)\\n\", errstr, error->cause ? buf : \"\",\n+\t\terror->message ? error->message : \"(no stated reason)\",\n+\t\terror->type);\n+}\n+\n+/* *** Port TM Capability *** */\n+struct cmd_show_port_tm_cap_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t tm;\n+\tcmdline_fixed_string_t cap;\n+\tuint8_t port_id;\n+};\n+\n+cmdline_parse_token_string_t cmd_show_port_tm_cap_show =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_cap_result,\n+\t\tshow, \"show\");\n+cmdline_parse_token_string_t cmd_show_port_tm_cap_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_cap_result,\n+\t\tport, \"port\");\n+cmdline_parse_token_string_t cmd_show_port_tm_cap_tm =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_cap_result,\n+\t\ttm, \"tm\");\n+cmdline_parse_token_string_t cmd_show_port_tm_cap_cap =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_cap_result,\n+\t\tcap, \"cap\");\n+cmdline_parse_token_num_t cmd_show_port_tm_cap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_cap_result,\n+\t\t port_id, UINT8);\n+\n+static void cmd_show_port_tm_cap_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_port_tm_cap_result *res = parsed_result;\n+\tstruct rte_port *port;\n+\tstruct rte_tm_capabilities cap;\n+\tstruct rte_tm_error error;\n+\tuint8_t port_id = res->port_id;\n+\tuint32_t i;\n+\tint ret;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tport = &ports[port_id];\n+\n+\t/* Port tm flag */\n+\tif (port->softport.tm_flag == 0) {\n+\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\t/* Forward mode: tm */\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n+\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\tmemset(&cap, 0, sizeof(struct rte_tm_capabilities));\n+\tret = rte_tm_capabilities_get(port_id, &cap, &error);\n+\tif (ret) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\n+\tprintf(\"\\n****   Port TM Capabilities ****\\n\\n\");\n+\tprintf(\"cap.n_nodes_max %u\\n\", cap.n_nodes_max);\n+\tprintf(\"cap.n_levels_max %u\\n\", cap.n_levels_max);\n+\tprintf(\"cap.non_leaf_nodes_identical %d\\n\",\n+\t\tcap.non_leaf_nodes_identical);\n+\tprintf(\"cap.leaf_nodes_identical %d\\n\", cap.leaf_nodes_identical);\n+\tprintf(\"cap.shaper_n_max %u\\n\", cap.shaper_n_max);\n+\tprintf(\"cap.shaper_private_n_max %u\\n\", cap.shaper_private_n_max);\n+\tprintf(\"cap.shaper_private_dual_rate_n_max %d\\n\",\n+\t\tcap.shaper_private_dual_rate_n_max);\n+\tprintf(\"cap.shaper_private_rate_min %lu\\n\",\n+\t\tcap.shaper_private_rate_min);\n+\tprintf(\"cap.shaper_private_rate_max %lu\\n\",\n+\t\tcap.shaper_private_rate_max);\n+\tprintf(\"cap.shaper_shared_n_max %u\\n\", cap.shaper_shared_n_max);\n+\tprintf(\"cap.shaper_shared_n_nodes_per_shaper_max %u\\n\",\n+\t\tcap.shaper_shared_n_nodes_per_shaper_max);\n+\tprintf(\"cap.shaper_shared_n_shapers_per_node_max %u\\n\",\n+\t\tcap.shaper_shared_n_shapers_per_node_max);\n+\tprintf(\"cap.shaper_shared_dual_rate_n_max %u\\n\",\n+\t\tcap.shaper_shared_dual_rate_n_max);\n+\tprintf(\"cap.shaper_shared_rate_min %lu\\n\",\n+\t\tcap.shaper_shared_rate_min);\n+\tprintf(\"cap.shaper_shared_rate_max %lu\\n\",\n+\t\tcap.shaper_shared_rate_max);\n+\tprintf(\"cap.shaper_pkt_length_adjust_min %d\\n\",\n+\t\tcap.shaper_pkt_length_adjust_min);\n+\tprintf(\"cap.shaper_pkt_length_adjust_max %d\\n\",\n+\t\tcap.shaper_pkt_length_adjust_max);\n+\tprintf(\"cap.sched_n_children_max %u\\n\", cap.sched_n_children_max);\n+\tprintf(\"cap.sched_sp_n_priorities_max %u\\n\",\n+\t\tcap.sched_sp_n_priorities_max);\n+\tprintf(\"cap.sched_wfq_n_children_per_group_max %u\\n\",\n+\t\tcap.sched_wfq_n_children_per_group_max);\n+\tprintf(\"cap.sched_wfq_n_groups_max %u\\n\", cap.sched_wfq_n_groups_max);\n+\tprintf(\"cap.sched_wfq_weight_max %u\\n\", cap.sched_wfq_weight_max);\n+\tprintf(\"cap.cman_head_drop_supported %d\\n\",\n+\t\tcap.cman_head_drop_supported);\n+\tprintf(\"cap.cman_wred_context_n_max %u\\n\", cap.cman_wred_context_n_max);\n+\tprintf(\"cap.cman_wred_context_private_n_max %u\\n\",\n+\t\tcap.cman_wred_context_private_n_max);\n+\tprintf(\"cap.cman_wred_context_shared_n_max %u\\n\",\n+\t\tcap.cman_wred_context_shared_n_max);\n+\tprintf(\"cap.cman_wred_context_shared_n_nodes_per_context_max %u\\n\",\n+\t\tcap.cman_wred_context_shared_n_nodes_per_context_max);\n+\tprintf(\"cap.cman_wred_context_shared_n_contexts_per_node_max %u\\n\",\n+\t\tcap.cman_wred_context_shared_n_contexts_per_node_max);\n+\n+\tfor (i = 0; i < RTE_TM_COLORS; i++) {\n+\t\tprintf(\"cap.mark_vlan_dei_supported %d\\n\",\n+\t\t\tcap.mark_vlan_dei_supported[i]);\n+\t\tprintf(\"cap.mark_ip_ecn_tcp_supported %d\\n\",\n+\t\t\tcap.mark_ip_ecn_tcp_supported[i]);\n+\t\tprintf(\"cap.mark_ip_ecn_sctp_supported %d\\n\",\n+\t\t\tcap.mark_ip_ecn_sctp_supported[i]);\n+\t\tprintf(\"cap.mark_ip_dscp_supported %d\\n\",\n+\t\t\tcap.mark_ip_dscp_supported[i]);\n+\t}\n+\n+\tprintf(\"cap.dynamic_update_mask %lu\\n\", cap.dynamic_update_mask);\n+\tprintf(\"cap.stats_mask %lu\\n\", cap.stats_mask);\n+}\n+\n+cmdline_parse_inst_t cmd_show_port_tm_cap = {\n+\t.f = cmd_show_port_tm_cap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Show Port TM Capabilities\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_port_tm_cap_show,\n+\t\t(void *)&cmd_show_port_tm_cap_port,\n+\t\t(void *)&cmd_show_port_tm_cap_tm,\n+\t\t(void *)&cmd_show_port_tm_cap_cap,\n+\t\t(void *)&cmd_show_port_tm_cap_port_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Port TM Hierarchical Level Capability *** */\n+struct cmd_show_port_tm_level_cap_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t tm;\n+\tcmdline_fixed_string_t level;\n+\tcmdline_fixed_string_t cap;\n+\tuint8_t port_id;\n+\tuint32_t level_id;\n+};\n+\n+cmdline_parse_token_string_t cmd_show_port_tm_level_cap_show =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\tshow, \"show\");\n+cmdline_parse_token_string_t cmd_show_port_tm_level_cap_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\tport, \"port\");\n+cmdline_parse_token_string_t cmd_show_port_tm_level_cap_tm =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\ttm, \"tm\");\n+cmdline_parse_token_string_t cmd_show_port_tm_level_cap_level =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\tlevel, \"level\");\n+cmdline_parse_token_string_t cmd_show_port_tm_level_cap_cap =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\tcap, \"cap\");\n+cmdline_parse_token_num_t cmd_show_port_tm_level_cap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\t port_id, UINT8);\n+cmdline_parse_token_num_t cmd_show_port_tm_level_cap_level_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_level_cap_result,\n+\t\t level_id, UINT32);\n+\n+\n+static void cmd_show_port_tm_level_cap_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_port_tm_level_cap_result *res = parsed_result;\n+\tstruct rte_port *port;\n+\tstruct rte_tm_level_capabilities lcap;\n+\tstruct rte_tm_error error;\n+\tuint8_t port_id = res->port_id;\n+\tint ret, level_id = res->level_id;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tport = &ports[port_id];\n+\n+\t/* Port tm flag */\n+\tif (port->softport.tm_flag == 0) {\n+\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\t/* Forward mode: tm */\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n+\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\tif ((level_id > 4) || (level_id < 0)) {\n+\t\tprintf(\"  TM hierarchical level invalid !! \");\n+\t\treturn;\n+\t}\n+\n+\tmemset(&lcap, 0, sizeof(struct rte_tm_level_capabilities));\n+\tret = rte_tm_level_capabilities_get(port_id, level_id, &lcap, &error);\n+\tif (ret) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\tprintf(\"\\n****   Port TM Hierarchy level %u Capability ****\\n\\n\",\n+\t\tlevel_id);\n+\n+\tprintf(\"cap.n_nodes_max %u\\n\", lcap.n_nodes_max);\n+\tprintf(\"cap.n_nodes_nonleaf_max %u\\n\", lcap.n_nodes_nonleaf_max);\n+\tprintf(\"cap.n_nodes_leaf_max %u\\n\", lcap.n_nodes_leaf_max);\n+\tprintf(\"cap.non_leaf_nodes_identical %d\\n\",\n+\t\tlcap.non_leaf_nodes_identical);\n+\tprintf(\"cap.leaf_nodes_identical %d\\n\", lcap.leaf_nodes_identical);\n+\tif (level_id <= 3) {\n+\t\tprintf(\"cap.nonleaf.shaper_private_supported %d\\n\",\n+\t\t\tlcap.nonleaf.shaper_private_supported);\n+\t\tprintf(\"cap.nonleaf.shaper_private_dual_rate_supported %d\\n\",\n+\t\t\tlcap.nonleaf.shaper_private_dual_rate_supported);\n+\t\tprintf(\"cap.nonleaf.shaper_private_rate_min %lu\\n\",\n+\t\t\tlcap.nonleaf.shaper_private_rate_min);\n+\t\tprintf(\"cap.nonleaf.shaper_private_rate_max %lu\\n\",\n+\t\t\tlcap.nonleaf.shaper_private_rate_max);\n+\t\tprintf(\"cap.nonleaf.shaper_shared_n_max %u\\n\",\n+\t\t\tlcap.nonleaf.shaper_shared_n_max);\n+\t\tprintf(\"cap.nonleaf.sched_n_children_max %u\\n\",\n+\t\t\tlcap.nonleaf.sched_n_children_max);\n+\t\tprintf(\"cap.nonleaf.sched_sp_n_priorities_max %u\\n\",\n+\t\t\tlcap.nonleaf.sched_sp_n_priorities_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_n_children_per_group_max %u\\n\",\n+\t\t\tlcap.nonleaf.sched_wfq_n_children_per_group_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_n_groups_max %u\\n\",\n+\t\t\tlcap.nonleaf.sched_wfq_n_groups_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_weight_max %u\\n\",\n+\t\t\tlcap.nonleaf.sched_wfq_weight_max);\n+\t\tprintf(\"cap.nonleaf.stats_mask %lu\\n\", lcap.nonleaf.stats_mask);\n+\t} else {\n+\t\tprintf(\"cap.leaf.shaper_private_supported %d\\n\",\n+\t\t\tlcap.leaf.shaper_private_supported);\n+\t\tprintf(\"cap.leaf.shaper_private_dual_rate_supported %d\\n\",\n+\t\t\tlcap.leaf.shaper_private_dual_rate_supported);\n+\t\tprintf(\"cap.leaf.shaper_private_rate_min %lu\\n\",\n+\t\t\tlcap.leaf.shaper_private_rate_min);\n+\t\tprintf(\"cap.leaf.shaper_private_rate_max %lu\\n\",\n+\t\t\tlcap.leaf.shaper_private_rate_max);\n+\t\tprintf(\"cap.leaf.shaper_shared_n_max %u\\n\",\n+\t\t\tlcap.leaf.shaper_shared_n_max);\n+\t\tprintf(\"cap.leaf.cman_head_drop_supported %d\\n\",\n+\t\t\tlcap.leaf.cman_head_drop_supported);\n+\t\tprintf(\"cap.leaf.cman_wred_context_private_supported %d\\n\",\n+\t\t\tlcap.leaf.cman_wred_context_private_supported);\n+\t\tprintf(\"cap.leaf.cman_wred_context_shared_n_max %u\\n\",\n+\t\t\tlcap.leaf.cman_wred_context_shared_n_max);\n+\t\tprintf(\"cap.leaf.stats_mask %lu\\n\",\n+\t\t\tlcap.leaf.stats_mask);\n+\t}\n+}\n+\n+cmdline_parse_inst_t cmd_show_port_tm_level_cap = {\n+\t.f = cmd_show_port_tm_level_cap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Show Port TM Hierarhical level Capabilities\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_port_tm_level_cap_show,\n+\t\t(void *)&cmd_show_port_tm_level_cap_port,\n+\t\t(void *)&cmd_show_port_tm_level_cap_tm,\n+\t\t(void *)&cmd_show_port_tm_level_cap_level,\n+\t\t(void *)&cmd_show_port_tm_level_cap_cap,\n+\t\t(void *)&cmd_show_port_tm_level_cap_port_id,\n+\t\t(void *)&cmd_show_port_tm_level_cap_level_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Port TM Hierarchy Node Capability *** */\n+struct cmd_show_port_tm_node_cap_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t tm;\n+\tcmdline_fixed_string_t node;\n+\tcmdline_fixed_string_t cap;\n+\tuint8_t port_id;\n+\tuint32_t node_id;\n+};\n+\n+cmdline_parse_token_string_t cmd_show_port_tm_node_cap_show =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\tshow, \"show\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_cap_port =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\tport, \"port\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_cap_tm =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\ttm, \"tm\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_cap_node =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\tnode, \"node\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_cap_cap =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\tcap, \"cap\");\n+cmdline_parse_token_num_t cmd_show_port_tm_node_cap_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\t port_id, UINT8);\n+cmdline_parse_token_num_t cmd_show_port_tm_node_cap_node_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_cap_result,\n+\t\t node_id, UINT32);\n+\n+static void cmd_show_port_tm_node_cap_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_port_tm_node_cap_result *res = parsed_result;\n+\tstruct rte_port *port;\n+\tstruct rte_tm_node_capabilities ncap;\n+\tstruct rte_tm_error error;\n+\tuint32_t node_id = res->node_id;\n+\tuint8_t port_id = res->port_id;\n+\tint ret, is_leaf = 0;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tport = &ports[port_id];\n+\n+\t/* Port tm flag */\n+\tif (port->softport.tm_flag == 0) {\n+\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\t/* Forward mode: tm */\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n+\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\t/* Node id must be valid */\n+\tret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);\n+\tif (ret != 0) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&ncap, 0, sizeof(struct rte_tm_node_capabilities));\n+\tret = rte_tm_node_capabilities_get(port_id, node_id, &ncap, &error);\n+\tif (ret != 0) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\tprintf(\"\\n****   Port TM Hierarchy node %u Capability ****\\n\\n\",\n+\t\tnode_id);\n+\tprintf(\"cap.shaper_private_supported %d\\n\",\n+\t\tncap.shaper_private_supported);\n+\tprintf(\"cap.shaper_private_dual_rate_supported %d\\n\",\n+\t\tncap.shaper_private_dual_rate_supported);\n+\tprintf(\"cap.shaper_private_rate_min %lu\\n\",\n+\t\tncap.shaper_private_rate_min);\n+\tprintf(\"cap.shaper_private_rate_max %lu\\n\",\n+\t\tncap.shaper_private_rate_max);\n+\tprintf(\"cap.shaper_shared_n_max %u\\n\",\n+\t\tncap.shaper_shared_n_max);\n+\tif (!is_leaf) {\n+\t\tprintf(\"cap.nonleaf.sched_n_children_max %u\\n\",\n+\t\t\tncap.nonleaf.sched_n_children_max);\n+\t\tprintf(\"cap.nonleaf.sched_sp_n_priorities_max %u\\n\",\n+\t\t\tncap.nonleaf.sched_sp_n_priorities_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_n_children_per_group_max %u\\n\",\n+\t\t\tncap.nonleaf.sched_wfq_n_children_per_group_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_n_groups_max %u\\n\",\n+\t\t\tncap.nonleaf.sched_wfq_n_groups_max);\n+\t\tprintf(\"cap.nonleaf.sched_wfq_weight_max %u\\n\",\n+\t\t\tncap.nonleaf.sched_wfq_weight_max);\n+\t} else {\n+\t\tprintf(\"cap.leaf.cman_head_drop_supported %d\\n\",\n+\t\t\tncap.leaf.cman_head_drop_supported);\n+\t\tprintf(\"cap.leaf.cman_wred_context_private_supported %d\\n\",\n+\t\t\tncap.leaf.cman_wred_context_private_supported);\n+\t\tprintf(\"cap.leaf.cman_wred_context_shared_n_max %u\\n\",\n+\t\t\tncap.leaf.cman_wred_context_shared_n_max);\n+\t}\n+\tprintf(\"cap.stats_mask %lu\\n\", ncap.stats_mask);\n+}\n+\n+cmdline_parse_inst_t cmd_show_port_tm_node_cap = {\n+\t.f = cmd_show_port_tm_node_cap_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Show Port TM Hierarchy node capabilities\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_port_tm_node_cap_show,\n+\t\t(void *)&cmd_show_port_tm_node_cap_port,\n+\t\t(void *)&cmd_show_port_tm_node_cap_tm,\n+\t\t(void *)&cmd_show_port_tm_node_cap_node,\n+\t\t(void *)&cmd_show_port_tm_node_cap_cap,\n+\t\t(void *)&cmd_show_port_tm_node_cap_port_id,\n+\t\t(void *)&cmd_show_port_tm_node_cap_node_id,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Show Port TM Node Statistics *** */\n+struct cmd_show_port_tm_node_stats_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t tm;\n+\tcmdline_fixed_string_t node;\n+\tcmdline_fixed_string_t stats;\n+\tuint8_t port_id;\n+\tuint32_t node_id;\n+\tuint32_t clear;\n+};\n+\n+cmdline_parse_token_string_t cmd_show_port_tm_node_stats_show =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, show, \"show\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_stats_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, port, \"port\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_stats_tm =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, tm, \"tm\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_stats_node =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, node, \"node\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_stats_stats =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, stats, \"stats\");\n+cmdline_parse_token_num_t cmd_show_port_tm_node_stats_port_id =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_show_port_tm_node_stats_result,\n+\t\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_show_port_tm_node_stats_node_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result,\n+\t\t\tnode_id, UINT32);\n+cmdline_parse_token_num_t cmd_show_port_tm_node_stats_clear =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_stats_result, clear, UINT32);\n+\n+static void cmd_show_port_tm_node_stats_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_port_tm_node_stats_result *res = parsed_result;\n+\tstruct rte_port *port;\n+\tstruct rte_tm_node_stats stats;\n+\tstruct rte_tm_error error;\n+\tuint64_t stats_mask = 0, leaf_stats_mask;\n+\tuint32_t node_id = res->node_id;\n+\tuint32_t clear = res->clear;\n+\tuint8_t port_id = res->port_id;\n+\tint ret;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tport = &ports[port_id];\n+\n+\t/* Port tm flag */\n+\tif (port->softport.tm_flag == 0) {\n+\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\t/* Forward mode: tm */\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n+\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\t/* TM hierarchy status */\n+\tif (port->softport.tm.hierarchy_frozen == 0) {\n+\t\tprintf(\" hierarchy not frozen(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\t/* Port status */\n+\tif (!port_is_started(port_id)) {\n+\t\tprintf(\" Port %u not started (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\tmemset(&stats, 0, sizeof(struct rte_tm_node_stats));\n+\tret = rte_tm_node_stats_read(port_id, node_id, &stats,\n+\t\t\t&stats_mask, clear, &error);\n+\tif (ret != 0) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\n+\tleaf_stats_mask = RTE_TM_STATS_N_PKTS |\n+\t\tRTE_TM_STATS_N_BYTES |\n+\t\tRTE_TM_STATS_N_PKTS_GREEN_DROPPED |\n+\t\tRTE_TM_STATS_N_BYTES_GREEN_DROPPED |\n+\t\tRTE_TM_STATS_N_PKTS_QUEUED;\n+\n+\tprintf(\"pkts scheduled from node %lu\\n\", stats.n_pkts);\n+\tprintf(\"bytes scheduled from node %lu\\n\", stats.n_bytes);\n+\tprintf(\"pkts dropped %lu\\n \", stats.leaf.n_pkts_dropped[RTE_TM_GREEN]);\n+\tprintf(\"bytes dropped %lu\\n \",\n+\t\tstats.leaf.n_bytes_dropped[RTE_TM_GREEN]);\n+\n+\tif (stats_mask == leaf_stats_mask)\n+\t\tprintf(\"packets enqueued %lu\\n\", stats.leaf.n_pkts_queued);\n+}\n+\n+cmdline_parse_inst_t cmd_show_port_tm_node_stats = {\n+\t.f = cmd_show_port_tm_node_stats_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Show port tm node stats\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_port_tm_node_stats_show,\n+\t\t(void *)&cmd_show_port_tm_node_stats_port,\n+\t\t(void *)&cmd_show_port_tm_node_stats_tm,\n+\t\t(void *)&cmd_show_port_tm_node_stats_node,\n+\t\t(void *)&cmd_show_port_tm_node_stats_stats,\n+\t\t(void *)&cmd_show_port_tm_node_stats_port_id,\n+\t\t(void *)&cmd_show_port_tm_node_stats_node_id,\n+\t\t(void *)&cmd_show_port_tm_node_stats_clear,\n+\t\tNULL,\n+\t},\n+};\n+\n+/* *** Show Port TM Node Type *** */\n+struct cmd_show_port_tm_node_type_result {\n+\tcmdline_fixed_string_t show;\n+\tcmdline_fixed_string_t port;\n+\tcmdline_fixed_string_t tm;\n+\tcmdline_fixed_string_t node;\n+\tcmdline_fixed_string_t type;\n+\tuint8_t port_id;\n+\tuint32_t node_id;\n+};\n+\n+cmdline_parse_token_string_t cmd_show_port_tm_node_type_show =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result, show, \"show\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_type_port =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result, port, \"port\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_type_tm =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result, tm, \"tm\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_type_node =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result, node, \"node\");\n+cmdline_parse_token_string_t cmd_show_port_tm_node_type_type =\n+\tTOKEN_STRING_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result, type, \"type\");\n+cmdline_parse_token_num_t cmd_show_port_tm_node_type_port_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result,\n+\t\t\tport_id, UINT8);\n+cmdline_parse_token_num_t cmd_show_port_tm_node_type_node_id =\n+\tTOKEN_NUM_INITIALIZER(\n+\t\tstruct cmd_show_port_tm_node_type_result,\n+\t\t\tnode_id, UINT32);\n+\n+static void cmd_show_port_tm_node_type_parsed(void *parsed_result,\n+\t__attribute__((unused)) struct cmdline *cl,\n+\t__attribute__((unused)) void *data)\n+{\n+\tstruct cmd_show_port_tm_node_type_result *res = parsed_result;\n+\tstruct rte_port *port;\n+\tstruct rte_tm_error error;\n+\tuint32_t node_id = res->node_id;\n+\tuint8_t port_id = res->port_id;\n+\tint ret, is_leaf = 0;\n+\n+\tif (port_id_is_invalid(port_id, ENABLED_WARN))\n+\t\treturn;\n+\n+\tport = &ports[port_id];\n+\n+\t/* Port tm flag */\n+\tif (port->softport.tm_flag == 0) {\n+\t\tprintf(\"  tm not enabled on port %u (error)\\n\", port_id);\n+\t\treturn;\n+\t}\n+\n+\t/* Forward mode: tm */\n+\tif (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, \"tm\")) {\n+\t\tprintf(\"  tm mode not enabled(error)\\n\");\n+\t\treturn;\n+\t}\n+\n+\tret = rte_tm_node_type_get(port_id, node_id, &is_leaf, &error);\n+\tif (ret != 0) {\n+\t\tprint_err_msg(&error);\n+\t\treturn;\n+\t}\n+\n+\tif (is_leaf == 1)\n+\t\tprintf(\"leaf node\\n\");\n+\telse\n+\t\tprintf(\"nonleaf node\\n\");\n+\n+}\n+\n+cmdline_parse_inst_t cmd_show_port_tm_node_type = {\n+\t.f = cmd_show_port_tm_node_type_parsed,\n+\t.data = NULL,\n+\t.help_str = \"Show port tm node type\",\n+\t.tokens = {\n+\t\t(void *)&cmd_show_port_tm_node_type_show,\n+\t\t(void *)&cmd_show_port_tm_node_type_port,\n+\t\t(void *)&cmd_show_port_tm_node_type_tm,\n+\t\t(void *)&cmd_show_port_tm_node_type_node,\n+\t\t(void *)&cmd_show_port_tm_node_type_type,\n+\t\t(void *)&cmd_show_port_tm_node_type_port_id,\n+\t\t(void *)&cmd_show_port_tm_node_type_node_id,\n+\t\tNULL,\n+\t},\n+};\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "2/5"
    ]
}