fixes for link speed
cover fixes for link speed
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified port
app/test-pmd/cmdline.c | 48 +++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/2 app/testpmd: add link speed check before port start
From: Huisong Li <[email protected]>
Currently, to check whether the configured link_speeds is valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.
This patch adds the link_speeds check before port start by calling dev_configure, and resolves these problems.
--- app/test-pmd/cmdline.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +38 -2
@@ -1537,8 +1537,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );
@@ -1550,7 +1554,26 @@ cmd_config_speed_all_parsed(void *parsed_result,return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); + goto roolback; + } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 );
@@ -1609,7 +1632,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );
@@ -1623,7 +1649,17 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0)return ; - ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; +return ; + }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); }
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH 1/2] app/testpmd: add link speed check before port start
Quoted 10 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.
Hi Connor,
I am not sure about this patch, overall design in many commands seems store the config changes and mark port or queue as needs reconfiguration ('cmd_reconfig_device_queue()'), and do the reconfigure during port_start. Your change is against this overall design.
What is the downside of learning that speed is invalid in port start?
To not able to restore the previous speed is not good, but user can set the desired speed again in case of failure.
And do you think adding a check that if the requested speed is in the device reported speed capability help on early fail and restore?
Quoted 82 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c +38
-2@@ -1537,8 +1537,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1550,7 +1554,26 @@ cmd_config_speed_all_parsed(void *parsed_result,return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); + goto roolback; + } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 );@@ -1609,7 +1632,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1623,7 +1649,17 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0)return ; - ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; +return ; + }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); }
Re: [dpdk-dev] [PATCH 1/2] app/testpmd: add link speed check before port start
Quoted 8 lines · Ferruh Yigit
Quoted 7 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.
Quoted 9 lines
Quoted 3 lines
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Hi Connor,
I am not sure about this patch, overall design in many commands seems store the config changes and mark port or queue as needs reconfiguration ('
cmd_reconfig_device_queue()'), and do the reconfigure duringport_start. Your change is against this overall design.
Not exactly. DCB configuration in testpmd is also the same operation. I understand that the DCB configuration needs to be verified in driver dev_configure before doing the reconfigure during port_start.
Quoted 3 lines
What is the downside of learning that speed is invalid in port start?
To not able to restore the previous speed is not good, but user can set the desired speed again in case of failure.
I think there are two things:
1/ User may not know the previous configuration.
2/ Generally, if a command fails to be configured, the current configuration does not聽 take effect and remains in the previous state. This is achieved by adding a check and recovery here.
Quoted 2 lines
And do you think adding a check that if the requested speed is in the device reported speed capability help on early fail and restore?
It may not be feasible. After all, the definition of 'speed_capa' and 'link_speeds' is not very relevant in the framework.
In addition, the scheme for reporting 'speed_capa' varies from the PMD driver. Many drivers report all speed capabilities, but the actual state may not support all of them.
However, if the driver supports the 'link_speeds' configuration, the driver should verify the link_speeds configuration because the ethdev layer does not verify the 'link_speeds' configuration.
Above is my personal opinion, look forward to reply.
Quoted 81 lines
Quoted 69 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>---
app/test-pmd/cmdline.c| 40 ++++++++++++++++++++++++++++++++++++++--1 file changed, 38 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c +31
-2@@ -1537,8 +1537,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_config_speed_all *res = parsed_result; + uint32_t old_link_speeds[RTE_MAX_ETHPORTS]; + struct rte_port *port; uint32_t link_speed; portid_t pid; + portid_t i; + int ret; if (!all_ports_stopped()) { printf("Please stop all ports first\n");@@ -1550,7 +1554,26 @@ cmd_config_speed_all_parsed(void *parsed_result, return; RTE_ETH_FOREACH_DEV(pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret = rte_eth_dev_configure(pid, nb_rxq, nb_txq, + &port->dev_conf); + if (ret < 0) { + printf("Failed to check link speeds for port %d, ret = %d.\n", + pid, ret); + goto roolback; + } + } + + cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); + + return; + +roolback: + for (i = 0; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);@@ -1609,7 +1632,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) { struct cmd_config_speed_specific *res = parsed_result; + uint32_t old_link_speeds; + struct rte_port *port; uint32_t link_speed; + int ret; if (!all_ports_stopped()) { printf("Please stop all ports first\n");@@ -1623,7 +1649,17 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0) return; - ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret = rte_eth_dev_configure(res->id, nb_rxq, nb_txq,app/test-pmd/cmdline.c cmd_config_speed_specific_parsed(void · line 1665
Quoted 10 lines
app/test-pmd/cmdline.c +7
-0+ &port->dev_conf); + if (ret < 0) { + printf("Failed to check link speeds for port %d, ret = %d.\n", + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + return; + } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); }.
PATCH 2/2 app/testpmd: fix link speed for a specified port
In reply to Min Hu (Connor)From: Huisong Li <[email protected]>
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop all ports. It's not necessary.
--- app/test-pmd/cmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +4 -4
@@ -1637,13 +1637,13 @@ cmd_config_speed_specific_parsed(void *parsed_result,uint32_t link_speed;int ret; -if (!all_ports_stopped ()) { -printf ("Please stop all ports first\n" ); +if (port_id_is_invalid (res->id,ENABLED_WARN ))return ; - } -if (port_id_is_invalid (res->id,ENABLED_WARN )) +if (!port_is_stopped (res->id)) { +printf ("Please stop port %d first\n" , res->id);return ; + }if (parse_and_check_speed_duplex (res->value1, res->value2, &link_speed) <0 )
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH 2/2] app/testpmd: fix link speed for a specified port
Quoted 11 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop all ports. It's not necessary.Fixes 82113036e4e5 ("ethdev: redesign link speed config")Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>
v2 cover fixes for link speed
In reply to Min Hu (Connor)This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified port
app/test-pmd/cmdline.c | 50 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 app/testpmd: add link speed check before port start
From: Huisong Li <[email protected]>
Currently, to check whether the configured link_speeds is valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.
This patch adds the link_speeds check before port start by calling dev_configure, and resolves these problems.
--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)
app/test-pmd/cmdline.c +40 -2
@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );
@@ -1562,7 +1566,26 @@ cmd_config_speed_all_parsed(void *parsed_result,return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); + goto roolback; + } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 );
@@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );
@@ -1635,8 +1661,20 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0)return ; - ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); }
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 8 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 8 lines
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.
Not sure about this patch. I don't think you can fix the issue you mentioned.
Probably only hns3 does speed check in dev_configure. I don't see this in other drivers, not in i40e/ice/mlx. I guess it's because if it's not supported speed, it will just be UNKNOWN and user can config again?
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 38 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++-(quoted diff) +0
-1- 1 file changed, 40 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +4
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26 @@cmd_config_speed_all_parsed(void
*parsed_result,app/test-pmd/cmdline.c +7
-1return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;
Why don't you just add restoring all ports speed here and then "break"? No matter one dev fails or not, all ports will do reconfig from your code logic. And you type rollback wrongly.
Quoted 48 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20 @@cmd_config_speed_specific_parsed(void
*parsed_result,app/test-pmd/cmdline.c +13
-2&link_speed) < 0)return ; - ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --2.7.4
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 13 lines · Xiaoyun
Quoted 13 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startFrom: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.
Quoted 5 lines
Quoted 2 lines
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned.
Probably only hns3 does speed check indev_configure. I don't see this in other drivers, not in i40e/ice/mlx. I guess it's because if it's not supported speed, it will just be UNKNOWN and user can config again?
I think that the validity of the configuration delivered by dev_configure is ensured by this interface and cannot be left to the backend.
Because it facilitates users to handle abnormal configurations in a timely manner. It may be more appropriate for the driver to do this check in dev_configure.
In addition, even if other drivers do not add this check in dev_configure, this patch does not seem to affect the current behavior of these drivers.
Quoted 29 lines
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 27 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++-(quoted diff) +0
-1- 1 file changed, 40 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +4
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26 @@cmd_config_speed_all_parsed(void
*parsed_result,
return;
Quoted 14 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 12 lines
RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +7
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;Why don't you just add restoring all ports speed here and then "break"? No matter one dev fails or not, all ports will do reconfig from your code logic. And you type rollback wrongly.
It cannot exit directly after restoring all ports speed. If the cmd fails to execute, it is necessary to reconfigure device with the correct configuration. Because "nb_rx/tx_queues" in dev->data are cleared to zero if dev_configure fails to be executed in PMD driver.
Quoted 49 lines
Quoted 47 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20 @@cmd_config_speed_specific_parsed(void
*parsed_result,
&link_speed) < 0)
return;app/test-pmd/cmdline.c +13
-2- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --Quoted 1 line
2.7.4
.
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 34 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Friday, April 30, 2021 12:04
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 13 lines · Xiaoyun
Quoted 9 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 4 lines
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port-Quoted 7 lines
dev_conf.link_speeds"
Quoted 4 lines
maintained in testpmd cannot be restored.
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned. Probably only hns3 does speed check in
dev_configure. I don't see this in otherdrivers, not in i40e/ice/mlx.
Quoted 1 line
I guess it's because if it's not supported speed, it will just be UNKNOWN and
Quoted 8 lines
user can config again?
I think that the validity of the configuration delivered by
dev_configureis ensured by this interface and cannot be left to the backend.Because it facilitates users to handle abnormal configurations in a timely manner. It may be more appropriate for the driver to do this check in
dev_configure.
I still think it's not necessary.
Quoted 48 lines
In addition, even if other drivers do not add this check in
dev_configure, this patch does not seem to affect the current behavior of these drivers.Quoted 10 lines
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 8 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 40 insertions(+), 2 deletions(-)Quoted 5 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void
Quoted 5 lines
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +0
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void
*parsed_result,Quoted 15 lines
Quoted 15 lines
app/test-pmd/cmdline.c +4
-0__rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26 @@cmd_config_speed_all_parsed(void
*parsed_result,
return;Quoted 13 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 12 lines
RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +7
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;Why don't you just add restoring all ports speed here and then "break"? No
Quoted 7 lines
matter one dev fails or not, all ports will do reconfig from your code logic.
Quoted 1 line
And you type rollback wrongly.
It cannot exit directly after restoring all ports speed. If the cmd fails to execute, it is necessary to reconfigure device with the correct configuration.
Because "nb_rx/tx_queues" indev->dataare cleared to zero ifdev_configure
fails to be executed in PMD driver.
?cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); is at the end of this cmd. This will re-config all ports. I don't understand why can't you add a restoring in this if and break this loop and do this reconfig.
Quoted 50 lines
Quoted 50 lines
Quoted 48 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20 @@cmd_config_speed_specific_parsed(void
*parsed_result,
&link_speed) < 0)
return;app/test-pmd/cmdline.c +13
-2- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --Quoted 1 line
2.7.4
.
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 35 lines · Xiaoyun
Quoted 35 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Friday, April 30, 2021 12:04
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 13 lines · Xiaoyun
Quoted 9 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 4 lines
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port-Quoted 7 lines
dev_conf.link_speeds"
Quoted 4 lines
maintained in testpmd cannot be restored.
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned. Probably only hns3 does speed check in
dev_configure. I don't see this in otherdrivers, not in i40e/ice/mlx.
Quoted 1 line
I guess it's because if it's not supported speed, it will just be UNKNOWN and
user can config again?
Quoted 7 lines
Quoted 6 lines
I think that the validity of the configuration delivered by
dev_configureis ensured by this interface and cannot be left to the backend.Because it facilitates users to handle abnormal configurations in a timely manner. It may be more appropriate for the driver to do this check in
dev_configure.I still think it's not necessary.
ok😂
@Ferruh, what do you think?
Quoted 49 lines
Quoted 49 lines
In addition, even if other drivers do not add this check in
dev_configure, this patch does not seem to affect the current behavior of these drivers.Quoted 10 lines
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 8 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 40 insertions(+), 2 deletions(-)Quoted 5 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void
Quoted 5 lines
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +0
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void
*parsed_result,Quoted 15 lines
Quoted 15 lines
app/test-pmd/cmdline.c +4
-0__rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26 @@cmd_config_speed_all_parsed(void
*parsed_result,
return;Quoted 13 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 12 lines
RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +7
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;Why don't you just add restoring all ports speed here and then "break"? No
matter one dev fails or not, all ports will do reconfig from your code logic.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
And you type rollback wrongly.
It cannot exit directly after restoring all ports speed. If the cmd fails to execute, it is necessary to reconfigure device with the correct configuration.
Because "nb_rx/tx_queues" indev->dataare cleared to zero ifdev_configure
fails to be executed in PMD driver.?
cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); is at the end of this cmd. This will re-config all ports. I don't understand why can't you add a restoring in this if and break this loop and do this reconfig.
What do you mean? If a port fails among all ports, only the failed port is restored and reconfigured. I suppose that's what you mean? The cmd "port config all speed xxx duplex xxx" applies to all ports. If it fails to be delivered, the user considers that the cmd does not take effect. So it is necessary to restore and reconfigure all ports to the previous state.
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 48 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20 @@cmd_config_speed_specific_parsed(void
*parsed_result,
&link_speed) < 0)
return;app/test-pmd/cmdline.c +13
-2- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --Quoted 1 line
2.7.4
.
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 121 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Tuesday, May 4, 2021 09:46
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 38 lines · Xiaoyun
Quoted 38 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Friday, April 30, 2021 12:04
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 14 lines · Xiaoyun
Quoted 9 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 5 lines
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port-Quoted 8 lines
dev_conf.link_speeds"
Quoted 4 lines
maintained in testpmd cannot be restored.
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned. Probably only hns3 does speed check in
dev_configure. I don't see this in otherdrivers, not in i40e/ice/mlx.
Quoted 2 lines
I guess it's because if it's not supported speed, it will just be UNKNOWN and
user can config again?
Quoted 7 lines
Quoted 6 lines
I think that the validity of the configuration delivered by
dev_configureis ensured by this interface and cannot be left to the backend.Because it facilitates users to handle abnormal configurations in a timely manner. It may be more appropriate for the driver to do this check in
dev_configure.I still think it's not necessary.
ok😂
@Ferruh, what do you think?
Quoted 3 lines
Quoted 3 lines
In addition, even if other drivers do not add this check in
dev_configure, this patch does not seem to affect the current behavior ofthese drivers.
Quoted 46 lines
Quoted 46 lines
Quoted 11 lines
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 8 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 40 insertions(+), 2 deletions(-)Quoted 5 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void
Quoted 5 lines
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +0
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void
*parsed_result,Quoted 29 lines
Quoted 25 lines
app/test-pmd/cmdline.c +4
-0__rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26@@ cmd_config_speed_all_parsed(void
*parsed_result,
return;RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +7
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;Why don't you just add restoring all ports speed here and then "break"? No
Quoted 4 lines
Quoted 4 lines
matter one dev fails or not, all ports will do reconfig from your code logic.
Quoted 1 line
And you type rollback wrongly.
It cannot exit directly after restoring all ports speed. If the cmd fails to execute, it is necessary to reconfigure device with the correct
configuration.
Quoted 4 lines
Quoted 2 lines
Because "nb_rx/tx_queues" in
dev->dataare cleared to zero ifdev_configurefails to be executed in PMD driver.?
cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); is at the end of this cmd.
Quoted 8 lines
This will re-config all ports.
Quoted 1 line
I don't understand why can't you add a restoring in this if and break this loop
and do this reconfig.
What do you mean? If a port fails among all ports, only the failed port is restored and reconfigured. I suppose that's what you mean?
The cmd "port config all speed xxx duplex xxx" applies to all ports. If it fails to be delivered, the user considers that the cmd does not take effect.
So it is necessary to restore and reconfigure all ports to the previous state.
You still don't understand me. See below. I mean the following.
You don't need to got to rollback. Because "cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);" will config all ports anyway already no matter you restore speeds or not. Can you read the code carefully? "cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);" is always there and it configs ALL ports.
static void
cmd_config_speed_all_parsed(void *parsed_result,
__rte_unused struct cmdline *cl, __rte_unused void *data)
{
struct cmd_config_speed_all *res = parsed_result;
uint32_t link_speed;
portid_t pid;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
return;
}
if (parse_and_check_speed_duplex(res->value1, res->value2,
&link_speed) < 0)
return;
RTE_ETH_FOREACH_DEV(pid) {- ports[pid].dev_conf.link_speeds = link_speed;
+ port = &ports[pid];
+ old_link_speeds[pid] = port->dev_conf.link_speeds;
+ port->dev_conf.link_speeds = link_speed;
+ ret = rte_eth_dev_configure(pid, nb_rxq, nb_txq,
+ &port->dev_conf);
+ if (ret < 0) {
+ printf("Failed to check link speeds for port %d, ret = %d.\n",
+ pid, ret);
+ for (i = 0; i <= pid; i++) {
+ port = &ports[i];
+ port->dev_conf.link_speeds = old_link_speeds[i];
+ }
+ break;
+ }
} cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); }
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 50 lines
Quoted 48 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20@@ cmd_config_speed_specific_parsed(void
*parsed_result,
&link_speed) < 0)
return;app/test-pmd/cmdline.c +13
-2- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --Quoted 1 line
2.7.4
.
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 162 lines · Xiaoyun
Quoted 116 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Tuesday, May 4, 2021 09:46
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 37 lines · Xiaoyun
Quoted 37 lines
-----Original Message-----
From: Huisong Li <[email protected]>
Sent: Friday, April 30, 2021 12:04
To: Li, Xiaoyun <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 14 lines · Xiaoyun
Quoted 9 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startQuoted 5 lines
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port-Quoted 8 lines
dev_conf.link_speeds"
Quoted 4 lines
maintained in testpmd cannot be restored.
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned. Probably only hns3 does speed check in
dev_configure. I don't see this in otherdrivers, not in i40e/ice/mlx.
Quoted 2 lines
I guess it's because if it's not supported speed, it will just be UNKNOWN and
user can config again?
Quoted 7 lines
Quoted 6 lines
I think that the validity of the configuration delivered by
dev_configureis ensured by this interface and cannot be left to the backend.Because it facilitates users to handle abnormal configurations in a timely manner. It may be more appropriate for the driver to do this check in
dev_configure.I still think it's not necessary.
ok😂
@Ferruh, what do you think?
Quoted 2 lines
Quoted 2 lines
In addition, even if other drivers do not add this check in
dev_configure, this patch does not seem to affect the current behavior ofthese drivers.
Quoted 45 lines
Quoted 45 lines
Quoted 10 lines
BTW, even if this behavior is accepted by others, still some comments below.
Quoted 8 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 40 insertions(+), 2 deletions(-)Quoted 5 lines
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void
Quoted 5 lines
app/test-pmd/cmdline.c index renamed from app/test-pmd/cmdline.c +0
-05fdcc1c..ddbc629 100644
app/test-pmd/cmdline.c +0
-0@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void
*parsed_result,Quoted 29 lines
Quoted 25 lines
app/test-pmd/cmdline.c +4
-0__rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1562,7 +1566,26@@ cmd_config_speed_all_parsed(void
*parsed_result,return; RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +7
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { + printf("Failed to check link speeds for port %d, ret= %d.\n",
app/test-pmd/cmdline.c cmd_config_speed_all_parsed(void *parsed_result, · line 1577
Quoted 2 lines
app/test-pmd/cmdline.c +2
-0+ pid, ret); + goto roolback;Why don't you just add restoring all ports speed here and then "break"? No
Quoted 4 lines
Quoted 4 lines
matter one dev fails or not, all ports will do reconfig from your code logic.
Quoted 1 line
And you type rollback wrongly.
It cannot exit directly after restoring all ports speed. If the cmd fails to execute, it is necessary to reconfigure device with the correct
configuration.
Quoted 4 lines
Quoted 2 lines
Because "nb_rx/tx_queues" in
dev->dataare cleared to zero ifdev_configurefails to be executed in PMD driver.?
cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); is at the end of this cmd.Quoted 8 lines
This will re-config all ports.
Quoted 1 line
I don't understand why can't you add a restoring in this if and break this loop
and do this reconfig.
What do you mean? If a port fails among all ports, only the failed port is restored and reconfigured. I suppose that's what you mean?
The cmd "port config all speed xxx duplex xxx" applies to all ports. If it fails to be delivered, the user considers that the cmd does not take effect.
So it is necessary to restore and reconfigure all ports to the previous state.You still don't understand me. See below. I mean the following.
You don't need to got to rollback. Because "cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);" will config all ports anyway already no matter you restore speeds or not. Can you read the code carefully? "cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);" is always there and it configs ALL ports.static void
cmd_config_speed_all_parsed(void*parsed_result,
__rte_unusedstruct cmdline *cl,__rte_unusedvoid *data){ struct cmd_config_speed_all *res = parsed_result; uint32_t link_speed; portid_t pid; if (!all_ports_stopped()) { printf("Please stop all ports first\n"); return; } if (parse_and_check_speed_duplex(res->value1, res->value2, &link_speed) < 0) return; RTE_ETH_FOREACH_DEV(pid) {app/test-pmd/cmdline.c +14
-1- ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; + } +break ; + }
Quoted 4 lines
} cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); }
It looks good! Now we're left with a question about whether we need to add this link speed check.
@Ferruh, what do you think?
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 49 lines
Quoted 47 lines
app/test-pmd/cmdline.c +15
-0+ } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; } cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1); @@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) { printf("Please stop all ports first\n"); @@ -1635,8 +1661,20@@ cmd_config_speed_specific_parsed(void
*parsed_result,&link_speed) < 0) return;app/test-pmd/cmdline.c +13
-2- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds; + } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); } --Quoted 1 line
2.7.4
.
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
In reply to Li, XiaoyunQuoted 14 lines · Xiaoyun
Quoted 14 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 1/2] app/testpmd: add link speed check before port startFrom: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.
Quoted 5 lines
Quoted 2 lines
This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Not sure about this patch. I don't think you can fix the issue you mentioned.
Probably only hns3 does speed check indev_configure. I don't see this in other drivers, not in i40e/ice/mlx.
The configuration check may be done by passing the configuration to HW and HW may reject it. (Just as a side note that it is not that simple/)
Quoted 4 lines
I guess it's because if it's not supported speed, it will just be UNKNOWN and user can config again?
BTW, even if this behavior is accepted by others, still some comments below.
[snip]
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
In reply to Min Hu (Connor)Quoted 76 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c +27
-1@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1562,7 +1566,26 @@ cmd_config_speed_all_parsed(void *parsed_result,return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); + goto roolback; + } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 );@@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1635,8 +1661,20 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0)return ;
app/test-pmd/cmdline.c cmd_config_speed_specific_parsed(void *parsed_result, · line 1672
Quoted 10 lines
app/test-pmd/cmdline.c +9
-1- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds;
In fact, you don't really know here if link speed is a problem or something else configured while device is stopped. So, I think there is no point to over-complicate it with addition of possibly misleading diagnostics.
Quoted 9 lines
app/test-pmd/cmdline.c +4
-0+ } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); }
Re: [dpdk-dev] [PATCH v2 1/2] app/testpmd: add link speed check before port start
Quoted 77 lines · Andrew Rybchenko
Quoted 76 lines · Min Hu (Connor)
From: Huisong Li <[email protected]>
Currently, to check whether the configured
link_speedsis valid, we have to run "port start". In addition, if the configuration fails, "port->dev_conf.link_speeds" maintained in testpmd cannot be restored.This patch adds the
link_speedscheck before port start by callingdev_configure, and resolves these problems.Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)app/test-pmd/cmdline.c +27
-1@@ -1549,8 +1549,12 @@ cmd_config_speed_all_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_all *res = parsed_result; +uint32_t old_link_speeds[RTE_MAX_ETHPORTS ]; +struct rte_port *port;uint32_t link_speed;portid_t pid; +portid_t i; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1562,7 +1566,26 @@ cmd_config_speed_all_parsed(void *parsed_result,return ;RTE_ETH_FOREACH_DEV (pid) { - ports[pid].dev_conf.link_speeds = link_speed; + port = &ports[pid]; + old_link_speeds[pid] = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (pid, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + pid, ret); + goto roolback; + } + } + +cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); + +return ; + +roolback: +for (i =0 ; i <= pid; i++) { + port = &ports[i]; + port->dev_conf.link_speeds = old_link_speeds[i]; }cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 );@@ -1621,7 +1644,10 @@ cmd_config_speed_specific_parsed(void *parsed_result, __rte_unused void *data) {struct cmd_config_speed_specific *res = parsed_result; +uint32_t old_link_speeds; +struct rte_port *port;uint32_t link_speed; +int ret;if (!all_ports_stopped ()) {printf ("Please stop all ports first\n" );@@ -1635,8 +1661,20 @@ cmd_config_speed_specific_parsed(void *parsed_result, &link_speed) < 0)return ;
Quoted 14 lines
app/test-pmd/cmdline.c cmd_config_speed_specific_parsed(void *parsed_result, · line 1672
Quoted 10 lines
app/test-pmd/cmdline.c +9
-1- ports[res->id].dev_conf.link_speeds = link_speed; + port = &ports[res->id]; + old_link_speeds = port->dev_conf.link_speeds; + port->dev_conf.link_speeds = link_speed; + ret =rte_eth_dev_configure (res->id, nb_rxq, nb_txq, + &port->dev_conf); +if (ret <0 ) { +printf ("Failed to check link speeds for port %d, ret = %d.\n" , + res->id, ret); + port->dev_conf.link_speeds = old_link_speeds;In fact, you don't really know here if link speed is a problem or something else configured while device is stopped. So, I think there is no point to over-complicate it with addition of possibly misleading diagnostics.
Thanks for your reivew.
You're right. There are many configurations in tespmd that need to recall dev_configure and are not verified during configuration.
Only one of them is verified, which does not indicate that the failure is caused by the current configuration. So let's keep it the way it was.
Quoted 10 lines
app/test-pmd/cmdline.c cmd_config_speed_specific_parsed(void *parsed_result, · line 1680
Quoted 9 lines
app/test-pmd/cmdline.c +4
-0+ } +/* +* If the cmd fails to execute, it is necessary to reconfigure device. +*/ cmd_reconfig_device_queue (RTE_PORT_ALL ,1 ,1 ); }.
PATCH v2 2/2 app/testpmd: fix link speed for a specified port
In reply to Min Hu (Connor)From: Huisong Li <[email protected]>
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop all ports. It's not necessary.
--- app/test-pmd/cmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
app/test-pmd/cmdline.c +4 -4
@@ -1649,13 +1649,13 @@ cmd_config_speed_specific_parsed(void *parsed_result,uint32_t link_speed;int ret; -if (!all_ports_stopped ()) { -printf ("Please stop all ports first\n" ); +if (port_id_is_invalid (res->id,ENABLED_WARN ))return ; - } -if (port_id_is_invalid (res->id,ENABLED_WARN )) +if (!port_is_stopped (res->id)) { +printf ("Please stop port %d first\n" , res->id);return ; + }if (parse_and_check_speed_duplex (res->value1, res->value2, &link_speed) <0 )
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix link speed for a specified port
Quoted 13 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 2/2] app/testpmd: fix link speed for a specified portFrom: Huisong Li <[email protected]>
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop all ports. It's not necessary.
Quoted 8 lines
Fixes 82113036e4e5 ("ethdev: redesign link speed config")Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Re: [dpdk-dev] [PATCH v2 2/2] app/testpmd: fix link speed for a specified port
Quoted 16 lines · Xiaoyun
Quoted 16 lines
-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Wednesday, April 28, 2021 16:37
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Li, Xiaoyun <[email protected]>
Subject: [PATCH v2 2/2] app/testpmd: fix link speed for a specified portFrom: Huisong Li <[email protected]>
When we use the following cmd to modify the link speed of specified
port: "port config <port_id> speed xxx duplex xxx", we have to stop all ports. It's not necessary.Fixes 82113036e4e5 ("ethdev: redesign link speed config")
Quoted 8 lines
Quoted 5 lines
Signed-off-by Huisong Li <[email protected]>Signed-off-by Min Hu (Connor) <[email protected]>--- app/test-pmd/cmdline.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Acked-by Xiaoyun Li <[email protected]>
From v1:
Applied the patch only, thanks.
What is the difference of v2 from v1? Please, try to add version changelog in the future.
Quoted 9 lines · Min Hu (Connor)
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified portapp/test-pmd/cmdline.c | 50 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-)
Quoted 2 lines · Andrew Rybchenko
What is the difference of v2 from v1? Please, try to add version changelog in the future.
ok😁
Quoted 11 lines · Min Hu (Connor)
Quoted 9 lines
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified portapp/test-pmd/cmdline.c | 50 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-).
Hi, all,
any comments?
Quoted 9 lines · Min Hu (Connor)
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified portapp/test-pmd/cmdline.c | 50 ++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-)
Hi Min Hu,
Quoted 2 lines · Min Hu (Connor)
Hi, all,
any comments?
As part of this series-
[PATCH v2 1/2]: As per Huisong Li "So let's keep it the way it was." [PATCH v2 2/2]: Has been acked.
Quoted 11 lines · Min Hu (Connor)
Quoted 9 lines
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified port
app/test-pmd/cmdline.c| 50 ++++++++++++++++++++++++++++++++++------1 file changed, 44 insertions(+), 6 deletions(-)
Hi, Singh
Quoted 8 lines · Aman Deep
Hi Min Hu,
Quoted 2 lines · Min Hu (Connor)
Hi, all,
any comments?As part of this series-
[PATCH v2 1/2]: As per Huisong Li "So let's keep it the way it was."
This patch can be abandoned.
Quoted 1 line
[PATCH v2 2/2]: Has been acked.
This patch could be merged, thanks。
Quoted 13 lines
Quoted 12 lines · Min Hu (Connor)
Quoted 9 lines
This patchset contains fixes for link speed in testpmd.
Huisong Li (2):
app/testpmd: add link speed check before port start app/testpmd: fix link speed for a specified port
app/test-pmd/cmdline.c| 50 ++++++++++++++++++++++++++++++++++------1 file changed, 44 insertions(+), 6 deletions(-).
Quoted 9 lines · Min Hu (Connor)
Hi, Singh
Quoted 6 lines · Aman Deep
Hi Min Hu,
Quoted 2 lines · Min Hu (Connor)
Hi, all,
any comments?
Quoted 6 lines
Quoted 2 lines
As part of this series-
[PATCH v2 1/2]: As per Huisong Li "So let's keep it the way it was."This patch can be abandoned.
Quoted 1 line
[PATCH v2 2/2]: Has been acked.
This patch could be merged, thanks。
Done.