From patchwork Mon Mar 9 06:05:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Qiu X-Patchwork-Id: 3928 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id BC9FF5ABA; Mon, 9 Mar 2015 07:06:08 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CED8658EF for ; Mon, 9 Mar 2015 07:06:07 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 08 Mar 2015 23:03:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,365,1422950400"; d="scan'208";a="537896103" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga003.jf.intel.com with ESMTP; 08 Mar 2015 23:05:39 -0700 Received: from shecgisg004.sh.intel.com (shecgisg004.sh.intel.com [10.239.29.89]) by shvmail01.sh.intel.com with ESMTP id t29664cV007642; Mon, 9 Mar 2015 14:06:04 +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 t29661T0027636; Mon, 9 Mar 2015 14:06:03 +0800 Received: (from dayuqiu@localhost) by shecgisg004.sh.intel.com (8.13.6/8.13.6/Submit) id t296613W027632; Mon, 9 Mar 2015 14:06:01 +0800 From: Michael Qiu To: dev@dpdk.org Date: Mon, 9 Mar 2015 14:05:47 +0800 Message-Id: <1425881147-27600-1-git-send-email-michael.qiu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] testpmd: Fix action of operationg invalid port 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently, if try to start/stop/close one invalid prot, no error shows in testpmd. This is a bug, need check the port number. Signed-off-by: Michael Qiu Acked-by: Tetsuya Mukawa --- app/test-pmd/config.c | 3 +++ app/test-pmd/testpmd.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 49be819..ec53923 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -384,6 +384,9 @@ port_infos_display(portid_t port_id) int port_id_is_invalid(portid_t port_id, enum print_warning warning) { + if (port_id == (portid_t)RTE_PORT_ALL) + return 0; + if (ports[port_id].enabled) return 0; diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e556b4c..1c4c651 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1326,6 +1326,9 @@ start_port(portid_t pid) return -1; } + if (port_id_is_invalid(pid, ENABLED_WARN)) + return 0; + if (init_fwd_streams() < 0) { printf("Fail from init_fwd_streams()\n"); return -1; @@ -1482,10 +1485,14 @@ stop_port(portid_t pid) dcb_test = 0; dcb_config = 0; } + + if (port_id_is_invalid(pid, ENABLED_WARN)) + return; + 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]; @@ -1517,10 +1524,13 @@ close_port(portid_t pid) return; } + if (port_id_is_invalid(pid, ENABLED_WARN)) + return; + printf("Closing 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];