ethdev: add notifications for probing and removal
authorThomas Monjalon <thomas@monjalon.net>
Thu, 4 Jan 2018 16:01:11 +0000 (17:01 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
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>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_ether/rte_ethdev.c
lib/librte_ether/rte_ethdev.h

index 780b1d6..b349599 100644 (file)
@@ -209,6 +209,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;
 }
 
@@ -250,6 +252,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;
 }
 
index 5aa8afc..f0eeefe 100644 (file)
@@ -3499,6 +3499,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 */
 };