Fix build with kernel 4.12

Corresponding upstream patches -
  * http://dpdk.org/dev/patchwork/patch/24076/
  * http://dpdk.org/dev/patchwork/patch/22003/

Tested on "4.12.4-custom".
dev
Shivansh Rai 2018-01-05 11:20:59 +05:30
parent 403263ffc6
commit 0d76c9d0a5
No known key found for this signature in database
GPG Key ID: 79F7981AFEE5A3A1
5 changed files with 27 additions and 0 deletions

View File

@ -380,7 +380,11 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
case RTE_INTR_MODE_MSIX:
/* Only 1 msi-x vector needed */
msix_entry.entry = 0;
#ifdef HAVE_PCI_ENABLE_MSIX
if (pci_enable_msix(dev, &msix_entry, 1) == 0) {
#else
if (pci_enable_msix_range(dev, &msix_entry, 1, 1) == 0) {
#endif
dev_dbg(&dev->dev, "using MSI-X");
udev->info.irq = msix_entry.vector;
udev->mode = RTE_INTR_MODE_MSIX;

View File

@ -2,6 +2,8 @@
* Minimal wrappers to allow compiling kni on older kernels.
*/
#include <linux/version.h>
#ifndef RHEL_RELEASE_VERSION
#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b))
#endif
@ -38,3 +40,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
#define HAVE_TRANS_START_HELPER
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
#endif

View 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;
}

View File

@ -3933,4 +3933,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
#define HAVE_VF_VLAN_PROTO
#endif /* >= 4.9.0 */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
#define HAVE_PCI_ENABLE_MSIX
#endif
#endif /* _KCOMPAT_H_ */

View File

@ -25,9 +25,15 @@
#ifndef _KNI_DEV_H_
#define _KNI_DEV_H_
#include "compat.h"
#include <linux/if.h>
#include <linux/wait.h>
#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
#include <linux/sched/signal.h>
#else
#include <linux/sched.h>
#endif
#include <linux/netdevice.h>
#include <linux/spinlock.h>
#include <linux/list.h>