[dpdk-dev,11/25] ethdev: Add rte_eth_dev_check_detachable

Message ID 1416474399-16851-12-git-send-email-mukawa@igel.co.jp (mailing list archive)
State Superseded, archived
Headers

Commit Message

Tetsuya Mukawa Nov. 20, 2014, 9:06 a.m. UTC
  The function returns whether a PMD supports detach function, or not.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
---
 lib/librte_ether/rte_ethdev.c |  9 +++++++++
 lib/librte_ether/rte_ethdev.h | 11 +++++++++++
 2 files changed, 20 insertions(+)
  

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 372ab7d..0d2397b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -466,6 +466,15 @@  rte_eth_dev_get_name_by_port(uint8_t port_id, char *name)
 	return 0;
 }
 
+int
+rte_eth_dev_check_detachable(uint8_t port_id)
+{
+	uint32_t drv_flags;
+
+	drv_flags = rte_eth_devices[port_id].driver->pci_drv.drv_flags;
+	return !!(drv_flags & RTE_PCI_DRV_DETACHABLE);
+}
+
 static int
 rte_eth_dev_rx_queue_config(struct rte_eth_dev *dev, uint16_t nb_queues)
 {
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index 2087daf..49b4e9b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1697,6 +1697,17 @@  extern int rte_eth_dev_get_port_by_addr(
 extern int rte_eth_dev_get_name_by_port(uint8_t port_id, char *name);
 
 /**
+ * Function for internal use by port hotplug functions.
+ * Check whether or not, a PMD that is handling the ethdev specified by port
+ * identifier can support detach function.
+ * @param	port_id
+ *   The port identifier
+ * @return
+ *   - 0 on supporting detach function, negative on not supporting
+ */
+extern int rte_eth_dev_check_detachable(uint8_t port_id);
+
+/**
  * Function for internal use by dummy drivers primarily, e.g. ring-based
  * driver.
  * Allocates a new ethdev slot for an ethernet device and returns the pointer