From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id D0C745FEB for ; Wed, 24 Jun 2015 09:56:51 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 24 Jun 2015 00:56:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,671,1427785200"; d="scan'208";a="513396391" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 24 Jun 2015 00:56:33 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t5O7uVQp018943; Wed, 24 Jun 2015 15:56:31 +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 t5O7uRUk010227; Wed, 24 Jun 2015 15:56:29 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t5O7uR8m010223; Wed, 24 Jun 2015 15:56:27 +0800 From: Michael Qiu To: dev@dpdk.org Date: Wed, 24 Jun 2015 15:56:25 +0800 Message-Id: <1435132585-10192-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] testpmd: Fix wrong message in testpmd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2015 07:56:52 -0000 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 --- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 3057791..907cda3 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -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; -- 2.1.0