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 89119A04B1; Wed, 23 Sep 2020 22:32:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BE64B1DB36; Wed, 23 Sep 2020 22:32:45 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 453A71DB32 for ; Wed, 23 Sep 2020 22:32:44 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id A04D65C0061; Wed, 23 Sep 2020 16:32:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 23 Sep 2020 16:32:43 -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= aAhUS4F81kQcbxYvG5IsdW7TixiswxzU34t0yLSjBWo=; b=SgF+FM6xyYFpi1/x XARQpLH+EhiXUXRRKJcIKtXqLwvl9WJYFOndlEqpVbaFY1YEx3uyJNi7E79bYncI e1kbkmZVf4RwrZ7tDBzJtjfzWVlGQyIjSzaQkogHVAu3dzW4yLpRCILLuLr5Mnw6 JRhTnGmKQ2Lwcm5BM1JQO/Ksxx4YTBkKsODk8+a2SAg0b6defH/fkIelN9J/I4DB S9Ar2DO+WOogTdjYTw4MIkj1bXzH7ERGHIusGdPO7BlUjuwhaWmI18OzIJRwtXTI Z0BAQs44nWJrXB7FFWDB5yym7NW04T8oBQxU+f/shzFRyRA5FFC5IvZtEuskvwVQ 78gxeA== 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=aAhUS4F81kQcbxYvG5IsdW7TixiswxzU34t0yLSjB Wo=; b=FjkxD6/Qu7ydtUPhsr6BtSmeByvi7Vij/Q5KMlf52mfc1JSX0SCz7fsc5 e55bBCMF8paQDpA1W8inJwLK3BGuSAuMEjo1yTK/C8wDi0oY1ViesISTa+UkTCxP +avCFUF4q0oOpW+uZZ9bm0ez57qeXRRqQSbHg7PjY4YwEnI9tTrP+dBtZK8icde6 /KFu3Ev9guP1mClP/4D/tAi5AlvaN75i+FlKhcUpkPGuaXkFaBoJk5KAIY6sSXaQ nV8jp+gilstedns5ELQz7M9r5QWoStAKq0Tn7JSaDr0y4dyKWpKwhrFQxivnSCoq oALjd9bPNpOj198JbJeKEXCInP9Zw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudeigdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght 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 EC92B3280063; Wed, 23 Sep 2020 16:32:41 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, arybchenko@solarflare.com, Wenzhuo Lu , Beilei Xing , Bernard Iremonger Date: Wed, 23 Sep 2020 22:32:39 +0200 Message-ID: <26171115.May8GztZaD@thomas> In-Reply-To: <04ce289e-9e37-98e5-e3db-297ca6390c6b@intel.com> References: <20200913220711.3768597-1-thomas@monjalon.net> <20200913220711.3768597-20-thomas@monjalon.net> <04ce289e-9e37-98e5-e3db-297ca6390c6b@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" 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?