1 From 2de9d1629312a32f82c43167467640bc793805a6 Mon Sep 17 00:00:00 2001
2 From: Damjan Marion <damarion@cisco.com>
3 Date: Mon, 12 Oct 2015 14:23:30 +0200
4 Subject: [PATCH 1/9] kni: fix igb build with kernel 4.2
6 Kernel 4.2 has introduced two new parameters in ndo_bridge_getlink,
7 which breaks DPDK compilation.
9 Linux: 7d4f8d87 ("switchdev: ad VLAN support for ports bridge-getlink")
11 This patch adds the necessary checks to fix it.
13 Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
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(-)
19 diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
20 index 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,
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,
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 */
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;
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);
50 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags);
51 +#endif /* HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL */
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 */
57 return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode);
58 #endif /* HAVE_NDO_FDB_ADD_VID */
59 diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
60 index 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)
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
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_ */