kni: fix build on Centos 7.4 when Ethtool enabled
PATCH 1/1 kni: fix build on Centos 7.4 when Ethtool enabled
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,
^
--- kernel/linux/kni/ethtool/igb/kcompat.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/linux/kni/ethtool/igb/kcompat.h +7 -1
@@ -3900,7 +3900,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 */
@@ -3920,6 +3921,11 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)#if ((LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,9 ,0 )) || \ (SLE_VERSION_CODE &&SLE_VERSION_CODE >=SLE_VERSION (12 ,3 ,0 )))#define HAVE_VF_VLAN_PROTO +#elif (RHEL_RELEASE_CODE >=RHEL_RELEASE_VERSION (7 ,4 ) ) +/* In RHEL/Centos 7.4, the "new" version of ndo_set_vf_vlan +* is in the net_device_ops_extended struct */ +#define HAVE_VF_VLAN_PROTO +#define ndo_set_vf_vlan extended.ndo_set_vf_vlan#endif /* >= 4.9.0, >= SLES12SP3 */ #if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,8 ,0 )
Signature · 1 line
2.13.2.556.g5116f79
Quoted 20 lines · Dan Gora
Fix compilation errors on Centos 7.4 when
CONFIG_RTE_KNI_KMOD_ETHTOOLis 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’
returnndo_dflt_bridge_getlink(skb, pid, seq, dev, mode, 0, 0, nlflags); ^Centos 7.4 needs
HAVE_VF_VLAN_PROTOand needs to redefinendo_set_vf_vlanto .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 <[email protected]>
<...>
kernel/linux/kni/ethtool/igb/kcompat.h skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type) · line 3928
Quoted 9 lines
kernel/linux/kni/ethtool/igb/kcompat.h +5
-0@@ -3920,6 +3921,11 @@ skb_set_hash(struct sk_buff *skb, __u32 hash, __always_unused int type)#if ((LINUX_VERSION_CODE >=KERNEL_VERSION (4 ,9 ,0 )) || \ (SLE_VERSION_CODE &&SLE_VERSION_CODE >=SLE_VERSION (12 ,3 ,0 )))#define HAVE_VF_VLAN_PROTO +#elif (RHEL_RELEASE_CODE >=RHEL_RELEASE_VERSION (7 ,4 ) ) +/* In RHEL/Centos 7.4, the "new" version of ndo_set_vf_vlan +* is in the net_device_ops_extended struct */ +#define HAVE_VF_VLAN_PROTO +#define ndo_set_vf_vlan extended.ndo_set_vf_vlan
This works but it is not really an "else" condition logically, what do you think about something like:
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 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
#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 net_device_ops_extended struct */
#define ndo_set_vf_vlan extended.ndo_set_vf_vlan #endif /* RHEL >= 7.4 */
#endif /* >= 4.9.0, >= SLES12SP3 */
Quoted 4 lines
kernel/linux/kni/ethtool/igb/kcompat.h +0
-0#endif /* >= 4.9.0, >= SLES12SP3 */ #if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,8 ,0 )