[dpdk-dev,v6,2/5] igb_uio: fix irq disable on recent kernels
Checks
Commit Message
igb_uio already allocates irqs using pci_alloc_irq_vectors on
recent kernels >= 4.8. The interrupt disable code was not
using the corresponding pci_free_irq_vectors, but the also
deprecated pci_disable_msix, before this fix.
Fixes: 99bb58f3adc7 ("igb_uio: switch to new irq function for MSI-X")
Cc: nicolas.dichtel@6wind.com
Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
lib/librte_eal/linuxapp/igb_uio/compat.h | 4 ++--
lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 11 ++++++++---
2 files changed, 10 insertions(+), 5 deletions(-)
Comments
On 9/4/2017 7:17 PM, Markus Theil wrote:
> igb_uio already allocates irqs using pci_alloc_irq_vectors on
> recent kernels >= 4.8. The interrupt disable code was not
> using the corresponding pci_free_irq_vectors, but the also
> deprecated pci_disable_msix, before this fix.
>
> Fixes: 99bb58f3adc7 ("igb_uio: switch to new irq function for MSI-X")
> Cc: nicolas.dichtel@6wind.com
>
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
<...>
> -#ifdef HAVE_PCI_ENABLE_MSIX
> +#ifndef HAVE_ALLOC_IRQ_VECTORS
> msix_entry.entry = 0;
> if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) {
> dev_dbg(&udev->pdev->dev, "using MSI-X");
> - udev->info.irq_flags = IRQF_NO_THREAD;
This and below one [1] seems merge artifact, needs to be removed from
this patch.
> udev->info.irq = msix_entry.vector;
> udev->mode = RTE_INTR_MODE_MSIX;
> break;
> @@ -331,6 +330,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
> #else
> if (pci_alloc_irq_vectors(udev->pdev, 1, 1, PCI_IRQ_MSIX) == 1) {
> dev_dbg(&udev->pdev->dev, "using MSI-X");
> + udev->info.irq_flags = IRQF_NO_THREAD;
[1]
> udev->info.irq = pci_irq_vector(udev->pdev, 0);
> udev->mode = RTE_INTR_MODE_MSIX;
> break;
<...>
@@ -124,6 +124,6 @@ static bool pci_check_and_mask_intx(struct pci_dev *pdev)
#endif /* < 3.3.0 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
-#define HAVE_PCI_ENABLE_MSIX
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+#define HAVE_ALLOC_IRQ_VECTORS 1
#endif
@@ -312,18 +312,17 @@ static int
igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
{
int err = 0;
-#ifdef HAVE_PCI_ENABLE_MSIX
+#ifndef HAVE_ALLOC_IRQ_VECTORS
struct msix_entry msix_entry;
#endif
switch (igbuio_intr_mode_preferred) {
case RTE_INTR_MODE_MSIX:
/* Only 1 msi-x vector needed */
-#ifdef HAVE_PCI_ENABLE_MSIX
+#ifndef HAVE_ALLOC_IRQ_VECTORS
msix_entry.entry = 0;
if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) {
dev_dbg(&udev->pdev->dev, "using MSI-X");
- udev->info.irq_flags = IRQF_NO_THREAD;
udev->info.irq = msix_entry.vector;
udev->mode = RTE_INTR_MODE_MSIX;
break;
@@ -331,6 +330,7 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
#else
if (pci_alloc_irq_vectors(udev->pdev, 1, 1, PCI_IRQ_MSIX) == 1) {
dev_dbg(&udev->pdev->dev, "using MSI-X");
+ udev->info.irq_flags = IRQF_NO_THREAD;
udev->info.irq = pci_irq_vector(udev->pdev, 0);
udev->mode = RTE_INTR_MODE_MSIX;
break;
@@ -364,8 +364,13 @@ igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev)
static void
igbuio_pci_disable_interrupts(struct rte_uio_pci_dev *udev)
{
+#ifndef HAVE_ALLOC_IRQ_VECTORS
if (udev->mode == RTE_INTR_MODE_MSIX)
pci_disable_msix(udev->pdev);
+#else
+ if (udev->mode == RTE_INTR_MODE_MSIX)
+ pci_free_irq_vectors(udev->pdev);
+#endif
}
static int