From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id B796D5A24 for ; Thu, 5 May 2016 17:40:26 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 05 May 2016 08:40:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,582,1455004800"; d="scan'208";a="973366845" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 05 May 2016 08:40:25 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u45FeOsm022289; Thu, 5 May 2016 16:40:24 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id u45FeOXN019275; Thu, 5 May 2016 16:40:24 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id u45FeOZj019271; Thu, 5 May 2016 16:40:24 +0100 From: Bernard Iremonger To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com, Bernard Iremonger Date: Thu, 5 May 2016 16:39:50 +0100 Message-Id: <1462462795-18767-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1462462795-18767-1-git-send-email-bernard.iremonger@intel.com> References: <1461156779-24737-1-git-send-email-bernard.iremonger@intel.com> <1462462795-18767-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v2 3/8] app/testpmd: check port is not forwarding in stop_port and close_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: , X-List-Received-Date: Thu, 05 May 2016 15:40:27 -0000 Add calls to port_is_forwarding function. Signed-off-by: Bernard Iremonger --- app/test-pmd/testpmd.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5dc7bba..11b4cf7 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1268,11 +1268,6 @@ start_port(portid_t pid) struct rte_port *port; struct ether_addr mac_addr; - if (test_done == 0) { - printf("Please stop forwarding first\n"); - return -1; - } - if (port_id_is_invalid(pid, ENABLED_WARN)) return 0; @@ -1424,10 +1419,6 @@ stop_port(portid_t pid) struct rte_port *port; int need_check_link_status = 0; - if (test_done == 0) { - printf("Please stop forwarding first\n"); - return; - } if (dcb_test) { dcb_test = 0; dcb_config = 0; @@ -1442,6 +1433,11 @@ stop_port(portid_t pid) if (pid != pi && pid != (portid_t)RTE_PORT_ALL) continue; + if (port_is_forwarding(pi) != 0 && test_done == 0) { + printf("Please remove port %d from forwarding configuration.\n", pi); + continue; + } + port = &ports[pi]; if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_STARTED, RTE_PORT_HANDLING) == 0) @@ -1466,11 +1462,6 @@ close_port(portid_t pid) portid_t pi; struct rte_port *port; - if (test_done == 0) { - printf("Please stop forwarding first\n"); - return; - } - if (port_id_is_invalid(pid, ENABLED_WARN)) return; @@ -1480,6 +1471,11 @@ close_port(portid_t pid) if (pid != pi && pid != (portid_t)RTE_PORT_ALL) continue; + if (port_is_forwarding(pi) != 0 && test_done == 0) { + printf("Please remove port %d from forwarding configuration.\n", pi); + continue; + } + port = &ports[pi]; if (rte_atomic16_cmpset(&(port->port_status), RTE_PORT_CLOSED, RTE_PORT_CLOSED) == 1) { -- 2.6.3