* [dpdk-dev] [PATCH 1/2] app/testpmd: add command to suspend a TM node
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 ` Tomasz Duszynski
2018-02-01 9:36 ` [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume " Tomasz Duszynski
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-01 9:36 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
Traffic manager provides an API for suspending
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 9f12c0f..6bbd606 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -797,6 +797,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" (priority) (weight)\n"
" Set port tm node parent.\n\n"
+ "suspend port tm node (port_id) (node_id)"
+ " Suspend tm node.\n\n"
+
"port tm hierarchy commit (port_id) (clean_on_fail)\n"
" Commit tm hierarchy.\n\n"
@@ -16247,6 +16250,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_port_tm_leaf_node,
(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_port_tm_hierarchy_commit,
NULL,
};
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 9859c3d..c9a18dd 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1966,6 +1966,76 @@ cmdline_parse_inst_t cmd_set_port_tm_node_parent = {
},
};
+/* *** Suspend Port TM Node *** */
+struct cmd_suspend_port_tm_node_result {
+ cmdline_fixed_string_t suspend;
+ 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_suspend_port_tm_node_suspend =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, suspend, "suspend");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, port, "port");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_tm =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, tm, "tm");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_node =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, node, "node");
+cmdline_parse_token_num_t cmd_suspend_port_tm_node_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, port_id, UINT16);
+cmdline_parse_token_num_t cmd_suspend_port_tm_node_node_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, node_id, UINT32);
+
+static void cmd_suspend_port_tm_node_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_suspend_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_suspend(port_id, node_id, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_suspend_port_tm_node = {
+ .f = cmd_suspend_port_tm_node_parsed,
+ .data = NULL,
+ .help_str = "Suspend port tm node",
+ .tokens = {
+ (void *)&cmd_suspend_port_tm_node_suspend,
+ (void *)&cmd_suspend_port_tm_node_port,
+ (void *)&cmd_suspend_port_tm_node_tm,
+ (void *)&cmd_suspend_port_tm_node_node,
+ (void *)&cmd_suspend_port_tm_node_port_id,
+ (void *)&cmd_suspend_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 ba30360..c4d5e8c 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -22,6 +22,7 @@ extern cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node;
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_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 7ab8eea..68a9f03 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2491,6 +2491,11 @@ success depends on the port support for this operation, as advertised through
the port capability set. This function is valid for all nodes of the traffic
management hierarchy except root node.
+Suspend port traffic management hierarchy node
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ testpmd> suspend port tm node (port_id) (node_id)
+
Commit port traffic management hierarchy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume a TM node
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 ` Tomasz Duszynski
2018-02-16 13:10 ` Singh, Jasvinder
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
3 siblings, 1 reply; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-01 9:36 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
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;
+ }
+
+ 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume a TM node
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
2018-02-19 7:17 ` Tomasz Duszynski
0 siblings, 1 reply; 11+ messages in thread
From: Singh, Jasvinder @ 2018-02-16 13:10 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: Lu, Wenzhuo, Wu, Jingjing
> -----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>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 2/2] app/testpmd: add command to resume a TM node
2018-02-16 13:10 ` Singh, Jasvinder
@ 2018-02-19 7:17 ` Tomasz Duszynski
0 siblings, 0 replies; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-19 7:17 UTC (permalink / raw)
To: Singh, Jasvinder; +Cc: Tomasz Duszynski, dev, Lu, Wenzhuo, Wu, Jingjing
On Fri, Feb 16, 2018 at 01:10:39PM +0000, Singh, Jasvinder wrote:
>
>
> > -----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.
Fair enough. Thanks for the review.
>
> Besides this,
> Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com>
--
- Tomasz Duszyński
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH 0/2] add suspend/resume TM node commands to testpmd
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 8:11 ` Tomasz Duszynski
2018-02-19 7:46 ` [dpdk-dev] [PATCH v2 " Tomasz Duszynski
3 siblings, 0 replies; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-16 8:11 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
On Thu, Feb 01, 2018 at 10:36:37AM +0100, Tomasz Duszynski wrote:
> Add new testpmd commands for invoking traffic manager suspend/resume API.
>
> Tomasz Duszynski (2):
> app/testpmd: add command to suspend a TM node
> app/testpmd: add command to resume a TM node
>
> app/test-pmd/cmdline.c | 8 ++
> app/test-pmd/cmdline_tm.c | 140 ++++++++++++++++++++++++++++
> app/test-pmd/cmdline_tm.h | 2 +
> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++
> 4 files changed, 160 insertions(+)
>
> --
> 2.7.4
>
Patchseries has been here for a while already but did not receive any
attention. Should I perhaps respin it?
--
- Tomasz Duszyński
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 0/2] add suspend/resume TM node commands to testpmd
2018-02-01 9:36 [dpdk-dev] [PATCH 0/2] add suspend/resume TM node commands to testpmd Tomasz Duszynski
` (2 preceding siblings ...)
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 ` 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-02-19 7:46 ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: add command to resume " Tomasz Duszynski
3 siblings, 2 replies; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-19 7:46 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
Add new testpmd commands for invoking traffic manager suspend/resume API.
v2:
- Remove the CLI layer restriction to check the port status.
Tomasz Duszynski (2):
app/testpmd: add command to suspend a TM node
app/testpmd: add command to resume a TM node
app/test-pmd/cmdline.c | 8 ++
app/test-pmd/cmdline_tm.c | 128 ++++++++++++++++++++++++++++
app/test-pmd/cmdline_tm.h | 2 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +++
4 files changed, 148 insertions(+)
--
2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 1/2] app/testpmd: add command to suspend a TM node
2018-02-19 7:46 ` [dpdk-dev] [PATCH v2 " Tomasz Duszynski
@ 2018-02-19 7:46 ` 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
1 sibling, 1 reply; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-19 7:46 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
Traffic manager provides an API for suspending
an arbitrary node in a hierarchy.
This commit adds support for calling this API from testpmd.
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com>
---
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(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index d1dc1de..8e17f20 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -771,6 +771,9 @@ static void cmd_help_long_parsed(void *parsed_result,
" (priority) (weight)\n"
" Set port tm node parent.\n\n"
+ "suspend port tm node (port_id) (node_id)"
+ " Suspend tm node.\n\n"
+
"port tm hierarchy commit (port_id) (clean_on_fail)\n"
" Commit tm hierarchy.\n\n"
@@ -16271,6 +16274,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_add_port_tm_leaf_node,
(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_port_tm_hierarchy_commit,
NULL,
};
diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c
index 35cad54..daa912a 100644
--- a/app/test-pmd/cmdline_tm.c
+++ b/app/test-pmd/cmdline_tm.c
@@ -1958,6 +1958,70 @@ cmdline_parse_inst_t cmd_set_port_tm_node_parent = {
},
};
+/* *** Suspend Port TM Node *** */
+struct cmd_suspend_port_tm_node_result {
+ cmdline_fixed_string_t suspend;
+ 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_suspend_port_tm_node_suspend =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, suspend, "suspend");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_port =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, port, "port");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_tm =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, tm, "tm");
+cmdline_parse_token_string_t cmd_suspend_port_tm_node_node =
+ TOKEN_STRING_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, node, "node");
+cmdline_parse_token_num_t cmd_suspend_port_tm_node_port_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, port_id, UINT16);
+cmdline_parse_token_num_t cmd_suspend_port_tm_node_node_id =
+ TOKEN_NUM_INITIALIZER(
+ struct cmd_suspend_port_tm_node_result, node_id, UINT32);
+
+static void cmd_suspend_port_tm_node_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_suspend_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_suspend(port_id, node_id, &error);
+ if (ret != 0) {
+ print_err_msg(&error);
+ return;
+ }
+}
+
+cmdline_parse_inst_t cmd_suspend_port_tm_node = {
+ .f = cmd_suspend_port_tm_node_parsed,
+ .data = NULL,
+ .help_str = "Suspend port tm node",
+ .tokens = {
+ (void *)&cmd_suspend_port_tm_node_suspend,
+ (void *)&cmd_suspend_port_tm_node_port,
+ (void *)&cmd_suspend_port_tm_node_tm,
+ (void *)&cmd_suspend_port_tm_node_node,
+ (void *)&cmd_suspend_port_tm_node_port_id,
+ (void *)&cmd_suspend_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 ba30360..c4d5e8c 100644
--- a/app/test-pmd/cmdline_tm.h
+++ b/app/test-pmd/cmdline_tm.h
@@ -22,6 +22,7 @@ extern cmdline_parse_inst_t cmd_add_port_tm_nonleaf_node;
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_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 a766ac7..38682ea 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2483,6 +2483,11 @@ success depends on the port support for this operation, as advertised through
the port capability set. This function is valid for all nodes of the traffic
management hierarchy except root node.
+Suspend port traffic management hierarchy node
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ testpmd> suspend port tm node (port_id) (node_id)
+
Commit port traffic management hierarchy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add command to suspend a TM node
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
0 siblings, 0 replies; 11+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-04 14:46 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: Lu, Wenzhuo, Wu, Jingjing, Singh, Jasvinder
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Duszynski
> Sent: Monday, February 19, 2018 7:46 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: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add command to suspend
> a TM node
>
> Traffic manager provides an API for suspending
> an arbitrary node in a hierarchy.
>
> This commit adds support for calling this API from testpmd.
>
> Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
> Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com>
> ---
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied to next-qos tree, thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2 2/2] app/testpmd: add command to resume a TM node
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-02-19 7:46 ` Tomasz Duszynski
2018-05-04 14:47 ` Dumitrescu, Cristian
1 sibling, 1 reply; 11+ messages in thread
From: Tomasz Duszynski @ 2018-02-19 7:46 UTC (permalink / raw)
To: dev; +Cc: wenzhuo.lu, jingjing.wu, jasvinder.singh, Tomasz Duszynski
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>
Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com>
---
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(+)
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v2 2/2] app/testpmd: add command to resume a TM node
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
0 siblings, 0 replies; 11+ messages in thread
From: Dumitrescu, Cristian @ 2018-05-04 14:47 UTC (permalink / raw)
To: Tomasz Duszynski, dev; +Cc: Lu, Wenzhuo, Wu, Jingjing, Singh, Jasvinder
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Duszynski
> Sent: Monday, February 19, 2018 7:46 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: [dpdk-dev] [PATCH v2 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>
> Reviewed-by: Jasvinder Singh <jasvinder.singh@inel.com>
> ---
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied to next-qos tree, thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread