The function returns whether a PMD supports detach function, or not. Signed-off-by: Tetsuya Mukawa <mukawa at igel.co.jp> --- lib/librte_ether/rte_ethdev.c | 9 +++++++++ lib/librte_ether/rte_ethdev.h | 11 +++++++++++ 2 files changed, 20 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1d82f69..ed53e66 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -498,6 +498,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 bd921d0..404c41f 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1701,6 +1701,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 -- 1.9.1