From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v2 08/10] igb_uio: fix IRQ mode handling Date: Fri, 18 Jul 2014 13:49:19 +0200 Message-ID: <2492608.JgTHGoTi8P@xps13> References: <20140606235028.189345212@networkplumber.org> <20140606235113.600528535@networkplumber.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Stephen Hemminger Return-path: In-Reply-To: <20140606235113.600528535-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hi Stephen, I cannot merge this part because some lines were removed from the context. I think I just have to add them but I would like confirmation. See below. > @@ -512,36 +499,36 @@ > #endif > udev->info.priv = udev; > udev->pdev = dev; > - udev->mode = 0; /* set the default value for interrupt mode */ > - spin_lock_init(&udev->lock); > > - /* check if it need to try msix first */ > - if (igbuio_intr_mode_preferred == IGBUIO_MSIX_INTR_MODE) { > - /* only one MSIX vector needed */ > - struct msix_entry msix_entry = { > - .entry = 0, > - }; > - > - if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) { > + switch (igbuio_intr_mode_preferred) { > + case IGBUIO_MSIX_INTR_MODE: > + /* Only 1 msi-x vector needed */ > + msix_entry.entry = 0; > + if (pci_enable_msix(dev, &msix_entry, 1) == 0) { > + dev_dbg(&dev->dev, "using MSI-X"); > + udev->info.irq = msix_entry.vector; > udev->mode = IGBUIO_MSIX_INTR_MODE; > - } else { > - pr_err("failed to enable pci msix, or not enough msix entries\n"); > - udev->mode = IGBUIO_LEGACY_INTR_MODE; > + break; > } > - } > - switch (udev->mode) { > - case IGBUIO_MSIX_INTR_MODE: > - udev->info.irq_flags = 0; > - udev->info.irq = udev->msix_entries[0].vector; > - break; > + /* fall back to MSI */ > case IGBUIO_MSI_INTR_MODE: > - break; > + if (pci_enable_msi(dev) == 0) { > + dev_dbg(&dev->dev, "using MSI"); > + udev->info.irq = dev->irq; > + udev->mode = IGBUIO_MSI_INTR_MODE; > + break; > + } > + /* fall back to INTX */ > case IGBUIO_LEGACY_INTR_MODE: > - udev->info.irq_flags = IRQF_SHARED; > - udev->info.irq = dev->irq; > - break; > - default: > - break; > + if (pci_intx_mask_supported(dev)) { > + dev_dbg(&dev->dev, "using INTX"); > + udev->info.irq_flags = IRQF_SHARED; > + udev->mode = IGBUIO_LEGACY_INTR_MODE; > + } else { > + dev_err(&dev->dev, "PCI INTX mask not supported\n"); > + err = -EIO; > + goto fail_release_iomem; > + } > } There is a problem here. These 2 lines are missing: pci_set_drvdata(dev, udev); igbuio_pci_irqcontrol(&udev->info, 0); > err = sysfs_create_group(&dev->dev.kobj, &dev_attr_grp); -- Thomas