diff mbox

[dpdk-dev] app/test-pmd: fix incorrect port number check

Message ID 1426735018-19411-2-git-send-email-yong.liu@intel.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Liu, Yong March 19, 2015, 3:16 a.m. UTC
testpmd parameter "nb-port" mean the number of forwarding port.
It's incorrect to use function port_id_is_invalid to check number of ports.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

Comments

Thomas Monjalon March 19, 2015, 8:40 a.m. UTC | #1
This patch was already applied:
	http://dpdk.org/browse/dpdk/commit/?id=0a530f0d58b030

2015-03-19 11:16, Yong Liu:
> testpmd parameter "nb-port" mean the number of forwarding port.
> It's incorrect to use function port_id_is_invalid to check number of ports.
> 
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
> 
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index 11d9af0..f1daa6e 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -628,8 +628,7 @@ launch_args_parse(int argc, char** argv)
>  #endif
>  			if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
>  				n = atoi(optarg);
> -				if (n > 0 &&
> -				    !port_id_is_invalid(n, DISABLED_WARN))
> +				if (n > 0 && n <= nb_ports)
>  					nb_fwd_ports = (uint8_t) n;
>  				else
>  					rte_exit(EXIT_FAILURE,
>
diff mbox

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 11d9af0..f1daa6e 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -628,8 +628,7 @@  launch_args_parse(int argc, char** argv)
 #endif
 			if (!strcmp(lgopts[opt_idx].name, "nb-ports")) {
 				n = atoi(optarg);
-				if (n > 0 &&
-				    !port_id_is_invalid(n, DISABLED_WARN))
+				if (n > 0 && n <= nb_ports)
 					nb_fwd_ports = (uint8_t) n;
 				else
 					rte_exit(EXIT_FAILURE,