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 19FBE4F98 for ; Wed, 17 Oct 2018 04:06:36 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8306A22160; Tue, 16 Oct 2018 22:06:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 16 Oct 2018 22:06:35 -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:content-type; s=mesmtp; bh=dQmFrpPUoIxXiwm9B8zKegjHUh8yMCkm+9YtjKY7dHs=; b=YHyU4ZJBj0uR Rnk1+xAbgJU/pn/hxaO6mw1eBanxUE8XUiODzvSaS6q0NqK83KOcb8TcY7+4FrFx KMbMF2nx8U8RU623ZarO7geFLZ27c9g1L+4iyrsDupL3u/1CRnRTKucKOOYpFaIG OvA5CtdGGvISJKdCq9qtTC3tYXudh6k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=dQmFrpPUoIxXiwm9B8zKegjHUh8yMCkm+9YtjKY7d Hs=; b=IkEd69O2r44ja+KusSWSp251qCjG1hUwRqdDGG1uB6sm/ojcoxaIu6wr1 v2R5AXhT8qCfLt5Lt2k0FKIpdR0ZkV1oaShpnRwizJO3jdnDf6jZ2ZsDbBCOjhbj TckPxrIFqeyV5djzRJxZDTEgz199g8oPT74wtdVdfBcQOPT5IWbg2TXX/5w1CdFT JU4sPiGoGQcu3jBVw7aOCaJiHNuM8/f83KacT35I3BwLKMLRY0r4CNEH7R5DlvkU HAdKd8OyincY0eRJMr6sLYbCHcjRddTrzhlPoZJsyd+mGH9IWIbfUyQk4fXVMxkr MRNnmeP2AGEEpFvRpsSAgcygbRuPA== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 21E61E447F; Tue, 16 Oct 2018 22:06:34 -0400 (EDT) From: Thomas Monjalon To: bernard.iremonger@intel.com Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com, ophirmu@mellanox.com Date: Wed, 17 Oct 2018 04:06:37 +0200 Message-ID: <5737181.WHA25Rt80X@xps> In-Reply-To: <20181017015450.15783-2-thomas@monjalon.net> References: <20180907233929.21950-1-thomas@monjalon.net> <20181017015450.15783-1-thomas@monjalon.net> <20181017015450.15783-2-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3 1/4] 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: Wed, 17 Oct 2018 02:06:36 -0000 +Cc Bernard Note that the function port_is_closed is replaced because a closed port is always seen as invalid after this series: the state is set to RTE_ETH_DEV_UNUSED by rte_eth_dev_release_port(). I may split this patch and add a release note to make it clear. 17/10/2018 03:54, Thomas Monjalon: > 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. > > Signed-off-by: Thomas Monjalon > --- > app/test-pmd/testpmd.c | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 5dbbf783f..f5dee1d71 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -1938,18 +1938,6 @@ port_is_started(portid_t port_id) > return 1; > } > > -static int > -port_is_closed(portid_t port_id) > -{ > - if (port_id_is_invalid(port_id, ENABLED_WARN)) > - return 0; > - > - if (ports[port_id].port_status != RTE_PORT_CLOSED) > - return 0; > - > - return 1; > -} > - > int > start_port(portid_t pid) > { > @@ -2319,14 +2307,12 @@ 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_CLOSED) { > + printf("Port 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; >