From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 56FB2A04B1; Thu, 24 Sep 2020 14:25:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 49F711DE7C; Thu, 24 Sep 2020 14:17:12 +0200 (CEST) Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by dpdk.org (Postfix) with ESMTP id 9E1B71DE67 for ; Thu, 24 Sep 2020 14:17:10 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 285089CC; Thu, 24 Sep 2020 08:17:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 24 Sep 2020 08:17:08 -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=fm2; bh= u99LSZhNPD5PsB4qbVExoGq36n/c7R/51GUZMxemlwU=; b=Yr0nbHLVP5byyoPK MBFSFkL81z8zZoVXt2YTbDOg14UpzDNHAJUoS4ylMprp8l0MUIGJxzjVzqz4v2gq syvqOfNBcEWrwYzN6hv7CAFkeP3rI7FgjmHCSNSa6fhz+qE5RuaE//9d+46dfrwm jBAccsqA1vAxhKUXRgLMLTARottU9IE6hMg3bKvFngOW+Gt/LwxvbyytHPi8gc3S wOSUUVTJvOwELZ4661eqB+0Flqm6e06v8rcuL4OHuxmXGOlAUDv82Zeh5E6lPGSq aCdbbOjs5uNTad1vsUfqpIdeQhwqmHB+xRLcDcP6V7/J1v+Y3UokheW9kL2vwILf ns4ZFw== 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=fm3; bh=u99LSZhNPD5PsB4qbVExoGq36n/c7R/51GUZMxeml wU=; b=mrWreiES9UGM8k2T0qNwhzXLq8cHUJE/VWJuwZ1Q+75sBwB0sYof2mroA wfe8lEEaNfdbSWFnrnn5ZlMycnY7e4PdF1VNfUb9zgXyUQ3CEmg+CVsFG0mdAd0M /MfMisXqub70wmYHy8MgNOFUD2mhMbhxJHHLOKczx3qgK+s26wKYFuU0rzSYEKSw jkocyBNtgdsXBwHjekCVoHRri5EVpECXeki/c2++mygI6oq3d9B7sBqi/hrOa74v PWKoWqgVEm9sAMFA/avhnx4dvAkf+K35wcsfLHSlj0Q8Kw+Izpg4ampRWbTBFCC/ acJ3BYp3G9YYoPPmQCjVkOhtugSxg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudekgdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth 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 85FB33064610; Thu, 24 Sep 2020 08:17:06 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, arybchenko@solarflare.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Date: Thu, 24 Sep 2020 14:17:04 +0200 Message-ID: <5482678.jQLLJtJmLa@thomas> In-Reply-To: <7f70403e-79f7-b3de-6a7b-a83571251810@intel.com> References: <20200913220711.3768597-1-thomas@monjalon.net> <26171115.May8GztZaD@thomas> <7f70403e-79f7-b3de-6a7b-a83571251810@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 19/20] app/testpmd: reset port status on close notification 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 24/09/2020 14:07, Ferruh Yigit: > On 9/23/2020 9:32 PM, Thomas Monjalon wrote: > > 23/09/2020 18:45, Ferruh Yigit: > >> On 9/13/2020 11:07 PM, Thomas Monjalon wrote: > >>> Since rte_eth_dev_release_port() is called on all port close operations, > >>> the event RTE_ETH_EVENT_DESTROY can be reliably used for resetting > >>> the port status on the application side. > >>> > >>> The intermediate state RTE_PORT_HANDLING is removed in close_port() > >>> because a port can also be closed by a PMD in a device remove operation. > >>> > >>> In case multiple ports are closed, calling remove_invalid_ports() > >>> only once is enough. > >>> > >>> Signed-off-by: Thomas Monjalon > >> > >> <...> > >> > >>> @@ -3118,6 +3093,13 @@ eth_event_callback(portid_t port_id, enum rte_eth_event_type type, void *param, > >>> rmv_port_callback, (void *)(intptr_t)port_id)) > >>> fprintf(stderr, "Could not set up deferred device removal\n"); > >>> break; > >>> + case RTE_ETH_EVENT_DESTROY: > >>> + if (rte_atomic16_cmpset(&(ports[port_id].port_status), > >>> + RTE_PORT_STOPPED, > >>> + RTE_PORT_CLOSED) == 0) > >>> + printf("Port %d cannot be set to closed\n", port_id); > >>> + printf("Port %u is closed\n", port_id); > >>> + break; > >> > >> This is failing if a port closed without application port stop command, > >> PMD may be doing port stop within the close function but since > >> application didn't give the stop command, the port status is not > >> 'RTE_PORT_STOPPED', hence 'port_status' is not updated correctly. > > > > Do you think we should give up with the atomic state transition, > > and just assign the state as closed? > > > > It can be better, if the DESTROY event received it should be in closed > state. I don't understand your proposal. Note that we are not managing ethdev states here. Despite the misleading RTE prefix, it is a testpmd state. > Right now device can be hot removed while running, or it may be closed > before it has been stopped, both cases state transition assumption from > stopped->closed will be wrong, and final state will be wrong. I think we should force the state, not matter what it was before.