testpmd: Fix wrong message in testpmd
PATCH 1/1 testpmd: Fix wrong message in testpmd
When close one port twice, testpmd will give out wrong messagse.
testpmd> port stop 0
Stopping ports...
Checking link statuses...
Port 0 Link Up - speed 0 Mbps - full-duplex
Port 1 Link Up - speed 0 Mbps - full-duplex
Done
testpmd> port close 0
Closing ports...
Done
testpmd> port close 0
Closing ports...
Port 0 is now not stopped
Done
testpmd>
--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)
app/test-pmd/testpmd.c +6 -0
@@ -1534,6 +1534,12 @@ close_port(portid_t pid) port = &ports[pi];if (rte_atomic16_cmpset (&(port->port_status), +RTE_PORT_CLOSED ,RTE_PORT_CLOSED ) ==1 ) { +printf ("Port %d is already closed\n" , pi); +continue ; + } + +if (rte_atomic16_cmpset (&(port->port_status),RTE_PORT_STOPPED ,RTE_PORT_HANDLING ) ==0 ) {printf ("Port %d is now not stopped\n" , pi);continue ;
Signature · 1 line
2.1.0
Any comments? This is a bug fix, not a feature.
Thanks,
Michael
Quoted 40 lines · Michael
When close one port twice, testpmd will give out wrong messagse.
testpmd> port stop 0
Stopping ports...
Checking link statuses...
Port 0 Link Up - speed 0 Mbps - full-duplex
Port 1 Link Up - speed 0 Mbps - full-duplex
Done
testpmd> port close 0
Closing ports...
Done
testpmd> port close 0
Closing ports...
Port 0 is now not stopped
Done
testpmd>Signed-off-by Michael Qiu <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c +6
-0@@ -1534,6 +1534,12 @@ close_port(portid_t pid) port = &ports[pi];if (rte_atomic16_cmpset (&(port->port_status), +RTE_PORT_CLOSED ,RTE_PORT_CLOSED ) ==1 ) { +printf ("Port %d is already closed\n" , pi); +continue ; + } + +if (rte_atomic16_cmpset (&(port->port_status),RTE_PORT_STOPPED ,RTE_PORT_HANDLING ) ==0 ) {printf ("Port %d is now not stopped\n" , pi);continue ;
Quoted 35 lines · Michael
Any comments? This is a bug fix, not a feature.
Thanks,
MichaelQuoted 29 lines · Michael
When close one port twice, testpmd will give out wrong messagse.
testpmd> port stop 0
Stopping ports...
Checking link statuses...
Port 0 Link Up - speed 0 Mbps - full-duplex
Port 1 Link Up - speed 0 Mbps - full-duplex
Done
testpmd> port close 0
Closing ports...
Done
testpmd> port close 0
Closing ports...
Port 0 is now not stopped
Done
testpmd>Signed-off-by Michael Qiu <[email protected]>--- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/testpmd.c +0
-0@@ -1534,6 +1534,12 @@ close_port(portid_t pid)
Quoted 11 lines
app/test-pmd/testpmd.c close_port(portid_t pid) · line 1545
Quoted 11 lines
app/test-pmd/testpmd.c +6
-0port = &ports[pi];if (rte_atomic16_cmpset (&(port->port_status), +RTE_PORT_CLOSED ,RTE_PORT_CLOSED ) ==1 ) { +printf ("Port %d is already closed\n" , pi); +continue ; + } + +if (rte_atomic16_cmpset (&(port->port_status),RTE_PORT_STOPPED ,RTE_PORT_HANDLING ) ==0 ) {printf ("Port %d is now not stopped\n" , pi);continue ;
I know it's not part of your change, but "Now not stopped" doesn't really seem right to me. What is the message actually trying to report?
/Bruce
Quoted 1 line
Quoted 1 line · Bruce
On Wed, Jul 08, 2015 at 07:16:21AM +0000, Qiu, Michael wrote:
[.../...]
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
app/test-pmd/testpmd.c +3
-0port = &ports[pi];if (rte_atomic16_cmpset (&(port->port_status), +RTE_PORT_CLOSED ,RTE_PORT_CLOSED ) ==1 ) { +printf ("Port %d is already closed\n" , pi); +continue ;
Quoted 8 lines
Quoted 6 lines
app/test-pmd/testpmd.c close_port(portid_t pid) · line 1545
Quoted 6 lines
app/test-pmd/testpmd.c +3
-0+ } + +if (rte_atomic16_cmpset (&(port->port_status),RTE_PORT_STOPPED ,RTE_PORT_HANDLING ) ==0 ) {printf ("Port %d is now not stopped\n" , pi);continue ;I know it's not part of your change, but "Now not stopped" doesn't really seem right to me. What is the message actually trying to report?
It is just make sure the port is in stopped state. So it will check if it is not in RTE_PORT_STOPPED stat or fail to set to RTE_PORT_HANDLING, it will report as "now not stopped"
Thanks,
Michael
Quoted 2 lines
/Bruce
Thomas Monjalon
Applied2015-06-24 15:56, Michael Qiu:
Quoted 18 lines
When close one port twice, testpmd will give out wrong messagse.
testpmd> port stop 0
Stopping ports...
Checking link statuses...
Port 0 Link Up - speed 0 Mbps - full-duplex
Port 1 Link Up - speed 0 Mbps - full-duplex
Done
testpmd> port close 0
Closing ports...
Done
testpmd> port close 0
Closing ports...
Port 0 is now not stopped
Done
testpmd>
Quoted 1 line
Signed-off-by Michael Qiu <[email protected]>
Applied, thanks