From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by dpdk.org (Postfix) with ESMTP id 6C2501B025 for ; Thu, 1 Feb 2018 10:36:54 +0100 (CET) Received: by mail-lf0-f67.google.com with SMTP id a204so25180850lfa.2 for ; Thu, 01 Feb 2018 01:36:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pLjtNzH+gYUsWv+DYgZqgaaqmIJDbbblH5izu13UqK4=; b=kRt9BxxPICffDkLSpZ8CTOWVEKVscE9Ny63DgmGDF1RCAZ+dDxYrZ17mv29MwXtbL6 xr/oXjY6kZdPwcEuSkM0m+UkIy6gjJfZR4xjdiL5KxJTBJr8DH448KpA2Ja5z4yFtxuM OZ1ER2c1jQXL/uh84ysnATb80YqMiEOZOaG3YqgnRjlvtCDVE3jmUoQjm9kXpH8hHZZ9 7tsiyav8zd0pYfqc0/Hsvpi6UumwW8Q/EL7w+aId5QRyMNxEv6r8AVvRl3iD4oBixLGY JS2wKGwQm7FIB9S2iRjRwhTCErwsWWsE0t3q3SPpQ0XXSfMC+yz7TyV4QD3R+h6Srpe9 2l5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pLjtNzH+gYUsWv+DYgZqgaaqmIJDbbblH5izu13UqK4=; b=eYYCyCJ74McrIeiUNL4vPkA3HNAkBZFyqk/UyR6E8ZU1hF08NapSpqEiDM+meskqDw NOn6NTq7Gy+kJGSnLJ2HGXOHPSMeZvXmwHgkQGBWCmYmuFLNNMf/1zIxUmuD8oFTKbgM w8fzphVnzeVCw/2rOPgAN+mPgRFkc5Nlm/bhhv0d/pbVRRbBYpZ7UYOmkI3wb74QmHd1 EzjzQ5K0+xBLQB2a+z3SKM/OBKGHl/1GVtgWRToAg7GJ4fKR8njFYdFTu/nQa54E3dcJ ZeewJ1PxDEP+oZTp/oFkyzGuEzmWR4xZSnQtbFKWHSQ9PkAYYxQmAGTjMLddbmwa+kTL +QvQ== X-Gm-Message-State: AKwxytcGOTgWP0eBIGRKGNzeQ2VxL8ZCK0/EklRuruzkHEQ1O8UO2+zk 3ldEWyYatPChf3eElkN4GL8PvIlqm/8= X-Google-Smtp-Source: AH8x225xh8OWsetbpmVH7sYIGBUIxOvshifDYjhg3/vIEPI+jV4PjPc8av+zovVyEiwWOl29zV2OkQ== X-Received: by 10.25.17.227 with SMTP id 96mr22003475lfr.85.1517477813726; Thu, 01 Feb 2018 01:36:53 -0800 (PST) Received: from sh.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id 36sm4257637lfx.13.2018.02.01.01.36.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Feb 2018 01:36:52 -0800 (PST) From: Tomasz Duszynski To: dev@dpdk.org Cc: wenzhuo.lu@intel.com, jingjing.wu@intel.com, jasvinder.singh@intel.com, Tomasz Duszynski Date: Thu, 1 Feb 2018 10:36:39 +0100 Message-Id: <1517477799-18946-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517477799-18946-1-git-send-email-tdu@semihalf.com> References: <1517477799-18946-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume a TM node X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2018 09:36:54 -0000 Traffic manager provides an API for resuming an arbitrary node in a hierarchy. This commit adds support for calling this API from testpmd. Signed-off-by: Tomasz Duszynski --- app/test-pmd/cmdline.c | 4 ++ app/test-pmd/cmdline_tm.c | 70 +++++++++++++++++++++++++++++ app/test-pmd/cmdline_tm.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ 4 files changed, 80 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6bbd606..f9827f6 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -800,6 +800,9 @@ static void cmd_help_long_parsed(void *parsed_result, "suspend port tm node (port_id) (node_id)" " Suspend tm node.\n\n" + "resume port tm node (port_id) (node_id)" + " Resume tm node.\n\n" + "port tm hierarchy commit (port_id) (clean_on_fail)\n" " Commit tm hierarchy.\n\n" @@ -16251,6 +16254,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_del_port_tm_node, (cmdline_parse_inst_t *)&cmd_set_port_tm_node_parent, (cmdline_parse_inst_t *)&cmd_suspend_port_tm_node, + (cmdline_parse_inst_t *)&cmd_resume_port_tm_node, (cmdline_parse_inst_t *)&cmd_port_tm_hierarchy_commit, NULL, }; diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c index c9a18dd..807e724 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -2036,6 +2036,76 @@ cmdline_parse_inst_t cmd_suspend_port_tm_node = { }, }; +/* *** Resume Port TM Node *** */ +struct cmd_resume_port_tm_node_result { + cmdline_fixed_string_t resume; + cmdline_fixed_string_t port; + cmdline_fixed_string_t tm; + cmdline_fixed_string_t node; + uint16_t port_id; + uint32_t node_id; +}; + +cmdline_parse_token_string_t cmd_resume_port_tm_node_resume = + TOKEN_STRING_INITIALIZER( + struct cmd_resume_port_tm_node_result, resume, "resume"); +cmdline_parse_token_string_t cmd_resume_port_tm_node_port = + TOKEN_STRING_INITIALIZER( + struct cmd_resume_port_tm_node_result, port, "port"); +cmdline_parse_token_string_t cmd_resume_port_tm_node_tm = + TOKEN_STRING_INITIALIZER( + struct cmd_resume_port_tm_node_result, tm, "tm"); +cmdline_parse_token_string_t cmd_resume_port_tm_node_node = + TOKEN_STRING_INITIALIZER( + struct cmd_resume_port_tm_node_result, node, "node"); +cmdline_parse_token_num_t cmd_resume_port_tm_node_port_id = + TOKEN_NUM_INITIALIZER( + struct cmd_resume_port_tm_node_result, port_id, UINT16); +cmdline_parse_token_num_t cmd_resume_port_tm_node_node_id = + TOKEN_NUM_INITIALIZER( + struct cmd_resume_port_tm_node_result, node_id, UINT32); + +static void cmd_resume_port_tm_node_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_resume_port_tm_node_result *res = parsed_result; + struct rte_tm_error error; + uint32_t node_id = res->node_id; + portid_t port_id = res->port_id; + int ret; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + + /* Port status */ + if (!port_is_started(port_id)) { + printf(" Port %u not started (error)\n", port_id); + return; + } + + ret = rte_tm_node_resume(port_id, node_id, &error); + if (ret != 0) { + print_err_msg(&error); + return; + } +} + +cmdline_parse_inst_t cmd_resume_port_tm_node = { + .f = cmd_resume_port_tm_node_parsed, + .data = NULL, + .help_str = "Resume port tm node", + .tokens = { + (void *)&cmd_resume_port_tm_node_resume, + (void *)&cmd_resume_port_tm_node_port, + (void *)&cmd_resume_port_tm_node_tm, + (void *)&cmd_resume_port_tm_node_node, + (void *)&cmd_resume_port_tm_node_port_id, + (void *)&cmd_resume_port_tm_node_node_id, + NULL, + }, +}; + /* *** Port TM Hierarchy Commit *** */ struct cmd_port_tm_hierarchy_commit_result { cmdline_fixed_string_t port; diff --git a/app/test-pmd/cmdline_tm.h b/app/test-pmd/cmdline_tm.h index c4d5e8c..b3a14ad 100644 --- a/app/test-pmd/cmdline_tm.h +++ b/app/test-pmd/cmdline_tm.h @@ -23,6 +23,7 @@ extern cmdline_parse_inst_t cmd_add_port_tm_leaf_node; extern cmdline_parse_inst_t cmd_del_port_tm_node; extern cmdline_parse_inst_t cmd_set_port_tm_node_parent; extern cmdline_parse_inst_t cmd_suspend_port_tm_node; +extern cmdline_parse_inst_t cmd_resume_port_tm_node; extern cmdline_parse_inst_t cmd_port_tm_hierarchy_commit; #endif /* _CMDLINE_TM_H_ */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 68a9f03..158061c 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2496,6 +2496,11 @@ Suspend port traffic management hierarchy node testpmd> suspend port tm node (port_id) (node_id) +Resume port traffic management hierarchy node +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + testpmd> resume port tm node (port_id) (node_id) + Commit port traffic management hierarchy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- 2.7.4