DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: Tomasz Duszynski <tdu@semihalf.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume a TM node
Date: Fri, 16 Feb 2018 13:10:39 +0000	[thread overview]
Message-ID: <54CBAA185211B4429112C315DA58FF6D332FA949@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <1517477799-18946-3-git-send-email-tdu@semihalf.com>



> -----Original Message-----
> From: Tomasz Duszynski [mailto:tdu@semihalf.com]
> Sent: Thursday, February 1, 2018 9:37 AM
> To: dev@dpdk.org
> Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Tomasz Duszynski <tdu@semihalf.com>
> Subject: [PATCH 2/2] app/testpmd: add command to resume a TM node
> 
> 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 <tdu@semihalf.com>
> ---
>  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;
> +	}

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 node in started/stopped state depending upon the allowed configuration.

Besides this, 
Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com> 

  reply	other threads:[~2018-02-16 13:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01  9:36 [dpdk-dev] [PATCH 0/2] add suspend/resume TM node commands to testpmd Tomasz Duszynski
2018-02-01  9:36 ` [dpdk-dev] [PATCH 1/2] app/testpmd: add command to suspend a TM node Tomasz Duszynski
2018-02-01  9:36 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume " Tomasz Duszynski
2018-02-16 13:10   ` Singh, Jasvinder [this message]
2018-02-19  7:17     ` Tomasz Duszynski
2018-02-16  8:11 ` [dpdk-dev] [PATCH 0/2] add suspend/resume TM node commands to testpmd Tomasz Duszynski
2018-02-19  7:46 ` [dpdk-dev] [PATCH v2 " Tomasz Duszynski
2018-02-19  7:46   ` [dpdk-dev] [PATCH v2 1/2] app/testpmd: add command to suspend a TM node Tomasz Duszynski
2018-05-04 14:46     ` Dumitrescu, Cristian
2018-02-19  7:46   ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: add command to resume " Tomasz Duszynski
2018-05-04 14:47     ` Dumitrescu, Cristian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CBAA185211B4429112C315DA58FF6D332FA949@IRSMSX103.ger.corp.intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=tdu@semihalf.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).