[dpdk-dev] testpmd: Fix port validation code of "port stop all" command

Message ID 1425540606-12554-1-git-send-email-mukawa@igel.co.jp (mailing list archive)
State Superseded, archived
Headers

Commit Message

Tetsuya Mukawa March 5, 2015, 7:30 a.m. UTC
  When "port stop all" is executed, the command doesn't work as it should
because of wrong port validation. The patch fixes this issue.

Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 app/test-pmd/testpmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

De Lara Guarch, Pablo March 6, 2015, 1:44 p.m. UTC | #1
> -----Original Message-----
> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp]
> Sent: Thursday, March 05, 2015 7:30 AM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo; Tetsuya Mukawa
> Subject: [PATCH] testpmd: Fix port validation code of "port stop all"
> command
> 
> When "port stop all" is executed, the command doesn't work as it should
> because of wrong port validation. The patch fixes this issue.
> 
> Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
> ---
>  app/test-pmd/testpmd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 61291be..bb65342 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -1484,7 +1484,7 @@ stop_port(portid_t pid)
>  	printf("Stopping ports...\n");
> 
>  	FOREACH_PORT(pi, ports) {
> -		if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
> +		if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
>  			continue;
> 
>  		port = &ports[pi];
> --
> 1.9.1

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  

Patch

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 61291be..bb65342 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1484,7 +1484,7 @@  stop_port(portid_t pid)
 	printf("Stopping ports...\n");
 
 	FOREACH_PORT(pi, ports) {
-		if (!port_id_is_invalid(pid, DISABLED_WARN) && pid != pi)
+		if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
 			continue;
 
 		port = &ports[pi];