DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: add notifications for probing and removal
@ 2017-11-28 22:13 Thomas Monjalon
  2017-12-22  3:17 ` Ferruh Yigit
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Thomas Monjalon @ 2017-11-28 22:13 UTC (permalink / raw)
  To: dev; +Cc: matan

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 <thomas@monjalon.net>
---

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

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-01-10 21:19 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28 22:13 [dpdk-dev] [PATCH] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-22  3:17 ` Ferruh Yigit
2017-12-22  8:39   ` Thomas Monjalon
2017-12-29 13:12 ` [dpdk-dev] [PATCH v2 0/3] ethdev port notifications Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 1/3] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 2/3] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:12   ` [dpdk-dev] [PATCH v2 3/3] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36 ` [dpdk-dev] [PATCH v3 0/5] ethdev port notifications Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-02 11:35     ` Iremonger, Bernard
2018-01-02 12:21       ` Neil Horman
2018-01-03  8:17         ` Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2017-12-29 13:36   ` [dpdk-dev] [PATCH v3 5/5] app/testpmd: extend event printing Thomas Monjalon
2018-01-04 16:01 ` [dpdk-dev] [PATCH v4 0/5] ethdev port notifications Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 1/5] ethdev: remove useless parameter in callback process Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 2/5] ethdev: allow event registration for all ports Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 3/5] ethdev: free detached port by the dedicated function Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 4/5] ethdev: add notifications for probing and removal Thomas Monjalon
2018-01-04 16:01   ` [dpdk-dev] [PATCH v4 5/5] app/testpmd: extend event printing Thomas Monjalon
2018-01-04 16:03     ` Thomas Monjalon
2018-01-10 21:02     ` Ferruh Yigit
2018-01-10 21:19   ` [dpdk-dev] [PATCH v4 0/5] ethdev port notifications Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).