summaryrefslogtreecommitdiff
path: root/datapath/linux
diff options
context:
space:
mode:
authorGreg Rose <gvrose8192@gmail.com>2018-02-24 14:04:31 -0800
committerBen Pfaff <blp@ovn.org>2018-05-21 20:17:04 -0700
commitd97d7f77a96558eda8fc402fff4696fc18073f77 (patch)
treec34a5c6a008f0796c79d0a7bb0fb50049361752b /datapath/linux
parent1d0dead5c47fbd80c00f80ea2ea064ae5e4cb22a (diff)
downloadopenvswitch-d97d7f77a96558eda8fc402fff4696fc18073f77.tar.gz
compat: Remove unsupported kernel compat code
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> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: William Tu <u9012063@gmail.com>
Diffstat (limited to 'datapath/linux')
-rw-r--r--datapath/linux/compat/include/linux/etherdevice.h30
-rw-r--r--datapath/linux/compat/include/linux/if_vlan.h11
-rw-r--r--datapath/linux/compat/include/linux/kconfig.h8
-rw-r--r--datapath/linux/compat/include/linux/kernel.h38
-rw-r--r--datapath/linux/compat/include/linux/netdev_features.h19
-rw-r--r--datapath/linux/compat/include/linux/netdevice.h5
-rw-r--r--datapath/linux/compat/include/linux/skbuff.h7
-rw-r--r--datapath/linux/compat/include/linux/workqueue.h4
-rw-r--r--datapath/linux/compat/include/net/checksum.h6
-rw-r--r--datapath/linux/compat/include/net/dst.h28
-rw-r--r--datapath/linux/compat/include/net/genetlink.h11
-rw-r--r--datapath/linux/compat/include/net/ip6_route.h23
-rw-r--r--datapath/linux/compat/include/net/ip_tunnels.h4
-rw-r--r--datapath/linux/compat/include/net/ipv6.h15
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h2
-rw-r--r--datapath/linux/compat/include/net/netlink.h15
-rw-r--r--datapath/linux/compat/include/net/route.h105
-rw-r--r--datapath/linux/compat/ip_gre.c11
-rw-r--r--datapath/linux/compat/ip_tunnel.c8
-rw-r--r--datapath/linux/compat/lisp.c2
-rw-r--r--datapath/linux/compat/stt.c6
-rw-r--r--datapath/linux/compat/udp_tunnel.c2
-rw-r--r--datapath/linux/compat/utils.c22
23 files changed, 2 insertions, 380 deletions
diff --git a/datapath/linux/compat/include/linux/etherdevice.h b/datapath/linux/compat/include/linux/etherdevice.h
index 850b7798d..4b2707455 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 fc95b04bf..2cf18e5fa 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 5717a2687..d3fa57a6b 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 5c4269b01..2e81abc2f 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 a39bd4ab5..411f2949b 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 9d3b24903..29ef6c794 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 2910f3f35..149ef28e9 100644
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ b/datapath/linux/compat/include/linux/skbuff.h
@@ -212,13 +212,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 461fefd08..ed573c226 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 398df9324..d1f1125d1 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 5ec3d307b..af78a6ca6 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 b05eae5fa..602ce38d3 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 e49ca39fe..7c78fd5c6 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 ae60f09e2..68dbd7c9c 100644
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ b/datapath/linux/compat/include/net/ip_tunnels.h
@@ -301,11 +301,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 48a307a5d..7fc03398c 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 fb43acba3..d46c098c7 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 ba24a3498..d42bf108b 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 8f336b695..9e4a1f18a 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 2f297a548..43048624a 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -365,16 +365,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
*/
@@ -496,9 +492,7 @@ static const struct net_device_ops gre_tap_netdev_ops = {
#else
.ndo_change_mtu = ip_tunnel_change_mtu,
#endif
-#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
@@ -515,13 +509,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 be82b557c..ebd154455 100644
--- a/datapath/linux/compat/ip_tunnel.c
+++ b/datapath/linux/compat/ip_tunnel.c
@@ -168,11 +168,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;
@@ -180,9 +176,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
+ unregister_netdevice_queue(dev, head);
}
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 4882a636a..41531adf1 100644
--- a/datapath/linux/compat/lisp.c
+++ b/datapath/linux/compat/lisp.c
@@ -597,10 +597,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 ee1c7aa0a..69859e2a4 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 23801bbeb..852069f62 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 c9546ea90..a4a98ba65 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,