diff --git a/src/Kbuild b/src/Kbuild index e1bc4a3e..b7f9d7a0 100644 --- a/src/Kbuild +++ b/src/Kbuild @@ -227,6 +227,9 @@ $(eval $(call add_compat_flag,$(srctree)/include/net/flow_offload.h,_NET_FLOW_OF # Check for bpf_mac_inc type $(eval $(call add_compat_flag,$(srctree)/include/linux/bpf.h,"^void bpf_map_inc(struct bpf_map \*map);",COMPAT__VOID_BPF_MAP_INC)) +# Check for udp_tunnel_nic_add/del_port +$(eval $(call add_compat_flag,$(srctree)/include/net/udp_tunnel.h,"udp_tunnel_nic_add_port",COMPAT__UDP_TUN_NIC_PORT)) + utsrelease_h_path :=$(srctree)/include/generated/utsrelease.h # Check for BC Linux $(eval $(call add_compat_flag,$(utsrelease_h_path),bclinux,COMPAT_BCLINUX=1)) diff --git a/src/nfp_net_common.c b/src/nfp_net_common.c index c8219e00..eb5336b4 100644 --- a/src/nfp_net_common.c +++ b/src/nfp_net_common.c @@ -1132,8 +1132,7 @@ static int nfp_net_set_config_and_enable(struct nfp_net *nn) nn->dp.ctrl = new_ctrl; } -#if COMPAT__HAVE_VXLAN_OFFLOAD && (VER_NON_RHEL_OR_KYL_LT(5, 9) || VER_RHEL_LT(8, 4) \ - || VER_KYL_LT(10, 4)) +#if COMPAT__HAVE_VXLAN_OFFLOAD && !defined(COMPAT__UDP_TUN_NIC_PORT) /* Since reconfiguration requests while NFP is down are ignored we * have to wipe the entire VXLAN configuration and reinitialize it. */ @@ -2354,8 +2353,7 @@ nfp_net_get_phys_port_name(struct net_device *netdev, char *name, size_t len) } #endif -#if COMPAT__HAVE_VXLAN_OFFLOAD && (VER_NON_RHEL_OR_SLEL_LT(5, 9) || \ - VER_RHEL_LT(8, 4) || SLEL_LOCALVER_LT(5, 3, 18, 57, 0)) +#if COMPAT__HAVE_VXLAN_OFFLOAD && !defined(COMPAT__UDP_TUN_NIC_PORT) /** * nfp_net_set_vxlan_port() - set vxlan port in SW and reconfigure HW * @nn: NFP Net device to reconfigure @@ -2835,7 +2833,7 @@ const struct net_device_ops nfp_nfdk_netdev_ops = { #endif }; -#if VER_NON_RHEL_OR_KYL_GE(5, 9) || VER_RHEL_GE(8, 4) || VER_KYL_GE(10, 4) +#ifdef COMPAT__UDP_TUN_NIC_PORT static int nfp_udp_tunnel_sync(struct net_device *netdev, unsigned int table) { struct nfp_net *nn = netdev_priv(netdev); @@ -3196,7 +3194,7 @@ static void nfp_net_netdev_init(struct nfp_net *nn) netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; #endif } -#if VER_NON_RHEL_OR_KYL_GE(5, 9) || VER_RHEL_GE(8, 4) || VER_KYL_GE(10, 4) +#ifdef COMPAT__UDP_TUN_NIC_PORT netdev->udp_tunnel_nic_info = &nfp_udp_tunnels; #endif nn->dp.ctrl |= NFP_NET_CFG_CTRL_VXLAN; diff --git a/src/nfp_net_compat.h b/src/nfp_net_compat.h index d619a4f0..50c2e660 100644 --- a/src/nfp_net_compat.h +++ b/src/nfp_net_compat.h @@ -1552,8 +1552,7 @@ flow_indr_block_cb_remove(struct flow_block_cb *block_cb, } #endif -#if COMPAT__HAVE_UDP_OFFLOAD && ((!COMPAT_SLELINUX && VER_NON_RHEL_OR_KYL_LT(5, 9)) || \ - VER_RHEL_LT(8, 4) || VER_KYL_LT(10, 4) || SLEL_LOCALVER_LT(5, 3, 18, 57, 0)) +#if COMPAT__HAVE_UDP_OFFLOAD && !defined(COMPAT__UDP_TUN_NIC_PORT) #define udp_tunnel_nic_add_port nfp_net_add_vxlan_port #define udp_tunnel_nic_del_port nfp_net_del_vxlan_port #endif diff --git a/src/nfpcore/kcompat.h b/src/nfpcore/kcompat.h index 915b3e2a..d80f159d 100644 --- a/src/nfpcore/kcompat.h +++ b/src/nfpcore/kcompat.h @@ -1063,11 +1063,13 @@ static inline u64 pci_get_dsn(struct pci_dev *dev) #undef CONFIG_NFP_APP_FLOWER #endif -#if VER_NON_RHEL_LT(5, 3) || VER_RHEL_LT(8, 2) +#include +#ifndef in_dev_for_each_ifa_rtnl #define in_dev_for_each_ifa_rtnl(ifa, in_dev) \ for (ifa = rtnl_dereference((in_dev)->ifa_list); ifa; \ ifa = rtnl_dereference(ifa->ifa_next)) - +#endif +#ifndef in_dev_for_each_ifa_rcu #define in_dev_for_each_ifa_rcu(ifa, in_dev) \ for (ifa = rcu_dereference((in_dev)->ifa_list); ifa; \ ifa = rcu_dereference(ifa->ifa_next))