kni: fix ethtool build with kernel 4.11
authorFerruh Yigit <ferruh.yigit@intel.com>
Wed, 3 May 2017 16:00:16 +0000 (17:00 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 5 May 2017 13:42:12 +0000 (15:42 +0200)
build error:
.../lib/librte_eal/linuxapp/kni/igb_main.c:1034:10:
error: implicit declaration of function ‘pci_enable_msix’
    err = pci_enable_msix(pdev,
              ^~~~~~~~~~~~~~~

This build error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option
enabled.

Following Linux commit removes the pci_enable_msix()
Linux: 4244de1c64de ("PCI: remove pci_enable_msix")

Switch to pci_enable_msix_range() for kernel > 4.8 since current Linux
igb driver uses this function.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h

index c0d52db..5f1f3a6 100644 (file)
@@ -1031,8 +1031,15 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
                        for (i = 0; i < numvecs; i++)
                                adapter->msix_entries[i].entry = i;
 
+#ifdef HAVE_PCI_ENABLE_MSIX
                        err = pci_enable_msix(pdev,
                                              adapter->msix_entries, numvecs);
+#else
+                       err = pci_enable_msix_range(pdev,
+                                       adapter->msix_entries,
+                                       numvecs,
+                                       numvecs);
+#endif
                        if (err == 0)
                                break;
                }
index 4abab4a..4c52da3 100644 (file)
@@ -3937,4 +3937,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define HAVE_VF_VLAN_PROTO
 #endif /* >= 4.9.0, >= SLES12SP3 */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
+#define HAVE_PCI_ENABLE_MSIX
+#endif
+
 #endif /* _KCOMPAT_H_ */