From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <yliu84x@shecgisg003.sh.intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 2B07D5A13
 for <dev@dpdk.org>; Thu, 19 Mar 2015 04:17:08 +0100 (CET)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by fmsmga103.fm.intel.com with ESMTP; 18 Mar 2015 20:17:07 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,427,1422950400"; d="scan'208";a="682242857"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2015 20:17:06 -0700
Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com
 [10.239.29.90])
 by shvmail01.sh.intel.com with ESMTP id t2J3H47i024353;
 Thu, 19 Mar 2015 11:17:04 +0800
Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1])
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t2J3H247019454; Thu, 19 Mar 2015 11:17:04 +0800
Received: (from yliu84x@localhost)
 by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t2J3H2UJ019450;
 Thu, 19 Mar 2015 11:17:02 +0800
From: Yong Liu <yong.liu@intel.com>
To: dev@dpdk.org
Date: Thu, 19 Mar 2015 11:16:51 +0800
Message-Id: <1426735018-19411-2-git-send-email-yong.liu@intel.com>
X-Mailer: git-send-email 1.7.4.1
In-Reply-To: <1426735018-19411-1-git-send-email-yong.liu@intel.com>
References: <1426735018-19411-1-git-send-email-yong.liu@intel.com>
Subject: [dpdk-dev] [PATCH] app/test-pmd: fix incorrect port number check
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2015 03:17:09 -0000

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,
-- 
1.9.3