From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 5CFBBA48D for ; Fri, 16 Feb 2018 14:10:42 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 05:10:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,519,1511856000"; d="scan'208";a="27791680" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by FMSMGA003.fm.intel.com with ESMTP; 16 Feb 2018 05:10:40 -0800 Received: from irsmsx103.ger.corp.intel.com ([169.254.3.197]) by IRSMSX153.ger.corp.intel.com ([169.254.9.213]) with mapi id 14.03.0319.002; Fri, 16 Feb 2018 13:10:39 +0000 From: "Singh, Jasvinder" To: Tomasz Duszynski , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "Wu, Jingjing" Thread-Topic: [PATCH 2/2] app/testpmd: add command to resume a TM node Thread-Index: AQHTm0BNXeHUkXNDEki/giHXRMYpVqOm5uYA Date: Fri, 16 Feb 2018 13:10:39 +0000 Message-ID: <54CBAA185211B4429112C315DA58FF6D332FA949@IRSMSX103.ger.corp.intel.com> References: <1517477799-18946-1-git-send-email-tdu@semihalf.com> <1517477799-18946-3-git-send-email-tdu@semihalf.com> In-Reply-To: <1517477799-18946-3-git-send-email-tdu@semihalf.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTkwNWE4MWEtMDYzMC00MGYwLTg4OWUtNTU3ZDM4N2ZjMDA4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Im50dms3a0JHR1RmRkRpaVprVWdKV1FPemc5OE1SS2xlckwycXkwek9wcEU9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Fri, 16 Feb 2018 13:10:42 -0000 > -----Original Message----- > From: Tomasz Duszynski [mailto:tdu@semihalf.com] > Sent: Thursday, February 1, 2018 9:37 AM > To: dev@dpdk.org > Cc: Lu, Wenzhuo ; Wu, Jingjing > ; Singh, Jasvinder ; > Tomasz Duszynski > Subject: [PATCH 2/2] app/testpmd: add command to resume a TM node >=20 > Traffic manager provides an API for resuming an arbitrary node in a > hierarchy. >=20 > This commit adds support for calling this API from testpmd. >=20 > 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(+) >=20 > 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" >=20 > + "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" >=20 > @@ -16251,6 +16254,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (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 =3D { > }, > }; >=20 > +/* *** 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 =3D > + TOKEN_STRING_INITIALIZER( > + struct cmd_resume_port_tm_node_result, resume, > "resume"); > +cmdline_parse_token_string_t cmd_resume_port_tm_node_port =3D > + TOKEN_STRING_INITIALIZER( > + struct cmd_resume_port_tm_node_result, port, "port"); > +cmdline_parse_token_string_t cmd_resume_port_tm_node_tm =3D > + TOKEN_STRING_INITIALIZER( > + struct cmd_resume_port_tm_node_result, tm, "tm"); > +cmdline_parse_token_string_t cmd_resume_port_tm_node_node =3D > + TOKEN_STRING_INITIALIZER( > + struct cmd_resume_port_tm_node_result, node, "node"); > +cmdline_parse_token_num_t cmd_resume_port_tm_node_port_id =3D > + 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 =3D > + 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 =3D parsed_result; > + struct rte_tm_error error; > + uint32_t node_id =3D res->node_id; > + portid_t port_id =3D 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; > + } I suggest to remove the CLI layer restriction to check the port status for = node suspend/resume. The device can check at the driver layer whether it is ok suspend/resume no= de in started/stopped state depending upon the allowed configuration. Besides this,=20 Reviewed-by: Jasvinder Singh =20