]> git.proxmox.com Git - pve-kernel-jessie.git/blame - igb_4.9_compat.patch
buildsys: update make upload target for stretch
[pve-kernel-jessie.git] / igb_4.9_compat.patch
CommitLineData
174ba651
FG
1From 6445198f802d993c73f4b246353b2ceb2dfafc32 Mon Sep 17 00:00:00 2001
2From: Ferruh Yigit <ferruh.yigit@intel.com>
3Date: Mon, 17 Oct 2016 11:23:14 +0100
4Subject: kni: fix build with kernel 4.9
5
6compile error:
7 CC [M] .../lib/librte_eal/linuxapp/kni/igb_main.o
8.../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21:
9error: initialization from incompatible pointer type
10 [-Werror=incompatible-pointer-types]
11 .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
12 ^~~~~~~~~~~~~~~~~~~
13
14Linux kernel 4.9 updates API for ndo_set_vf_vlan:
15Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support")
16
17Use new API for Linux kernels >= 4.9
18
19Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
20Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
21---
22 src/igb_main.c | 19 +++++++++++++++++++
23 src/kcompat.h | 4 ++++
24 2 files changed, 23 insertions(+)
25
26diff --git a/src/igb_main.c b/src/igb_main.c
27index 23e2d64..f4dca5a 100644
28--- a/src/igb_main.c
29+++ b/src/igb_main.c
30@@ -195,7 +195,11 @@ static void igb_process_mdd_event(struct igb_adapter *);
31 #ifdef IFLA_VF_MAX
32 static int igb_ndo_set_vf_mac( struct net_device *netdev, int vf, u8 *mac);
33 static int igb_ndo_set_vf_vlan(struct net_device *netdev,
34+#ifdef HAVE_VF_VLAN_PROTO
35+ int vf, u16 vlan, u8 qos, __be16 vlan_proto);
36+#else
37 int vf, u16 vlan, u8 qos);
38+#endif
39 #ifdef HAVE_VF_SPOOFCHK_CONFIGURE
40 static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
41 bool setting);
42@@ -6412,7 +6416,11 @@ static void igb_set_vmvir(struct igb_adapter *adapter, u32 vid, u32 vf)
43 }
44
45 static int igb_ndo_set_vf_vlan(struct net_device *netdev,
46+#ifdef HAVE_VF_VLAN_PROTO
47+ int vf, u16 vlan, u8 qos, __be16 vlan_proto)
48+#else
49 int vf, u16 vlan, u8 qos)
50+#endif
51 {
52 int err = 0;
53 struct igb_adapter *adapter = netdev_priv(netdev);
54@@ -6420,6 +6428,12 @@ static int igb_ndo_set_vf_vlan(struct net_device *netdev,
55 /* VLAN IDs accepted range 0-4094 */
56 if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1) || (qos > 7))
57 return -EINVAL;
58+
59+#ifdef HAVE_VF_VLAN_PROTO
60+ if (vlan_proto != htons(ETH_P_8021Q))
61+ return -EPROTONOSUPPORT;
62+#endif
63+
64 if (vlan || qos) {
65 err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
66 if (err)
67@@ -6580,7 +6594,12 @@ static inline void igb_vf_reset(struct igb_adapter *adapter, u32 vf)
68 if (adapter->vf_data[vf].pf_vlan)
69 igb_ndo_set_vf_vlan(adapter->netdev, vf,
70 adapter->vf_data[vf].pf_vlan,
71+#ifdef HAVE_VF_VLAN_PROTO
72+ adapter->vf_data[vf].pf_qos,
73+ htons(ETH_P_8021Q));
74+#else
75 adapter->vf_data[vf].pf_qos);
76+#endif
77 else
78 igb_clear_vf_vfta(adapter, vf);
79 #endif
80diff --git a/src/kcompat.h b/src/kcompat.h
81index 69e0e7a..84826b2 100644
82--- a/src/kcompat.h
83+++ b/src/kcompat.h
84@@ -3929,4 +3929,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
85 #define vlan_tx_tag_present skb_vlan_tag_present
86 #endif
87
88+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) )
89+#define HAVE_VF_VLAN_PROTO
90+#endif /* >= 4.9.0 */
91+
92 #endif /* _KCOMPAT_H_ */
93--
94cgit v1.0
95