[ovs-dev,ERSPAN,RFC,15/25] compat: Remove unsupported kernel compat code

Message ID 1521756461-3870-16-git-send-email-gvrose8192@gmail.com
State RFC
Headers show
Series
  • Introduce ERSPAN for OVS
Related show

Commit Message

Gregory Rose March 22, 2018, 10:07 p.m.
Anything less than 3.10 isn't supported since a couple of releases ago
so remove the dead code.

Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/linux/compat/include/linux/etherdevice.h  |  30 ------
 datapath/linux/compat/include/linux/if_vlan.h      |  11 ---
 datapath/linux/compat/include/linux/kconfig.h      |   8 --
 datapath/linux/compat/include/linux/kernel.h       |  38 --------
 .../linux/compat/include/linux/netdev_features.h   |  19 ----
 datapath/linux/compat/include/linux/netdevice.h    |   5 -
 datapath/linux/compat/include/linux/skbuff.h       |   7 --
 datapath/linux/compat/include/linux/workqueue.h    |   4 -
 datapath/linux/compat/include/net/checksum.h       |   6 --
 datapath/linux/compat/include/net/dst.h            |  28 +-----
 datapath/linux/compat/include/net/genetlink.h      |  11 ---
 datapath/linux/compat/include/net/ip6_route.h      |  23 -----
 datapath/linux/compat/include/net/ip_tunnels.h     |   4 -
 datapath/linux/compat/include/net/ipv6.h           |  15 ---
 .../include/net/netfilter/nf_conntrack_zones.h     |   2 -
 datapath/linux/compat/include/net/netlink.h        |  15 ---
 datapath/linux/compat/include/net/route.h          | 105 ---------------------
 datapath/linux/compat/ip_gre.c                     |  11 ---
 datapath/linux/compat/ip_tunnel.c                  |   6 --
 datapath/linux/compat/lisp.c                       |   2 -
 datapath/linux/compat/stt.c                        |   6 --
 datapath/linux/compat/udp_tunnel.c                 |   2 -
 datapath/linux/compat/utils.c                      |  22 -----
 23 files changed, 1 insertion(+), 379 deletions(-)

Patch

diff --git a/datapath/linux/compat/include/linux/etherdevice.h b/datapath/linux/compat/include/linux/etherdevice.h
index 850b779..4b27074 100644
--- a/datapath/linux/compat/include/linux/etherdevice.h
+++ b/datapath/linux/compat/include/linux/etherdevice.h
@@ -4,36 +4,6 @@ 
 #include <linux/version.h>
 #include_next <linux/etherdevice.h>
 
-#ifndef HAVE_ETH_HW_ADDR_RANDOM
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
-static inline void eth_hw_addr_random(struct net_device *dev)
-{
-	random_ether_addr(dev->dev_addr);
-}
-#elif LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)
-static inline void eth_hw_addr_random(struct net_device *dev)
-{
-	dev_hw_addr_random(dev, dev->dev_addr);
-}
-#endif
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
-#define eth_mac_addr rpl_eth_mac_addr
-static inline int eth_mac_addr(struct net_device *dev, void *p)
-{
-	struct sockaddr *addr = p;
-
-	if (!is_valid_ether_addr(addr->sa_data))
-		return -EADDRNOTAVAIL;
-#ifdef NET_ADDR_RANDOM
-	dev->addr_assign_type &= ~NET_ADDR_RANDOM;
-#endif
-	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
-	return 0;
-}
-#endif
-
 #ifndef HAVE_ETHER_ADDR_COPY
 static inline void ether_addr_copy(u8 *dst, const u8 *src)
 {
diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h
index fc95b04..2cf18e5 100644
--- a/datapath/linux/compat/include/linux/if_vlan.h
+++ b/datapath/linux/compat/include/linux/if_vlan.h
@@ -90,17 +90,6 @@  static inline struct sk_buff *vlan_hwaccel_push_inside(struct sk_buff *skb)
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
-static inline struct sk_buff *rpl___vlan_hwaccel_put_tag(struct sk_buff *skb,
-						     __be16 vlan_proto,
-						     u16 vlan_tci)
-{
-	return __vlan_hwaccel_put_tag(skb, vlan_tci);
-}
-
-#define __vlan_hwaccel_put_tag rpl___vlan_hwaccel_put_tag
-#endif
-
 #ifndef HAVE_ETH_TYPE_VLAN
 /**
  * eth_type_vlan - check for valid vlan ether type.
diff --git a/datapath/linux/compat/include/linux/kconfig.h b/datapath/linux/compat/include/linux/kconfig.h
index 5717a26..d3fa57a 100644
--- a/datapath/linux/compat/include/linux/kconfig.h
+++ b/datapath/linux/compat/include/linux/kconfig.h
@@ -3,14 +3,6 @@ 
 
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
-#define CONFIG_NET_IPGRE_DEMUX 1
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)
-#include_next <linux/kconfig.h>
-#endif
-
 #ifndef IS_ENABLED
 
 /*
diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h
index 5c4269b..2e81abc 100644
--- a/datapath/linux/compat/include/linux/kernel.h
+++ b/datapath/linux/compat/include/linux/kernel.h
@@ -8,44 +8,6 @@ 
 
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
-#define pr_warn pr_warning
-#endif
-
-/*
- * Print a one-time message (analogous to WARN_ONCE() et al):
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
-#undef printk_once
-#define printk_once(fmt, ...)			\
-({						\
-	static bool __print_once;		\
-						\
-	if (!__print_once) {			\
-		__print_once = true;		\
-		printk(fmt, ##__VA_ARGS__);	\
-	}					\
-})
-
-#define pr_emerg_once(fmt, ...)					\
-	printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_alert_once(fmt, ...)					\
-	printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_crit_once(fmt, ...)					\
-	printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_err_once(fmt, ...)					\
-	printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_warn_once(fmt, ...)					\
-	printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_notice_once(fmt, ...)				\
-	printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_info_once(fmt, ...)					\
-	printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
-#define pr_cont_once(fmt, ...)					\
-	printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
-
-#endif
-
 #ifndef USHRT_MAX
 #define USHRT_MAX	((u16)(~0U))
 #define SHRT_MAX	((s16)(USHRT_MAX>>1))
diff --git a/datapath/linux/compat/include/linux/netdev_features.h b/datapath/linux/compat/include/linux/netdev_features.h
index a39bd4a..411f294 100644
--- a/datapath/linux/compat/include/linux/netdev_features.h
+++ b/datapath/linux/compat/include/linux/netdev_features.h
@@ -1,18 +1,7 @@ 
 #ifndef __LINUX_NETDEV_FEATURES_WRAPPER_H
 #define __LINUX_NETDEV_FEATURES_WRAPPER_H
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)
 #include_next <linux/netdev_features.h>
-#endif
-
-#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
-/* On RHEL 6, netdev features are defined in netdevice.h header. */
-#include <linux/netdevice.h>
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
-#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
-#endif
 
 #ifndef NETIF_F_GSO_GRE
 #define NETIF_F_GSO_GRE 0
@@ -81,14 +70,6 @@ 
 				 NETIF_F_GSO_MPLS)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)
-#define SKB_GSO_GRE 0
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
-#define SKB_GSO_UDP_TUNNEL 0
-#endif
-
 #ifndef HAVE_NETIF_F_GSO_GRE_CSUM
 #define SKB_GSO_GRE_CSUM 0
 #endif
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
index 9d3b249..29ef6c7 100644
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ b/datapath/linux/compat/include/linux/netdevice.h
@@ -37,11 +37,6 @@  struct net;
         alloc_netdev_mq(sizeof_priv, name, setup, 1)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
-#define unregister_netdevice_queue(dev, head)	unregister_netdevice(dev)
-#define unregister_netdevice_many(head)
-#endif
-
 #ifndef HAVE_DEV_DISABLE_LRO
 extern void dev_disable_lro(struct net_device *dev);
 #endif
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
index f0665ed..45778bd 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -241,13 +241,6 @@  static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
 #define skb_get_hash skb_get_rxhash
 #endif /* HAVE_SKB_GET_HASH */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)
-static inline void skb_tx_error(struct sk_buff *skb)
-{
-	return;
-}
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) */
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0)
 #define skb_zerocopy_headlen rpl_skb_zerocopy_headlen
 unsigned int rpl_skb_zerocopy_headlen(const struct sk_buff *from);
diff --git a/datapath/linux/compat/include/linux/workqueue.h b/datapath/linux/compat/include/linux/workqueue.h
index 461fefd..ed573c2 100644
--- a/datapath/linux/compat/include/linux/workqueue.h
+++ b/datapath/linux/compat/include/linux/workqueue.h
@@ -3,8 +3,4 @@ 
 
 #include_next <linux/workqueue.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)
-#define queue_work(wq, dw) schedule_work(dw);
-#endif
-
 #endif
diff --git a/datapath/linux/compat/include/net/checksum.h b/datapath/linux/compat/include/net/checksum.h
index 398df93..d1f1125 100644
--- a/datapath/linux/compat/include/net/checksum.h
+++ b/datapath/linux/compat/include/net/checksum.h
@@ -36,10 +36,4 @@  static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
 #define CSUM_MANGLED_0 ((__force __sum16)0xffff)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
-#define inet_proto_csum_replace16 rpl_inet_proto_csum_replace16
-void rpl_inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
-			           const __be32 *from, const __be32 *to,
-			           int pseudohdr);
-#endif
 #endif /* checksum.h */
diff --git a/datapath/linux/compat/include/net/dst.h b/datapath/linux/compat/include/net/dst.h
index 5ec3d30..af78a6c 100644
--- a/datapath/linux/compat/include/net/dst.h
+++ b/datapath/linux/compat/include/net/dst.h
@@ -4,13 +4,6 @@ 
 #include <linux/version.h>
 #include_next <net/dst.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) &&    \
-    LINUX_VERSION_CODE > KERNEL_VERSION(3,0,20)
-
-#define dst_get_neighbour_noref dst_get_neighbour
-
-#endif
-
 #ifndef HAVE_SKB_DST_ACCESSOR_FUNCS
 
 static inline void skb_dst_drop(struct sk_buff *skb)
@@ -30,19 +23,7 @@  static inline void skb_dst_drop(struct sk_buff *skb)
 #define DST_NOCOUNT		0
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
-static inline void __skb_dst_copy(struct sk_buff *nskb, unsigned long refdst)
-{
-	nskb->_skb_dst = refdst;
-	dst_clone(skb_dst(nskb));
-}
-
-static inline void refdst_drop(unsigned long refdst) { }
-static inline void skb_dst_set_noref(struct sk_buff *skb,
-				     struct dst_entry *dst) { }
-static inline void dst_init_metrics(struct dst_entry *dst, const u32 *metrics,
-				    bool read_only) { }
-#elif !defined(HAVE___SKB_DST_COPY)
+#if !defined(HAVE___SKB_DST_COPY)
 static inline void __skb_dst_copy(struct sk_buff *nskb, unsigned long refdst)
 {
 	nskb->_skb_refdst = refdst;
@@ -51,13 +32,6 @@  static inline void __skb_dst_copy(struct sk_buff *nskb, unsigned long refdst)
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
-static inline void dst_entries_add(struct dst_ops *ops, int count)
-{
-	atomic_add(count, &ops->entries);
-}
-#endif
-
 #if  LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
 static const u32 rpl_dst_default_metrics[RTAX_MAX + 1] = {
 	/* This initializer is needed to force linker to place this variable
diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h
index b05eae5..602ce38 100644
--- a/datapath/linux/compat/include/net/genetlink.h
+++ b/datapath/linux/compat/include/net/genetlink.h
@@ -6,17 +6,6 @@ 
 #include <net/net_namespace.h>
 #include_next <net/genetlink.h>
 
-/*
- * 15e473046cb6e5d18a4d0057e61d76315230382b renames pid to portid
- * the affected structures are
- * netlink_skb_parms::pid -> portid
- * genl_info::snd_pid -> snd_portid
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
-#define snd_portid snd_pid
-#define portid pid
-#endif
-
 #ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
 struct rpl_genl_family {
 	struct genl_family	compat_family;
diff --git a/datapath/linux/compat/include/net/ip6_route.h b/datapath/linux/compat/include/net/ip6_route.h
index e49ca39..7c78fd5 100644
--- a/datapath/linux/compat/include/net/ip6_route.h
+++ b/datapath/linux/compat/include/net/ip6_route.h
@@ -7,29 +7,6 @@ 
 
 #include_next<net/ip6_route.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
-
-static inline
-struct dst_entry *rpl_ip6_route_output(struct net *net, const struct sock *sk,
-				   struct flowi6 *fl6)
-{
-	struct flowi fl;
-
-	memset(&fl, 0, sizeof(fl));
-	fl.oif = fl6->flowi6_oif;
-	fl.fl6_dst = fl6->daddr;
-	fl.fl6_src = fl6->saddr;
-	fl.mark = fl6->flowi6_mark;
-	fl.proto = fl6->flowi6_proto;
-
-	return ip6_route_output(net, (struct sock *) sk, &fl);
-}
-#define ip6_route_output rpl_ip6_route_output
-
-#define ip6_dst_hoplimit(dst) dst_metric(dst, RTAX_HOPLIMIT)
-
-#endif /* 2.6.39 */
-
 #ifndef HAVE_NF_IPV6_OPS_FRAGMENT
 int rpl_ip6_fragment(struct sock *sk, struct sk_buff *skb,
 		     int (*output)(OVS_VPORT_OUTPUT_PARAMS));
diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
index 159eb48..4c1f0a1 100644
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ b/datapath/linux/compat/include/net/ip_tunnels.h
@@ -444,11 +444,7 @@  int rpl_ip_tunnel_newlink(struct net_device *dev, struct nlattr *tb[],
 			  struct ip_tunnel_parm *p);
 
 #define ip_tunnel_dellink rpl_ip_tunnel_dellink
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 void rpl_ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
-#else
-void rpl_ip_tunnel_dellink(struct net_device *dev);
-#endif
 
 #define ip_tunnel_init_net rpl_ip_tunnel_init_net
 int rpl_ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
diff --git a/datapath/linux/compat/include/net/ipv6.h b/datapath/linux/compat/include/net/ipv6.h
index 48a307a..7fc0339 100644
--- a/datapath/linux/compat/include/net/ipv6.h
+++ b/datapath/linux/compat/include/net/ipv6.h
@@ -26,21 +26,6 @@  extern int rpl_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 			     int target, unsigned short *fragoff, int *fragflg);
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)
-static inline u32 ipv6_addr_hash(const struct in6_addr *a)
-{
-#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
-	const unsigned long *ul = (const unsigned long *)a;
-	unsigned long x = ul[0] ^ ul[1];
-
-	return (u32)(x ^ (x >> 32));
-#else
-	return (__force u32)(a->s6_addr32[0] ^ a->s6_addr32[1] ^
-			     a->s6_addr32[2] ^ a->s6_addr32[3]);
-#endif
-}
-#endif
-
 #ifndef HAVE___IPV6_ADDR_JHASH
 static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 unused)
 {
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
index fb43acb..d46c098 100644
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
+++ b/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
@@ -3,9 +3,7 @@ 
 
 #include <linux/version.h>
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)
 #include_next <net/netfilter/nf_conntrack_zones.h>
-#endif
 
 #ifndef HAVE_NF_CT_ZONE_INIT
 
diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h
index ba24a34..d42bf10 100644
--- a/datapath/linux/compat/include/net/netlink.h
+++ b/datapath/linux/compat/include/net/netlink.h
@@ -16,21 +16,6 @@  static inline __be16 nla_get_be16(const struct nlattr *nla)
 }
 #endif  /* !HAVE_NLA_GET_BE16 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
-/* This function was introduced in 2.6.31, but initially it performed an
- * unaligned access, so we replace it up to 2.6.34 where it was fixed.  */
-#define nla_get_be64 rpl_nla_get_be64
-static inline __be64 nla_get_be64(const struct nlattr *nla)
-{
-	__be64 tmp;
-
-	/* The additional cast is necessary because  */
-	nla_memcpy(&tmp, (struct nlattr *) nla, sizeof(tmp));
-
-	return tmp;
-}
-#endif
-
 #ifndef HAVE_NLA_PUT_BE16
 static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
 {
diff --git a/datapath/linux/compat/include/net/route.h b/datapath/linux/compat/include/net/route.h
index 8f336b6..9e4a1f1 100644
--- a/datapath/linux/compat/include/net/route.h
+++ b/datapath/linux/compat/include/net/route.h
@@ -3,109 +3,4 @@ 
 
 #include_next <net/route.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
-struct flowi_common {
-	int	flowic_oif;
-	__u32   flowic_mark;
-	__u8    flowic_tos;
-	__u8    flowic_proto;
-};
-
-union flowi_uli {
-	struct {
-		__be16	dport;
-		__be16	sport;
-	} ports;
-
-	struct {
-		__u8	type;
-		__u8	code;
-	} icmpt;
-
-	struct {
-		__le16	dport;
-		__le16	sport;
-	} dnports;
-
-	__be32		spi;
-	__be32		gre_key;
-
-	struct {
-		__u8	type;
-	} mht;
-};
-
-struct flowi4 {
-	struct flowi_common	__fl_common;
-#define flowi4_oif		__fl_common.flowic_oif
-#define flowi4_iif		__fl_common.flowic_iif
-#define flowi4_mark		__fl_common.flowic_mark
-#define flowi4_tos		__fl_common.flowic_tos
-#define flowi4_scope		__fl_common.flowic_scope
-#define flowi4_proto		__fl_common.flowic_proto
-#define flowi4_flags		__fl_common.flowic_flags
-#define flowi4_secid		__fl_common.flowic_secid
-#define flowi4_tun_key		__fl_common.flowic_tun_key
-
-	union flowi_uli		uli;
-#define fl4_gre_key		uli.gre_key
-
-	/* (saddr,daddr) must be grouped, same order as in IP header */
-	__be32			saddr;
-	__be32			daddr;
-
-} __attribute__((__aligned__(BITS_PER_LONG/8)));
-
-struct flowi6 {
-	struct flowi_common	__fl_common;
-#define flowi6_oif		__fl_common.flowic_oif
-#define flowi6_iif		__fl_common.flowic_iif
-#define flowi6_mark		__fl_common.flowic_mark
-#define flowi6_tos		__fl_common.flowic_tos
-#define flowi6_scope		__fl_common.flowic_scope
-#define flowi6_proto		__fl_common.flowic_proto
-#define flowi6_flags		__fl_common.flowic_flags
-#define flowi6_secid		__fl_common.flowic_secid
-#define flowi6_tun_key		__fl_common.flowic_tun_key
-	struct in6_addr		daddr;
-	struct in6_addr		saddr;
-	__be32			flowlabel;
-	union flowi_uli		uli;
-#define fl6_sport		uli.ports.sport
-#define fl6_dport		uli.ports.dport
-#define fl6_icmp_type		uli.icmpt.type
-#define fl6_icmp_code		uli.icmpt.code
-#define fl6_ipsec_spi		uli.spi
-#define fl6_mh_type		uli.mht.type
-#define fl6_gre_key		uli.gre_key
-} __attribute__((__aligned__(BITS_PER_LONG/8)));
-
-static inline struct rtable *rpl_ip_route_output_key(struct net *net, struct flowi4 *flp)
-{
-	struct rtable *rt;
-	/* Tunnel configuration keeps DSCP part of TOS bits, But Linux
-	 * router expect RT_TOS bits only.
-	 */
-
-	struct flowi fl = { .nl_u = { .ip4_u = {
-					.daddr = flp->daddr,
-					.saddr = flp->saddr,
-					.tos   = RT_TOS(flp->flowi4_tos) } },
-					.mark = flp->flowi4_mark,
-					.proto = flp->flowi4_proto };
-
-	if (unlikely(ip_route_output_key(net, &rt, &fl)))
-		return ERR_PTR(-EADDRNOTAVAIL);
-	flp->saddr = fl.nl_u.ip4_u.saddr;
-	return rt;
-}
-#define ip_route_output_key rpl_ip_route_output_key
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)
-static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
-{
-	return dst_metric(dst, RTAX_HOPLIMIT);
-}
-#endif
 #endif
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index f315b16..e684019 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -609,16 +609,12 @@  static void __gre_tunnel_init(struct net_device *dev)
 	dev->mtu		= ETH_DATA_LEN - t_hlen - 4;
 
 	dev->features		|= GRE_FEATURES;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 	dev->hw_features	|= GRE_FEATURES;
-#endif
 
 	if (!(tunnel->parms.o_flags & TUNNEL_SEQ)) {
 		/* TCP offload with GRE SEQ is not supported. */
 		dev->features    |= NETIF_F_GSO_SOFTWARE;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 		dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-#endif
 		/* Can use a lockless transmit, unless we generate
 		 * output sequences
 		 */
@@ -818,9 +814,7 @@  static const struct net_device_ops gre_tap_netdev_ops = {
 	.ndo_set_mac_address	= eth_mac_addr,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_change_mtu		= ip_tunnel_change_mtu,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 	.ndo_get_stats64	= ip_tunnel_get_stats64,
-#endif
 #ifdef HAVE_NDO_GET_IFLINK
 	.ndo_get_iflink		= ip_tunnel_get_iflink,
 #endif
@@ -875,13 +869,8 @@  static void ipgre_tap_setup(struct net_device *dev)
 	ip_tunnel_setup(dev, gre_tap_net_id);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 static int ipgre_newlink(struct net *src_net, struct net_device *dev,
 			 struct nlattr *tb[], struct nlattr *data[])
-#else
-static int ipgre_newlink(struct net_device *dev,
-			 struct nlattr *tb[], struct nlattr *data[])
-#endif
 {
 	struct ip_tunnel_parm p;
 	int err;
diff --git a/datapath/linux/compat/ip_tunnel.c b/datapath/linux/compat/ip_tunnel.c
index 6e9fa95..d8cd798 100644
--- a/datapath/linux/compat/ip_tunnel.c
+++ b/datapath/linux/compat/ip_tunnel.c
@@ -431,11 +431,7 @@  static void ip_tunnel_dev_free(struct net_device *dev)
 	free_netdev(dev);
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 void rpl_ip_tunnel_dellink(struct net_device *dev, struct list_head *head)
-#else
-void rpl_ip_tunnel_dellink(struct net_device *dev)
-#endif
 {
 	struct ip_tunnel *tunnel = netdev_priv(dev);
 	struct ip_tunnel_net *itn;
@@ -443,9 +439,7 @@  void rpl_ip_tunnel_dellink(struct net_device *dev)
 	itn = net_generic(tunnel->net, tunnel->ip_tnl_net_id);
 
 	ip_tunnel_del(itn, netdev_priv(dev));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
         unregister_netdevice_queue(dev, head);
-#endif
 }
 
 int rpl_ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
diff --git a/datapath/linux/compat/lisp.c b/datapath/linux/compat/lisp.c
index 34f8232..f7e48ff 100644
--- a/datapath/linux/compat/lisp.c
+++ b/datapath/linux/compat/lisp.c
@@ -593,10 +593,8 @@  static void lisp_setup(struct net_device *dev)
 	dev->features    |= NETIF_F_RXCSUM;
 	dev->features    |= NETIF_F_GSO_SOFTWARE;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
 	dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
 	dev->hw_features |= NETIF_F_GSO_SOFTWARE;
-#endif
 #ifdef USE_UPSTREAM_TUNNEL
 	netif_keep_dst(dev);
 #endif
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index 2189476..405d0d7 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -239,9 +239,7 @@  static void copy_skb_metadata(struct sk_buff *to, struct sk_buff *from)
 	to->priority = from->priority;
 	to->mark = from->mark;
 	to->vlan_tci = from->vlan_tci;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
 	to->vlan_proto = from->vlan_proto;
-#endif
 	skb_copy_secmark(to, from);
 }
 
@@ -762,10 +760,8 @@  static int stt_can_offload(struct sk_buff *skb, __be16 l3_proto, u8 l4_proto)
 	if (skb->len + STT_HEADER_LEN + sizeof(struct iphdr) > 65535)
 		return 0;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
 	if (skb_vlan_tag_present(skb) && skb->vlan_proto != htons(ETH_P_8021Q))
 		return 0;
-#endif
 	return 1;
 }
 
@@ -792,7 +788,6 @@  static struct sk_buff *handle_offloads(struct sk_buff *skb, int min_headroom)
 {
 	int err;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
 	if (skb_vlan_tag_present(skb) && skb->vlan_proto != htons(ETH_P_8021Q)) {
 
 		min_headroom += VLAN_HLEN;
@@ -812,7 +807,6 @@  static struct sk_buff *handle_offloads(struct sk_buff *skb, int min_headroom)
 			goto error;
 		}
 	}
-#endif
 
 	if (skb_is_gso(skb)) {
 		struct sk_buff *nskb;
diff --git a/datapath/linux/compat/udp_tunnel.c b/datapath/linux/compat/udp_tunnel.c
index 23801bb..852069f 100644
--- a/datapath/linux/compat/udp_tunnel.c
+++ b/datapath/linux/compat/udp_tunnel.c
@@ -130,9 +130,7 @@  void rpl_setup_udp_tunnel_sock(struct net *net, struct socket *sock,
 
 	udp_sk(sk)->encap_type = cfg->encap_type;
 	udp_sk(sk)->encap_rcv = cfg->encap_rcv;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
 	udp_sk(sk)->encap_destroy = cfg->encap_destroy;
-#endif
 #ifdef HAVE_UDP_TUNNEL_SOCK_CFG_GRO_RECEIVE
 	udp_sk(sk)->gro_receive = cfg->gro_receive;
 	udp_sk(sk)->gro_complete = cfg->gro_complete;
diff --git a/datapath/linux/compat/utils.c b/datapath/linux/compat/utils.c
index c9546ea..a4a98ba 100644
--- a/datapath/linux/compat/utils.c
+++ b/datapath/linux/compat/utils.c
@@ -18,28 +18,6 @@ 
 #include <asm/byteorder.h>
 #include <asm/uaccess.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
-void rpl_inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
-			           const __be32 *from, const __be32 *to,
-			           int pseudohdr)
-{
-	__be32 diff[] = {
-		~from[0], ~from[1], ~from[2], ~from[3],
-		to[0], to[1], to[2], to[3],
-	};
-	if (skb->ip_summed != CHECKSUM_PARTIAL) {
-		*sum = csum_fold(csum_partial(diff, sizeof(diff),
-					~csum_unfold(*sum)));
-		if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
-			skb->csum = ~csum_partial(diff, sizeof(diff),
-					~skb->csum);
-	} else if (pseudohdr)
-		*sum = ~csum_fold(csum_partial(diff, sizeof(diff),
-					csum_unfold(*sum)));
-}
-EXPORT_SYMBOL_GPL(rpl_inet_proto_csum_replace16);
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0)
 
 bool rpl___net_get_random_once(void *buf, int nbytes, bool *done,