The integration of using uio_pci_generic broke use of UIO by igb_uio and other drivers. Go back to using uio IRQ control through interrupt fd.
This patch assumes that if uio_pci_generic is being used that the kernel has been fixed to support this by integrating patch to support IRQ control. Signed-off-by: Stephen Hemminger <stephen at networkplumber.org> --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -363,48 +363,28 @@ vfio_disable_msix(struct rte_intr_handle static int uio_intr_disable(struct rte_intr_handle *intr_handle) { - unsigned char command_high; + const int value = 0; - /* use UIO config file descriptor for uio_pci_generic */ - if (pread(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) { + if (write(intr_handle->fd, &value, sizeof(value)) < 0){ RTE_LOG(ERR, EAL, - "Error reading interrupts status for fd %d\n", - intr_handle->uio_cfg_fd); + "Error disabling interrupts for fd %d (%s)\n", + intr_handle->fd, strerror(errno)); return -1; } - /* disable interrupts */ - command_high |= 0x4; - if (pwrite(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) { - RTE_LOG(ERR, EAL, - "Error disabling interrupts for fd %d\n", - intr_handle->uio_cfg_fd); - return -1; - } - return 0; } static int uio_intr_enable(struct rte_intr_handle *intr_handle) { - unsigned char command_high; + const int value = 1; - /* use UIO config file descriptor for uio_pci_generic */ - if (pread(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) { + if (write(intr_handle->fd, &value, sizeof(value)) < 0) { RTE_LOG(ERR, EAL, - "Error reading interrupts status for fd %d\n", - intr_handle->uio_cfg_fd); + "Error enabling interrupts for fd %d (%s)\n", + intr_handle->fd, strerror(errno)); return -1; } - /* enable interrupts */ - command_high &= ~0x4; - if (pwrite(intr_handle->uio_cfg_fd, &command_high, 1, 5) != 1) { - RTE_LOG(ERR, EAL, - "Error enabling interrupts for fd %d\n", - intr_handle->uio_cfg_fd); - return -1; - } - return 0; } @@ -547,7 +527,7 @@ rte_intr_callback_unregister(struct rte_ int rte_intr_enable(struct rte_intr_handle *intr_handle) { - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) + if (!intr_handle || intr_handle->fd < 0) return -1; switch (intr_handle->type){ @@ -587,7 +567,7 @@ rte_intr_enable(struct rte_intr_handle * int rte_intr_disable(struct rte_intr_handle *intr_handle) { - if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < 0) + if (!intr_handle || intr_handle->fd < 0) return -1; switch (intr_handle->type){ --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -276,7 +276,6 @@ pci_uio_map_resource(struct rte_pci_devi struct pci_map *maps; dev->intr_handle.fd = -1; - dev->intr_handle.uio_cfg_fd = -1; dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN; /* secondary processes - use already recorded details */ --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h @@ -52,8 +52,7 @@ enum rte_intr_handle_type { struct rte_intr_handle { union { int vfio_dev_fd; /**< VFIO device file descriptor */ - int uio_cfg_fd; /**< UIO config file descriptor - for uio_pci_generic */ + int uio_cfg_fd; /**< UIO config file descriptor */ }; int fd; /**< interrupt event file descriptor */ enum rte_intr_handle_type type; /**< handle type */