app/testpmd: fix Segment fault when start fwd
PATCH 1/1 app/testpmd: fix Segment fault when start fwd
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)
app/test-pmd/testpmd.c +6 -0
@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {
@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }
Signature · 1 line
2.17.1
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wang ShougangX
Sent: Friday, September 6, 2019 2:29 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH] app/testpmd: fix Segment fault when start fwd
Quoted 7 lines
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>
Quoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {
app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }
Hi Shougang,
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?
- I am not able to see 'reset' has been documented in 'doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?
Thanks,
ferruh
Hi Ferruh
Thanks for your reply.
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Firstly, port must be stopped before reset. Usually, port is stopped by rte_eth_dev_reset(), so testpmd does not prompt user to stop port. Although it can stop port, but testpmd does not change its own port status flag to "RTE_PORT_STOPPED" and it will cause "port start" to fail. So I add this patch to stop port as same as running "port stop" command.
Quoted 3 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?
"port reset" supports reset all ports (testpmd > port reset all), so this loop is necessary.
Quoted 3 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?
OK. I will add it in the next patch.
Thanks.
Shougang
Quoted 63 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?Thanks,
ferruh
Quoted 4 lines · ShougangX
Hi Ferruh
Thanks for your reply.
Quoted 8 lines
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Firstly, port must be stopped before reset. Usually, port is stopped by
rte_eth_dev_reset(), so testpmd does not prompt user to stop port. Although it can stop port, but testpmd does not change its own port status flag to "RTE_PORT_STOPPED" and it will cause "port start" to fail. So I add this patch to stop port as same as running "port stop" command.
Let's assume port already stopped before calling the reset, reset will cause port to be started.
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.
Quoted 6 lines
Quoted 4 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?"port reset" supports reset all ports (testpmd > port reset all), so this loop is necessary.
Got it.
Quoted 74 lines
Quoted 4 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?OK. I will add it in the next patch.
Thanks.
ShougangQuoted 63 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?Thanks,
ferruh
Quoted 2 lines
Let's assume port already stopped before calling the reset, reset will cause port to be started.
Indeed, automatically start looks strange in this case. User explicitly do the "port start" command should be better.
Quoted 2 lines
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.
There are two reasons that it is necessary to stop automatically in "port reset" command:
1) Even without this patch, user does not need to manually execute "port stop" command before "port reset" too, because port will be stopped in rte_eth_dev_reset() function. But this function does not update the port status flag of testpmd. It makes the port state recorded by testpmd inconsistent with the actual port state. So I add stop processing in reset_port() function to stop port as same as running "port stop" command.
2) If let user to stop port manually when he wants to reset port, it is not easy to use than before.
Thanks.
Shougang
Quoted 113 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 16, 2019 11:28 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 11 lines · ShougangX
Hi Ferruh
Thanks for your reply.
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Firstly, port must be stopped before reset. Usually, port is stopped by
rte_eth_dev_reset(), so testpmd does not prompt user to stop port. Although it can stop port, but testpmd does not change its own port statusflag to "
RTE_PORT_STOPPED" and it will cause "port start" to fail.Quoted 1 line
So I add this patch to stop port as same as running "port stop" command.
Let's assume port already stopped before calling the reset, reset will cause port to be started.
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.Quoted 6 lines
Quoted 4 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?"port reset" supports reset all ports (testpmd > port reset all), so this loop is
necessary.
Got it.
Quoted 74 lines
Quoted 4 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?OK. I will add it in the next patch.
Thanks.
ShougangQuoted 63 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?Thanks,
ferruh
Quoted 9 lines · ShougangX
Quoted 2 lines
Let's assume port already stopped before calling the reset, reset will cause port to be started.
Indeed, automatically start looks strange in this case. User explicitly do the "port start" command should be better.
Quoted 2 lines
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.
Quoted 6 lines
There are two reasons that it is necessary to stop automatically in "port reset" command:
1) Even without this patch, user does not need to manually execute "port stop" command before "port reset" too, because port will be stopped inrte_eth_dev_reset()function. But this function does not update the port status flag of testpmd. It makes the port state recorded by testpmd inconsistent with the actual port state. So I add stop processing inreset_port()function to stop port as same as running "port stop" command.
I see 'rte_eth_dev_reset()' API calls the 'rte_eth_dev_stop()' but it isn't enough as you said and a testpmd stop is required, instead of doing in the function it is easy to detect port is not stopped and return an error in the 'reset', it is up to user to stop and do the reset.
Quoted 2 lines
2) If let user to stop port manually when he wants to reset port, it is not easy to use than before.
I still prefer 'Explicit is better than implicit.' [1], yes it is two commands now to reset the port if it is already started but I don't see this is a problem.
Anyway this is not a big deal, if testpmd maintainers are OK for it we can continue with this...
[1] see: The Zen of Python :)
Quoted 119 lines
Thanks.
ShougangQuoted 113 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 16, 2019 11:28 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 11 lines · ShougangX
Hi Ferruh
Thanks for your reply.
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Firstly, port must be stopped before reset. Usually, port is stopped by
rte_eth_dev_reset(), so testpmd does not prompt user to stop port. Although it can stop port, but testpmd does not change its own port statusflag to "
RTE_PORT_STOPPED" and it will cause "port start" to fail.Quoted 1 line
So I add this patch to stop port as same as running "port stop" command.
Let's assume port already stopped before calling the reset, reset will cause port to be started.
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.Quoted 6 lines
Quoted 4 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?"port reset" supports reset all ports (testpmd > port reset all), so this loop is
necessary.
Got it.
Quoted 74 lines
Quoted 4 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?OK. I will add it in the next patch.
Thanks.
ShougangQuoted 63 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in advance if she wants.
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?Thanks,
ferruh
Hi ShougangX, Ferruh,
Quoted 36 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Monday, September 23, 2019 12:04 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 10 lines · ShougangX
Quoted 2 lines
Let's assume port already stopped before calling the reset, reset will cause port to be started.
Indeed, automatically start looks strange in this case. User explicitly do the "port start" command should be better.
Quoted 2 lines
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.
There are two reasons that it is necessary to stop automatically in "port
reset" command:
Quoted 2 lines
1) Even without this patch, user does not need to manually execute "port stop" command before "port reset" too, because port will be
stopped in
rte_eth_dev_reset()function.Quoted 4 lines
But this function does not update the port status flag of testpmd. It makes the port state recorded by testpmd inconsistent with the actual port state. So I add stop processing in
reset_port()function to stop port as same as running "port stop"command.
I see '
rte_eth_dev_reset()' API calls the 'rte_eth_dev_stop()' but it isn't enough as you said and a testpmd stop is required, instead of doing in the function it is easy to detect port is not stopped and return an error in the 'reset', it is up to user to stop and do the reset.Quoted 1 line
Quoted 8 lines
Quoted 1 line
2) If let user to stop port manually when he wants to reset port, it is not
easy to use than before.
I still prefer 'Explicit is better than implicit.' [1], yes it is two commands now to reset the port if it is already started but I don't see this is a problem.
Anyway this is not a big deal, if testpmd maintainers are OK for it we can continue with this...
I am inclined to agree with Ferruh, that it would be better to return an error if the port is not stopped when "port reset" is called rather that silently stopping the port.
Quoted 107 lines
[1] see: The Zen of Python :)
Quoted 22 lines
Thanks.
ShougangQuoted 17 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 16, 2019 11:28 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 7 lines · ShougangX
Hi Ferruh
Thanks for your reply.
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in
advance if she wants.
Quoted 82 lines
Quoted 82 lines
Quoted 5 lines
Firstly, port must be stopped before reset. Usually, port is stopped by
rte_eth_dev_reset(), so testpmd does not prompt user to stop port. Although it can stop port, but testpmd does not change its own port statusflag to "
RTE_PORT_STOPPED" and it will cause "port start" to fail.Quoted 1 line
So I add this patch to stop port as same as running "port stop" command.
Let's assume port already stopped before calling the reset, reset will cause port to be started.
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.Quoted 7 lines
Quoted 4 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?"port reset" supports reset all ports (testpmd > port reset all), so this loop is
necessary.
Got it.
Quoted 58 lines
Quoted 4 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?OK. I will add it in the next patch.
Thanks.
ShougangQuoted 47 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 26 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Quoted 17 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in
advance if she wants.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?Thanks,
ferruh
Regards,
Bernard.
Hi Regards, Ferruh
Quoted 55 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Monday, September 23, 2019 10:18 PM
To: Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdHi ShougangX, Ferruh,
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ferruh Yigit
Sent: Monday, September 23, 2019 12:04 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 11 lines · ShougangX
Quoted 2 lines
Let's assume port already stopped before calling the reset, reset will cause port to be started.
Indeed, automatically start looks strange in this case. User explicitly do the "port start" command should be better.
Quoted 2 lines
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.
There are two reasons that it is necessary to stop automatically in "port
reset" command:
Quoted 2 lines
1) Even without this patch, user does not need to manually execute "port stop" command before "port reset" too, because port will be
stopped in
rte_eth_dev_reset()function.Quoted 4 lines
But this function does not update the port status flag of testpmd. It makes the port state recorded by testpmd inconsistent with the actual port state. So I add stop processing in
reset_port()function to stop port as same as running "port stop"command.
I see '
rte_eth_dev_reset()' API calls the 'rte_eth_dev_stop()' but it isn't enough as you said and a testpmd stop is required, instead of doing in the function it is easy to detect port is not stopped and return an error in the 'reset', it is up to user to stop and do the reset.Quoted 1 line
Quoted 6 lines
Quoted 2 lines
2) If let user to stop port manually when he wants to reset port, it is not
easy to use than before.
I still prefer 'Explicit is better than implicit.' [1], yes it is two commands now to reset the port if it is already started but I don't see this is a
Quoted 9 lines
problem.
Quoted 3 lines
Anyway this is not a big deal, if testpmd maintainers are OK for it we can continue with this...
I am inclined to agree with Ferruh, that it would be better to return an error if the port is not stopped when "port reset" is called rather that silently stopping the port.
I will adopt your suggestion.
Quoted 125 lines
Quoted 18 lines
[1] see: The Zen of Python :)
Quoted 15 lines
Thanks.
ShougangQuoted 10 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Monday, September 16, 2019 11:28 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdOn 9/16/2019 7:37 AM, Wang, ShougangX wrote:
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Hi Ferruh
Thanks for your reply.
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in
advance if she wants.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Firstly, port must be stopped before reset. Usually, port is stopped by
rte_eth_dev_reset(), so testpmd does not prompt user to stopport.
Quoted 95 lines
Quoted 80 lines
Quoted 80 lines
Quoted 2 lines
Although it can stop port, but testpmd does not change its own port status
flag to "
RTE_PORT_STOPPED" and it will cause "port start" to fail.Quoted 1 line
So I add this patch to stop port as same as running "port stop" command.
Let's assume port already stopped before calling the reset, reset will cause port to be started.
I am for user explicitly do the stop, reset and start commands, instead of reset automatically stop and start later.Quoted 7 lines
Quoted 4 lines
- '
reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?"port reset" supports reset all ports (testpmd > port reset all), so this loop is
necessary.
Got it.
Quoted 59 lines
Quoted 4 lines
- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?OK. I will add it in the next patch.
Thanks.
ShougangQuoted 48 lines
-----Original Message-----
From: Yigit, Ferruh
Sent: Saturday, September 14, 2019 1:35 AM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix Segment fault when start fwdQuoted 27 lines · Wang ShougangX
This patch fixed the reset function to avoid crash when user don't call port reset , port stop and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c +0
-0index
e8e2a39b6..273a7aa02100644app/test-pmd/testpmd.c +3
-0@@ -2344,6 +2344,9 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +printf ("Stopping ports...\n" ); +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2382
Quoted 8 lines
app/test-pmd/testpmd.c +3
-0@@ -2372,6 +2375,9 @@ reset_port(portid_t pid) } } +printf ("Starting ports...\n" ); +start_port (pid); +printf ("Done\n" ); }Hi Shougang,
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Not sure if 'reset' command should do more than it says, if there is a requirement that port should be stopped, why not add this condition with an error message so that user can stop the port in
advance if she wants.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Btw, a few things related,
- 'reset_port()' function has a loop inside, 'RTE_ETH_FOREACH_DEV()' but it works on single port, the loop looked unnecessary to me, can you please check and remove the loop if required?- I am not able to see 'reset' has been documented in '
doc/guides/testpmd_app_ug/testpmd_funcs.rst', it may be missing, can you please check and add it if required?
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Thanks,
ferruhRegards,
Bernard.
Thanks.
Shougang
PATCH v2 1/1 app/testpmd: fix Segment fault when start fwd
In reply to Wang ShougangXThis patch fixed the reset function to avoid crash when user don't call port stop, port reset and port start functions as sequence.
--- app/test-pmd/testpmd.c | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++ 2 files changed, 11 insertions(+)
app/test-pmd/testpmd.c +2 -0
@@ -2344,6 +2344,8 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -2041,6 +2041,15 @@ Close all ports or a specific port:: testpmd> port close (port_id|all) +port reset +~~~~~~~~~~ + +Reset all ports or a specific port:: + + testpmd> port reset (port_id|all) + +User should (re-)start the port after reset. + port config - queue ring size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.17.1
Hi Shougangx
Quoted 27 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wang ShougangX
Sent: Friday, September 20, 2019 4:14 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix Segment fault when start fwdThis patch fixed the reset function to avoid crash when user don't call port stop, port reset and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++ 2 files changed, 11 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..9224aa1f7100644
app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2351
Quoted 8 lines
app/test-pmd/testpmd.c +2
-0@@ -2344,6 +2344,8 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {
The app/test-pmd/cmdline.c file should be updated at line 760 to add help text for the "port reset (port_id|all)\n" command.
Quoted 22 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9
-1@@ -2041,6 +2041,15 @@ Close all ports or a specific port:: testpmd> port close (port_id|all) +port reset +~~~~~~~~~~ + +Reset all ports or a specific port:: + + testpmd> port reset (port_id|all) + +User should (re-)start the port after reset. + port config - queue ring size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --
Quoted 1 line
2.17.1
Regards,
Bernard.
Hi Bernard
Quoted 2 lines
The
app/test-pmd/cmdline.cfile should be updated at line 760 to add help text for the "port reset (port_id|all)\n" command.
Thank you very much, I will add in next patch.
Thanks.
Shougang
Quoted 78 lines
-----Original Message-----
From: Iremonger, Bernard
Sent: Monday, September 23, 2019 6:20 PM
To: Wang, ShougangX <[email protected]>; [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH v2] app/testpmd: fix Segment fault when start fwdHi Shougangx
Quoted 27 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Wang ShougangX
Sent: Friday, September 20, 2019 4:14 AM
To: [email protected]
Cc: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>; Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix Segment fault when start fwdThis patch fixed the reset function to avoid crash when user don't call port stop, port reset and port start functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>--- app/test-pmd/testpmd.c | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++ 2 files changed, 11 insertions(+)app/test-pmd/testpmd.c index renamed from app/test-pmd/testpmd.c +0
-0
e8e2a39b6..9224aa1f7100644app/test-pmd/testpmd.c reset_port(portid_t pid) · line 2351
Quoted 8 lines
app/test-pmd/testpmd.c +2
-0@@ -2344,6 +2344,8 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +stop_port (pid); +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {The
app/test-pmd/cmdline.cfile should be updated at line 760 to add help text for the "port reset (port_id|all)\n" command.Quoted 22 lines
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9
-1@@ -2041,6 +2041,15 @@ Close all ports or a specific port:: testpmd> port close (port_id|all) +port reset +~~~~~~~~~~ + +Reset all ports or a specific port:: + + testpmd> port reset (port_id|all) + +User should (re-)start the port after reset. + port config - queue ring size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --Quoted 1 line
2.17.1
Regards,
Bernard.
PATCH v3 1/1 app/testpmd: fix Segment fault when start fwd
In reply to Wang ShougangXThis patch fixed the reset function to avoid crash when user don't call port stop, port reset functions as sequence.
--- app/test-pmd/cmdline.c | 3 +++ app/test-pmd/testpmd.c | 6 ++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++++++++ 3 files changed, 18 insertions(+)
app/test-pmd/cmdline.c +3 -0
@@ -758,6 +758,9 @@ static void cmd_help_long_parsed(void *parsed_result,"port close (port_id|all)\n" " Close all ports or port_id.\n\n" +"port reset (port_id|all)\n" +" Reset all ports or port_id.\n\n" +"port attach (ident)\n" " Attach physical or virtual dev by pci address or virtual device name\n\n"
app/test-pmd/testpmd.c +6 -0
@@ -2344,6 +2344,12 @@ reset_port(portid_t pid)if (port_id_is_invalid (pid,ENABLED_WARN ))return ; +if ((pid == (portid_t )RTE_PORT_ALL && !all_ports_stopped ()) || + (pid != (portid_t )RTE_PORT_ALL && !port_is_stopped (pid))) { +printf ("Can not reset port(s), please stop port(s) first.\n" ); +return ; + } +printf ("Resetting ports...\n" );RTE_ETH_FOREACH_DEV (pi) {
doc/guides/testpmd_app_ug/testpmd_funcs.rst +9 -0
@@ -2041,6 +2041,15 @@ Close all ports or a specific port:: testpmd> port close (port_id|all) +port reset +~~~~~~~~~~ + +Reset all ports or a specific port:: + + testpmd> port reset (port_id|all) + +User should stop port(s) before resetting and (re-)start after reset. + port config - queue ring size ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signature · 1 line
2.17.1
Quoted 9 lines
-----Original Message-----
From: Wang, ShougangX
Sent: Tuesday, September 24, 2019 5:49 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Iremonger, Bernard <[email protected]>; Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [PATCH v3] app/testpmd: fix Segment fault when start fwd
Quoted 7 lines
This patch fixed the reset function to avoid crash when user don't call port stop, port reset functions as sequence.
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>
Ferruh Yigit
AppliedQuoted 12 lines · Bernard
Quoted 12 lines
-----Original Message-----
From: Wang, ShougangX
Sent: Tuesday, September 24, 2019 5:49 AM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Iremonger, Bernard <[email protected]>; Yigit, Ferruh <[email protected]>; Wang, ShougangX <[email protected]>; [email protected]
Subject: [PATCH v3] app/testpmd: fix Segment fault when start fwdThis patch fixed the reset function to avoid crash when user don't call port stop, port reset functions as sequence.
Quoted 7 lines
Quoted 4 lines
Fixes 97f1e19679 ("app/testpmd: add port reset command")Signed-off-by Wang ShougangX <[email protected]>
Applied to dpdk-next-net/master, thanks.