6 #ifndef _RTE_ETHDEV_PCI_H_ 7 #define _RTE_ETHDEV_PCI_H_ 11 #include <rte_bus_pci.h> 12 #include <rte_config.h> 26 rte_eth_copy_pci_info(
struct rte_eth_dev *eth_dev,
27 struct rte_pci_device *pci_dev)
29 if ((eth_dev == NULL) || (pci_dev == NULL)) {
30 RTE_ETHDEV_LOG(ERR,
"NULL pointer eth_dev=%p pci_dev=%p",
31 (
void *)eth_dev, (
void *)pci_dev);
35 eth_dev->intr_handle = &pci_dev->intr_handle;
38 eth_dev->data->dev_flags = 0;
39 if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
41 if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV)
44 eth_dev->data->numa_node = pci_dev->device.numa_node;
49 eth_dev_pci_specific_init(
struct rte_eth_dev *eth_dev,
void *bus_device) {
50 struct rte_pci_device *pci_dev = bus_device;
55 rte_eth_copy_pci_info(eth_dev, pci_dev);
74 static inline struct rte_eth_dev *
75 rte_eth_dev_pci_allocate(
struct rte_pci_device *dev,
size_t private_data_size)
77 struct rte_eth_dev *eth_dev;
83 name = dev->device.name;
86 eth_dev = rte_eth_dev_allocate(name);
90 if (private_data_size) {
92 private_data_size, RTE_CACHE_LINE_SIZE,
93 dev->device.numa_node);
94 if (!eth_dev->data->dev_private) {
95 rte_eth_dev_release_port(eth_dev);
100 eth_dev = rte_eth_dev_attach_secondary(name);
105 eth_dev->device = &dev->device;
106 rte_eth_copy_pci_info(eth_dev, dev);
110 typedef int (*eth_dev_pci_callback_t)(
struct rte_eth_dev *eth_dev);
118 rte_eth_dev_pci_generic_probe(
struct rte_pci_device *pci_dev,
119 size_t private_data_size, eth_dev_pci_callback_t dev_init)
121 struct rte_eth_dev *eth_dev;
124 eth_dev = rte_eth_dev_pci_allocate(pci_dev, private_data_size);
128 RTE_FUNC_PTR_OR_ERR_RET(*dev_init, -EINVAL);
129 ret = dev_init(eth_dev);
131 rte_eth_dev_release_port(eth_dev);
133 rte_eth_dev_probing_finish(eth_dev);
144 rte_eth_dev_pci_generic_remove(
struct rte_pci_device *pci_dev,
145 eth_dev_pci_callback_t dev_uninit)
147 struct rte_eth_dev *eth_dev;
150 eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
155 ret = dev_uninit(eth_dev);
160 rte_eth_dev_release_port(eth_dev);
#define RTE_ETH_DEV_INTR_LSC
enum rte_proc_type_t rte_eal_process_type(void)
#define RTE_ETH_DEV_INTR_RMV
void * rte_zmalloc_socket(const char *type, size_t size, unsigned align, int socket) __rte_alloc_size(2)