From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 4CB112C58 for ; Tue, 28 Nov 2017 23:13:06 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C4F1C20CA6; Tue, 28 Nov 2017 17:13:05 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 28 Nov 2017 17:13:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=DmrDIRCfxRwehONTSmymswSCtDSoyYkhHQlsTK /2DOk=; b=CRmJCQrJWlSleRH1g0wl1Atwp5apjklZ9G/a6Ms9FWf0ARU1HxmNHH 3nl7cKiA+OGZ5/VEyZYUerhgzb6vqeWkf11AO9gL1eQhiaEqxJKZzn22z6u7k6Ji vdAPlSEHxXXrdooUCGmSmVW1QxN84gsDs7HB6y/UpEEDPaeO2zmYI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=DmrDIRCfxRwehONTS mymswSCtDSoyYkhHQlsTK/2DOk=; b=dEOfz4h0FBJMMpZMIj/c1h9zUac3Hn/L9 mbjX4J1GbDyKua1vLFHOcHDzDbF0hFxkg29GpVKQiXy0SUWhALZCEFZoHzCX+oGM KKXPfR/Dr3dp2culyJTE76WamfwcA1b53eJ7cb30zHfZbvIn62NcG0GF7gUvhAup OFuNrYVkX/0DcyPtUf4A5tEG79dpYgLEU7/Tt5Ye0IfrGhOAw93kJVWHlNvAu4q+ ML6V8ppyBjHR/Pr5yF3czBXlsAUV9friIjCl3JMH8GKLsdRhnY2rExiWp54gajpD d9/7eeVx25O78hOW7mZn6Gr+bap8HBNaLbXL01CNJ5OFG9hFu//iw== 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 3E72924536; Tue, 28 Nov 2017 17:13:05 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: matan@mellanox.com Date: Tue, 28 Nov 2017 23:13:02 +0100 Message-Id: <20171128221302.15400-1-thomas@monjalon.net> X-Mailer: git-send-email 2.15.0 Subject: [dpdk-dev] [PATCH] ethdev: add notifications for probing and removal 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: Tue, 28 Nov 2017 22:13:06 -0000 When a PMD finishes probing, it creates the new port by calling the function rte_eth_dev_allocate(). A notification of the new port is sent there to the upper layer. When a PMD finishes removal of a port, it calls the function rte_eth_dev_release_port(). A notification of the destroyed port is sent there to the upper layer. Signed-off-by: Thomas Monjalon --- This patch depends on: - ethdev: remove useless parameter in callback process - ethdev: free a port by a dedicated API --- lib/librte_ether/rte_ethdev.c | 5 +++++ lib/librte_ether/rte_ethdev.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index c196c3692..517e6546f 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -238,6 +238,8 @@ rte_eth_dev_allocate(const char *name) eth_dev->data->port_id = port_id; eth_dev->data->mtu = ETHER_MTU; + _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_NEW, NULL); + return eth_dev; } @@ -279,6 +281,9 @@ rte_eth_dev_release_port(struct rte_eth_dev *eth_dev) return -EINVAL; eth_dev->state = RTE_ETH_DEV_UNUSED; + + _rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_DESTROY, NULL); + return 0; } diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 15309aa7c..6986ee2a0 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3526,6 +3526,8 @@ enum rte_eth_event_type { RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */ RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */ RTE_ETH_EVENT_INTR_RMV, /**< device removal event */ + RTE_ETH_EVENT_NEW, /**< port is probed */ + RTE_ETH_EVENT_DESTROY, /**< port is released */ RTE_ETH_EVENT_MAX /**< max value of this enum */ }; -- 2.15.0