[dpdk-dev,11/25] ethdev: Add rte_eth_dev_check_detachable
Commit Message
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(+)
@@ -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)
{
@@ -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