From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dayuqiu@shecgisg004.sh.intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 99615595A
 for <dev@dpdk.org>; Mon,  2 Mar 2015 09:31:45 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by fmsmga101.fm.intel.com with ESMTP; 02 Mar 2015 00:31:43 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.09,674,1418112000"; d="scan'208";a="659083601"
Received: from shvmail01.sh.intel.com ([10.239.29.42])
 by orsmga001.jf.intel.com with ESMTP; 02 Mar 2015 00:31:43 -0800
Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com
 [10.239.29.89])
 by shvmail01.sh.intel.com with ESMTP id t228Vf2E010452;
 Mon, 2 Mar 2015 16:31:41 +0800
Received: from shecgisg004.sh.intel.com (localhost [127.0.0.1])
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id
 t228VcBR014816; Mon, 2 Mar 2015 16:31:40 +0800
Received: (from dayuqiu@localhost)
 by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t228VbVa014812;
 Mon, 2 Mar 2015 16:31:37 +0800
From: Michael Qiu <michael.qiu@intel.com>
To: dev@dpdk.org
Date: Mon,  2 Mar 2015 16:31:37 +0800
Message-Id: <1425285097-14781-1-git-send-email-michael.qiu@intel.com>
X-Mailer: git-send-email 1.7.4.1
Subject: [dpdk-dev] [PATCH] app/test-pmd: Fix log issue without nic binded
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: Mon, 02 Mar 2015 08:31:46 -0000

As hotplug has been enabled, start the testpmd with no nic binded
will show one error log "Please stop the ports first":

Interactive-mode selected
Please stop the ports first
Done
testpmd>

This issue is cause by the logic of check link status.

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 app/test-pmd/testpmd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 61291be..e556b4c 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1315,7 +1315,7 @@ port_is_closed(portid_t port_id)
 int
 start_port(portid_t pid)
 {
-	int diag, need_check_link_status = 0;
+	int diag, need_check_link_status = -1;
 	portid_t pi;
 	queueid_t qi;
 	struct rte_port *port;
@@ -1337,6 +1337,7 @@ start_port(portid_t pid)
 		if (pid != pi && pid != (portid_t)RTE_PORT_ALL)
 			continue;
 
+		need_check_link_status = 0;
 		port = &ports[pi];
 		if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STOPPED,
 						 RTE_PORT_HANDLING) == 0) {
@@ -1457,9 +1458,9 @@ start_port(portid_t pid)
 		need_check_link_status = 1;
 	}
 
-	if (need_check_link_status && !no_link_check)
+	if (need_check_link_status == 1 && !no_link_check)
 		check_all_ports_link_status(RTE_PORT_ALL);
-	else
+	else if (need_check_link_status == 0)
 		printf("Please stop the ports first\n");
 
 	printf("Done\n");
-- 
1.9.3