From patchwork Mon Feb 19 07:46:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 35215 X-Patchwork-Delegate: cristian.dumitrescu@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 200C81B1DE; Mon, 19 Feb 2018 08:46:37 +0100 (CET) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 1D34DA48A for ; Mon, 19 Feb 2018 08:46:32 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id f136so11754065lff.8 for ; Sun, 18 Feb 2018 23:46:32 -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=g1Anf3rwu0seLdwhB7OtaD57jcpSrIk9GT6t1hO5CKk=; b=LSqyhJHQCEHXAiNAQYGmgt4X9b1oi+tENyqZ0Wmq//S+wmHIK7vBRnidlvXXMSduJT 5MgA13JpmPhWCX1QXkIkzWE6BotBllL9kMCd3VTvrcBqUF/aJYji3VkJUu8Mi0IP2jVQ zVL0HhfNmpcWOFO8t850VaMScrVMx5ld7jUHecWda89e/OmuEY2s8SqriKmwubGAV7ZZ LQOIw7l9hWc9iUOMUyZFhFITWzwgcs1JphMHgpIPOD2WtFxeO3diXMMhbnrBxezYLVDK HWcVgh+ICCV5Ecn8cBLU31Ruwq1aBmfQa2Nu3k6AmXPWqACJsJGOWP2cwsbnTFVX9ZRt atMg== 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=g1Anf3rwu0seLdwhB7OtaD57jcpSrIk9GT6t1hO5CKk=; b=VMjxvil6XIhzVOLtkwSRsvD68i92/iNP07DORrvHvhcqAb2txYpVFgRqsFIGYr6/Uu uRa/8OHZzlnOe3iVG4/6Jz1Jlq0tf/jKFgPULfZMIuxqfDgAyLhC1Wr5N5KAcwc0hbeV 7WZ3LVrm0r0Up9N7MXX8CnfeHHSnnXfqpUYoyVIXnjhpeicI01UEtjNt2KenqWEzmV9D X8cn4bfV8PJQ8L8xGIYfufewlxTenhoEuZjHj83NoYgE1PZbHjkM1AzzWh+edbLHEUV3 r4yfIwChfmrUDdpf6+YABvTcY/0Dm5rzcDSwNbjge30ZA2c+Uq0xfC6eaPY79IoyXF4i BnJQ== X-Gm-Message-State: APf1xPA7ZRQgz/kqPq6ecqKx244dUFlm2nsO7SFbrPT+iUSYks0LWCj2 JR7gjETzPJ/rR9H5O9QnEaV4yhkiN8w= X-Google-Smtp-Source: AH8x224ojQRKUGf6rVxdYfuQAosp9QUJONKF7aOb+aLM5ST58kjeakybGcocxezX2bM3+VONtT0HLQ== X-Received: by 10.46.93.69 with SMTP id r66mr8776980ljb.88.1519026391580; Sun, 18 Feb 2018 23:46:31 -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 y3sm2284259ljy.28.2018.02.18.23.46.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Feb 2018 23:46:30 -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: Mon, 19 Feb 2018 08:46:19 +0100 Message-Id: <1519026379-7924-3-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519026379-7924-1-git-send-email-tdu@semihalf.com> References: <1517477799-18946-1-git-send-email-tdu@semihalf.com> <1519026379-7924-1-git-send-email-tdu@semihalf.com> Subject: [dpdk-dev] [PATCH v2 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Jasvinder Singh Acked-by: Cristian Dumitrescu --- app/test-pmd/cmdline.c | 4 ++ app/test-pmd/cmdline_tm.c | 64 +++++++++++++++++++++++++++++ app/test-pmd/cmdline_tm.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 5 +++ 4 files changed, 74 insertions(+) -- 2.7.4 diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 8e17f20..052d58e 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -774,6 +774,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" @@ -16275,6 +16278,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 daa912a..7fb69de 100644 --- a/app/test-pmd/cmdline_tm.c +++ b/app/test-pmd/cmdline_tm.c @@ -2022,6 +2022,70 @@ 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; + + 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 38682ea..f26f41a 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2488,6 +2488,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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~