931965c3e1a75e8ab355f851fc069c70f33d405f
[deb_dpdk.git] / debian / patches / dpdk-dev-kni-fix-build-with-kernel-4.9.patch
1 Description: compile error:
2   CC [M]  .../lib/librte_eal/linuxapp/kni/igb_main.o
3 .../lib/librte_eal/linuxapp/kni/igb_main.c:2317:21:
4 error: initialization from incompatible pointer type
5         [-Werror=incompatible-pointer-types]
6   .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
7                      ^~~~~~~~~~~~~~~~~~~
8
9 Linux kernel 4.9 updates API for ndo_set_vf_vlan:
10 Linux: 79aab093a0b5 ("net: Update API for VF vlan protocol 802.1ad support")
11
12 Use new API for Linux kernels >= 4.9
13
14 Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
15 Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
16
17 Origin: Upstream, http://dpdk.org/dev/patchwork/patch/16651/
18 Author: Luca Boccassi <luca.boccassi@gmail.com>
19 Last-Update: 2016-10-17
20 ---
21  lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c | 19 +++++++++++++++++++
22  lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h  |  4 ++++
23  2 files changed, 23 insertions(+)
24
25 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
26 +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/igb_main.c
27 @@ -195,7 +195,11 @@ static void igb_process_mdd_event(struct
28  #ifdef IFLA_VF_MAX
29  static int igb_ndo_set_vf_mac( struct net_device *netdev, int vf, u8 *mac);
30  static int igb_ndo_set_vf_vlan(struct net_device *netdev,
31 +#ifdef HAVE_VF_VLAN_PROTO
32 +                               int vf, u16 vlan, u8 qos, __be16 vlan_proto);
33 +#else
34                                 int vf, u16 vlan, u8 qos);
35 +#endif
36  #ifdef HAVE_VF_SPOOFCHK_CONFIGURE
37  static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
38                                 bool setting);
39 @@ -6411,7 +6415,11 @@ static void igb_set_vmvir(struct igb_ada
40  }
41  
42  static int igb_ndo_set_vf_vlan(struct net_device *netdev,
43 +#ifdef HAVE_VF_VLAN_PROTO
44 +                              int vf, u16 vlan, u8 qos, __be16 vlan_proto)
45 +#else
46                                int vf, u16 vlan, u8 qos)
47 +#endif
48  {
49         int err = 0;
50         struct igb_adapter *adapter = netdev_priv(netdev);
51 @@ -6419,6 +6427,12 @@ static int igb_ndo_set_vf_vlan(struct ne
52         /* VLAN IDs accepted range 0-4094 */
53         if ((vf >= adapter->vfs_allocated_count) || (vlan > VLAN_VID_MASK-1) || (qos > 7))
54                 return -EINVAL;
55 +
56 +#ifdef HAVE_VF_VLAN_PROTO
57 +       if (vlan_proto != htons(ETH_P_8021Q))
58 +               return -EPROTONOSUPPORT;
59 +#endif
60 +
61         if (vlan || qos) {
62                 err = igb_vlvf_set(adapter, vlan, !!vlan, vf);
63                 if (err)
64 @@ -6579,7 +6593,12 @@ static inline void igb_vf_reset(struct i
65         if (adapter->vf_data[vf].pf_vlan)
66                 igb_ndo_set_vf_vlan(adapter->netdev, vf,
67                                     adapter->vf_data[vf].pf_vlan,
68 +#ifdef HAVE_VF_VLAN_PROTO
69 +                                   adapter->vf_data[vf].pf_qos,
70 +                                   htons(ETH_P_8021Q));
71 +#else
72                                     adapter->vf_data[vf].pf_qos);
73 +#endif
74         else
75                 igb_clear_vf_vfta(adapter, vf);
76  #endif
77 --- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
78 +++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
79 @@ -3906,6 +3906,10 @@ skb_set_hash(struct sk_buff *skb, __u32
80  #endif /* !RHEL 7.2 */
81  #endif /* 4.0.0 */
82  
83 +#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0) )
84 +#define HAVE_VF_VLAN_PROTO
85 +#endif /* >= 4.9.0 */
86 +
87  #if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) )
88  /* ndo_bridge_getlink adds new nlflags parameter */
89  #define HAVE_NDO_BRIDGE_GETLINK_NLFLAGS