[dpdk-stable] [PATCH 16.11] kni: fix build on CentOS 7.4

Luca Boccassi bluca at debian.org
Wed Nov 21 17:46:44 CET 2018


From: Dan Gora <dg at adax.com>

[ backported from upstream commit 4005ad2556c4ad988d93cd1a1fa4815677e00714 ]

Fix compilation errors on Centos 7.4 when CONFIG_RTE_KNI_KMOD_ETHTOOL
is set to 'y'.

Centos 7.4 needs HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL:

igb_main.c: In function ‘igb_ndo_bridge_getlink’:
igb_main.c:2289:2: error: too few arguments to function
                   ‘ndo_dflt_bridge_getlink’
  return ndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags);
  ^

Centos 7.4 needs HAVE_VF_VLAN_PROTO and needs to redefine
ndo_set_vf_vlan to .extended.ndo_set_vf_vlan:

igb_main.c:2318:2: error: unknown field ‘ndo_set_vf_vlan’ specified
                   in initializer
  .ndo_set_vf_vlan = igb_ndo_set_vf_vlan,
  ^

Signed-off-by: Dan Gora <dg at adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
index f20205d56..87d0096c7 100644
--- a/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
+++ b/lib/librte_eal/linuxapp/kni/ethtool/igb/kcompat.h
@@ -3915,7 +3915,8 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #define HAVE_NDO_BRIDGE_GETLINK_NLFLAGS
 #endif /* >= 4.1.0 */
 
-#if ( LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) )
+#if (( LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ) \
+    || ( RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7,4) ))
 /* ndo_bridge_getlink adds new filter_mask and vlan_fill parameters */
 #define HAVE_NDO_BRIDGE_GETLINK_FILTER_MASK_VLAN_FILL
 #endif /* >= 4.2.0 */
@@ -3933,9 +3934,15 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)
 #endif
 
 #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) || \
-    (SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(12, 3, 0)))
+     (SLE_VERSION_CODE && SLE_VERSION_CODE >= SLE_VERSION(12, 3, 0)) || \
+     (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 4)))
 #define HAVE_VF_VLAN_PROTO
-#endif /* >= 4.9.0, >= SLES12SP3 */
+#if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 4))
+/* In RHEL/Centos 7.4, the "new" version of ndo_set_vf_vlan
+ * is in the struct net_device_ops_extended */
+#define ndo_set_vf_vlan extended.ndo_set_vf_vlan
+#endif
+#endif
 
 #if (defined(RHEL_RELEASE_CODE) && \
 	(RHEL_RELEASE_VERSION(7, 5) <= RHEL_RELEASE_CODE))
-- 
2.19.1



More information about the stable mailing list