/** * This is the irqcontrol callback to be registered to uio_info. * It can be used to disable/enable interrupt from user space processes. * * @param info * pointer to uio_info. * @param irq_state * state value. 1 to enable interrupt, 0 to disable interrupt. * * @return * - On success, 0. * - On failure, a negative value. */ static int igbuio_pci_irqcontrol(struct uio_info *info, s32 irq_state) { struct rte_uio_pci_dev *udev = info->priv; struct pci_dev *pdev = udev->pdev; pci_cfg_access_lock(pdev); if (udev->mode == RTE_INTR_MODE_LEGACY) pci_intx(pdev, !!irq_state); else if (udev->mode == RTE_INTR_MODE_MSIX) { struct msi_desc *desc; #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)) list_for_each_entry(desc, &pdev->msi_list, list) igbuio_msix_mask_irq(desc, irq_state); #else list_for_each_entry(desc, &pdev->dev.msi_list, list) igbuio_msix_mask_irq(desc, irq_state); #endif } pci_cfg_access_unlock(pdev); return 0; }
static void igbuio_mask_irq(struct pci_dev *pdev, enum rte_intr_mode mode, s32 irq_state) { struct msi_desc *desc; struct list_head *msi_list; #ifdef HAVE_MSI_LIST_IN_GENERIC_DEVICE msi_list = &pdev->dev.msi_list; #else msi_list = &pdev->msi_list; #endif if (mode == RTE_INTR_MODE_MSIX) { list_for_each_entry(desc, msi_list, list) igbuio_msix_mask_irq(desc, irq_state); } else if (mode == RTE_INTR_MODE_MSI) { list_for_each_entry(desc, msi_list, list) igbuio_msi_mask_irq(pdev, desc, irq_state); } }