app/testpmd: support the query of link flow ctrl info
PATCH 1/1 app/testpmd: support the query of link flow ctrl info
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id> flow_ctrl
--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)
app/test-pmd/cmdline.c +83 -0
@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }
@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + +if (!rte_eth_dev_is_valid_port (res->port_id)) { +printf ("Invalid port id %u\n" , res->port_id); +return ; + } + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if ((fc_conf.mode ==RTE_FC_RX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL )) + rx_fc_en = true; +if ((fc_conf.mode ==RTE_FC_TX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL )) + tx_fc_en = true; + +printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" ); +printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); +printf ("mac ctrl frame fwd: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"On" :"Off" ); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;
@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
Hi
Quoted 21 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 15, 2021 14:47
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)
<snip>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6924
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" );
"fc_conf.autoneg ? "On" : "Off"" is enough like the others in this patch.
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6929
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); + printf("mac ctrl frame fwd: %s\n",
Follow others' format will be better like "Send Xon". "Forward MAC control frames:"
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+ fc_conf.mac_ctrl_frame_fwd ? "On" : "Off"); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} +
<snip>
Quoted 3 lines
--
2.7.4
Hi,
Quoted 32 lines · Xiaoyun
Hi
Quoted 21 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 15, 2021 14:47
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)<snip>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6924
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" );"fc_conf.autoneg ? "On" : "Off"" is enough like the others in this patch.Got it.
Quoted 9 lines
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6929
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); + printf("mac ctrl frame fwd: %s\n",Follow others' format will be better like "Send Xon". "Forward MAC control frames:"
I don not catch your meaning. Is that right?:
change the statement
"
+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off");
+ printf("mac ctrl frame fwd: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off")
"
to
"
+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off");
+ printf("Forward MAC control frames: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off")
"
Quoted 12 lines
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+ fc_conf.mac_ctrl_frame_fwd ? "On" : "Off"); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} +<snip>
Quoted 3 lines
--
2.7.4.
Hi
Quoted 52 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Monday, April 19, 2021 14:41
To: Li, Xiaoyun <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH] app/testpmd: support the query of link flow ctrl infoHi,
Quoted 20 lines · Xiaoyun
Hi
Quoted 18 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 15, 2021 14:47
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83+++++++++++++++++++++++++++++
Quoted 12 lines
Quoted 3 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)<snip>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6924
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" );"fc_conf.autoneg ? "On" : "Off"" is enough like the others in this patch.Got it.
Quoted 9 lines
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6929
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); + printf("mac ctrl frame fwd: %s\n",Follow others' format will be better like "Send Xon". "Forward MAC control frames:"
I don not catch your meaning. Is that right?:
Quoted 1 line
change the statement
I mean change the statement as:printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); printf("Forward MAC control frames: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off");
Keep the same format.
Quoted 26 lines
"
(quoted diff) +2
-0+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("mac ctrl frame fwd: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" :"Off")
"
to"
(quoted diff) +2
-0+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("Forward MAC controlframes: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off")
"Quoted 12 lines
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+ fc_conf.mac_ctrl_frame_fwd ? "On" : "Off"); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} +<snip>
Quoted 3 lines
--
2.7.4.
Hi, fixed in v2, thanks
Quoted 90 lines · Xiaoyun
Hi
Quoted 52 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Monday, April 19, 2021 14:41
To: Li, Xiaoyun <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>
Subject: Re: [PATCH] app/testpmd: support the query of link flow ctrl infoHi,
Quoted 20 lines · Xiaoyun
Hi
Quoted 18 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 15, 2021 14:47
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83+++++++++++++++++++++++++++++
Quoted 12 lines
Quoted 3 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)<snip>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6924
Quoted 6 lines
app/test-pmd/cmdline.c +6
-0+printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" );"fc_conf.autoneg ? "On" : "Off"" is enough like the others in this patch.Got it.
Quoted 9 lines
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6929
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); + printf("mac ctrl frame fwd: %s\n",Follow others' format will be better like "Send Xon". "Forward MAC control frames:"
I don not catch your meaning. Is that right?:Quoted 1 line
change the statement
I mean change the statement as:
printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off");printf("Forward MAC control frames: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off");Keep the same format.
Quoted 10 lines
"
(quoted diff) +2
-0+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("mac ctrl frame fwd: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" :"Off")
"
to"
(quoted diff) +2
-0+ printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("Forward MAC controlQuoted 16 lines
frames: %s\n",fc_conf.mac_ctrl_frame_fwd ? "On" : "Off")
"Quoted 12 lines
Quoted 5 lines
app/test-pmd/cmdline.c +5
-0+ fc_conf.mac_ctrl_frame_fwd ? "On" : "Off"); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} +<snip>
Quoted 3 lines
--
2.7.4.
.
PATCH v2 1/1 app/testpmd: support the query of link flow ctrl info
In reply to Min Hu (Connor)From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id> flow_ctrl
--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)
app/test-pmd/cmdline.c +83 -0
@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }
@@ -6899,6 +6902,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + +if (!rte_eth_dev_is_valid_port (res->port_id)) { +printf ("Invalid port id %u\n" , res->port_id); +return ; + } + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if ((fc_conf.mode ==RTE_FC_RX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL )) + rx_fc_en = true; +if ((fc_conf.mode ==RTE_FC_TX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL )) + tx_fc_en = true; + +printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg ?"On" :"Off" ); +printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); +printf ("Forward MAC control frames: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"On" :"Off" ); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;
@@ -17037,6 +17119,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
Quoted 10 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>
Hi
Quoted 14 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Monday, April 19, 2021 16:28
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrl
Quoted 8 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)2.7.4
Ferruh Yigit
AppliedQuoted 23 lines · Xiaoyun
Hi
Quoted 21 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Monday, April 19, 2021 16:28
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2] app/testpmd: support the query of link flow ctrl infoFrom: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)
Quoted 5 lines
Quoted 1 line
2.7.4
Acked-by Xiaoyun Li <[email protected]>
Applied to dpdk-next-net/main, thanks.
Quoted 10 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>
Hi Connor,
Just a few minor comments,
thanks,
Kevin.
Quoted 47 lines
--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)app/test-pmd/cmdline.c +27
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed(void *parsed_result, + __rte_unused struct cmdline *cl,
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6902
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+ __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + +if (!rte_eth_dev_is_valid_port (res->port_id)) {
This ^ is already checked in rte_eth_dev_flow_ctrl_get() below. That said, it's not doing any harm here and you would need to add check for -ENODEV below if you wanted to tell the user that the port is invalid so either way is ok IMHO.
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6914
Quoted 12 lines
app/test-pmd/cmdline.c +12
-0+printf ("Invalid port id %u\n" , res->port_id); +return ; + } + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if ((fc_conf.mode ==RTE_FC_RX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL ))
You can remove unnecessary brackets, i.e.
if (fc_conf.mode == RTE_FC_RX_PAUSE || fc_conf.mode == RTE_FC_FULL)
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6916
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ rx_fc_en = true; +if ((fc_conf.mode ==RTE_FC_TX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL ))
same comment on brackets
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +3
-0+ tx_fc_en = true; + + printf("\n%s Flow control infos for port %-2d %s\n",
s/infos/info/
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6921
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ info_border, res->port_id, info_border); +printf ("FC mode:\n" );
It's better not to introduce a new acronym (even if it's a bit obvious)
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6930
Quoted 9 lines
app/test-pmd/cmdline.c +9
-0+printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" ); +printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); +printf ("mac ctrl frame fwd: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"On" :"Off" );
There's a mix of struct member names and descriptions here. I think it's better to stick to one or the other.
i.e. currently
testpmd> show port 0 flow_ctrl
********************* Flow control infos for port 0 ********************* FC mode:
Rx: Off
Tx: Off
FC autoneg status: Onpause_time: 0x680high_water: 0x80low_water: 0x40
Send Xon: On
Forward MAC control frames: Off
Suggestion:
********************* Flow control info for port 0 ********************* Rx mode: off
Tx mode: off
Autoneg: on
Pause time: 0x680
High water: 0x80
Low water: 0x40
Send XON: on
Forward MAC control frames: off
*********************************** End ********************************
As ever, display is subjective, so please take as suggestion, you/others may have different view.
Quoted 47 lines
app/test-pmd/cmdline.c +18
-0+printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +7
-0@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~
Hi Kevin,
Thank you for your review.
This patchset has been applied to dpdk-next-net/main. I will send a new patch to fix it.
Your suggestion is better. I intend to use the following format:
********************* Flow control info for port 0 ********************* FC mode:
Rx pause: off
Tx pause: off
Autoneg: on
Pause time: 0x680
High waterline: 0x80
Low waterline: 0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************
Quoted 202 lines · Kevin Traynor
Quoted 10 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Hi Connor,
Just a few minor comments,
thanks,
Kevin.Quoted 47 lines
--- app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 90 insertions(+)app/test-pmd/cmdline.c +27
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed(void *parsed_result, + __rte_unused struct cmdline *cl,app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6902
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+ __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + +if (!rte_eth_dev_is_valid_port (res->port_id)) {This ^ is already checked in
rte_eth_dev_flow_ctrl_get()below. That said, it's not doing any harm here and you would need to add check for-ENODEVbelow if you wanted to tell the user that the port is invalid so either way is ok IMHO.app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6914
Quoted 12 lines
app/test-pmd/cmdline.c +12
-0+printf ("Invalid port id %u\n" , res->port_id); +return ; + } + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if ((fc_conf.mode ==RTE_FC_RX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL ))You can remove unnecessary brackets, i.e.
if (fc_conf.mode ==RTE_FC_RX_PAUSE|| fc_conf.mode ==RTE_FC_FULL)app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6916
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ rx_fc_en = true; +if ((fc_conf.mode ==RTE_FC_TX_PAUSE ) || (fc_conf.mode ==RTE_FC_FULL ))same comment on brackets
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +3
-0+ tx_fc_en = true; + + printf("\n%s Flow control infos for port %-2d %s\n",s/infos/info/
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6921
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ info_border, res->port_id, info_border); +printf ("FC mode:\n" );It's better not to introduce a new acronym (even if it's a bit obvious)
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6930
Quoted 9 lines
app/test-pmd/cmdline.c +9
-0+printf (" Rx: %s\n" , rx_fc_en ?"On" :"Off" ); +printf (" Tx: %s\n" , tx_fc_en ?"On" :"Off" ); +printf ("FC autoneg status: %s\n" , fc_conf.autoneg !=0 ?"On" :"Off" ); +printf ("pause_time: 0x%x\n" , fc_conf.pause_time); +printf ("high_water: 0x%x\n" , fc_conf.high_water); +printf ("low_water: 0x%x\n" , fc_conf.low_water); +printf ("Send Xon: %s\n" , fc_conf.send_xon ?"On" :"Off" ); +printf ("mac ctrl frame fwd: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"On" :"Off" );There's a mix of struct member names and descriptions here. I think it's better to stick to one or the other.
i.e. currently
testpmd> show port 0
flow_ctrl********************* Flow control infos for port 0 ********************* FC mode:
Rx: Off
Tx: Off
FC autoneg status: Onpause_time:0x680high_water:0x80low_water:0x40
Send Xon: On
Forward MAC control frames: OffSuggestion:
********************* Flow control info for port 0 ********************* Rx mode: off
Tx mode: off
Autoneg: on
Pause time:0x680
High water:0x80
Low water:0x40
Send XON: on
Forward MAC control frames: off
*********************************** End ********************************As ever, display is subjective, so please take as suggestion, you/others may have different view.
Quoted 37 lines
app/test-pmd/cmdline.c +18
-0+printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +0
-0@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter.doc/guides/testpmd_app_ug/testpmd_funcs.rst Where: · line 1538
Quoted 10 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7
-0+show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~.
Quoted 8 lines · Huisong Li
Hi Kevin,
Thank you for your review.
This patchset has been applied to dpdk-next-net/main. I will send a new patch to fix it.
Your suggestion is better. I intend to use the following format:
Quoted 12 lines
********************* Flow control info for port 0 ********************* FC mode:
Rx pause: off
Tx pause: off
Autoneg: on
Pause time:0x680
High waterline:0x80
Low waterline:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************
I missed the outstanding comments from Kevin, I will drop the patch from next-net, we can proceed with next version.
Quoted 198 lines · Kevin Traynor
Quoted 196 lines · Min Hu (Connor)
Quoted 10 lines
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Hi Connor,
Just a few minor comments,
thanks,
Kevin.Quoted 44 lines
---
app/test-pmd/cmdline.c | 83 +++++++++++++++++++++++++++++doc/guides/testpmd_app_ug/testpmd_funcs.rst| 7 +++2 files changed, 90 insertions(+)app/test-pmd/cmdline.c +0
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (
port_id)fec_mode"
" Show fec mode of a port.\n\n" +
+ "show port <port_id>flow_ctrl"
+ " Show flow control info of a port.\n\n" );
}app/test-pmd/cmdline.c +24
-0@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { + cmdline_fixed_string_t show; + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show, "show"); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port, "port"); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl, "flow_ctrl"); + +static void +cmd_link_flow_ctrl_show_parsed(void *parsed_result, + __rte_unused struct cmdline *cl,app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6901
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+ __rte_unused void *data) +{ + struct cmd_link_flow_ctrl_show *res = parsed_result; + static const char *info_border = "*********************"; + struct rte_eth_fc_conf fc_conf; + bool rx_fc_en = false; + bool tx_fc_en = false; + int ret; + + if (!rte_eth_dev_is_valid_port(res->port_id)) {This ^ is already checked in
rte_eth_dev_flow_ctrl_get()below. That said, it's not doing any harm here and you would need to add check for-ENODEVbelow if you wanted to tell the user that the port is invalid so either way is ok IMHO.app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6914
Quoted 12 lines
app/test-pmd/cmdline.c +12
-0+ printf("Invalid port id %u\n", res->port_id); + return; + } + + ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf); + if (ret != 0) { + printf("Failed to get current flow ctrl information: err = %d\n", + ret); + return; + } + + if ((fc_conf.mode == RTE_FC_RX_PAUSE) || (fc_conf.mode == RTE_FC_FULL))You can remove unnecessary brackets, i.e.
if (fc_conf.mode ==RTE_FC_RX_PAUSE|| fc_conf.mode ==RTE_FC_FULL)app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6916
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ rx_fc_en = true; + if ((fc_conf.mode == RTE_FC_TX_PAUSE) || (fc_conf.mode == RTE_FC_FULL))same comment on brackets
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +3
-0+ tx_fc_en = true; + + printf("\n%s Flow control infos for port %-2d %s\n",s/infos/info/
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6921
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ info_border, res->port_id, info_border); + printf("FC mode:\n");It's better not to introduce a new acronym (even if it's a bit obvious)
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6930
Quoted 9 lines
app/test-pmd/cmdline.c +9
-0+ printf(" Rx: %s\n", rx_fc_en ? "On" : "Off"); + printf(" Tx: %s\n", tx_fc_en ? "On" : "Off"); + printf("FC autoneg status: %s\n", fc_conf.autoneg != 0 ? "On" : "Off"); + printf("pause_time: 0x%x\n", fc_conf.pause_time); + printf("high_water: 0x%x\n", fc_conf.high_water); + printf("low_water: 0x%x\n", fc_conf.low_water); + printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("mac ctrl frame fwd: %s\n", + fc_conf.mac_ctrl_frame_fwd ? "On" : "Off");There's a mix of struct member names and descriptions here. I think it's better to stick to one or the other.
i.e. currently
testpmd> show port 0
flow_ctrl********************* Flow control infos for port 0 ********************* FC mode:
Rx: Off
Tx: Off
FC autoneg status: Onpause_time:0x680high_water:0x80low_water:0x40
Send Xon: On
Forward MAC control frames: OffSuggestion:
********************* Flow control info for port 0 ********************* Rx mode: off
Tx mode: off
Autoneg: on
Pause time:0x680
High water:0x80
Low water:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************As ever, display is subjective, so please take as suggestion, you/others may have different view.
Quoted 41 lines
app/test-pmd/cmdline.c +18
-0+ printf("\n%s************** End ***********%s\n", + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data = NULL, + .help_str = "show port <port_id> flow_ctrl", + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, + NULL, + }, +}; + /* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result { cmdline_fixed_string_t set;@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +7
-0@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl +Quoted 3 lines
set
pfc_ctrlrx
~~~~~~~~~~~~~~~.
Quoted 22 lines · Ferruh Yigit
Quoted 8 lines · Huisong Li
Hi Kevin,
Thank you for your review.
This patchset has been applied to dpdk-next-net/main. I will send a new patch to fix it.
Your suggestion is better. I intend to use the following format:
Quoted 12 lines
********************* Flow control info for port 0 ********************* FC mode:
Rx pause: off
Tx pause: off
Autoneg: on
Pause time:0x680
High waterline:0x80
Low waterline:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************
Quoted 2 lines
I missed the outstanding comments from Kevin, I will drop the patch from next-net, we can proceed with next version.
v2 dropped from tree, patchwork status updated. Please send v3.
Quoted 200 lines
Quoted 199 lines · Kevin Traynor
Quoted 197 lines · Min Hu (Connor)
Quoted 10 lines
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Hi Connor,
Just a few minor comments,
thanks,
Kevin.Quoted 45 lines
---
app/test-pmd/cmdline.c | 83
+++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst| 7 +++2 files changed, 90 insertions(+)app/test-pmd/cmdline.c +0
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (
port_id)fec_mode"
" Show fec mode of a port.\n\n" +
+ "show port <port_id>flow_ctrl"
+ " Show flow control info of a port.\n\n" );
}app/test-pmd/cmdline.c +24
-0@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { + cmdline_fixed_string_t show; + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show, "show"); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port, "port"); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl, "flow_ctrl"); + +static void +cmd_link_flow_ctrl_show_parsed(void *parsed_result, + __rte_unused struct cmdline *cl,app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6901
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+ __rte_unused void *data) +{ + struct cmd_link_flow_ctrl_show *res = parsed_result; + static const char *info_border = "*********************"; + struct rte_eth_fc_conf fc_conf; + bool rx_fc_en = false; + bool tx_fc_en = false; + int ret; + + if (!rte_eth_dev_is_valid_port(res->port_id)) {This ^ is already checked in
rte_eth_dev_flow_ctrl_get()below. That said, it's not doing any harm here and you would need to add check for-ENODEVbelow if you wanted to tell the user that the port is invalid so either way is ok IMHO.app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6914
Quoted 12 lines
app/test-pmd/cmdline.c +12
-0+ printf("Invalid port id %u\n", res->port_id); + return; + } + + ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf); + if (ret != 0) { + printf("Failed to get current flow ctrl information: err = %d\n", + ret); + return; + } + + if ((fc_conf.mode == RTE_FC_RX_PAUSE) || (fc_conf.mode == RTE_FC_FULL))You can remove unnecessary brackets, i.e.
if (fc_conf.mode ==RTE_FC_RX_PAUSE|| fc_conf.mode ==RTE_FC_FULL)app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6916
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ rx_fc_en = true; + if ((fc_conf.mode == RTE_FC_TX_PAUSE) || (fc_conf.mode == RTE_FC_FULL))same comment on brackets
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +3
-0+ tx_fc_en = true; + + printf("\n%s Flow control infos for port %-2d %s\n",s/infos/info/
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6921
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ info_border, res->port_id, info_border); + printf("FC mode:\n");It's better not to introduce a new acronym (even if it's a bit obvious)
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6930
Quoted 9 lines
app/test-pmd/cmdline.c +9
-0+ printf(" Rx: %s\n", rx_fc_en ? "On" : "Off"); + printf(" Tx: %s\n", tx_fc_en ? "On" : "Off"); + printf("FC autoneg status: %s\n", fc_conf.autoneg != 0 ? "On" : "Off"); + printf("pause_time: 0x%x\n", fc_conf.pause_time); + printf("high_water: 0x%x\n", fc_conf.high_water); + printf("low_water: 0x%x\n", fc_conf.low_water); + printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("mac ctrl frame fwd: %s\n", + fc_conf.mac_ctrl_frame_fwd ? "On" : "Off");There's a mix of struct member names and descriptions here. I think it's better to stick to one or the other.
i.e. currently
testpmd> show port 0
flow_ctrl********************* Flow control infos for port 0 ********************* FC mode:
Rx: Off
Tx: Off
FC autoneg status: Onpause_time:0x680high_water:0x80low_water:0x40
Send Xon: On
Forward MAC control frames: OffSuggestion:
********************* Flow control info for port 0 ********************* Rx mode: off
Tx mode: off
Autoneg: on
Pause time:0x680
High water:0x80
Low water:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************As ever, display is subjective, so please take as suggestion, you/others may have different view.
Quoted 41 lines
app/test-pmd/cmdline.c +18
-0+ printf("\n%s************** End ***********%s\n", + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data = NULL, + .help_str = "show port <port_id> flow_ctrl", + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, + NULL, + }, +}; + /* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result { cmdline_fixed_string_t set;@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +7
-0@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl +Quoted 3 lines
set
pfc_ctrlrx
~~~~~~~~~~~~~~~.
Quoted 23 lines · Ferruh Yigit
Quoted 22 lines · Ferruh Yigit
Quoted 20 lines · Huisong Li
Hi Kevin,
Thank you for your review.
This patchset has been applied to dpdk-next-net/main. I will send a new patch to fix it.
Your suggestion is better. I intend to use the following format:
********************* Flow control info for port 0 ********************* FC mode:
Rx pause: off
Tx pause: off
Autoneg: on
Pause time:0x680
High waterline:0x80
Low waterline:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************
Quoted 5 lines
Quoted 2 lines
I missed the outstanding comments from Kevin, I will drop the patch from next-net, we can proceed with next version.
v2 dropped from tree, patchwork status updated. Please send v3.
Hi, v3 has been sent, thanks.
Quoted 208 lines
Quoted 197 lines
Quoted 197 lines · Kevin Traynor
Quoted 195 lines · Min Hu (Connor)
Quoted 10 lines
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Hi Connor,
Just a few minor comments,
thanks,
Kevin.Quoted 47 lines
---
app/test-pmd/cmdline.c | 83
+++++++++++++++++++++++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst| 7 +++2 files changed, 90 insertions(+)app/test-pmd/cmdline.c +0
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (
port_id)fec_mode"
" Show fec mode of a port.\n\n" +
+ "show port <port_id>flow_ctrl"
+ " Show flow control info of a port.\n\n" );
}app/test-pmd/cmdline.c +24
-0@@ -6863,6 +6866,85 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { + cmdline_fixed_string_t show; + cmdline_fixed_string_t port; + portid_t port_id; + cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show, "show"); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port, "port"); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl, "flow_ctrl"); + +static void +cmd_link_flow_ctrl_show_parsed(void *parsed_result, + __rte_unused struct cmdline *cl,app/test-pmd/cmdline.c cmdline_parse_inst_t · line 6902
Quoted 10 lines
app/test-pmd/cmdline.c +10
-0+ __rte_unused void *data) +{ + struct cmd_link_flow_ctrl_show *res = parsed_result; + static const char *info_border = "*********************"; + struct rte_eth_fc_conf fc_conf; + bool rx_fc_en = false; + bool tx_fc_en = false; + int ret; + + if (!rte_eth_dev_is_valid_port(res->port_id)) {This ^ is already checked in
rte_eth_dev_flow_ctrl_get()below. That said, it's not doing any harm here and you would need to add check for-ENODEVbelow if you wanted to tell the user that the port is invalid so either way is ok IMHO.Quoted 4 lines
app/test-pmd/cmdline.c +4
-0+ printf("Invalid port id %u\n", res->port_id); + return; + } +app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = {
Quoted 10 lines
app/test-pmd/cmdline.c +8
-0+ ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf); + if (ret != 0) { + printf("Failed to get current flow ctrl information: err = %d\n", + ret); + return; + } + + if ((fc_conf.mode == RTE_FC_RX_PAUSE) || (fc_conf.mode ==RTE_FC_FULL ))You can remove unnecessary brackets, i.e.
if (fc_conf.mode ==RTE_FC_RX_PAUSE|| fc_conf.mode ==RTE_FC_FULL)app/test-pmd/cmdline.c cmdline_parse_inst_t · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +2
-0+ rx_fc_en = true; + if ((fc_conf.mode == RTE_FC_TX_PAUSE) || (fc_conf.mode ==RTE_FC_FULL ))same comment on brackets
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6919
Quoted 3 lines
app/test-pmd/cmdline.c +3
-0+ tx_fc_en = true; + + printf("\n%s Flow control infos for port %-2d %s\n",s/infos/info/
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_set_allmulti_mode_one = { · line 6921
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ info_border, res->port_id, info_border); + printf("FC mode:\n");It's better not to introduce a new acronym (even if it's a bit obvious)
Quoted 10 lines
app/test-pmd/cmdline.c +3
-0+ printf(" Rx: %s\n", rx_fc_en ? "On" : "Off"); + printf(" Tx: %s\n", tx_fc_en ? "On" : "Off"); + printf("FC autoneg status: %s\n", fc_conf.autoneg != 0 ? "On": "Off");
+printf("pause_time: 0x%x\n", fc_conf.pause_time); +printf("high_water: 0x%x\n", fc_conf.high_water); +printf("low_water: 0x%x\n", fc_conf.low_water); +printf("Send Xon: %s\n", fc_conf.send_xon ? "On" : "Off"); + printf("mac ctrl frame fwd: %s\n",
+ fc_conf.mac_ctrl_frame_fwd ? "On" : "Off");There's a mix of struct member names and descriptions here. I think it's better to stick to one or the other.
i.e. currently
testpmd> show port 0
flow_ctrl********************* Flow control infos for port 0 ********************* FC mode:
Rx: Off
Tx: Off
FC autoneg status: Onpause_time:0x680high_water:0x80low_water:0x40
Send Xon: On
Forward MAC control frames: OffSuggestion:
********************* Flow control info for port 0 ********************* Rx mode: off
Tx mode: off
Autoneg: on
Pause time:0x680
High water:0x80
Low water:0x40
Send XON: on
Forward MAC control frames: off *********************************** End ********************************As ever, display is subjective, so please take as suggestion, you/others may have different view.
Quoted 37 lines
+
printf("\n%s************** End ***********%s\n", + info_border, info_border);app/test-pmd/cmdline.c +15
-0+} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data = NULL, + .help_str = "show port <port_id> flow_ctrl", + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, + NULL, + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */
structcmd_link_flow_ctrl_set_result{
cmdline_fixed_string_tset;app/test-pmd/cmdline.c +1
-0@@ -17001,6 +17083,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +3
-0@@ -1526,6 +1526,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ +Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +4
-0+show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl +set
pfc_ctrlrx
~~~~~~~~~~~~~~~.
.
PATCH v3 1/1 app/testpmd: support the query of link flow ctrl info
In reply to Min Hu (Connor)From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id> flow_ctrl
---
v3:
* fixed the print format of link flow ctrl, and removes redundant port number verification.
v2:
* fixed logging.
--- app/test-pmd/cmdline.c | 78 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 85 insertions(+)
app/test-pmd/cmdline.c +78 -0
@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }
@@ -6863,6 +6866,80 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if (fc_conf.mode ==RTE_FC_RX_PAUSE || fc_conf.mode ==RTE_FC_FULL ) + rx_fc_en = true; +if (fc_conf.mode ==RTE_FC_TX_PAUSE || fc_conf.mode ==RTE_FC_FULL ) + tx_fc_en = true; + +printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx pause: %s\n" , rx_fc_en ?"on" :"off" ); +printf (" Tx pause: %s\n" , tx_fc_en ?"on" :"off" ); +printf ("Autoneg: %s\n" , fc_conf.autoneg ?"on" :"off" ); +printf ("Pause time: 0x%x\n" , fc_conf.pause_time); +printf ("High waterline: 0x%x\n" , fc_conf.high_water); +printf ("Low waterline: 0x%x\n" , fc_conf.low_water); +printf ("Send XON: %s\n" , fc_conf.send_xon ?"on" :"off" ); +printf ("Forward MAC control frames: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"on" :"off" ); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;
@@ -17354,6 +17431,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,
doc/guides/testpmd_app_ug/testpmd_funcs.rst +7 -0
@@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~
Signature · 1 line
2.7.4
Quoted 8 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrl
Thanks Connor,
Quoted 136 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>---
v3:
* fixed the print format of link flow ctrl, and removes redundant port number verification.v2:
* fixed logging.--- app/test-pmd/cmdline.c | 78 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 2 files changed, 85 insertions(+)app/test-pmd/cmdline.c +78
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl" +" Show flow control info of a port.\n\n" ); }@@ -6863,6 +6866,80 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { }, }; +/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ +struct cmd_link_flow_ctrl_show { +cmdline_fixed_string_t show; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t flow_ctrl; +}; + +cmdline_parse_token_string_t cmd_lfc_show_show = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + show,"show" ); +cmdline_parse_token_string_t cmd_lfc_show_port = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + port,"port" ); +cmdline_parse_token_num_t cmd_lfc_show_portid = + TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, + port_id,RTE_UINT16 ); +cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = + TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, + flow_ctrl,"flow_ctrl" ); + +static void +cmd_link_flow_ctrl_show_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_link_flow_ctrl_show *res = parsed_result; +static const char *info_border ="*********************" ; +struct rte_eth_fc_conf fc_conf; +bool rx_fc_en = false; +bool tx_fc_en = false; +int ret; + + ret =rte_eth_dev_flow_ctrl_get (res->port_id, &fc_conf); +if (ret !=0 ) { +printf ("Failed to get current flow ctrl information: err = %d\n" , + ret); +return ; + } + +if (fc_conf.mode ==RTE_FC_RX_PAUSE || fc_conf.mode ==RTE_FC_FULL ) + rx_fc_en = true; +if (fc_conf.mode ==RTE_FC_TX_PAUSE || fc_conf.mode ==RTE_FC_FULL ) + tx_fc_en = true; + +printf ("\n%s Flow control infos for port %-2d %s\n" , + info_border, res->port_id, info_border); +printf ("FC mode:\n" ); +printf (" Rx pause: %s\n" , rx_fc_en ?"on" :"off" ); +printf (" Tx pause: %s\n" , tx_fc_en ?"on" :"off" ); +printf ("Autoneg: %s\n" , fc_conf.autoneg ?"on" :"off" ); +printf ("Pause time: 0x%x\n" , fc_conf.pause_time); +printf ("High waterline: 0x%x\n" , fc_conf.high_water); +printf ("Low waterline: 0x%x\n" , fc_conf.low_water); +printf ("Send XON: %s\n" , fc_conf.send_xon ?"on" :"off" ); +printf ("Forward MAC control frames: %s\n" , + fc_conf.mac_ctrl_frame_fwd ?"on" :"off" ); +printf ("\n%s************** End ***********%s\n" , + info_border, info_border); +} + +cmdline_parse_inst_t cmd_link_flow_control_show = { + .f = cmd_link_flow_ctrl_show_parsed, + .data =NULL , + .help_str ="show port <port_id> flow_ctrl" , + .tokens = { + (void *)&cmd_lfc_show_show, + (void *)&cmd_lfc_show_port, + (void *)&cmd_lfc_show_portid, + (void *)&cmd_lfc_show_flow_ctrl, +NULL , + }, +}; +/* *** SETUP ETHERNET LINK FLOW CONTROL *** */ struct cmd_link_flow_ctrl_set_result {cmdline_fixed_string_t set;@@ -17354,6 +17431,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, + (cmdline_parse_inst_t *)&cmd_link_flow_control_show, (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, (cmdline_parse_inst_t *)&cmd_config_dcb, (cmdline_parse_inst_t *)&cmd_read_reg,doc/guides/testpmd_app_ug/testpmd_funcs.rst +7
-0@@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ + +show the link flow control parameter on a port:: + + testpmd> show port <port_id> flow_ctrl + set pfc_ctrl rx ~~~~~~~~~~~~~~~
Quoted 6 lines · Kevin Traynor
Quoted 5 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
Quoted 9 lines
Quoted 5 lines
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Thanks Connor,
Acked-by Kevin Traynor <[email protected]>
Carrying Xiaoyun's ack from previous version:
Applied to dpdk-next-net/main, thanks.
Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst Where: · line 1529
Quoted 7 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +3
-0@@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ +
Expanded to "show flow control" while merging.
Quoted 23 lines · Ferruh Yigit
Quoted 6 lines · Kevin Traynor
Quoted 5 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
Quoted 9 lines
Quoted 5 lines
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>Thanks Connor,
Acked-by Kevin Traynor <[email protected]>Carrying Xiaoyun's ack from previous version:
Acked-by Xiaoyun Li <[email protected]>Applied to dpdk-next-net/main, thanks.
Quoted 10 lines
Quoted 5 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst Where: · line 1527
Quoted 5 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +3
-0@@ -1524,6 +1524,13 @@ Where: * ``autoneg``: Change the auto-negotiation parameter. +show flow ctrl +~~~~~~~~~~~~~~ +Expanded to "show flow control" while merging.
Ahh, it seems the release notes update is missing, adding following while merging:
diff --git a/doc/guides/rel_notes/release_21_05.rstb/doc/guides/rel_notes/release_21_05.rst
index b13c76124169..b36c120e5e1d 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -233,6 +233,8 @@ New Features
item matching.
* Added command to cleanup a Tx queue's mbuf on a port. ``port cleanup (port_id) txq (queue_id) (free_cnt)``
+ * Added command to show link flow control info.
+ ``show port (port_id) flow_ctrl``
* **Updated ipsec-secgw sample application.**
Quoted 10 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
This patch supports the query of the link flow control parameter on a port.
The command format is as follows:
show port <port_id>flow_ctrlSigned-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>
<...>
app/test-pmd/cmdline.c static void cmd_help_long_parsed(void *parsed_result, · line 262
Quoted 6 lines
app/test-pmd/cmdline.c +2
-0@@ -258,6 +258,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) fec_mode" " Show fec mode of a port.\n\n" + +"show port <port_id> flow_ctrl"
Fixing syntax as following, to be consistent, while merging:
show port (port_id) flow_ctrl