From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH v3 4/5] ethdev: add notifications for probing and removal Date: Fri, 29 Dec 2017 14:36:57 +0100 Message-ID: <20171229133658.31258-5-thomas@monjalon.net> References: <20171128221302.15400-1-thomas@monjalon.net> <20171229133658.31258-1-thomas@monjalon.net> Cc: ferruh.yigit@intel.com To: dev@dpdk.org Return-path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 8918C592B for ; Fri, 29 Dec 2017 14:37:28 +0100 (CET) In-Reply-To: <20171229133658.31258-1-thomas@monjalon.net> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Reviewed-by: Ferruh Yigit --- v2: no change v3: no change --- 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 f40627fa3..436066889 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -237,6 +237,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; } @@ -278,6 +280,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 c92508cfd..11f97e709 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -3528,6 +3528,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.1