[dpdk-dev] [PATCH 05/25] eal, ethdev: Add function pointer for closing a device

Tetsuya Mukawa mukawa at igel.co.jp
Thu Nov 20 10:06:19 CET 2014


The patch adds function pointer to rte_pci_driver and eth_driver
structure. These function pointers are used when ports are detached.

Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp>
---
 lib/librte_eal/common/include/rte_pci.h | 7 +++++++
 lib/librte_ether/rte_ethdev.h           | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index fe374a8..74720d1 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -181,12 +181,19 @@ struct rte_pci_driver;
 typedef int (pci_devinit_t)(struct rte_pci_driver *, struct rte_pci_device *);
 
 /**
+ * Shutdown function for the driver called during hotplugging.
+ */
+typedef int (pci_devshutdown_t)(
+		struct rte_pci_driver *, struct rte_pci_device *);
+
+/**
  * A structure describing a PCI driver.
  */
 struct rte_pci_driver {
 	TAILQ_ENTRY(rte_pci_driver) next;       /**< Next in list. */
 	const char *name;                       /**< Driver name. */
 	pci_devinit_t *devinit;                 /**< Device init. function. */
+	pci_devshutdown_t *devshutdown;         /**< Device shutdown function. */
 	struct rte_pci_id *id_table;            /**< ID table, NULL terminated. */
 	uint32_t drv_flags;                     /**< Flags contolling handling of device. */
 };
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 548467c..558d4d3 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1696,6 +1696,9 @@ struct eth_driver;
 typedef int (*eth_dev_init_t)(struct eth_driver  *eth_drv,
 			      struct rte_eth_dev *eth_dev);
 
+typedef int (*eth_dev_shutdown_t)(struct eth_driver  *eth_drv,
+				  struct rte_eth_dev *eth_dev);
+
 /**
  * @internal
  * The structure associated with a PMD Ethernet driver.
@@ -1712,6 +1715,7 @@ typedef int (*eth_dev_init_t)(struct eth_driver  *eth_drv,
 struct eth_driver {
 	struct rte_pci_driver pci_drv;    /**< The PMD is also a PCI driver. */
 	eth_dev_init_t eth_dev_init;      /**< Device init function. */
+	eth_dev_shutdown_t eth_dev_shutdown;/**< Device shutdown function. */
 	unsigned int dev_private_size;    /**< Size of device private data. */
 };
 
-- 
1.9.1



More information about the dev mailing list