The function rte_eth_dev_is_valid_port is good way to have all
drivers using same function and solves several hotplug related
bugs from drivers not checking attached flag.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
rte_eal_pci_register(ð_drv->pci_drv);
}
-static int
+int
rte_eth_dev_is_valid_port(uint8_t port_id)
{
if (port_id >= RTE_MAX_ETHPORTS ||
*/
extern int rte_eth_dev_socket_id(uint8_t port_id);
+/*
+ * Check if port_id of device is attached
+ *
+ * @param port_id
+ * The port identifier of the Ethernet device
+ * @return
+ * - 0 if port is out of range or not attached
+ * - 1 if device is attached
+ */
+extern int rte_eth_dev_is_valid_port(uint8_t port_id);
+
/*
* Allocate mbuf from mempool, setup the DMA physical address
* and then start RX for specified queue of a port. It is used
rte_eth_dev_get_eeprom_length;
rte_eth_dev_get_reg_info;
rte_eth_dev_get_reg_length;
+ rte_eth_dev_is_valid_port;
rte_eth_dev_set_eeprom;
rte_eth_dev_set_mc_addr_list;
rte_eth_timesync_disable;