ethdev: decouple interrupt handling from PCI device
The struct rte_intr_handle is an abstraction layer for different types of interrupt mechanisms. It is embedded in the low-level device (e.g. PCI). On allocation of a struct rte_eth_dev a reference to the intr_handle should be stored for devices supporting interrupts. Signed-off-by: Jan Blunck <jblunck@infradead.org> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
parent
36f8f62b7b
commit
0e1b45a284
@ -262,6 +262,7 @@ rte_eth_dev_pci_probe(struct rte_pci_driver *pci_drv,
|
||||
rte_panic("Cannot allocate memzone for private port data\n");
|
||||
}
|
||||
eth_dev->pci_dev = pci_dev;
|
||||
eth_dev->intr_handle = &pci_dev->intr_handle;
|
||||
eth_dev->driver = eth_drv;
|
||||
|
||||
/* Invoke PMD device initialization function */
|
||||
@ -2591,7 +2592,13 @@ rte_eth_dev_rx_intr_ctl(uint8_t port_id, int epfd, int op, void *data)
|
||||
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
|
||||
|
||||
dev = &rte_eth_devices[port_id];
|
||||
intr_handle = &dev->pci_dev->intr_handle;
|
||||
|
||||
if (!dev->intr_handle) {
|
||||
RTE_PMD_DEBUG_TRACE("RX Intr handle unset\n");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
intr_handle = dev->intr_handle;
|
||||
if (!intr_handle->intr_vec) {
|
||||
RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
|
||||
return -EPERM;
|
||||
@ -2651,7 +2658,12 @@ rte_eth_dev_rx_intr_ctl_q(uint8_t port_id, uint16_t queue_id,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
intr_handle = &dev->pci_dev->intr_handle;
|
||||
if (!dev->intr_handle) {
|
||||
RTE_PMD_DEBUG_TRACE("RX Intr handle unset\n");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
intr_handle = dev->intr_handle;
|
||||
if (!intr_handle->intr_vec) {
|
||||
RTE_PMD_DEBUG_TRACE("RX Intr vector unset\n");
|
||||
return -EPERM;
|
||||
@ -3253,6 +3265,8 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
|
||||
return;
|
||||
}
|
||||
|
||||
eth_dev->intr_handle = &pci_dev->intr_handle;
|
||||
|
||||
eth_dev->data->dev_flags = 0;
|
||||
if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_LSC)
|
||||
eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_LSC;
|
||||
|
@ -1625,6 +1625,7 @@ struct rte_eth_dev {
|
||||
const struct eth_driver *driver;/**< Driver for this device */
|
||||
const struct eth_dev_ops *dev_ops; /**< Functions exported by PMD */
|
||||
struct rte_pci_device *pci_dev; /**< PCI info. supplied by probing */
|
||||
struct rte_intr_handle *intr_handle; /**< Device interrupt handle */
|
||||
/** User application callbacks for NIC interrupts */
|
||||
struct rte_eth_dev_cb_list link_intr_cbs;
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user