diff mbox

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

Message ID 1414572576-21371-12-git-send-email-mukawa@igel.co.jp (mailing list archive)
State RFC, archived
Headers show

Commit Message

Tetsuya Mukawa Oct. 29, 2014, 8:49 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(+)
diff mbox

Patch

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index dea28c2..92a846a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -464,6 +464,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 11853f5..5cc438c 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1677,6 +1677,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