blob: 09bca06ed698e99865a78946bcbb3712e877f7f7 [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001From 2de9d1629312a32f82c43167467640bc793805a6 Mon Sep 17 00:00:00 2001
2From: Damjan Marion <damarion@cisco.com>
3Date: Mon, 12 Oct 2015 14:23:30 +0200
4Subject: [PATCH 1/9] kni: fix igb build with kernel 4.2
5
6Kernel 4.2 has introduced two new parameters in ndo_bridge_getlink,
7which breaks DPDK compilation.
8
9Linux: 7d4f8d87 ("switchdev: ad VLAN support for ports bridge-getlink")
10
11This patch adds the necessary checks to fix it.
12
13Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
14---
15 lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 13 +++++++++----
16 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 7 ++++++-
17 2 files changed, 15 insertions(+), 5 deletions(-)
18
19diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
20index eed8df6..b330b20 100644
21--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
22+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
23@@ -2250,14 +2250,14 @@ static int igb_ndo_bridge_setlink(struct net_device *dev,
24 }
25
26 #ifdef HAVE_BRIDGE_FILTER
27-#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
28+#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS
29 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
30 struct net_device *dev, u32 filter_mask,
31 int nlflags)
32 #else
33 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
34 struct net_device *dev, u32 filter_mask)
35-#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
36+#endif /* HAVE_NDO_BRIDGE_GETLINK_NLFLAGS */
37 #else
38 static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
39 struct net_device *dev)
40@@ -2275,11 +2275,16 @@ static int igb_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
41 mode = BRIDGE_MODE_VEPA;
42
43 #ifdef HAVE_NDO_FDB_ADD_VID
44-#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
45+#ifdef HAVE_NDO_BRIDGE_GETLINK_NLFLAGS
46+#ifdef HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL
47+ return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0,
48+ nlflags, filter_mask, NULL);
49+#else
50 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags);
51+#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL */
52 #else
53 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0);
54-#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK */
55+#endif /* HAVE_NDO_BRIDGE_GETLINK_NLFLAGS */
56 #else
57 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
58 #endif /* HAVE_NDO_FDB_ADD_VID */
59diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
60index 852f80f..5f45b8b 100644
61--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
62+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
63@@ -3899,6 +3899,11 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
64
65 #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) )
66 /* ndo_bridge_getlink adds new nlflags parameter */
67-#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK
68+#define HAVE_NDO_BRIDGE_GETLINK_NLFLAGS
69 #endif /* >= 4.1.0 */
70+
71+#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) )
72+/* ndo_bridge_getlink adds new filter_mask and vlan_fill parameters */
73+#define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL
74+#endif /* >= 4.2.0 */
75 #endif /* _KCOMPAT_H_ */
76--
772.5.0
78