From 4094930e55d1d629a1b929e22a088b0e4bb5386b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 25 Jul 2014 10:37:54 -0700 Subject: [PATCH] igb_uio: handle no IRQ fallback Fix a couple of issues with my earlier igb_uio stuff: 1. With MSI (like MSI-X) actual IRQ number is not known until after the pci_enable_msi() is done. 2. If INTX fails, fall back to running without IRQ. This allows usermode PCI to recover and run without out IRQ for cases where PCI INTX support is broken (aka VMWare). Signed-off-by: Stephen Hemminger Acked-by: Thomas Monjalon --- lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index c143fd16c4..3225d9f658 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -506,7 +506,6 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) udev->info.version = "0.1"; udev->info.handler = igbuio_pci_irqhandler; udev->info.irqcontrol = igbuio_pci_irqcontrol; - udev->info.irq = dev->irq; #ifdef CONFIG_XEN_DOM0 /* check if the driver run on Xen Dom0 */ if (xen_initial_domain()) @@ -516,9 +515,6 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) udev->pdev = dev; switch (igbuio_intr_mode_preferred) { - case RTE_INTR_MODE_NONE: - udev->info.irq = 0; - break; case RTE_INTR_MODE_MSIX: /* Only 1 msi-x vector needed */ msix_entry.entry = 0; @@ -532,6 +528,7 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) case RTE_INTR_MODE_MSI: if (pci_enable_msi(dev) == 0) { dev_dbg(&dev->dev, "using MSI"); + udev->info.irq = dev->irq; udev->mode = RTE_INTR_MODE_MSI; break; } @@ -540,13 +537,17 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) if (pci_intx_mask_supported(dev)) { dev_dbg(&dev->dev, "using INTX"); udev->info.irq_flags = IRQF_SHARED; + udev->info.irq = dev->irq; udev->mode = RTE_INTR_MODE_LEGACY; - } else { - dev_err(&dev->dev, "PCI INTX mask not supported\n"); - err = -EIO; - goto fail_release_iomem; + break; } + dev_notice(&dev->dev, "PCI INTX mask not supported\n"); + /* fall back to no IRQ */ + case RTE_INTR_MODE_NONE: + udev->mode = RTE_INTR_MODE_NONE; + udev->info.irq = 0; break; + default: dev_err(&dev->dev, "invalid IRQ mode %u", igbuio_intr_mode_preferred); -- 2.20.1