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 AA604374E for ; Sun, 20 May 2018 13:00:51 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 57A1A22194; Sun, 20 May 2018 07:00:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 20 May 2018 07:00:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=hiAGZf3Jp2ndB4 E0h+m1Rsz89jBoQ046zjPfZEMr67E=; b=HFNxC274TvrVS9TvVxl7PnbMkfuAwX ZVEvp2NhGvJ1oUwrrHHjBq1uOduEayskjmB2/hUaZLoSm2z690HbOeSo5Od3sOvM iug8eVckLosXwQgC4WDWylp5Q5qyHXEGhZ6xdGuUX7IpCfePrvSbXHyu2pkjCfI7 TqbCrTf9F2G0w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=hiAGZf3Jp2ndB4E0h+m1Rsz89jBoQ046zjPfZEMr67E=; b=N1Ip8325 yr2Wgv0CTclOGS7HiB0oUeFnRW+MJG2JD05VCarbloH0vy1Hmkhpyspp+coa3Kgz vbzlULq3RYk+iuCGzxy47mDjooogntuDk+D4xchW2HmKm3KtuINysIkn1ODZBOTl kVOfkTF8xDopb/LZwgX3XgEl16IhHHf4qyXmf2D/lo6yYsA15cr/+Obtb3LOwgmE +5RtBdxinTckpwsmzkKEHozYykl9esbObVV77NA8Fh7ZxLbJs8YbrUzjJzY+5Aim +nWhbqAW5W6yafbHyKCG7HxCLGxlK5Fo8Jsk8PJ4sVj4pfn2Ny9CAzm3bweHv8MX /jygA/++x+Mvaw== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from xps.monjalon.net (114.149.6.93.rev.sfr.net [93.6.149.114]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CD6A10262 for ; Sun, 20 May 2018 07:00:50 -0400 (EDT) From: Thomas Monjalon To: stable@dpdk.org Date: Sun, 20 May 2018 13:00:06 +0200 Message-Id: <20180520110006.9026-5-thomas@monjalon.net> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180520110006.9026-1-thomas@monjalon.net> References: <20180520110006.9026-1-thomas@monjalon.net> Subject: [dpdk-stable] [PATCH 18.02 4/4] ethdev: fix port probing notification 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: Sun, 20 May 2018 11:00:52 -0000 The new device was notified as soon as it was allocated. It leads to use a device which is not yet initialized. The notification must be published after the initialization is done by the PMD, but before the state is changed, in order to let notified entities taking ownership before general availability. Fixes: 29aa41e36de7 ("ethdev: add notifications for probing and removal") Signed-off-by: Thomas Monjalon Reviewed-by: Andrew Rybchenko Reviewed-by: Stephen Hemminger --- lib/librte_ether/rte_ethdev.c | 5 ++--- lib/librte_ether/rte_ethdev_driver.h | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 04a1e474e..8ce5ec999 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -317,9 +317,6 @@ rte_eth_dev_allocate(const char *name) unlock: rte_spinlock_unlock(&rte_eth_dev_shared_data->ownership_lock); - if (eth_dev != NULL) - _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_NEW, NULL); - return eth_dev; } @@ -3392,6 +3389,8 @@ rte_eth_dev_probing_finish(struct rte_eth_dev *dev) if (dev == NULL) return; + _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_NEW, NULL); + dev->state = RTE_ETH_DEV_ATTACHED; } diff --git a/lib/librte_ether/rte_ethdev_driver.h b/lib/librte_ether/rte_ethdev_driver.h index a0780cdcc..710850dd2 100644 --- a/lib/librte_ether/rte_ethdev_driver.h +++ b/lib/librte_ether/rte_ethdev_driver.h @@ -106,6 +106,8 @@ int _rte_eth_dev_callback_process(struct rte_eth_dev *dev, * This is the last step of device probing. * It must be called after a port is allocated and initialized successfully. * + * The notification RTE_ETH_EVENT_NEW is sent to other entities + * (libraries and applications). * The state is set as RTE_ETH_DEV_ATTACHED. * * @param dev -- 2.16.2