From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id CCE5F1BBCF for ; Fri, 11 May 2018 01:58:54 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7C9A420DD3; Thu, 10 May 2018 19:58:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 10 May 2018 19:58:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=H+LiDW/mkitAPc bZb9MjKfVuDVxzOFwCrzH7Lj5iKG8=; b=RjY5gS1QS795i6IrNJA8BB5VZO10/l LxRmcRUuYGFoFBdu+qMG9ikgt+s6tVwerHizgwp41wJ4+7tdbxNsKV1YA1GltLrq ievXcNsO8DdipA1dCoL1VxCb+N1N/qwCo5s9opR5eHWBcIQblGTWlhfTroC7cgkx fwhiItziMmG1k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=H+LiDW/mkitAPcbZb9MjKfVuDVxzOFwCrzH7Lj5iKG8=; b=RU8Qe0aI z84S/Q0oDw3bkhZidrCa5mfL5z+KVCbFLJmBOHT1ZV02mr8sOT1x47a8cpQZncdN KnSepnbGVbMLvsgiDytijFP+4tLerVbjvGRiDDjyC4raNOn8X2wze9SZK1HH3VPn FfF//O9HBmtndgquzVZ61f/Vvh+Mc9lTHRjfGXHf9ucGRIkB7Xs/q/p8MSb5DDCB FGNnYM4ns0uXFSGuuOJJDJjbPkEPfKHsJ4o6UrqfH2sM30TReBNxJJUyaaUThEVS evkvdXVYND46TX0NZhjwau3+lezO1JWNJh2VaBlVeT8tlHJol3tGTYWEw+0gg2u5 gl5n+BAAy3mXuQ== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 9160DE4393; Thu, 10 May 2018 19:58:53 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: matan@mellanox.com, arybchenko@solarflare.com, stephen@networkplumber.org, ferruh.yigit@intel.com Date: Fri, 11 May 2018 01:58:36 +0200 Message-Id: <20180510235836.1099-12-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180510235836.1099-1-thomas@monjalon.net> References: <20180509094337.26112-1-thomas@monjalon.net> <20180510235836.1099-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v3 11/11] ethdev: fix port removal notification timing 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: Thu, 10 May 2018 23:58:55 -0000 From: Matan Azrad When an ethdev port is released, a destroy event is triggered to notify the users about the released port. A bit before the destroy event is triggered, the port becomes invalid by changing its state to UNUSED and cleaning its data. Therefore, the port is invalid for the destroy event callback process and the users may get a wrong information of the port. Move the destroy event emitting to be called before the port invalidation. Fixes: 133b54779aa1 ("ethdev: fix port data reset timing") Fixes: 29aa41e36de7 ("ethdev: add notifications for probing and removal") Cc: stable@dpdk.org Signed-off-by: Matan Azrad Acked-by: Thomas Monjalon Reviewed-by: Ferruh Yigit Reviewed-by: Andrew Rybchenko Reviewed-by: Stephen Hemminger --- lib/librte_ethdev/rte_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 54439cd64..3ddf3accb 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -366,6 +366,8 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) rte_eth_dev_shared_data_prepare(); + _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL); + rte_spinlock_lock(&rte_eth_dev_shared_data->ownership_lock); eth_dev->state = RTE_ETH_DEV_UNUSED; @@ -374,8 +376,6 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock); - _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL); - return 0; } -- 2.16.2