Merge branch 'upstream-16.11-stable' into 16.11.x
[deb_dpdk.git] / debian / patches / igb_uio-switch-to-new-irq-function-for-MSI-X.patch
1 Description: igb_uio: switch to new irq function for MSI-X
2
3 From 99bb58f3adc73046b538874a0944578146ee1189 Mon Sep 17 00:00:00 2001
4 From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
5 Date: Thu, 20 Apr 2017 15:11:23 +0200
6 Subject: [PATCH] igb_uio: switch to new irq function for MSI-X
7
8 pci_enable_msix() will be removed in kernel 4.12.
9 The new API pci_alloc_irq_vectors() is available
10 since linux 4.8, thus let's use it.
11
12 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aff171641d18
13 Link: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=4244de1c64de
14
15 Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
16 Reviewed-by: David Marchand <david.marchand@6wind.com>
17 Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
18 ---
19  lib/librte_eal/linuxapp/igb_uio/compat.h  |  4 ++++
20  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 11 +++++++++++
21  2 files changed, 15 insertions(+)
22
23 Forwarded: no (backport)
24 Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
25 Original-Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
26 Origin: http://dpdk.org/browse/dpdk/commit/?id=99bb58f3adc73046b538874a0944578146ee1189
27 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1700768
28 Patch-Name: debian/patches/igb_uio-switch-to-new-irq-function-for-MSI-X.patch
29 Last-Update: 2017-06-27
30 --- a/lib/librte_eal/linuxapp/igb_uio/compat.h
31 +++ b/lib/librte_eal/linuxapp/igb_uio/compat.h
32 @@ -123,3 +123,7 @@
33  }
34  
35  #endif /* < 3.3.0 */
36 +
37 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
38 +#define HAVE_PCI_ENABLE_MSIX
39 +#endif
40 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
41 +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
42 @@ -325,7 +325,9 @@
43  igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
44  {
45         struct rte_uio_pci_dev *udev;
46 +#ifdef HAVE_PCI_ENABLE_MSIX
47         struct msix_entry msix_entry;
48 +#endif
49         int err;
50  
51         udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL);
52 @@ -379,6 +381,7 @@
53         switch (igbuio_intr_mode_preferred) {
54         case RTE_INTR_MODE_MSIX:
55                 /* Only 1 msi-x vector needed */
56 +#ifdef HAVE_PCI_ENABLE_MSIX
57                 msix_entry.entry = 0;
58                 if (pci_enable_msix(dev, &msix_entry, 1) == 0) {
59                         dev_dbg(&dev->dev, "using MSI-X");
60 @@ -386,6 +389,14 @@
61                         udev->mode = RTE_INTR_MODE_MSIX;
62                         break;
63                 }
64 +#else
65 +               if (pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_MSIX) == 1) {
66 +                       dev_dbg(&dev->dev, "using MSI-X");
67 +                       udev->info.irq = pci_irq_vector(dev, 0);
68 +                       udev->mode = RTE_INTR_MODE_MSIX;
69 +                       break;
70 +               }
71 +#endif
72                 /* fall back to INTX */
73         case RTE_INTR_MODE_LEGACY:
74                 if (pci_intx_mask_supported(dev)) {