From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 73B601B00C for ; Thu, 4 Jan 2018 17:01:41 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A56FA20BEB; Thu, 4 Jan 2018 11:01:40 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 04 Jan 2018 11:01:40 -0500 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=VjhjxBOwY9Ky3E SJsXJ3Hz3cLVHwxv099yWFFnLoxh8=; b=sE6fbJov681PRoYx5Lt6tNlaAMl99y DHQhtFGrOoHHGfNFJcwu0IIKtempn+84mgLj1NGlM/GDU1ozAfh9pQ1FX2qdH2Ty t0Em6Z4xVZyZ5/Jcuc8PDLBHvZ7Fwq7+MMVBT6ggWE/Aokzn63inVEdQhi/rCY8d YcOQv4NGT2JuM= 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= fm1; bh=VjhjxBOwY9Ky3ESJsXJ3Hz3cLVHwxv099yWFFnLoxh8=; b=Dguz/MT+ TTi9uEGjH12Fcv3oYoDoNSBIlXZFCVYEtRNM4kAjRj9Y3AOnatMb6Hj8R6DdZPbv UFrltdXUGpvXT3zxfDwbpNi1BzVV1yNk7IkVdAB3Xx3CWaefYkbACNOgU4Dzi/Ci S6Rd2Ekwmt7bl9Vips3t43IrdX0ZhbgJMNd3rRM/zvHNkOG5NT5nMXTsOYu0yHlh 2rSgTlrG4zQLZfCGfzH3OgVsLyqe5wRUiJ6lwAgYNVsaL0q+QNf0gHPVzQjwYcP7 Js5kTJv5fj1ncavT+JlwLEGACPW5cv/hrIP4OR7AXlRp4ZqvZ4jo35MwpJf2DceU ePaQAkJrDlRnSw== 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 063C17E183; Thu, 4 Jan 2018 11:01:39 -0500 (EST) From: Thomas Monjalon To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 4 Jan 2018 17:01:11 +0100 Message-Id: <20180104160112.28651-5-thomas@monjalon.net> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180104160112.28651-1-thomas@monjalon.net> References: <20171128221302.15400-1-thomas@monjalon.net> <20180104160112.28651-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v4 4/5] 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: Thu, 04 Jan 2018 16:01:41 -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 Reviewed-by: Ferruh Yigit --- v2: no change v3: no change v4: 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 8700f6f43..7c1f7eef9 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