From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id CD6941B11A for ; Fri, 19 Oct 2018 04:08:04 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5689122986; Thu, 18 Oct 2018 22:08:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 18 Oct 2018 22:08:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=bzB+PY+TZI 6TPHtbB+ZwWviAIhspa5uJEchh+O3t4xk=; b=KCECbVqKlRO9bzkmYDrNGYZoM2 G+4DEq6uIVDhV2ZlJCldlu1YNpLa+35p+jZ3ybfWryQmcVUxMaY8EMlc1zM1mOTC NWKBU7CYtSAqyNt9xfvP38V7pEkW9f5AISxUGFBSBBUKe19BdF0uyNZ+M8/ZQ9+g a46enJNyvsaPYV1fE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=bzB+PY+TZI6TPHtbB+ZwWviAIhspa5uJEchh+O3t4xk=; b=Gh64Pcwl ZBVs+ZgCjb4e2qoLNUe71pO0aeBK+mU0fOIDFXlIIOEQdhqt3uvkN09kvZPNGrUy 8XYmK/0tqysFJ+bSX6LQxew2A99p/rh+9aHKCr/oFbAgsBekNduzNu6jZ0ZQZtIE cf35q5pkIPbii5buixlCfIV8hrVAgidjnvcO1hsvhUwhOr5J1metiq2ENbFq2g6n ZXBchNAjPnoXbQ+wV0UJiT+h9Qn5COUosWc7vDFVDQVPQOEF3o/yMXDan4bY/FDV mmphEXGVnKGYqA3RwwGWLgVfivog4CHCxKlMnnTD/nBuRi+g+GxsIZRzdE+SMMoF ozgFta6fwySjdw== X-ME-Sender: X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3E034102EE; Thu, 18 Oct 2018 22:08:02 -0400 (EDT) From: Thomas Monjalon To: ferruh.yigit@intel.com, arybchenko@solarflare.com Cc: dev@dpdk.org, ophirmu@mellanox.com, bernard.iremonger@intel.com, rahul.lakkireddy@chelsio.com Date: Fri, 19 Oct 2018 04:07:53 +0200 Message-Id: <20181019020757.27698-3-thomas@monjalon.net> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181019020757.27698-1-thomas@monjalon.net> References: <20180907233929.21950-1-thomas@monjalon.net> <20181019020757.27698-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v6 2/6] app/testpmd: allow detaching a port not closed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Oct 2018 02:08:05 -0000 The testpmd application aim is for testing; so order of operations should not be enforced. There was a test to forbid detaching before closing a port. However, it may interesting to test what happens in such case. It is possible for a PMD to automatically close the port when detaching. in order to avoid a crash, it is checked that the port must be stopped before detaching (as for closing). Signed-off-by: Thomas Monjalon --- app/test-pmd/testpmd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 2c0b4a021..d5a8a14af 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2344,13 +2344,15 @@ detach_port(portid_t port_id) printf("Detaching a port...\n"); if (!port_is_closed(port_id)) { - printf("Please close port first\n"); - return; + if (ports[port_id].port_status != RTE_PORT_STOPPED) { + printf("Port not stopped\n"); + return; + } + printf("Port was not closed\n"); + if (ports[port_id].flow_list) + port_flow_flush(port_id); } - if (ports[port_id].flow_list) - port_flow_flush(port_id); - if (rte_eth_dev_detach(port_id, name)) { TESTPMD_LOG(ERR, "Failed to detach port %u\n", port_id); return; -- 2.19.0