patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings
@ 2021-02-05 13:39 Ferruh Yigit
  2021-02-07  2:47 ` Li, Xiaoyun
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-02-05 13:39 UTC (permalink / raw)
  To: Wenzhuo Lu, Xiaoyun Li, Bernard Iremonger, Jasvinder Singh,
	Jingjing Wu, Cristian Dumitrescu, Adrien Mazarguil
  Cc: Ferruh Yigit, dev, stable

Helps strings syntax is "command : description", the 'command' part was
missing, updated command help strings.

Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: jasvinder.singh@intel.com
Cc: cristian.dumitrescu@intel.com

- "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
  command itself is not requiring it, can be better to double check the
  intention in the command.
- In command "show port meter stats <port_id> <mtr_id> yes|no", it is
  not clear what 'yes|no' is, can be better to have a 'clear' keyword
  there: "show port meter stats <port_id> <mtr_id> clear yes|no"
- 'meter' commands seems using many high level commands, that is harder
  to remember when you take all commands into account:
  "show port meter ..."
  "add port meter ..."
  "del port meter ..."
  "create port meter ..."
  "enable port meter ..."
  "disable port meter ..."
  "set port meter ..."
  And some high level commands created just for 'meter'. Instead I think
  it is better to group the commands, like:
  "port meter [add,del,create,enable,disable] ..."
  "show port meter ..."
  It is already too late but it worth to keep in mind for the possible
  future update.
---
 app/test-pmd/cmdline.c     |  2 +-
 app/test-pmd/cmdline_mtr.c | 32 ++++++++++++++++++--------------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 59722d268bc3..1b9da38fb745 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -719,7 +719,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set port meter profile (port_id) (mtr_id) (profile_id)\n"
 			"    meter update meter profile\n\n"
 
-			"set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0)\n"
+			"set port meter dscp table [(dscp_tbl_entry0)\n"
 			"(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
 			"    update meter dscp table entries\n\n"
 
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 399ee56e07d9..a4f0cbe9db3f 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -312,7 +312,7 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_cap = {
 	.f = cmd_show_port_meter_cap_parsed,
 	.data = NULL,
-	.help_str = "Show port meter cap",
+	.help_str = "show port meter cap <port_id>",
 	.tokens = {
 		(void *)&cmd_show_port_meter_cap_show,
 		(void *)&cmd_show_port_meter_cap_port,
@@ -408,7 +408,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile srtcm (rfc2697)",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -515,7 +515,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc2698)",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -627,7 +627,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc4115)",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -702,7 +702,7 @@ static void cmd_del_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter_profile = {
 	.f = cmd_del_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter profile",
+	.help_str = "del port meter profile <port_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_profile_del,
 		(void *)&cmd_del_port_meter_profile_port,
@@ -827,7 +827,9 @@ static void cmd_create_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_create_port_meter = {
 	.f = cmd_create_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Create port meter",
+	.help_str = "create port meter <port_id> <mtr_id> <profile_id> "
+		"yes|no R|Y|G|D R|Y|G|D R|Y|G|D <stats_mask> <shared> "
+		"<use_pre_meter_color> [<dscp_tbl_entry0> <dscp_tbl_entry1> ...<dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_create_port_meter_create,
 		(void *)&cmd_create_port_meter_port,
@@ -896,7 +898,7 @@ static void cmd_enable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_enable_port_meter = {
 	.f = cmd_enable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Enable port meter",
+	.help_str = "enable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_enable_port_meter_enable,
 		(void *)&cmd_enable_port_meter_port,
@@ -957,7 +959,7 @@ static void cmd_disable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_disable_port_meter = {
 	.f = cmd_disable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Disable port meter",
+	.help_str = "disable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_disable_port_meter_disable,
 		(void *)&cmd_disable_port_meter_port,
@@ -1018,7 +1020,7 @@ static void cmd_del_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter = {
 	.f = cmd_del_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter",
+	.help_str = "del port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_del,
 		(void *)&cmd_del_port_meter_port,
@@ -1092,7 +1094,7 @@ static void cmd_set_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_profile = {
 	.f = cmd_set_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Set port meter profile",
+	.help_str = "set port meter profile <port_id> <mtr_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_profile_set,
 		(void *)&cmd_set_port_meter_profile_port,
@@ -1166,7 +1168,8 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
 	.f = cmd_set_port_meter_dscp_table_parsed,
 	.data = NULL,
-	.help_str = "Update port meter dscp table",
+	.help_str = "set port meter dscp table "
+		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_dscp_table_set,
 		(void *)&cmd_set_port_meter_dscp_table_port,
@@ -1276,7 +1279,8 @@ static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
 	.f = cmd_set_port_meter_policer_action_parsed,
 	.data = NULL,
-	.help_str = "Set port meter policer action",
+	.help_str = "set port meter policer action <port_id> <mtr_id> "
+		"<action_mask> <actiono> [<action1> <action2>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_policer_action_set,
 		(void *)&cmd_set_port_meter_policer_action_port,
@@ -1355,7 +1359,7 @@ static void cmd_set_port_meter_stats_mask_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_stats_mask = {
 	.f = cmd_set_port_meter_stats_mask_parsed,
 	.data = NULL,
-	.help_str = "Set port meter stats mask",
+	.help_str = "set port meter stats mask <port_id> <mtr_id> <stats_mask>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_stats_mask_set,
 		(void *)&cmd_set_port_meter_stats_mask_port,
@@ -1459,7 +1463,7 @@ static void cmd_show_port_meter_stats_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_stats = {
 	.f = cmd_show_port_meter_stats_parsed,
 	.data = NULL,
-	.help_str = "Show port meter stats",
+	.help_str = "show port meter stats <port_id> <mtr_id> yes|no",
 	.tokens = {
 		(void *)&cmd_show_port_meter_stats_show,
 		(void *)&cmd_show_port_meter_stats_port,
-- 
2.29.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings
  2021-02-05 13:39 [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings Ferruh Yigit
@ 2021-02-07  2:47 ` Li, Xiaoyun
  2021-02-08 14:40   ` Ferruh Yigit
  2021-02-08 15:15 ` [dpdk-stable] [PATCH v2] " Ferruh Yigit
  2021-02-09 14:15 ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
  2 siblings, 1 reply; 10+ messages in thread
From: Li, Xiaoyun @ 2021-02-07  2:47 UTC (permalink / raw)
  To: Yigit, Ferruh, Lu, Wenzhuo, Iremonger, Bernard, Singh, Jasvinder,
	Wu, Jingjing, Dumitrescu, Cristian, Adrien Mazarguil
  Cc: dev, stable

Hi

> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Friday, February 5, 2021 21:39
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Dumitrescu,
> Cristian <cristian.dumitrescu@intel.com>; Adrien Mazarguil
> <adrien.mazarguil@6wind.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] app/testpmd: fix meter commands help strings
> 
> Helps strings syntax is "command : description", the 'command' part was missing,
> updated command help strings.
> 
> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
> Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
> policing")
> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: jasvinder.singh@intel.com
> Cc: cristian.dumitrescu@intel.com
> 
> - "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
>   command itself is not requiring it, can be better to double check the
>   intention in the command.
> - In command "show port meter stats <port_id> <mtr_id> yes|no", it is
>   not clear what 'yes|no' is, can be better to have a 'clear' keyword
>   there: "show port meter stats <port_id> <mtr_id> clear yes|no"
> - 'meter' commands seems using many high level commands, that is harder
>   to remember when you take all commands into account:
>   "show port meter ..."
>   "add port meter ..."
>   "del port meter ..."
>   "create port meter ..."
>   "enable port meter ..."
>   "disable port meter ..."
>   "set port meter ..."
>   And some high level commands created just for 'meter'. Instead I think
>   it is better to group the commands, like:
>   "port meter [add,del,create,enable,disable] ..."
>   "show port meter ..."
>   It is already too late but it worth to keep in mind for the possible
>   future update.
> ---
>  app/test-pmd/cmdline.c     |  2 +-
>  app/test-pmd/cmdline_mtr.c | 32 ++++++++++++++++++--------------
>  2 files changed, 19 insertions(+), 15 deletions(-)
<snip>
> @@ -827,7 +827,9 @@ static void cmd_create_port_meter_parsed(void
> *parsed_result,  cmdline_parse_inst_t cmd_create_port_meter = {
>  	.f = cmd_create_port_meter_parsed,
>  	.data = NULL,
> -	.help_str = "Create port meter",
> +	.help_str = "create port meter <port_id> <mtr_id> <profile_id> "
> +		"yes|no R|Y|G|D R|Y|G|D R|Y|G|D <stats_mask> <shared> "

It seems it should be R|Y|G|D|r|y|g|d R|Y|G|D|r|y|g|d R|Y|G|D|r|y|g|d.
What about just use <g_action> <y_action> <r_action> as in cmd_help_long_parsed?

> +		"<use_pre_meter_color> [<dscp_tbl_entry0> <dscp_tbl_entry1>
> +...<dscp_tbl_entry63>]",
>  	.tokens = {
>  		(void *)&cmd_create_port_meter_create,
>  		(void *)&cmd_create_port_meter_port,
<snip>
> cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
> cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
>  	.f = cmd_set_port_meter_dscp_table_parsed,
>  	.data = NULL,
> -	.help_str = "Update port meter dscp table",
> +	.help_str = "set port meter dscp table "
> +		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]",

It should be "set port meter dscp table <port_id> <mtr_id> "
                      "[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]"?
Because in parse_multi_token_string(), it starts from port_id. Hmmm... The code seems very messy, not inconsistent.

>  	.tokens = {
>  		(void *)&cmd_set_port_meter_dscp_table_set,
>  		(void *)&cmd_set_port_meter_dscp_table_port,
> @@ -1276,7 +1279,8 @@ static void
> cmd_set_port_meter_policer_action_parsed(void *parsed_result,
> cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
>  	.f = cmd_set_port_meter_policer_action_parsed,
>  	.data = NULL,
> -	.help_str = "Set port meter policer action",
> +	.help_str = "set port meter policer action <port_id> <mtr_id> "
> +		"<action_mask> <actiono> [<action1> <action2>]",

<action0>[ <action1> <action2>]?
Since it seems only 3 actions exist (action_mask & (~0x7UL), check action mask part in parse function).
And each action seems to be G|Y|R|D|g|y|r|d. hmmm. Messy code...

>  	.tokens = {
>  		(void *)&cmd_set_port_meter_policer_action_set,
>  		(void *)&cmd_set_port_meter_policer_action_port,
<snip>
> --
> 2.29.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings
  2021-02-07  2:47 ` Li, Xiaoyun
@ 2021-02-08 14:40   ` Ferruh Yigit
  0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-02-08 14:40 UTC (permalink / raw)
  To: Li, Xiaoyun, Lu, Wenzhuo, Iremonger, Bernard, Singh, Jasvinder,
	Wu, Jingjing, Dumitrescu, Cristian, Adrien Mazarguil
  Cc: dev, stable

On 2/7/2021 2:47 AM, Li, Xiaoyun wrote:
> Hi
> 
>> -----Original Message-----
>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Sent: Friday, February 5, 2021 21:39
>> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Li, Xiaoyun <xiaoyun.li@intel.com>;
>> Iremonger, Bernard <bernard.iremonger@intel.com>; Singh, Jasvinder
>> <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Dumitrescu,
>> Cristian <cristian.dumitrescu@intel.com>; Adrien Mazarguil
>> <adrien.mazarguil@6wind.com>
>> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
>> Subject: [PATCH] app/testpmd: fix meter commands help strings
>>
>> Helps strings syntax is "command : description", the 'command' part was missing,
>> updated command help strings.
>>
>> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
>> Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
>> policing")
>> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> Cc: jasvinder.singh@intel.com
>> Cc: cristian.dumitrescu@intel.com
>>
>> - "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
>>    command itself is not requiring it, can be better to double check the
>>    intention in the command.
>> - In command "show port meter stats <port_id> <mtr_id> yes|no", it is
>>    not clear what 'yes|no' is, can be better to have a 'clear' keyword
>>    there: "show port meter stats <port_id> <mtr_id> clear yes|no"
>> - 'meter' commands seems using many high level commands, that is harder
>>    to remember when you take all commands into account:
>>    "show port meter ..."
>>    "add port meter ..."
>>    "del port meter ..."
>>    "create port meter ..."
>>    "enable port meter ..."
>>    "disable port meter ..."
>>    "set port meter ..."
>>    And some high level commands created just for 'meter'. Instead I think
>>    it is better to group the commands, like:
>>    "port meter [add,del,create,enable,disable] ..."
>>    "show port meter ..."
>>    It is already too late but it worth to keep in mind for the possible
>>    future update.
>> ---
>>   app/test-pmd/cmdline.c     |  2 +-
>>   app/test-pmd/cmdline_mtr.c | 32 ++++++++++++++++++--------------
>>   2 files changed, 19 insertions(+), 15 deletions(-)
> <snip>
>> @@ -827,7 +827,9 @@ static void cmd_create_port_meter_parsed(void
>> *parsed_result,  cmdline_parse_inst_t cmd_create_port_meter = {
>>   .f = cmd_create_port_meter_parsed,
>>   .data = NULL,
>> -.help_str = "Create port meter",
>> +.help_str = "create port meter <port_id> <mtr_id> <profile_id> "
>> +"yes|no R|Y|G|D R|Y|G|D R|Y|G|D <stats_mask> <shared> "
> 
> It seems it should be R|Y|G|D|r|y|g|d R|Y|G|D|r|y|g|d R|Y|G|D|r|y|g|d.
> What about just use <g_action> <y_action> <r_action> as in cmd_help_long_parsed?
> 

Yes action can be both upper case and lower case, but both does same thing, so I 
chose only uppercase ones to make it more readable.

The "<g_action>" makes it easy understand what the field is for, but for the 
user that doesn't know what is "g_action" or what can be the values "g_action" 
can take, there is no place to get this information. That is why I find it 
useful to provide values can take if they are fixed.

>> +"<use_pre_meter_color> [<dscp_tbl_entry0> <dscp_tbl_entry1>
>> +...<dscp_tbl_entry63>]",
>>   .tokens = {
>>   (void *)&cmd_create_port_meter_create,
>>   (void *)&cmd_create_port_meter_port,
> <snip>
>> cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
>> cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
>>   .f = cmd_set_port_meter_dscp_table_parsed,
>>   .data = NULL,
>> -.help_str = "Update port meter dscp table",
>> +.help_str = "set port meter dscp table "
>> +"[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]",
> 
> It should be "set port meter dscp table <port_id> <mtr_id> "
>                        "[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]"?
> Because in parse_multi_token_string(), it starts from port_id. Hmmm... The code seems very messy, not inconsistent.
> 

Please see my comment above, copied here:
  - "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
    command itself is not requiring it, can be better to double check the
    intention in the command.

If you check the code, port_id and mtr_id is not there.


>>   .tokens = {
>>   (void *)&cmd_set_port_meter_dscp_table_set,
>>   (void *)&cmd_set_port_meter_dscp_table_port,
>> @@ -1276,7 +1279,8 @@ static void
>> cmd_set_port_meter_policer_action_parsed(void *parsed_result,
>> cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
>>   .f = cmd_set_port_meter_policer_action_parsed,
>>   .data = NULL,
>> -.help_str = "Set port meter policer action",
>> +.help_str = "set port meter policer action <port_id> <mtr_id> "
>> +"<action_mask> <actiono> [<action1> <action2>]",
> 
> <action0>[ <action1> <action2>]?

ack

> Since it seems only 3 actions exist (action_mask & (~0x7UL), check action mask part in parse function).
> And each action seems to be G|Y|R|D|g|y|r|d. hmmm. Messy code...
> 
>>   .tokens = {
>>   (void *)&cmd_set_port_meter_policer_action_set,
>>   (void *)&cmd_set_port_meter_policer_action_port,
> <snip>
>> --
>> 2.29.2
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-stable] [PATCH v2] app/testpmd: fix meter commands help strings
  2021-02-05 13:39 [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings Ferruh Yigit
  2021-02-07  2:47 ` Li, Xiaoyun
@ 2021-02-08 15:15 ` Ferruh Yigit
  2021-02-09  2:35   ` Li, Xiaoyun
  2021-02-09 14:15 ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
  2 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2021-02-08 15:15 UTC (permalink / raw)
  To: Xiaoyun Li, Jasvinder Singh, Jingjing Wu, Adrien Mazarguil,
	Cristian Dumitrescu
  Cc: Ferruh Yigit, dev, stable

Helps strings syntax is "command : description", the 'command' part was
missing, updated command help strings.

Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: jasvinder.singh@intel.com
Cc: cristian.dumitrescu@intel.com

- "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
  command itself is not requiring it, can be better to double check the
  intention in the command.
- In command "show port meter stats <port_id> <mtr_id> yes|no", it is
  not clear what 'yes|no' is, can be better to have a 'clear' keyword
  there: "show port meter stats <port_id> <mtr_id> clear yes|no"
- 'meter' commands seems using many high level commands, that is harder
  to remember when you take all commands into account:
  "show port meter ..."
  "add port meter ..."
  "del port meter ..."
  "create port meter ..."
  "enable port meter ..."
  "disable port meter ..."
  "set port meter ..."
  And some high level commands created just for 'meter'. Instead I think
  it is better to group the commands, like:
  "port meter [add,del,create,enable,disable] ..."
  "show port meter ..."
  It is already too late but it worth to keep in mind for the possible
  future update.

v2:
* Fixed typo, actiono -> action0
* Added more info to help string, like "<variable>(possible values)"
---
 app/test-pmd/cmdline.c     |  2 +-
 app/test-pmd/cmdline_mtr.c | 33 +++++++++++++++++++--------------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 59722d268bc3..1b9da38fb745 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -719,7 +719,7 @@ static void cmd_help_long_parsed(void *parsed_result,
 			"set port meter profile (port_id) (mtr_id) (profile_id)\n"
 			"    meter update meter profile\n\n"
 
-			"set port meter dscp table (port_id) (mtr_id) [(dscp_tbl_entry0)\n"
+			"set port meter dscp table [(dscp_tbl_entry0)\n"
 			"(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
 			"    update meter dscp table entries\n\n"
 
diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 399ee56e07d9..298a5fc1acde 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -312,7 +312,7 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_cap = {
 	.f = cmd_show_port_meter_cap_parsed,
 	.data = NULL,
-	.help_str = "Show port meter cap",
+	.help_str = "show port meter cap <port_id>",
 	.tokens = {
 		(void *)&cmd_show_port_meter_cap_show,
 		(void *)&cmd_show_port_meter_cap_port,
@@ -408,7 +408,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile srtcm (rfc2697)",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -515,7 +515,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc2698)",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -627,7 +627,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc4115)",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -702,7 +702,7 @@ static void cmd_del_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter_profile = {
 	.f = cmd_del_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter profile",
+	.help_str = "del port meter profile <port_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_profile_del,
 		(void *)&cmd_del_port_meter_profile_port,
@@ -827,7 +827,10 @@ static void cmd_create_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_create_port_meter = {
 	.f = cmd_create_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Create port meter",
+	.help_str = "create port meter <port_id> <mtr_id> <profile_id> <meter_enable>(yes|no) "
+		"<g_action>(R|Y|G|D) <y_action>(R|Y|G|D) <r_action>(R|Y|G|D) "
+		"<stats_mask> <shared> <use_pre_meter_color> "
+		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ...<dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_create_port_meter_create,
 		(void *)&cmd_create_port_meter_port,
@@ -896,7 +899,7 @@ static void cmd_enable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_enable_port_meter = {
 	.f = cmd_enable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Enable port meter",
+	.help_str = "enable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_enable_port_meter_enable,
 		(void *)&cmd_enable_port_meter_port,
@@ -957,7 +960,7 @@ static void cmd_disable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_disable_port_meter = {
 	.f = cmd_disable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Disable port meter",
+	.help_str = "disable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_disable_port_meter_disable,
 		(void *)&cmd_disable_port_meter_port,
@@ -1018,7 +1021,7 @@ static void cmd_del_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter = {
 	.f = cmd_del_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter",
+	.help_str = "del port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_del,
 		(void *)&cmd_del_port_meter_port,
@@ -1092,7 +1095,7 @@ static void cmd_set_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_profile = {
 	.f = cmd_set_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Set port meter profile",
+	.help_str = "set port meter profile <port_id> <mtr_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_profile_set,
 		(void *)&cmd_set_port_meter_profile_port,
@@ -1166,7 +1169,8 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
 	.f = cmd_set_port_meter_dscp_table_parsed,
 	.data = NULL,
-	.help_str = "Update port meter dscp table",
+	.help_str = "set port meter dscp table "
+		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_dscp_table_set,
 		(void *)&cmd_set_port_meter_dscp_table_port,
@@ -1276,7 +1280,8 @@ static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
 	.f = cmd_set_port_meter_policer_action_parsed,
 	.data = NULL,
-	.help_str = "Set port meter policer action",
+	.help_str = "set port meter policer action <port_id> <mtr_id> "
+		"<action_mask> <action0> [<action1> <action2>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_policer_action_set,
 		(void *)&cmd_set_port_meter_policer_action_port,
@@ -1355,7 +1360,7 @@ static void cmd_set_port_meter_stats_mask_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_stats_mask = {
 	.f = cmd_set_port_meter_stats_mask_parsed,
 	.data = NULL,
-	.help_str = "Set port meter stats mask",
+	.help_str = "set port meter stats mask <port_id> <mtr_id> <stats_mask>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_stats_mask_set,
 		(void *)&cmd_set_port_meter_stats_mask_port,
@@ -1459,7 +1464,7 @@ static void cmd_show_port_meter_stats_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_stats = {
 	.f = cmd_show_port_meter_stats_parsed,
 	.data = NULL,
-	.help_str = "Show port meter stats",
+	.help_str = "show port meter stats <port_id> <mtr_id> <clear>(yes|no)",
 	.tokens = {
 		(void *)&cmd_show_port_meter_stats_show,
 		(void *)&cmd_show_port_meter_stats_port,
-- 
2.29.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH v2] app/testpmd: fix meter commands help strings
  2021-02-08 15:15 ` [dpdk-stable] [PATCH v2] " Ferruh Yigit
@ 2021-02-09  2:35   ` Li, Xiaoyun
  2021-02-09 11:19     ` Ferruh Yigit
  0 siblings, 1 reply; 10+ messages in thread
From: Li, Xiaoyun @ 2021-02-09  2:35 UTC (permalink / raw)
  To: Yigit, Ferruh, Singh, Jasvinder, Wu, Jingjing, Adrien Mazarguil,
	Dumitrescu, Cristian
  Cc: dev, stable

Hi

> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Monday, February 8, 2021 23:15
> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Adrien
> Mazarguil <adrien.mazarguil@6wind.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH v2] app/testpmd: fix meter commands help strings
> 
> Helps strings syntax is "command : description", the 'command' part was missing,
> updated command help strings.
> 
> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
> Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
> policing")
> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: jasvinder.singh@intel.com
> Cc: cristian.dumitrescu@intel.com
> 
> - "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
>   command itself is not requiring it, can be better to double check the
>   intention in the command.
> - In command "show port meter stats <port_id> <mtr_id> yes|no", it is
>   not clear what 'yes|no' is, can be better to have a 'clear' keyword
>   there: "show port meter stats <port_id> <mtr_id> clear yes|no"
> - 'meter' commands seems using many high level commands, that is harder
>   to remember when you take all commands into account:
>   "show port meter ..."
>   "add port meter ..."
>   "del port meter ..."
>   "create port meter ..."
>   "enable port meter ..."
>   "disable port meter ..."
>   "set port meter ..."
>   And some high level commands created just for 'meter'. Instead I think
>   it is better to group the commands, like:
>   "port meter [add,del,create,enable,disable] ..."
>   "show port meter ..."
>   It is already too late but it worth to keep in mind for the possible
>   future update.
> 
> v2:
> * Fixed typo, actiono -> action0
> * Added more info to help string, like "<variable>(possible values)"
> ---
>  app/test-pmd/cmdline.c     |  2 +-
>  app/test-pmd/cmdline_mtr.c | 33 +++++++++++++++++++--------------
>  2 files changed, 20 insertions(+), 15 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> 59722d268bc3..1b9da38fb745 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -719,7 +719,7 @@ static void cmd_help_long_parsed(void *parsed_result,
>  			"set port meter profile (port_id) (mtr_id) (profile_id)\n"
>  			"    meter update meter profile\n\n"
> 
> -			"set port meter dscp table (port_id) (mtr_id)
> [(dscp_tbl_entry0)\n"
> +			"set port meter dscp table [(dscp_tbl_entry0)\n"
>  			"(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
>  			"    update meter dscp table entries\n\n"
> 

I still have some concern on this one.
I understand the command itself doesn't include port_id & meter_id.
But this command use (void *)&cmd_set_port_meter_dscp_table_token_string, to take a string from cmd.
And in parser cmd_set_port_meter_dscp_table_parsed(), it will use parse_multi_token_string() to parse this token_string.
static int
parse_multi_token_string(char *t_str, uint16_t *port_id,
	uint32_t *mtr_id, enum rte_color **dscp_table)
{
	char *token;
	uint64_t val;
	int ret;

	/* First token: port id */
	token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
	if (token ==  NULL)
		return -1;

	ret = parse_uint(&val, token);
	if (ret != 0 || val > UINT16_MAX)
		return -1;

	*port_id = val;

	/* Second token: meter id */
	token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
	if (token == NULL)
		return 0;

	ret = parse_uint(&val, token);
	if (ret != 0 || val > UINT32_MAX)
		return -1;

	*mtr_id = val;

	ret = parse_dscp_table_entries(t_str, dscp_table);
	if (ret != 0)
		return -1;

	return 0;
}

In this function, the first thing in that string will be parsed as port id, the second thing will be parsed as meter id and then table entries.
So I think if the helper string is "set port meter dscp table [(dscp_tbl_entry0)...]". This will actually confuse users.
If a user follows the helper and sets command "set port meter dscp table dscp_tbl_entry0", user will get error because the " dscp_tbl_entry0" is treated as portid and there is no meter id provided.

I understand they shouldn't put port id and meter id in token string parse and should be put in command itself. But that's another story.

> --
> 2.29.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH v2] app/testpmd: fix meter commands help strings
  2021-02-09  2:35   ` Li, Xiaoyun
@ 2021-02-09 11:19     ` Ferruh Yigit
  0 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-02-09 11:19 UTC (permalink / raw)
  To: Li, Xiaoyun, Singh, Jasvinder, Wu, Jingjing, Adrien Mazarguil,
	Dumitrescu, Cristian
  Cc: dev, stable

On 2/9/2021 2:35 AM, Li, Xiaoyun wrote:
> Hi
> 
>> -----Original Message-----
>> From: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Sent: Monday, February 8, 2021 23:15
>> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Singh, Jasvinder
>> <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Adrien
>> Mazarguil <adrien.mazarguil@6wind.com>; Dumitrescu, Cristian
>> <cristian.dumitrescu@intel.com>
>> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
>> Subject: [PATCH v2] app/testpmd: fix meter commands help strings
>>
>> Helps strings syntax is "command : description", the 'command' part was missing,
>> updated command help strings.
>>
>> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
>> Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
>> policing")
>> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> Cc: jasvinder.singh@intel.com
>> Cc: cristian.dumitrescu@intel.com
>>
>> - "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
>>    command itself is not requiring it, can be better to double check the
>>    intention in the command.
>> - In command "show port meter stats <port_id> <mtr_id> yes|no", it is
>>    not clear what 'yes|no' is, can be better to have a 'clear' keyword
>>    there: "show port meter stats <port_id> <mtr_id> clear yes|no"
>> - 'meter' commands seems using many high level commands, that is harder
>>    to remember when you take all commands into account:
>>    "show port meter ..."
>>    "add port meter ..."
>>    "del port meter ..."
>>    "create port meter ..."
>>    "enable port meter ..."
>>    "disable port meter ..."
>>    "set port meter ..."
>>    And some high level commands created just for 'meter'. Instead I think
>>    it is better to group the commands, like:
>>    "port meter [add,del,create,enable,disable] ..."
>>    "show port meter ..."
>>    It is already too late but it worth to keep in mind for the possible
>>    future update.
>>
>> v2:
>> * Fixed typo, actiono -> action0
>> * Added more info to help string, like "<variable>(possible values)"
>> ---
>>   app/test-pmd/cmdline.c     |  2 +-
>>   app/test-pmd/cmdline_mtr.c | 33 +++++++++++++++++++--------------
>>   2 files changed, 20 insertions(+), 15 deletions(-)
>>
>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
>> 59722d268bc3..1b9da38fb745 100644
>> --- a/app/test-pmd/cmdline.c
>> +++ b/app/test-pmd/cmdline.c
>> @@ -719,7 +719,7 @@ static void cmd_help_long_parsed(void *parsed_result,
>>   "set port meter profile (port_id) (mtr_id) (profile_id)\n"
>>   "    meter update meter profile\n\n"
>>
>> -"set port meter dscp table (port_id) (mtr_id)
>> [(dscp_tbl_entry0)\n"
>> +"set port meter dscp table [(dscp_tbl_entry0)\n"
>>   "(dscp_tbl_entry1)...(dscp_tbl_entry63)]\n"
>>   "    update meter dscp table entries\n\n"
>>
> 
> I still have some concern on this one.
> I understand the command itself doesn't include port_id & meter_id.
> But this command use (void *)&cmd_set_port_meter_dscp_table_token_string, to take a string from cmd.
> And in parser cmd_set_port_meter_dscp_table_parsed(), it will use parse_multi_token_string() to parse this token_string.
> static int
> parse_multi_token_string(char *t_str, uint16_t *port_id,
> uint32_t *mtr_id, enum rte_color **dscp_table)
> {
> char *token;
> uint64_t val;
> int ret;
> 
> /* First token: port id */
> token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
> if (token ==  NULL)
> return -1;
> 
> ret = parse_uint(&val, token);
> if (ret != 0 || val > UINT16_MAX)
> return -1;
> 
> *port_id = val;
> 
> /* Second token: meter id */
> token = strtok_r(t_str, PARSE_DELIMITER, &t_str);
> if (token == NULL)
> return 0;
> 
> ret = parse_uint(&val, token);
> if (ret != 0 || val > UINT32_MAX)
> return -1;
> 
> *mtr_id = val;
> 
> ret = parse_dscp_table_entries(t_str, dscp_table);
> if (ret != 0)
> return -1;
> 
> return 0;
> }
> 
> In this function, the first thing in that string will be parsed as port id, the second thing will be parsed as meter id and then table entries.
> So I think if the helper string is "set port meter dscp table [(dscp_tbl_entry0)...]". This will actually confuse users.
> If a user follows the helper and sets command "set port meter dscp table dscp_tbl_entry0", user will get error because the " dscp_tbl_entry0" is treated as portid and there is no meter id provided.
> 

You are right, first two token of the 'token_string' is parsed as 'port_id' and 
'meter_id', so intention is to have them before 'dscp_table_entries'. I will 
update as you suggested.

> I understand they shouldn't put port id and meter id in token string parse and should be put in command itself. But that's another story.
> 

Cristian, Jasvider,

Can you please fix the command so that it gets 'port_id' and 'meter_id' as 
separate tokens, instead of it is being part of 'dscp_table_entries'?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [dpdk-stable] [PATCH v3] app/testpmd: fix meter commands help strings
  2021-02-05 13:39 [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings Ferruh Yigit
  2021-02-07  2:47 ` Li, Xiaoyun
  2021-02-08 15:15 ` [dpdk-stable] [PATCH v2] " Ferruh Yigit
@ 2021-02-09 14:15 ` Ferruh Yigit
  2021-02-09 15:32   ` Singh, Jasvinder
  2021-02-10  0:28   ` [dpdk-stable] " Li, Xiaoyun
  2 siblings, 2 replies; 10+ messages in thread
From: Ferruh Yigit @ 2021-02-09 14:15 UTC (permalink / raw)
  To: Xiaoyun Li, Jasvinder Singh, Jingjing Wu, Adrien Mazarguil,
	Cristian Dumitrescu
  Cc: Ferruh Yigit, dev, stable

Helps strings syntax is "command : description", the 'command' part was
missing, updated command help strings.

Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: jasvinder.singh@intel.com
Cc: cristian.dumitrescu@intel.com

- "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
  command itself is not requiring it, can be better to double check the
  intention in the command.
- In command "show port meter stats <port_id> <mtr_id> yes|no", it is
  not clear what 'yes|no' is, can be better to have a 'clear' keyword
  there: "show port meter stats <port_id> <mtr_id> clear yes|no"
- 'meter' commands seems using many high level commands, that is harder
  to remember when you take all commands into account:
  "show port meter ..."
  "add port meter ..."
  "del port meter ..."
  "create port meter ..."
  "enable port meter ..."
  "disable port meter ..."
  "set port meter ..."
  And some high level commands created just for 'meter'. Instead I think
  it is better to group the commands, like:
  "port meter [add,del,create,enable,disable] ..."
  "show port meter ..."
  It is already too late but it worth to keep in mind for the possible
  future update.

v2:
* Fixed typo, actiono -> action0
* Added more info to help string, like "<variable>(possible values)"

v3:
* Fix the "set port meter dscp table" command according the original
  intention
---
 app/test-pmd/cmdline_mtr.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/app/test-pmd/cmdline_mtr.c b/app/test-pmd/cmdline_mtr.c
index 399ee56e07d9..3982787d2093 100644
--- a/app/test-pmd/cmdline_mtr.c
+++ b/app/test-pmd/cmdline_mtr.c
@@ -312,7 +312,7 @@ static void cmd_show_port_meter_cap_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_cap = {
 	.f = cmd_show_port_meter_cap_parsed,
 	.data = NULL,
-	.help_str = "Show port meter cap",
+	.help_str = "show port meter cap <port_id>",
 	.tokens = {
 		(void *)&cmd_show_port_meter_cap_show,
 		(void *)&cmd_show_port_meter_cap_port,
@@ -408,7 +408,7 @@ static void cmd_add_port_meter_profile_srtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_srtcm = {
 	.f = cmd_add_port_meter_profile_srtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile srtcm (rfc2697)",
+	.help_str = "add port meter profile srtcm_rfc2697 <port_id> <profile_id> <cir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_srtcm_add,
 		(void *)&cmd_add_port_meter_profile_srtcm_port,
@@ -515,7 +515,7 @@ static void cmd_add_port_meter_profile_trtcm_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm = {
 	.f = cmd_add_port_meter_profile_trtcm_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc2698)",
+	.help_str = "add port meter profile trtcm_rfc2698 <port_id> <profile_id> <cir> <pir> <cbs> <pbs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_port,
@@ -627,7 +627,7 @@ static void cmd_add_port_meter_profile_trtcm_rfc4115_parsed(
 cmdline_parse_inst_t cmd_add_port_meter_profile_trtcm_rfc4115 = {
 	.f = cmd_add_port_meter_profile_trtcm_rfc4115_parsed,
 	.data = NULL,
-	.help_str = "Add port meter profile trtcm (rfc4115)",
+	.help_str = "add port meter profile trtcm_rfc4115 <port_id> <profile_id> <cir> <eir> <cbs> <ebs>",
 	.tokens = {
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_add,
 		(void *)&cmd_add_port_meter_profile_trtcm_rfc4115_port,
@@ -702,7 +702,7 @@ static void cmd_del_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter_profile = {
 	.f = cmd_del_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter profile",
+	.help_str = "del port meter profile <port_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_profile_del,
 		(void *)&cmd_del_port_meter_profile_port,
@@ -827,7 +827,10 @@ static void cmd_create_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_create_port_meter = {
 	.f = cmd_create_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Create port meter",
+	.help_str = "create port meter <port_id> <mtr_id> <profile_id> <meter_enable>(yes|no) "
+		"<g_action>(R|Y|G|D) <y_action>(R|Y|G|D) <r_action>(R|Y|G|D) "
+		"<stats_mask> <shared> <use_pre_meter_color> "
+		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ...<dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_create_port_meter_create,
 		(void *)&cmd_create_port_meter_port,
@@ -896,7 +899,7 @@ static void cmd_enable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_enable_port_meter = {
 	.f = cmd_enable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Enable port meter",
+	.help_str = "enable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_enable_port_meter_enable,
 		(void *)&cmd_enable_port_meter_port,
@@ -957,7 +960,7 @@ static void cmd_disable_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_disable_port_meter = {
 	.f = cmd_disable_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Disable port meter",
+	.help_str = "disable port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_disable_port_meter_disable,
 		(void *)&cmd_disable_port_meter_port,
@@ -1018,7 +1021,7 @@ static void cmd_del_port_meter_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_del_port_meter = {
 	.f = cmd_del_port_meter_parsed,
 	.data = NULL,
-	.help_str = "Delete port meter",
+	.help_str = "del port meter <port_id> <mtr_id>",
 	.tokens = {
 		(void *)&cmd_del_port_meter_del,
 		(void *)&cmd_del_port_meter_port,
@@ -1092,7 +1095,7 @@ static void cmd_set_port_meter_profile_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_profile = {
 	.f = cmd_set_port_meter_profile_parsed,
 	.data = NULL,
-	.help_str = "Set port meter profile",
+	.help_str = "set port meter profile <port_id> <mtr_id> <profile_id>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_profile_set,
 		(void *)&cmd_set_port_meter_profile_port,
@@ -1166,7 +1169,8 @@ static void cmd_set_port_meter_dscp_table_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_dscp_table = {
 	.f = cmd_set_port_meter_dscp_table_parsed,
 	.data = NULL,
-	.help_str = "Update port meter dscp table",
+	.help_str = "set port meter dscp table <port_id> <mtr_id> "
+		"[<dscp_tbl_entry0> <dscp_tbl_entry1> ... <dscp_tbl_entry63>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_dscp_table_set,
 		(void *)&cmd_set_port_meter_dscp_table_port,
@@ -1276,7 +1280,8 @@ static void cmd_set_port_meter_policer_action_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_policer_action = {
 	.f = cmd_set_port_meter_policer_action_parsed,
 	.data = NULL,
-	.help_str = "Set port meter policer action",
+	.help_str = "set port meter policer action <port_id> <mtr_id> "
+		"<action_mask> <action0> [<action1> <action2>]",
 	.tokens = {
 		(void *)&cmd_set_port_meter_policer_action_set,
 		(void *)&cmd_set_port_meter_policer_action_port,
@@ -1355,7 +1360,7 @@ static void cmd_set_port_meter_stats_mask_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_set_port_meter_stats_mask = {
 	.f = cmd_set_port_meter_stats_mask_parsed,
 	.data = NULL,
-	.help_str = "Set port meter stats mask",
+	.help_str = "set port meter stats mask <port_id> <mtr_id> <stats_mask>",
 	.tokens = {
 		(void *)&cmd_set_port_meter_stats_mask_set,
 		(void *)&cmd_set_port_meter_stats_mask_port,
@@ -1459,7 +1464,7 @@ static void cmd_show_port_meter_stats_parsed(void *parsed_result,
 cmdline_parse_inst_t cmd_show_port_meter_stats = {
 	.f = cmd_show_port_meter_stats_parsed,
 	.data = NULL,
-	.help_str = "Show port meter stats",
+	.help_str = "show port meter stats <port_id> <mtr_id> <clear>(yes|no)",
 	.tokens = {
 		(void *)&cmd_show_port_meter_stats_show,
 		(void *)&cmd_show_port_meter_stats_port,
-- 
2.29.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH v3] app/testpmd: fix meter commands help strings
  2021-02-09 14:15 ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
@ 2021-02-09 15:32   ` Singh, Jasvinder
  2021-02-10 20:59     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
  2021-02-10  0:28   ` [dpdk-stable] " Li, Xiaoyun
  1 sibling, 1 reply; 10+ messages in thread
From: Singh, Jasvinder @ 2021-02-09 15:32 UTC (permalink / raw)
  To: Yigit, Ferruh, Li, Xiaoyun, Wu, Jingjing, Adrien Mazarguil,
	Dumitrescu, Cristian
  Cc: dev, stable



> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Tuesday, February 9, 2021 2:15 PM
> To: Li, Xiaoyun <xiaoyun.li@intel.com>; Singh, Jasvinder
> <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Adrien
> Mazarguil <adrien.mazarguil@6wind.com>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH v3] app/testpmd: fix meter commands help strings
> 
> Helps strings syntax is "command : description", the 'command' part was
> missing, updated command help strings.
> 
> Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and
> policing")
> Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
> policing")
> Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing
> commands")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Cc: jasvinder.singh@intel.com
> Cc: cristian.dumitrescu@intel.com
> 

Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [PATCH v3] app/testpmd: fix meter commands help strings
  2021-02-09 14:15 ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
  2021-02-09 15:32   ` Singh, Jasvinder
@ 2021-02-10  0:28   ` Li, Xiaoyun
  1 sibling, 0 replies; 10+ messages in thread
From: Li, Xiaoyun @ 2021-02-10  0:28 UTC (permalink / raw)
  To: Yigit, Ferruh, Singh, Jasvinder, Wu, Jingjing, Adrien Mazarguil,
	Dumitrescu, Cristian
  Cc: dev, stable

Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>

-----Original Message-----
From: Yigit, Ferruh <ferruh.yigit@intel.com> 
Sent: Tuesday, February 9, 2021 22:15
To: Li, Xiaoyun <xiaoyun.li@intel.com>; Singh, Jasvinder <jasvinder.singh@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Adrien Mazarguil <adrien.mazarguil@6wind.com>; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org; stable@dpdk.org
Subject: [PATCH v3] app/testpmd: fix meter commands help strings

Helps strings syntax is "command : description", the 'command' part was missing, updated command help strings.

Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and policing")
Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")
Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing commands")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: jasvinder.singh@intel.com
Cc: cristian.dumitrescu@intel.com

- "set port meter dscp table" documented with 'port_id' & 'mtr_id', but
  command itself is not requiring it, can be better to double check the
  intention in the command.
- In command "show port meter stats <port_id> <mtr_id> yes|no", it is
  not clear what 'yes|no' is, can be better to have a 'clear' keyword
  there: "show port meter stats <port_id> <mtr_id> clear yes|no"
- 'meter' commands seems using many high level commands, that is harder
  to remember when you take all commands into account:
  "show port meter ..."
  "add port meter ..."
  "del port meter ..."
  "create port meter ..."
  "enable port meter ..."
  "disable port meter ..."
  "set port meter ..."
  And some high level commands created just for 'meter'. Instead I think
  it is better to group the commands, like:
  "port meter [add,del,create,enable,disable] ..."
  "show port meter ..."
  It is already too late but it worth to keep in mind for the possible
  future update.

v2:
* Fixed typo, actiono -> action0
* Added more info to help string, like "<variable>(possible values)"

v3:
* Fix the "set port meter dscp table" command according the original
  intention
---
 app/test-pmd/cmdline_mtr.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3] app/testpmd: fix meter commands help strings
  2021-02-09 15:32   ` Singh, Jasvinder
@ 2021-02-10 20:59     ` Thomas Monjalon
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2021-02-10 20:59 UTC (permalink / raw)
  To: Yigit, Ferruh
  Cc: Li, Xiaoyun, Wu, Jingjing, Adrien Mazarguil, Dumitrescu,
	Cristian, dev, stable, Singh, Jasvinder

> > Helps strings syntax is "command : description", the 'command' part was
> > missing, updated command help strings.
> > 
> > Fixes: 281eeb8afc55 ("app/testpmd: add commands for metering and
> > policing")
> > Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and
> > policing")
> > Fixes: e63b50162aa3 ("app/testpmd: clean metering and policing
> > commands")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> > Cc: jasvinder.singh@intel.com
> > Cc: cristian.dumitrescu@intel.com
> 
> Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-10 21:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 13:39 [dpdk-stable] [PATCH] app/testpmd: fix meter commands help strings Ferruh Yigit
2021-02-07  2:47 ` Li, Xiaoyun
2021-02-08 14:40   ` Ferruh Yigit
2021-02-08 15:15 ` [dpdk-stable] [PATCH v2] " Ferruh Yigit
2021-02-09  2:35   ` Li, Xiaoyun
2021-02-09 11:19     ` Ferruh Yigit
2021-02-09 14:15 ` [dpdk-stable] [PATCH v3] " Ferruh Yigit
2021-02-09 15:32   ` Singh, Jasvinder
2021-02-10 20:59     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
2021-02-10  0:28   ` [dpdk-stable] " Li, Xiaoyun

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git