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 13F08D08E for ; Wed, 9 May 2018 11:31:21 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B8646224C5; Wed, 9 May 2018 05:31:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 09 May 2018 05:31:20 -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=G8jtOUw+7In4Xb 2m3P+iu1HI1X5Yt6l1BuEgkDsUleU=; b=MD0T2992sEvVn1gVLHa+LkPy/tSRof Kys94YHouS1pBlyKsc5fRskPO8g5aKW8yGluxLtCN6WEfha/6mKeMzLzJTvLbXtV HnJzoqxlUUlE3GoADQZ75GD73R6lGIl/rAyVRE2JKMAx1+7FkXN2spxWaIFgWEhz Jo9GUqZ/zwFwM= 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=G8jtOUw+7In4Xb2m3P+iu1HI1X5Yt6l1BuEgkDsUleU=; b=JiYbONzA Duqn7Dk4D1JpFQZkShugjGmnHdo3XF1kYMhc7vlTZZIAUNvNpH3OGI6ImBCVEbll SSJAs2gQPXP82F5QVJipN2OETh4F8aX+8/qoDxBRtZx/6rd0yZJKV2UPIuVIgVau n8TOZvk+WpV6R1Ew9x2GFGJEk/mxzKsQ3xaz2U08cMVa2zvMYgtUqlLqfwKQFCLS 3tuIBAszhggHbZ/mT+UdnAyOwDh6JXpC0sKX+pxJVcKGP8B4P1BwOW/Qr9vgUfjf 7SLyMoC88LYB+CoNUnt3sEjDt6jtorjzvzsLAFZMbVG9G2FkZKzv3E5/icqBS5gs 8J9XGgwjx8Q4nw== 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 1934BE4120; Wed, 9 May 2018 05:31:20 -0400 (EDT) From: Thomas Monjalon To: matan@mellanox.com Cc: stable@dpdk.org Date: Wed, 9 May 2018 11:31:05 +0200 Message-Id: <20180509093105.25984-12-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180509093105.25984-1-thomas@monjalon.net> References: <20180509093105.25984-1-thomas@monjalon.net> Subject: [dpdk-stable] [PATCH 11/11] ethdev: fix port removal notification timing X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 May 2018 09:31:21 -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 --- 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 e1209bb2a..45ef13ab8 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -359,6 +359,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; @@ -367,8 +369,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