#ifndef _RTE_ETHDEV_PCI_H_
#define _RTE_ETHDEV_PCI_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include <rte_malloc.h>
#include <rte_pci.h>
#include <rte_bus_pci.h>
return;
}
- eth_dev->intr_handle = &pci_dev->intr_handle;
+ eth_dev->intr_handle = pci_dev->intr_handle;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
eth_dev->data->dev_flags = 0;
}
static inline int
-eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device) {
- struct rte_pci_device *pci_dev = bus_device;
+eth_dev_pci_specific_init(struct rte_eth_dev *eth_dev, void *bus_device)
+{
+ struct rte_pci_device *pci_dev = (struct rte_pci_device *)bus_device;
if (!pci_dev)
return -ENODEV;
if (!eth_dev)
return 0;
+ /*
+ * In secondary process, a released eth device can be found by its name
+ * in shared memory.
+ * If the state of the eth device is RTE_ETH_DEV_UNUSED, it means the
+ * eth device has been released.
+ */
+ if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+ eth_dev->state == RTE_ETH_DEV_UNUSED)
+ return 0;
+
if (dev_uninit) {
ret = dev_uninit(eth_dev);
if (ret)
return 0;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _RTE_ETHDEV_PCI_H_ */