summaryrefslogtreecommitdiff
path: root/datapath/linux/compat/include
diff options
context:
space:
mode:
Diffstat (limited to 'datapath/linux/compat/include')
-rw-r--r--datapath/linux/compat/include/linux/bug.h13
-rw-r--r--datapath/linux/compat/include/linux/cache.h23
-rw-r--r--datapath/linux/compat/include/linux/compiler-gcc.h20
-rw-r--r--datapath/linux/compat/include/linux/compiler.h26
-rw-r--r--datapath/linux/compat/include/linux/cpumask.h11
-rw-r--r--datapath/linux/compat/include/linux/err.h37
-rw-r--r--datapath/linux/compat/include/linux/etherdevice.h62
-rw-r--r--datapath/linux/compat/include/linux/genetlink.h16
-rw-r--r--datapath/linux/compat/include/linux/if.h6
-rw-r--r--datapath/linux/compat/include/linux/if_ether.h39
-rw-r--r--datapath/linux/compat/include/linux/if_link.h171
-rw-r--r--datapath/linux/compat/include/linux/if_vlan.h306
-rw-r--r--datapath/linux/compat/include/linux/in.h56
-rw-r--r--datapath/linux/compat/include/linux/jiffies.h34
-rw-r--r--datapath/linux/compat/include/linux/kconfig.h49
-rw-r--r--datapath/linux/compat/include/linux/kernel.h39
-rw-r--r--datapath/linux/compat/include/linux/list.h31
-rw-r--r--datapath/linux/compat/include/linux/mm.h44
-rw-r--r--datapath/linux/compat/include/linux/mpls.h40
-rw-r--r--datapath/linux/compat/include/linux/net.h62
-rw-r--r--datapath/linux/compat/include/linux/netdev_features.h77
-rw-r--r--datapath/linux/compat/include/linux/netdevice.h336
-rw-r--r--datapath/linux/compat/include/linux/netfilter.h19
-rw-r--r--datapath/linux/compat/include/linux/netfilter_ipv6.h32
-rw-r--r--datapath/linux/compat/include/linux/netlink.h19
-rw-r--r--datapath/linux/compat/include/linux/openvswitch.h1176
-rw-r--r--datapath/linux/compat/include/linux/overflow.h313
-rw-r--r--datapath/linux/compat/include/linux/percpu.h33
-rw-r--r--datapath/linux/compat/include/linux/random.h17
-rw-r--r--datapath/linux/compat/include/linux/rbtree.h19
-rw-r--r--datapath/linux/compat/include/linux/rculist.h39
-rw-r--r--datapath/linux/compat/include/linux/rcupdate.h41
-rw-r--r--datapath/linux/compat/include/linux/reciprocal_div.h37
-rw-r--r--datapath/linux/compat/include/linux/rtnetlink.h41
-rw-r--r--datapath/linux/compat/include/linux/skbuff.h491
-rw-r--r--datapath/linux/compat/include/linux/static_key.h86
-rw-r--r--datapath/linux/compat/include/linux/stddef.h15
-rw-r--r--datapath/linux/compat/include/linux/timekeeping.h11
-rw-r--r--datapath/linux/compat/include/linux/types.h11
-rw-r--r--datapath/linux/compat/include/linux/u64_stats_sync.h155
-rw-r--r--datapath/linux/compat/include/linux/udp.h33
-rw-r--r--datapath/linux/compat/include/linux/workqueue.h6
-rw-r--r--datapath/linux/compat/include/net/checksum.h39
-rw-r--r--datapath/linux/compat/include/net/dst.h77
-rw-r--r--datapath/linux/compat/include/net/dst_cache.h114
-rw-r--r--datapath/linux/compat/include/net/dst_metadata.h269
-rw-r--r--datapath/linux/compat/include/net/erspan.h342
-rw-r--r--datapath/linux/compat/include/net/genetlink.h136
-rw-r--r--datapath/linux/compat/include/net/geneve.h107
-rw-r--r--datapath/linux/compat/include/net/gre.h191
-rw-r--r--datapath/linux/compat/include/net/inet_ecn.h59
-rw-r--r--datapath/linux/compat/include/net/inet_frag.h83
-rw-r--r--datapath/linux/compat/include/net/inetpeer.h16
-rw-r--r--datapath/linux/compat/include/net/ip.h143
-rw-r--r--datapath/linux/compat/include/net/ip6_fib.h43
-rw-r--r--datapath/linux/compat/include/net/ip6_route.h16
-rw-r--r--datapath/linux/compat/include/net/ip6_tunnel.h208
-rw-r--r--datapath/linux/compat/include/net/ip_tunnels.h513
-rw-r--r--datapath/linux/compat/include/net/ipv6.h88
-rw-r--r--datapath/linux/compat/include/net/ipv6_frag.h8
-rw-r--r--datapath/linux/compat/include/net/lisp.h27
-rw-r--r--datapath/linux/compat/include/net/mpls.h62
-rw-r--r--datapath/linux/compat/include/net/net_namespace.h33
-rw-r--r--datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h42
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack.h33
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h137
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_count.h54
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_expect.h21
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_helper.h39
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_labels.h107
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_seqadj.h30
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_timeout.h34
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h101
-rw-r--r--datapath/linux/compat/include/net/netfilter/nf_nat.h44
-rw-r--r--datapath/linux/compat/include/net/netlink.h185
-rw-r--r--datapath/linux/compat/include/net/nsh.h313
-rw-r--r--datapath/linux/compat/include/net/protocol.h19
-rw-r--r--datapath/linux/compat/include/net/route.h6
-rw-r--r--datapath/linux/compat/include/net/rtnetlink.h44
-rw-r--r--datapath/linux/compat/include/net/sctp/checksum.h25
-rw-r--r--datapath/linux/compat/include/net/sock.h13
-rw-r--r--datapath/linux/compat/include/net/stt.h70
-rw-r--r--datapath/linux/compat/include/net/tun_proto.h49
-rw-r--r--datapath/linux/compat/include/net/udp.h62
-rw-r--r--datapath/linux/compat/include/net/udp_tunnel.h208
-rw-r--r--datapath/linux/compat/include/net/vrf.h26
-rw-r--r--datapath/linux/compat/include/net/vxlan.h444
-rw-r--r--datapath/linux/compat/include/uapi/linux/netfilter.h14
88 files changed, 0 insertions, 8786 deletions
diff --git a/datapath/linux/compat/include/linux/bug.h b/datapath/linux/compat/include/linux/bug.h
deleted file mode 100644
index 6538a22fc..000000000
--- a/datapath/linux/compat/include/linux/bug.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __LINUX_BUG_WRAPPER_H
-#define __LINUX_BUG_WRAPPER_H 1
-
-#include_next <linux/bug.h>
-
-#ifdef __CHECKER__
-#ifndef BUILD_BUG_ON_INVALID
-#define BUILD_BUG_ON_INVALID(e) (0)
-#endif
-
-#endif /* __CHECKER__ */
-
-#endif
diff --git a/datapath/linux/compat/include/linux/cache.h b/datapath/linux/compat/include/linux/cache.h
deleted file mode 100644
index c8a6710b3..000000000
--- a/datapath/linux/compat/include/linux/cache.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __LINUX_CACHE_WRAPPER_H
-#define __LINUX_CACHE_WRAPPER_H 1
-
-#include_next <linux/cache.h>
-
-/* Upstream commit c74ba8b3480d ("arch: Introduce post-init read-only memory")
- * introduced the __ro_after_init attribute, however it wasn't applied to
- * generic netlink sockets until commit 34158151d2aa ("netfilter: cttimeout:
- * use nf_ct_iterate_cleanup_net to unlink timeout objs"). Using it on
- * genetlink before the latter commit leads to crash on module unload.
- * For kernels < 4.10, define it as empty. */
-#ifdef HAVE_GENL_FAMILY_LIST
-#ifdef __ro_after_init
-#undef __ro_after_init
-#endif /* #ifdef __ro_after_init */
-#define __ro_after_init
-#else
-#ifndef __ro_after_init
-#define __ro_after_init
-#endif /* #ifndef __ro_after_init */
-#endif /* #ifdef HAVE_GENL_FAMILY_LIST */
-
-#endif
diff --git a/datapath/linux/compat/include/linux/compiler-gcc.h b/datapath/linux/compat/include/linux/compiler-gcc.h
deleted file mode 100644
index 39d2e0198..000000000
--- a/datapath/linux/compat/include/linux/compiler-gcc.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#if 0
-/* Disable this check - it no longer makes sense with so many backports
- * due to spectre mitigation
- */
-#ifndef HAVE_LINUX_COMPILER_TYPES_H
-#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
-#endif
-#endif
-#endif
-
-#include_next <linux/compiler-gcc.h>
-
-#ifndef __packed
-#define __packed __attribute__((packed))
-#endif
-
-#ifndef __always_unused
-#define __always_unused __attribute__((unused))
-#endif
diff --git a/datapath/linux/compat/include/linux/compiler.h b/datapath/linux/compat/include/linux/compiler.h
deleted file mode 100644
index 59b506fd4..000000000
--- a/datapath/linux/compat/include/linux/compiler.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __LINUX_COMPILER_WRAPPER_H
-#define __LINUX_COMPILER_WRAPPER_H 1
-
-#include_next <linux/compiler.h>
-
-#ifndef __percpu
-#define __percpu
-#endif
-
-#ifndef __rcu
-#define __rcu
-#endif
-
-#ifndef READ_ONCE
-#define READ_ONCE(x) (x)
-#endif
-
-#ifndef WRITE_ONCE
-#define WRITE_ONCE(x, val) \
-do { \
- *(volatile typeof(x) *)&(x) = (val); \
-} while (0)
-#endif
-
-
-#endif
diff --git a/datapath/linux/compat/include/linux/cpumask.h b/datapath/linux/compat/include/linux/cpumask.h
deleted file mode 100644
index 48c73aa8f..000000000
--- a/datapath/linux/compat/include/linux/cpumask.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __LINUX_CPUMASK_WRAPPER_H
-#define __LINUX_CPUMASK_WRAPPER_H
-
-#include_next <linux/cpumask.h>
-
-/* for_each_cpu was renamed for_each_possible_cpu in 2.6.18. */
-#ifndef for_each_possible_cpu
-#define for_each_possible_cpu for_each_cpu
-#endif
-
-#endif /* linux/cpumask.h wrapper */
diff --git a/datapath/linux/compat/include/linux/err.h b/datapath/linux/compat/include/linux/err.h
deleted file mode 100644
index 321386c21..000000000
--- a/datapath/linux/compat/include/linux/err.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __LINUX_ERR_WRAPPER_H
-#define __LINUX_ERR_WRAPPER_H 1
-
-#include_next <linux/err.h>
-
-#ifndef HAVE_ERR_CAST
-/**
- * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
- * @ptr: The pointer to cast.
- *
- * Explicitly cast an error-valued pointer to another pointer type in such a
- * way as to make it clear that's what's going on.
- */
-static inline void *ERR_CAST(const void *ptr)
-{
- /* cast away the const */
- return (void *) ptr;
-}
-#endif /* HAVE_ERR_CAST */
-
-#ifndef HAVE_IS_ERR_OR_NULL
-static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
-{
- return !ptr || IS_ERR_VALUE((unsigned long)ptr);
-}
-#endif
-
-#ifndef HAVE_PTR_ERR_OR_ZERO
-static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
-{
- if (IS_ERR(ptr))
- return PTR_ERR(ptr);
- else
- return 0;
-}
-#endif
-#endif
diff --git a/datapath/linux/compat/include/linux/etherdevice.h b/datapath/linux/compat/include/linux/etherdevice.h
deleted file mode 100644
index 4b2707455..000000000
--- a/datapath/linux/compat/include/linux/etherdevice.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef __LINUX_ETHERDEVICE_WRAPPER_H
-#define __LINUX_ETHERDEVICE_WRAPPER_H 1
-
-#include <linux/version.h>
-#include_next <linux/etherdevice.h>
-
-#ifndef HAVE_ETHER_ADDR_COPY
-static inline void ether_addr_copy(u8 *dst, const u8 *src)
-{
-#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
- *(u32 *)dst = *(const u32 *)src;
- *(u16 *)(dst + 4) = *(const u16 *)(src + 4);
-#else
- u16 *a = (u16 *)dst;
- const u16 *b = (const u16 *)src;
-
- a[0] = b[0];
- a[1] = b[1];
- a[2] = b[2];
-#endif
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
-#define eth_proto_is_802_3 rpl_eth_proto_is_802_3
-static inline bool eth_proto_is_802_3(__be16 proto)
-{
-#ifndef __BIG_ENDIAN
- /* if CPU is little endian mask off bits representing LSB */
- proto &= htons(0xFF00);
-#endif
- /* cast both to u16 and compare since LSB can be ignored */
- return (__force u16)proto >= (__force u16)htons(ETH_P_802_3_MIN);
-}
-#endif
-
-#define ether_addr_equal rpl_ether_addr_equal
-static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
-{
-#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
- u32 fold = ((*(const u32 *)addr1) ^ (*(const u32 *)addr2)) |
- ((*(const u16 *)(addr1 + 4)) ^ (*(const u16 *)(addr2 + 4)));
-
- return fold == 0;
-#else
- const u16 *a = (const u16 *)addr1;
- const u16 *b = (const u16 *)addr2;
-
- return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) == 0;
-#endif
-}
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
-#define eth_gro_receive rpl_eth_gro_receive
-struct sk_buff **rpl_eth_gro_receive(struct sk_buff **head,
- struct sk_buff *skb);
-
-#define eth_gro_complete rpl_eth_gro_complete
-int rpl_eth_gro_complete(struct sk_buff *skb, int nhoff);
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/genetlink.h b/datapath/linux/compat/include/linux/genetlink.h
deleted file mode 100644
index 3b85f3865..000000000
--- a/datapath/linux/compat/include/linux/genetlink.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _UAPI__LINUX_GENERIC_NETLINK_WRAPPER_H
-#define _UAPI__LINUX_GENERIC_NETLINK_WRAPPER_H
-
-#include_next <linux/genetlink.h>
-
-#ifndef GENL_UNS_ADMIN_PERM
-#define GENL_UNS_ADMIN_PERM GENL_ADMIN_PERM
-#endif
-
-#ifdef GENL_ID_GENERATE
-#if GENL_ID_GENERATE != 0
-#error "GENL_ID_GENERATE is assumed to be zero"
-#endif
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/if.h b/datapath/linux/compat/include/linux/if.h
deleted file mode 100644
index 3beb61df1..000000000
--- a/datapath/linux/compat/include/linux/if.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __LINUX_IF_WRAPPER_H
-#define __LINUX_IF_WRAPPER_H 1
-
-#include_next <linux/if.h>
-
-#endif
diff --git a/datapath/linux/compat/include/linux/if_ether.h b/datapath/linux/compat/include/linux/if_ether.h
deleted file mode 100644
index 8dff938b7..000000000
--- a/datapath/linux/compat/include/linux/if_ether.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __LINUX_IF_ETHER_WRAPPER_H
-#define __LINUX_IF_ETHER_WRAPPER_H 1
-
-#include_next <linux/if_ether.h>
-
-#ifndef ETH_MIN_MTU
-#define ETH_MIN_MTU 68 /* Min IPv4 MTU per RFC791 */
-#endif
-
-#ifndef ETH_MAX_MTU
-#define ETH_MAX_MTU 0xFFFFU /* 65535, same as IP_MAX_MTU */
-#endif
-
-#ifndef ETH_P_802_3_MIN
-#define ETH_P_802_3_MIN 0x0600
-#endif
-
-#ifndef ETH_P_8021AD
-#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
-#endif
-
-#ifndef ETH_P_NSH
-#define ETH_P_NSH 0x894F /* Network Service Header */
-#endif
-
-#ifndef ETH_P_ERSPAN
-#define ETH_P_ERSPAN 0x88BE /* ERSPAN TYPE II */
-#endif
-
-#ifndef ETH_P_ERSPAN2
-#define ETH_P_ERSPAN2 0x22EB /* ERSPAN version 2 (type III) */
-#endif
-
-#define inner_eth_hdr rpl_inner_eth_hdr
-static inline struct ethhdr *inner_eth_hdr(const struct sk_buff *skb)
-{
- return (struct ethhdr *)skb_inner_mac_header(skb);
-}
-#endif
diff --git a/datapath/linux/compat/include/linux/if_link.h b/datapath/linux/compat/include/linux/if_link.h
deleted file mode 100644
index bd77e33d3..000000000
--- a/datapath/linux/compat/include/linux/if_link.h
+++ /dev/null
@@ -1,171 +0,0 @@
-#ifndef _LINUX_IF_LINK_WRAPPER_H
-#define _LINUX_IF_LINK_WRAPPER_H
-
-#include_next<linux/if_link.h>
-
-/* GENEVE section */
-enum {
-#define IFLA_GENEVE_UNSPEC rpl_IFLA_GENEVE_UNSPEC
- IFLA_GENEVE_UNSPEC,
-
-#define IFLA_GENEVE_ID rpl_IFLA_GENEVE_ID
- IFLA_GENEVE_ID,
-
-#define IFLA_GENEVE_REMOTE rpl_IFLA_GENEVE_REMOTE
- IFLA_GENEVE_REMOTE,
-
-#define IFLA_GENEVE_TTL rpl_IFLA_GENEVE_TTL
- IFLA_GENEVE_TTL,
-
-#define IFLA_GENEVE_TOS rpl_IFLA_GENEVE_TOS
- IFLA_GENEVE_TOS,
-
-#define IFLA_GENEVE_PORT rpl_IFLA_GENEVE_PORT
- IFLA_GENEVE_PORT, /* destination port */
-
-#define IFLA_GENEVE_COLLECT_METADATA rpl_IFLA_GENEVE_COLLECT_METADATA
- IFLA_GENEVE_COLLECT_METADATA,
-
-#define IFLA_GENEVE_REMOTE6 rpl_IFLA_GENEVE_REMOTE6
- IFLA_GENEVE_REMOTE6,
-
-#define IFLA_GENEVE_UDP_CSUM rpl_IFLA_GENEVE_UDP_CSUM
- IFLA_GENEVE_UDP_CSUM,
-
-#define IFLA_GENEVE_UDP_ZERO_CSUM6_TX rpl_IFLA_GENEVE_UDP_ZERO_CSUM6_TX
- IFLA_GENEVE_UDP_ZERO_CSUM6_TX,
-
-#define IFLA_GENEVE_UDP_ZERO_CSUM6_RX rpl_IFLA_GENEVE_UDP_ZERO_CSUM6_RX
- IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
-
-#define IFLA_GENEVE_LABEL rpl_IFLA_GENEVE_LABEL
- IFLA_GENEVE_LABEL,
-
-#define __IFLA_GENEVE_MAX rpl__IFLA_GENEVE_MAX
- __IFLA_GENEVE_MAX
-};
-#undef IFLA_GENEVE_MAX
-#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
-
-/* STT section */
-enum {
- IFLA_STT_PORT, /* destination port */
- __IFLA_STT_MAX
-};
-#define IFLA_STT_MAX (__IFLA_STT_MAX - 1)
-
-/* LISP section */
-enum {
- IFLA_LISP_PORT, /* destination port */
- __IFLA_LISP_MAX
-};
-#define IFLA_LISP_MAX (__IFLA_LISP_MAX - 1)
-
-/* VXLAN section */
-enum {
-#define IFLA_VXLAN_UNSPEC rpl_IFLA_VXLAN_UNSPEC
- IFLA_VXLAN_UNSPEC,
-#define IFLA_VXLAN_ID rpl_IFLA_VXLAN_ID
- IFLA_VXLAN_ID,
-#define IFLA_VXLAN_GROUP rpl_IFLA_VXLAN_GROUP
- IFLA_VXLAN_GROUP, /* group or remote address */
-#define IFLA_VXLAN_LINK rpl_IFLA_VXLAN_LINK
- IFLA_VXLAN_LINK,
-#define IFLA_VXLAN_LOCAL rpl_IFLA_VXLAN_LOCAL
- IFLA_VXLAN_LOCAL,
-#define IFLA_VXLAN_TTL rpl_IFLA_VXLAN_TTL
- IFLA_VXLAN_TTL,
-#define IFLA_VXLAN_TOS rpl_IFLA_VXLAN_TOS
- IFLA_VXLAN_TOS,
-#define IFLA_VXLAN_LEARNING rpl_IFLA_VXLAN_LEARNING
- IFLA_VXLAN_LEARNING,
-#define IFLA_VXLAN_AGEING rpl_IFLA_VXLAN_AGEING
- IFLA_VXLAN_AGEING,
-#define IFLA_VXLAN_LIMIT rpl_IFLA_VXLAN_LIMIT
- IFLA_VXLAN_LIMIT,
-#define IFLA_VXLAN_PORT_RANGE rpl_IFLA_VXLAN_PORT_RANGE
- IFLA_VXLAN_PORT_RANGE, /* source port */
-#define IFLA_VXLAN_PROXY rpl_IFLA_VXLAN_PROXY
- IFLA_VXLAN_PROXY,
-#define IFLA_VXLAN_RSC rpl_IFLA_VXLAN_RSC
- IFLA_VXLAN_RSC,
-#define IFLA_VXLAN_L2MISS rpl_IFLA_VXLAN_L2MISS
- IFLA_VXLAN_L2MISS,
-#define IFLA_VXLAN_L3MISS rpl_IFLA_VXLAN_L3MISS
- IFLA_VXLAN_L3MISS,
-#define IFLA_VXLAN_PORT rpl_IFLA_VXLAN_PORT
- IFLA_VXLAN_PORT, /* destination port */
-#define IFLA_VXLAN_GROUP6 rpl_IFLA_VXLAN_GROUP6
- IFLA_VXLAN_GROUP6,
-#define IFLA_VXLAN_LOCAL6 rpl_IFLA_VXLAN_LOCAL6
- IFLA_VXLAN_LOCAL6,
-#define IFLA_VXLAN_UDP_CSUM rpl_IFLA_VXLAN_UDP_CSUM
- IFLA_VXLAN_UDP_CSUM,
-#define IFLA_VXLAN_UDP_ZERO_CSUM6_TX rpl_IFLA_VXLAN_UDP_ZERO_CSUM6_TX
- IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
-#define IFLA_VXLAN_UDP_ZERO_CSUM6_RX rpl_IFLA_VXLAN_UDP_ZERO_CSUM6_RX
- IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
-#define IFLA_VXLAN_REMCSUM_TX rpl_IFLA_VXLAN_REMCSUM_TX
- IFLA_VXLAN_REMCSUM_TX,
-#define IFLA_VXLAN_REMCSUM_RX rpl_IFLA_VXLAN_REMCSUM_RX
- IFLA_VXLAN_REMCSUM_RX,
-#define IFLA_VXLAN_GBP rpl_IFLA_VXLAN_GBP
- IFLA_VXLAN_GBP,
-#define IFLA_VXLAN_REMCSUM_NOPARTIAL rpl_IFLA_VXLAN_REMCSUM_NOPARTIAL
- IFLA_VXLAN_REMCSUM_NOPARTIAL,
-#define IFLA_VXLAN_COLLECT_METADATA rpl_IFLA_VXLAN_COLLECT_METADATA
- IFLA_VXLAN_COLLECT_METADATA,
-#define IFLA_VXLAN_LABEL rpl_IFLA_VXLAN_LABEL
- IFLA_VXLAN_LABEL,
-#define IFLA_VXLAN_GPE rpl_IFLA_VXLAN_GPE
- IFLA_VXLAN_GPE,
-
-#define __IFLA_VXLAN_MAX rpl___IFLA_VXLAN_MAX
- __IFLA_VXLAN_MAX
-};
-
-#undef IFLA_VXLAN_MAX
-#define IFLA_VXLAN_MAX (rpl___IFLA_VXLAN_MAX - 1)
-
-#define ifla_vxlan_port_range rpl_ifla_vxlan_port_range
-struct ifla_vxlan_port_range {
- __be16 low;
- __be16 high;
-};
-
-#ifndef HAVE_RTNL_LINK_STATS64
-/* The main device statistics structure */
-struct rtnl_link_stats64 {
- __u64 rx_packets; /* total packets received */
- __u64 tx_packets; /* total packets transmitted */
- __u64 rx_bytes; /* total bytes received */
- __u64 tx_bytes; /* total bytes transmitted */
- __u64 rx_errors; /* bad packets received */
- __u64 tx_errors; /* packet transmit problems */
- __u64 rx_dropped; /* no space in linux buffers */
- __u64 tx_dropped; /* no space available in linux */
- __u64 multicast; /* multicast packets received */
- __u64 collisions;
-
- /* detailed rx_errors: */
- __u64 rx_length_errors;
- __u64 rx_over_errors; /* receiver ring buff overflow */
- __u64 rx_crc_errors; /* recved pkt with crc error */
- __u64 rx_frame_errors; /* recv'd frame alignment error */
- __u64 rx_fifo_errors; /* recv'r fifo overrun */
- __u64 rx_missed_errors; /* receiver missed packet */
-
- /* detailed tx_errors */
- __u64 tx_aborted_errors;
- __u64 tx_carrier_errors;
- __u64 tx_fifo_errors;
- __u64 tx_heartbeat_errors;
- __u64 tx_window_errors;
-
- /* for cslip etc */
- __u64 rx_compressed;
- __u64 tx_compressed;
-};
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h
deleted file mode 100644
index 3ed7522c7..000000000
--- a/datapath/linux/compat/include/linux/if_vlan.h
+++ /dev/null
@@ -1,306 +0,0 @@
-#ifndef __LINUX_IF_VLAN_WRAPPER_H
-#define __LINUX_IF_VLAN_WRAPPER_H 1
-
-#include <linux/skbuff.h>
-#include <linux/version.h>
-#include_next <linux/if_vlan.h>
-
-#ifndef HAVE_VLAN_INSERT_TAG_SET_PROTO
-/*
- * The behavior of __vlan_put_tag()/vlan_insert_tag_set_proto() has changed
- * over time:
- *
- * - In 2.6.26 and earlier, it adjusted both MAC and network header
- * pointers. (The latter didn't make any sense.)
- *
- * - In 2.6.27 and 2.6.28, it did not adjust any header pointers at all.
- *
- * - In 2.6.29 and later, it adjusts the MAC header pointer only.
- *
- * - In 3.19 and later, it was renamed to vlan_insert_tag_set_proto()
- *
- * This is the version from 2.6.33. We unconditionally substitute this version
- * to avoid the need to guess whether the version in the kernel tree is
- * acceptable.
- */
-#define vlan_insert_tag_set_proto(skb, proto, vlan_tci) \
- rpl_vlan_insert_tag_set_proto(skb, proto, vlan_tci)
-static inline struct sk_buff *rpl_vlan_insert_tag_set_proto(struct sk_buff *skb,
- __be16 vlan_proto,
- u16 vlan_tci)
-{
- struct vlan_ethhdr *veth;
-
- if (skb_cow_head(skb, VLAN_HLEN) < 0) {
- kfree_skb(skb);
- return NULL;
- }
- veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
-
- /* Move the mac addresses to the beginning of the new header. */
- memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
- skb->mac_header -= VLAN_HLEN;
-
- /* first, the ethernet type */
- veth->h_vlan_proto = vlan_proto;
-
- /* now, the TCI */
- veth->h_vlan_TCI = htons(vlan_tci);
-
- skb->protocol = vlan_proto;
-
- return skb;
-}
-#endif
-
-#ifndef HAVE_VLAN_HWACCEL_CLEAR_TAG
-/**
- * __vlan_hwaccel_clear_tag - clear hardware accelerated VLAN info
- * @skb: skbuff to clear
- *
- * Clears the VLAN information from @skb
- */
-#define __vlan_hwaccel_clear_tag rpl_vlan_hwaccel_clear_tag
-static inline void rpl_vlan_hwaccel_clear_tag(struct sk_buff *skb)
-{
-#ifdef HAVE_SKBUFF_VLAN_PRESENT
- skb->vlan_present = 0;
-#else
- skb->vlan_tci = 0;
- skb->vlan_proto = 0;
-#endif
-}
-#endif
-
-#ifndef HAVE_VLAN_HWACCEL_PUSH_INSIDE
-
-/*
- * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
- * @skb: skbuff to tag
- *
- * Pushes the VLAN tag from @skb->vlan_tci inside to the payload.
- *
- * Following the skb_unshare() example, in case of error, the calling function
- * doesn't have to worry about freeing the original skb.
- */
-static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
-{
- skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
- vlan_tx_tag_get(skb));
- if (likely(skb))
- skb->vlan_tci = 0;
- return skb;
-}
-/*
- * vlan_hwaccel_push_inside - pushes vlan tag to the payload
- * @skb: skbuff to tag
- *
- * Checks is tag is present in @skb->vlan_tci and if it is, it pushes the
- * VLAN tag from @skb->vlan_tci inside to the payload.
- *
- * Following the skb_unshare() example, in case of error, the calling function
- * doesn't have to worry about freeing the original skb.
- */
-static inline struct sk_buff *vlan_hwaccel_push_inside(struct sk_buff *skb)
-{
- if (vlan_tx_tag_present(skb))
- skb = __vlan_hwaccel_push_inside(skb);
- return skb;
-}
-#endif
-
-#ifndef HAVE_ETH_TYPE_VLAN
-/**
- * eth_type_vlan - check for valid vlan ether type.
- * @ethertype: ether type to check
- *
- * Returns true if the ether type is a vlan ether type.
- */
-static inline bool eth_type_vlan(__be16 ethertype)
-{
- switch (ethertype) {
- case htons(ETH_P_8021Q):
- case htons(ETH_P_8021AD):
- return true;
- default:
- return false;
- }
-}
-#endif
-
-/* All of these were introduced in a single commit preceding 2.6.33, so
- * presumably all of them or none of them are present. */
-#ifndef VLAN_PRIO_MASK
-#define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */
-#define VLAN_PRIO_SHIFT 13
-#define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator */
-#define VLAN_TAG_PRESENT VLAN_CFI_MASK
-#endif
-
-#ifndef HAVE_VLAN_SET_ENCAP_PROTO
-static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
-{
- __be16 proto;
- unsigned char *rawp;
-
- /*
- * Was a VLAN packet, grab the encapsulated protocol, which the layer
- * three protocols care about.
- */
-
- proto = vhdr->h_vlan_encapsulated_proto;
- if (ntohs(proto) >= 1536) {
- skb->protocol = proto;
- return;
- }
-
- rawp = skb->data;
- if (*(unsigned short *) rawp == 0xFFFF)
- /*
- * This is a magic hack to spot IPX packets. Older Novell
- * breaks the protocol design and runs IPX over 802.3 without
- * an 802.2 LLC layer. We look for FFFF which isn't a used
- * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
- * but does for the rest.
- */
- skb->protocol = htons(ETH_P_802_3);
- else
- /*
- * Real 802.2 LLC
- */
- skb->protocol = htons(ETH_P_802_2);
-}
-#endif
-
-#ifndef HAVE___VLAN_INSERT_TAG
-/* Kernels which don't have __vlan_insert_tag() also don't have skb->vlan_proto
- * so ignore the proto paramter.
- */
-#define __vlan_insert_tag(skb, proto, tci) rpl_vlan_insert_tag(skb, tci)
-static inline int rpl_vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
-{
- struct vlan_ethhdr *veth;
-
- if (skb_cow_head(skb, VLAN_HLEN) < 0)
- return -ENOMEM;
-
- veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
-
- /* Move the mac addresses to the beginning of the new header. */
- memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
- skb->mac_header -= VLAN_HLEN;
-
- /* first, the ethernet type */
- veth->h_vlan_proto = htons(ETH_P_8021Q);
-
- /* now, the TCI */
- veth->h_vlan_TCI = htons(vlan_tci);
-
- return 0;
-}
-#endif
-
-#ifndef skb_vlan_tag_present
-#define skb_vlan_tag_present(skb) vlan_tx_tag_present(skb)
-#define skb_vlan_tag_get(skb) vlan_tx_tag_get(skb)
-#endif
-
-#ifndef HAVE_VLAN_GET_PROTOCOL
-
-static inline __be16 __vlan_get_protocol(struct sk_buff *skb, __be16 type,
- int *depth)
-{
- unsigned int vlan_depth = skb->mac_len;
-
- /* if type is 802.1Q/AD then the header should already be
- * present at mac_len - VLAN_HLEN (if mac_len > 0), or at
- * ETH_HLEN otherwise
- */
- if (eth_type_vlan(type)) {
- if (vlan_depth) {
- if (WARN_ON(vlan_depth < VLAN_HLEN))
- return 0;
- vlan_depth -= VLAN_HLEN;
- } else {
- vlan_depth = ETH_HLEN;
- }
- do {
- struct vlan_hdr *vh;
-
- if (unlikely(!pskb_may_pull(skb,
- vlan_depth + VLAN_HLEN)))
- return 0;
-
- vh = (struct vlan_hdr *)(skb->data + vlan_depth);
- type = vh->h_vlan_encapsulated_proto;
- vlan_depth += VLAN_HLEN;
- } while (eth_type_vlan(type));
- }
-
- if (depth)
- *depth = vlan_depth;
-
- return type;
-}
-
-/**
- * vlan_get_protocol - get protocol EtherType.
- * @skb: skbuff to query
- *
- * Returns the EtherType of the packet, regardless of whether it is
- * vlan encapsulated (normal or hardware accelerated) or not.
- */
-static inline __be16 vlan_get_protocol(struct sk_buff *skb)
-{
- return __vlan_get_protocol(skb, skb->protocol, NULL);
-}
-
-#endif
-
-#ifndef HAVE_SKB_VLAN_TAGGED
-/**
- * skb_vlan_tagged - check if skb is vlan tagged.
- * @skb: skbuff to query
- *
- * Returns true if the skb is tagged, regardless of whether it is hardware
- * accelerated or not.
- */
-static inline bool skb_vlan_tagged(const struct sk_buff *skb)
-{
- if (!skb_vlan_tag_present(skb) &&
- likely(!eth_type_vlan(skb->protocol)))
- return false;
-
- return true;
-}
-
-/**
- * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
- * @skb: skbuff to query
- *
- * Returns true if the skb is tagged with multiple vlan headers, regardless
- * of whether it is hardware accelerated or not.
- */
-static inline bool skb_vlan_tagged_multi(const struct sk_buff *skb)
-{
- __be16 protocol = skb->protocol;
-
- if (!skb_vlan_tag_present(skb)) {
- struct vlan_ethhdr *veh;
-
- if (likely(!eth_type_vlan(protocol)))
- return false;
-
- veh = (struct vlan_ethhdr *)skb->data;
- protocol = veh->h_vlan_encapsulated_proto;
- }
-
- if (!eth_type_vlan(protocol))
- return false;
-
- return true;
-}
-
-#endif /* HAVE_SKB_VLAN_TAGGED */
-
-#endif /* linux/if_vlan.h wrapper */
diff --git a/datapath/linux/compat/include/linux/in.h b/datapath/linux/compat/include/linux/in.h
deleted file mode 100644
index 78f8d7731..000000000
--- a/datapath/linux/compat/include/linux/in.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __LINUX_IN_WRAPPER_H
-#define __LINUX_IN_WRAPPER_H 1
-
-#include_next <linux/in.h>
-
-#include <linux/module.h>
-#ifndef HAVE_PROTO_PORTS_OFFSET
-static inline int proto_ports_offset(int proto)
-{
- switch (proto) {
- case IPPROTO_TCP:
- case IPPROTO_UDP:
- case IPPROTO_DCCP:
- case IPPROTO_ESP: /* SPI */
- case IPPROTO_SCTP:
- case IPPROTO_UDPLITE:
- return 0;
- case IPPROTO_AH: /* SPI */
- return 4;
- default:
- return -EINVAL;
- }
-}
-#endif
-
-#ifndef HAVE_IPV4_IS_MULTICAST
-
-static inline bool ipv4_is_loopback(__be32 addr)
-{
- return (addr & htonl(0xff000000)) == htonl(0x7f000000);
-}
-
-static inline bool ipv4_is_multicast(__be32 addr)
-{
- return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
-}
-
-static inline bool ipv4_is_local_multicast(__be32 addr)
-{
- return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
-}
-
-static inline bool ipv4_is_lbcast(__be32 addr)
-{
- /* limited broadcast */
- return addr == htonl(INADDR_BROADCAST);
-}
-
-static inline bool ipv4_is_zeronet(__be32 addr)
-{
- return (addr & htonl(0xff000000)) == htonl(0x00000000);
-}
-
-#endif /* !HAVE_IPV4_IS_MULTICAST */
-
-#endif
diff --git a/datapath/linux/compat/include/linux/jiffies.h b/datapath/linux/compat/include/linux/jiffies.h
deleted file mode 100644
index 642eacec7..000000000
--- a/datapath/linux/compat/include/linux/jiffies.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __LINUX_JIFFIES_WRAPPER_H
-#define __LINUX_JIFFIES_WRAPPER_H 1
-
-#include_next <linux/jiffies.h>
-
-#include <linux/version.h>
-
-/* Same as above, but does so with platform independent 64bit types.
- * These must be used when utilizing jiffies_64 (i.e. return value of
- * get_jiffies_64() */
-
-#ifndef time_after64
-#define time_after64(a, b) \
- (typecheck(__u64, a) && \
- typecheck(__u64, b) && \
- ((__s64)(b) - (__s64)(a) < 0))
-#endif
-
-#ifndef time_before64
-#define time_before64(a, b) time_after64(b, a)
-#endif
-
-#ifndef time_after_eq64
-#define time_after_eq64(a, b) \
- (typecheck(__u64, a) && \
- typecheck(__u64, b) && \
- ((__s64)(a) - (__s64)(b) >= 0))
-#endif
-
-#ifndef time_before_eq64
-#define time_before_eq64(a, b) time_after_eq64(b, a)
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/kconfig.h b/datapath/linux/compat/include/linux/kconfig.h
deleted file mode 100644
index d3fa57a6b..000000000
--- a/datapath/linux/compat/include/linux/kconfig.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __LINUX_KCONFIG_WRAPPER_H
-#define __LINUX_KCONFIG_WRAPPER_H
-
-#include <linux/version.h>
-
-#ifndef IS_ENABLED
-
-/*
- * Helper macros to use CONFIG_ options in C/CPP expressions. Note that
- * these only work with boolean and tristate options.
- */
-
-/*
- * Getting something that works in C and CPP for an arg that may or may
- * not be defined is tricky. Here, if we have "#define CONFIG_BOOGER 1"
- * we match on the placeholder define, insert the "0," for arg1 and generate
- * the triplet (0, 1, 0). Then the last step cherry picks the 2nd arg (a one).
- * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when
- * the last step cherry picks the 2nd arg, we get a zero.
- */
-#define __ARG_PLACEHOLDER_1 0,
-#define config_enabled(cfg) _config_enabled(cfg)
-#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
-#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
-#define ___config_enabled(__ignored, val, ...) val
-
-/*
- * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
- * 0 otherwise.
- *
- */
-#define IS_ENABLED(option) \
- (config_enabled(option) || config_enabled(option##_MODULE))
-
-/*
- * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
- * otherwise. For boolean options, this is equivalent to
- * IS_ENABLED(CONFIG_FOO).
- */
-#define IS_BUILTIN(option) config_enabled(option)
-
-/*
- * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
- * otherwise.
- */
-#define IS_MODULE(option) config_enabled(option##_MODULE)
-
-#endif /* IS_ENABLED */
-#endif /* __LINUX_KCONFIG_WRAPER_H */
diff --git a/datapath/linux/compat/include/linux/kernel.h b/datapath/linux/compat/include/linux/kernel.h
deleted file mode 100644
index 106b5940a..000000000
--- a/datapath/linux/compat/include/linux/kernel.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __KERNEL_H_WRAPPER
-#define __KERNEL_H_WRAPPER 1
-
-#include_next <linux/kernel.h>
-#ifndef HAVE_LOG2_H
-#include <linux/log2.h>
-#endif
-
-#include <linux/version.h>
-
-#ifndef USHRT_MAX
-#define USHRT_MAX ((u16)(~0U))
-#define SHRT_MAX ((s16)(USHRT_MAX>>1))
-#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
-#endif
-
-#ifndef DIV_ROUND_UP
-#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
-#endif
-
-#ifndef rounddown
-#define rounddown(x, y) ( \
-{ \
- typeof(x) __x = (x); \
- __x - (__x % (y)); \
-} \
-)
-#endif
-
-/* U32_MAX was introduced in include/linux/kernel.h after version 3.14. */
-#ifndef U32_MAX
-#define U32_MAX ((u32)~0U)
-#endif
-
-#ifndef sizeof_field
-#define sizeof_field(t, f) (sizeof(((t*)0)->f))
-#endif
-
-#endif /* linux/kernel.h */
diff --git a/datapath/linux/compat/include/linux/list.h b/datapath/linux/compat/include/linux/list.h
deleted file mode 100644
index 4234c17ce..000000000
--- a/datapath/linux/compat/include/linux/list.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __LINUX_LIST_WRAPPER_H
-#define __LINUX_LIST_WRAPPER_H 1
-
-#include_next <linux/list.h>
-
-#ifndef hlist_entry_safe
-#define hlist_entry_safe(ptr, type, member) \
- ({ typeof(ptr) ____ptr = (ptr); \
- ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
- })
-
-#undef hlist_for_each_entry
-#define hlist_for_each_entry(pos, head, member) \
- for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
- pos; \
- pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
-
-#undef hlist_for_each_entry_safe
-#define hlist_for_each_entry_safe(pos, n, head, member) \
- for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
- pos && ({ n = pos->member.next; 1; }); \
- pos = hlist_entry_safe(n, typeof(*pos), member))
-
-#endif
-
-#ifndef list_first_entry_or_null
-#define list_first_entry_or_null(ptr, type, member) \
- (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/mm.h b/datapath/linux/compat/include/linux/mm.h
deleted file mode 100644
index 681f3db89..000000000
--- a/datapath/linux/compat/include/linux/mm.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef OVS_MM_H
-#define OVS_MM_H
-
-#include <linux/overflow.h>
-
-#ifndef HAVE_KVMALLOC_ARRAY
-#ifndef HAVE_KVMALLOC_NODE
-extern void *vmalloc_node(unsigned long size, int node);
-#define kvmalloc_node(a, b, c) vmalloc_node(a, c)
-#else
-extern void *kvmalloc_node(size_t size, gfp_t flags, int node);
-#endif /* HAVE_KVMALLOC_NODE */
-static inline void *kvmalloc(size_t size, gfp_t flags)
-{
- return kvmalloc_node(size, flags, NUMA_NO_NODE);
-}
-static inline void *kvzalloc_node(size_t size, gfp_t flags, int node)
-{
- return kvmalloc_node(size, flags | __GFP_ZERO, node);
-}
-static inline void *kvzalloc(size_t size, gfp_t flags)
-{
- return kvmalloc(size, flags | __GFP_ZERO);
-}
-
-static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
-{
- size_t bytes;
-
- if (unlikely(check_mul_overflow(n, size, &bytes)))
- return NULL;
-
- return kvmalloc(bytes, flags);
-}
-
-static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
-{
- return kvmalloc_array(n, size, flags | __GFP_ZERO);
-}
-
-#endif
-#include_next <linux/mm.h>
-#endif /* OVS_MM_H */
-
diff --git a/datapath/linux/compat/include/linux/mpls.h b/datapath/linux/compat/include/linux/mpls.h
deleted file mode 100644
index ab99ebc30..000000000
--- a/datapath/linux/compat/include/linux/mpls.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _UAPI_MPLS_WRAPPER_H
-#define _UAPI_MPLS_WRAPPER_H
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)
-#include_next <linux/mpls.h>
-#else
-
-#include <linux/types.h>
-#include <asm/byteorder.h>
-
-/* Reference: RFC 5462, RFC 3032
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Label | TC |S| TTL |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Label: Label Value, 20 bits
- * TC: Traffic Class field, 3 bits
- * S: Bottom of Stack, 1 bit
- * TTL: Time to Live, 8 bits
- */
-
-struct mpls_label {
- __be32 entry;
-};
-
-#define MPLS_LS_LABEL_MASK 0xFFFFF000
-#define MPLS_LS_LABEL_SHIFT 12
-#define MPLS_LS_TC_MASK 0x00000E00
-#define MPLS_LS_TC_SHIFT 9
-#define MPLS_LS_S_MASK 0x00000100
-#define MPLS_LS_S_SHIFT 8
-#define MPLS_LS_TTL_MASK 0x000000FF
-#define MPLS_LS_TTL_SHIFT 0
-#endif
-
-#endif /* _UAPI_MPLS_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/net.h b/datapath/linux/compat/include/linux/net.h
deleted file mode 100644
index 2a6903d0a..000000000
--- a/datapath/linux/compat/include/linux/net.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef __LINUX_NET_WRAPPER_H
-#define __LINUX_NET_WRAPPER_H 1
-
-#include_next <linux/net.h>
-#include <linux/types.h>
-
-#ifndef net_ratelimited_function
-#define net_ratelimited_function(function, ...) \
-do { \
- if (net_ratelimit()) \
- function(__VA_ARGS__); \
-} while (0)
-
-#define net_emerg_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_emerg, fmt, ##__VA_ARGS__)
-#define net_alert_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_alert, fmt, ##__VA_ARGS__)
-#define net_crit_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_crit, fmt, ##__VA_ARGS__)
-#define net_err_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_err, fmt, ##__VA_ARGS__)
-#define net_notice_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_notice, fmt, ##__VA_ARGS__)
-#define net_warn_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
-#define net_info_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
-#define net_dbg_ratelimited(fmt, ...) \
- net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
-#endif
-
-#ifndef net_get_random_once
-#define __net_get_random_once rpl___net_get_random_once
-bool rpl___net_get_random_once(void *buf, int nbytes, bool *done,
- atomic_t *done_key);
-
-#define ___NET_RANDOM_STATIC_KEY_INIT ATOMIC_INIT(0)
-
-
-#define net_get_random_once(buf, nbytes) \
-({ \
- bool ___ret = false; \
- static bool ___done = false; \
- static atomic_t ___done_key = \
- ___NET_RANDOM_STATIC_KEY_INIT; \
- if (!atomic_read(&___done_key)) \
- ___ret = __net_get_random_once(buf, \
- nbytes, \
- &___done, \
- &___done_key); \
- ___ret; \
-})
-#endif
-
-#ifndef HAVE_SOCK_CREATE_KERN_NET
-int ovs_sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res);
-void ovs_sock_release(struct socket *sock);
-#define sock_create_kern ovs_sock_create_kern
-#define sock_release ovs_sock_release
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/netdev_features.h b/datapath/linux/compat/include/linux/netdev_features.h
deleted file mode 100644
index 411f2949b..000000000
--- a/datapath/linux/compat/include/linux/netdev_features.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __LINUX_NETDEV_FEATURES_WRAPPER_H
-#define __LINUX_NETDEV_FEATURES_WRAPPER_H
-
-#include_next <linux/netdev_features.h>
-
-#ifndef NETIF_F_GSO_GRE
-#define NETIF_F_GSO_GRE 0
-#endif
-
-#ifndef NETIF_F_GSO_GRE_CSUM
-#define NETIF_F_GSO_GRE_CSUM 0
-#else
-#define HAVE_NETIF_F_GSO_GRE_CSUM
-#endif
-
-#ifndef NETIF_F_GSO_IPIP
-#define NETIF_F_GSO_IPIP 0
-#endif
-
-#ifndef NETIF_F_GSO_SIT
-#define NETIF_F_GSO_SIT 0
-#endif
-
-#ifndef NETIF_F_CSUM_MASK
-#define NETIF_F_CSUM_MASK 0
-#endif
-
-#ifndef NETIF_F_GSO_UDP_TUNNEL
-#define NETIF_F_GSO_UDP_TUNNEL 0
-#else
-#define HAVE_NETIF_F_GSO_UDP_TUNNEL 0
-#endif
-
-#ifndef NETIF_F_GSO_UDP_TUNNEL_CSUM
-#define NETIF_F_GSO_UDP_TUNNEL_CSUM 0
-#define SKB_GSO_UDP_TUNNEL_CSUM 0
-#endif
-
-#ifndef NETIF_F_GSO_MPLS
-#define NETIF_F_GSO_MPLS 0
-#endif
-
-#ifndef NETIF_F_HW_VLAN_STAG_TX
-#define NETIF_F_HW_VLAN_STAG_TX 0
-#endif
-
-#ifndef NETIF_F_GSO_TUNNEL_REMCSUM
-#define NETIF_F_GSO_TUNNEL_REMCSUM 0
-#define SKB_GSO_TUNNEL_REMCSUM 0
-#else
-/* support for REM_CSUM is added in 3.19 but API are not defined
- * till 4.0, so turn on REMSUM support on kernel 4.0 onwards.
- */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
-#define HAVE_NETIF_F_GSO_TUNNEL_REMCSUM
-#endif
-#endif
-
-#ifndef NETIF_F_RXCSUM
-#define NETIF_F_RXCSUM 0
-#endif
-
-#ifndef NETIF_F_GSO_ENCAP_ALL
-#define NETIF_F_GSO_ENCAP_ALL (NETIF_F_GSO_GRE | \
- NETIF_F_GSO_GRE_CSUM | \
- NETIF_F_GSO_IPIP | \
- NETIF_F_GSO_SIT | \
- NETIF_F_GSO_UDP_TUNNEL | \
- NETIF_F_GSO_UDP_TUNNEL_CSUM | \
- NETIF_F_GSO_MPLS)
-#endif
-
-#ifndef HAVE_NETIF_F_GSO_GRE_CSUM
-#define SKB_GSO_GRE_CSUM 0
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
deleted file mode 100644
index 126ff23cf..000000000
--- a/datapath/linux/compat/include/linux/netdevice.h
+++ /dev/null
@@ -1,336 +0,0 @@
-#ifndef __LINUX_NETDEVICE_WRAPPER_H
-#define __LINUX_NETDEVICE_WRAPPER_H 1
-
-#include_next <linux/netdevice.h>
-#include <linux/if_bridge.h>
-
-struct net;
-
-#include <linux/version.h>
-
-#ifndef IFF_TX_SKB_SHARING
-#define IFF_TX_SKB_SHARING 0
-#endif
-
-#ifndef IFF_OVS_DATAPATH
-#define IFF_OVS_DATAPATH 0
-#else
-#define HAVE_OVS_DATAPATH
-#endif
-
-#ifndef IFF_LIVE_ADDR_CHANGE
-#define IFF_LIVE_ADDR_CHANGE 0
-#endif
-
-#ifndef IFF_OPENVSWITCH
-#define IFF_OPENVSWITCH 0
-#endif
-
-#ifndef to_net_dev
-#define to_net_dev(class) container_of(class, struct net_device, NETDEV_DEV_MEMBER)
-#endif
-
-#ifndef HAVE_NET_NAME_UNKNOWN
-#undef alloc_netdev
-#define NET_NAME_UNKNOWN 0
-#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
- alloc_netdev_mq(sizeof_priv, name, setup, 1)
-#endif
-
-#ifndef HAVE_DEV_DISABLE_LRO
-extern void dev_disable_lro(struct net_device *dev);
-#endif
-
-#ifndef HAVE_DEV_GET_BY_INDEX_RCU
-static inline struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex)
-{
- struct net_device *dev;
-
- read_lock(&dev_base_lock);
- dev = __dev_get_by_index(net, ifindex);
- read_unlock(&dev_base_lock);
-
- return dev;
-}
-#endif
-
-#ifndef NETIF_F_FSO
-#define NETIF_F_FSO 0
-#endif
-
-#ifndef HAVE_NETDEV_FEATURES_T
-typedef u32 netdev_features_t;
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
-#define OVS_USE_COMPAT_GSO_SEGMENTATION
-#endif
-
-#ifdef OVS_USE_COMPAT_GSO_SEGMENTATION
-/* define compat version to handle MPLS segmentation offload. */
-#define __skb_gso_segment rpl__skb_gso_segment
-struct sk_buff *rpl__skb_gso_segment(struct sk_buff *skb,
- netdev_features_t features,
- bool tx_path);
-
-#define skb_gso_segment rpl_skb_gso_segment
-static inline
-struct sk_buff *rpl_skb_gso_segment(struct sk_buff *skb, netdev_features_t features)
-{
- return rpl__skb_gso_segment(skb, features, true);
-}
-#endif
-
-#ifdef HAVE_NETIF_NEEDS_GSO_NETDEV
-#define netif_needs_gso rpl_netif_needs_gso
-static inline bool netif_needs_gso(struct sk_buff *skb,
- netdev_features_t features)
-{
- return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
- unlikely((skb->ip_summed != CHECKSUM_PARTIAL) &&
- (skb->ip_summed != CHECKSUM_UNNECESSARY)));
-}
-#endif
-
-#ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_PRIV
-#ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH
-static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev,
- struct net_device *upper_dev,
- void *upper_priv,
- void *upper_info, void *extack)
-{
- return netdev_master_upper_dev_link(dev, upper_dev);
-}
-#define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link
-#else /* #ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH */
-static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev,
- struct net_device *upper_dev,
- void *upper_priv,
- void *upper_info, void *extack)
-{
- return netdev_master_upper_dev_link(dev, upper_dev,
- upper_priv, upper_info);
-}
-#undef netdev_master_upper_dev_link
-#define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link
-#endif /* #else HAVE_NETDEV_MASTER_UPPER_DEV_LINK_RH */
-#else /* #ifndef HAVE_NETDEV_MASTER_UPPER_DEV_LINK_PRIV */
-#ifndef HAVE_UPPER_DEV_LINK_EXTACK
-static inline int rpl_netdev_master_upper_dev_link(struct net_device *dev,
- struct net_device *upper_dev,
- void *upper_priv,
- void *upper_info, void *extack)
-{
- return netdev_master_upper_dev_link(dev, upper_dev, upper_priv,
- upper_info);
-}
-#define netdev_master_upper_dev_link rpl_netdev_master_upper_dev_link
-#endif /* #ifndef HAVE_UPPER_DEV_LINK_EXTACK */
-#endif /* #else HAVE_NETDEV_MASTER_UPPER_DEV_LINK_PRIV */
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
-#define dev_queue_xmit rpl_dev_queue_xmit
-int rpl_dev_queue_xmit(struct sk_buff *skb);
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
-static inline struct net_device *rpl_netdev_notifier_info_to_dev(void *info)
-{
- return info;
-}
-#define netdev_notifier_info_to_dev rpl_netdev_notifier_info_to_dev
-#endif
-
-#ifndef HAVE_PCPU_SW_NETSTATS
-#define pcpu_sw_netstats pcpu_tstats
-#endif
-
-#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0)
-/* Use compat version for all redhas releases */
-#undef netdev_alloc_pcpu_stats
-#endif
-
-#ifndef netdev_alloc_pcpu_stats
-#define netdev_alloc_pcpu_stats(type) \
-({ \
- typeof(type) __percpu *pcpu_stats = alloc_percpu(type); \
- if (pcpu_stats) { \
- int ____i; \
- for_each_possible_cpu(____i) { \
- typeof(type) *stat; \
- stat = per_cpu_ptr(pcpu_stats, ____i); \
- u64_stats_init(&stat->syncp); \
- } \
- } \
- pcpu_stats; \
-})
-#endif
-
-#ifndef HAVE_DEV_RECURSION_LEVEL
-static inline bool dev_recursion_level(void) { return false; }
-#endif
-
-#ifndef NET_NAME_USER
-#define NET_NAME_USER 3
-#endif
-
-#ifndef HAVE_GRO_REMCSUM
-struct gro_remcsum {
-};
-
-#define skb_gro_remcsum_init(grc)
-#define skb_gro_remcsum_cleanup(a1, a2)
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
-
-#define skb_gro_remcsum_process rpl_skb_gro_remcsum_process
-static inline void *skb_gro_remcsum_process(struct sk_buff *skb, void *ptr,
- unsigned int off, size_t hdrlen,
- int start, int offset,
- struct gro_remcsum *grc,
- bool nopartial)
-{
- __wsum delta;
- size_t plen = hdrlen + max_t(size_t, offset + sizeof(u16), start);
-
- BUG_ON(!NAPI_GRO_CB(skb)->csum_valid);
-
- if (!nopartial) {
- NAPI_GRO_CB(skb)->gro_remcsum_start = off + hdrlen + start;
- return ptr;
- }
-
- ptr = skb_gro_header_fast(skb, off);
- if (skb_gro_header_hard(skb, off + plen)) {
- ptr = skb_gro_header_slow(skb, off + plen, off);
- if (!ptr)
- return NULL;
- }
-
- delta = remcsum_adjust(ptr + hdrlen, NAPI_GRO_CB(skb)->csum,
- start, offset);
-
- /* Adjust skb->csum since we changed the packet */
- NAPI_GRO_CB(skb)->csum = csum_add(NAPI_GRO_CB(skb)->csum, delta);
-
- grc->offset = off + hdrlen + offset;
- grc->delta = delta;
-
- return ptr;
-}
-#endif
-#endif
-
-#ifndef HAVE_RTNL_LINK_STATS64
-#define dev_get_stats rpl_dev_get_stats
-struct rtnl_link_stats64 *rpl_dev_get_stats(struct net_device *dev,
- struct rtnl_link_stats64 *storage);
-#endif
-
-#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7,0)
-/* Only required on RHEL 6. */
-#define dev_get_stats dev_get_stats64
-#endif
-
-#ifndef netdev_dbg
-#define netdev_dbg(__dev, format, args...) \
-do { \
- printk(KERN_DEBUG "%s ", __dev->name); \
- printk(KERN_DEBUG format, ##args); \
-} while (0)
-#endif
-
-#ifndef netdev_info
-#define netdev_info(__dev, format, args...) \
-do { \
- printk(KERN_INFO "%s ", __dev->name); \
- printk(KERN_INFO format, ##args); \
-} while (0)
-
-#endif
-
-#ifndef USE_UPSTREAM_TUNNEL
-#define dev_fill_metadata_dst ovs_dev_fill_metadata_dst
-int ovs_dev_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-#endif
-
-#ifndef NETDEV_OFFLOAD_PUSH_VXLAN
-#define NETDEV_OFFLOAD_PUSH_VXLAN 0x001C
-#endif
-
-#ifndef NETDEV_OFFLOAD_PUSH_GENEVE
-#define NETDEV_OFFLOAD_PUSH_GENEVE 0x001D
-#endif
-
-#ifndef HAVE_IFF_PHONY_HEADROOM
-
-#define IFF_PHONY_HEADROOM 0
-static inline unsigned netdev_get_fwd_headroom(struct net_device *dev)
-{
- return 0;
-}
-
-static inline void netdev_set_rx_headroom(struct net_device *dev, int new_hr)
-{
-}
-
-/* set the device rx headroom to the dev's default */
-static inline void netdev_reset_rx_headroom(struct net_device *dev)
-{
-}
-
-#endif
-
-#ifdef IFF_NO_QUEUE
-#define HAVE_IFF_NO_QUEUE
-#else
-#define IFF_NO_QUEUE 0
-#endif
-
-#ifndef HAVE_SKB_CSUM_HWOFFLOAD_HELP
-static inline int skb_csum_hwoffload_help(struct sk_buff *skb,
- const netdev_features_t features)
-{
- /* It's less accurate to approximate to this for older kernels, but
- * it was sufficient for a long time. If you care about ensuring that
- * upstream commit 7529390d08f0 has the same effect on older kernels,
- * consider backporting the following commits:
- * b72b5bf6a8fc ("net: introduce skb_crc32c_csum_help")
- * 43c26a1a4593 ("net: more accurate checksumming in validate_xmit_skb()")
- */
- return skb_checksum_help(skb);
-}
-#endif
-
-#ifndef HAVE_SKB_GSO_ERROR_UNWIND
-static inline void skb_gso_error_unwind(struct sk_buff *skb, __be16 protocol,
- int pulled_hlen, u16 mac_offset,
- int mac_len)
-{
- skb->protocol = protocol;
- skb->encapsulation = 1;
- skb_push(skb, pulled_hlen);
- skb_reset_transport_header(skb);
- skb->mac_header = mac_offset;
- skb->network_header = skb->mac_header + mac_len;
- skb->mac_len = mac_len;
-}
-#endif
-
-#ifndef HAVE_NETIF_KEEP_DST
-static inline void netif_keep_dst(struct net_device *dev)
-{
-}
-#endif
-
-#ifndef HAVE_DEV_CHANGE_FLAGS_TAKES_EXTACK
-static inline int rpl_dev_change_flags(struct net_device *dev,
- unsigned int flags,
- struct netlink_ext_ack *extack)
-{
- return dev_change_flags(dev, flags);
-}
-#define dev_change_flags rpl_dev_change_flags
-#endif
-
-#endif /* __LINUX_NETDEVICE_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/netfilter.h b/datapath/linux/compat/include/linux/netfilter.h
deleted file mode 100644
index a6ed6172d..000000000
--- a/datapath/linux/compat/include/linux/netfilter.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __NETFILTER_WRAPPER_H
-#define __NETFILTER_WRAPPER_H
-
-#include_next <linux/netfilter.h>
-
-#if !defined(HAVE_NF_HOOK_STATE) || !defined(HAVE_NF_HOOK_STATE_NET)
-struct rpl_nf_hook_state {
- unsigned int hook;
- u_int8_t pf;
- struct net_device *in;
- struct net_device *out;
- struct sock *sk;
- struct net *net;
- int (*okfn)(struct net *, struct sock *, struct sk_buff *);
-};
-#define nf_hook_state rpl_nf_hook_state
-#endif
-
-#endif /* __NETFILTER_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/netfilter_ipv6.h b/datapath/linux/compat/include/linux/netfilter_ipv6.h
deleted file mode 100644
index 8d896fbc5..000000000
--- a/datapath/linux/compat/include/linux/netfilter_ipv6.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __NETFILTER_IPV6_WRAPPER_H
-#define __NETFILTER_IPV6_WRAPPER_H 1
-
-#include_next <linux/netfilter_ipv6.h>
-
-#include <linux/version.h>
-#include <net/ip.h> /* For OVS_VPORT_OUTPUT_PARAMS */
-#include <net/ip6_route.h>
-
-#ifndef HAVE_NF_IPV6_OPS_FRAGMENT
-/* Try to minimise changes required to the actions.c code for calling IPv6
- * fragmentation. We can keep the fragment() API mostly the same, except that
- * the callback parameter needs to be in the form that older kernels accept.
- * We don't backport the other ipv6_ops as they're currently unused by OVS. */
-struct ovs_nf_ipv6_ops {
- int (*fragment)(struct sock *sk, struct sk_buff *skb,
- int (*output)(OVS_VPORT_OUTPUT_PARAMS));
-};
-#define nf_ipv6_ops ovs_nf_ipv6_ops
-
-static struct ovs_nf_ipv6_ops ovs_ipv6_ops = {
- .fragment = ip6_fragment,
-};
-
-static inline struct ovs_nf_ipv6_ops *ovs_nf_get_ipv6_ops(void)
-{
- return &ovs_ipv6_ops;
-}
-#define nf_get_ipv6_ops ovs_nf_get_ipv6_ops
-
-#endif /* HAVE_NF_IPV6_OPS_FRAGMENT */
-#endif /* __NETFILTER_IPV6_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/netlink.h b/datapath/linux/compat/include/linux/netlink.h
deleted file mode 100644
index a64de4ff8..000000000
--- a/datapath/linux/compat/include/linux/netlink.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __LINUX_NETLINK_WRAPPER_H
-#define __LINUX_NETLINK_WRAPPER_H 1
-
-#include <linux/skbuff.h>
-#include_next <linux/netlink.h>
-
-#ifndef NLA_TYPE_MASK
-#define NLA_F_NESTED (1 << 15)
-#define NLA_F_NET_BYTEORDER (1 << 14)
-#define NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER))
-#endif
-
-#include <net/netlink.h>
-
-#ifndef NLMSG_DEFAULT_SIZE
-#define NLMSG_DEFAULT_SIZE (NLMSG_GOODSIZE - NLMSG_HDRLEN)
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h
deleted file mode 100644
index 8bb5abdc8..000000000
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ /dev/null
@@ -1,1176 +0,0 @@
-/*
- * Copyright (c) 2007-2017 Nicira, Inc.
- *
- * This file is offered under your choice of two licenses: Apache 2.0 or GNU
- * GPL 2.0 or later. The permission statements for each of these licenses is
- * given below. You may license your modifications to this file under either
- * of these licenses or both. If you wish to license your modifications under
- * only one of these licenses, delete the permission text for the other
- * license.
- *
- * ----------------------------------------------------------------------
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ----------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA
- * ----------------------------------------------------------------------
- */
-
-#ifndef _LINUX_OPENVSWITCH_H
-#define _LINUX_OPENVSWITCH_H 1
-
-#include <linux/types.h>
-#include <linux/if_ether.h>
-
-/**
- * struct ovs_header - header for OVS Generic Netlink messages.
- * @dp_ifindex: ifindex of local port for datapath (0 to make a request not
- * specific to a datapath).
- *
- * Attributes following the header are specific to a particular OVS Generic
- * Netlink family, but all of the OVS families use this header.
- */
-
-struct ovs_header {
- int dp_ifindex;
-};
-
-/* Datapaths. */
-
-#define OVS_DATAPATH_FAMILY "ovs_datapath"
-#define OVS_DATAPATH_MCGROUP "ovs_datapath"
-
-/* V2:
- * - API users are expected to provide OVS_DP_ATTR_USER_FEATURES
- * when creating the datapath.
- */
-#define OVS_DATAPATH_VERSION 2
-
-/* First OVS datapath version to support features */
-#define OVS_DP_VER_FEATURES 2
-
-enum ovs_datapath_cmd {
- OVS_DP_CMD_UNSPEC,
- OVS_DP_CMD_NEW,
- OVS_DP_CMD_DEL,
- OVS_DP_CMD_GET,
- OVS_DP_CMD_SET
-};
-
-/**
- * enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
- * @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
- * port". This is the name of the network device whose dp_ifindex is given in
- * the &struct ovs_header. Always present in notifications. Required in
- * %OVS_DP_NEW requests. May be used as an alternative to specifying
- * dp_ifindex in other requests (with a dp_ifindex of 0).
- * @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
- * set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
- * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
- * not be sent.
- * @OVS_DP_ATTR_PER_CPU_PIDS: Per-cpu array of PIDs for upcalls when
- * OVS_DP_F_DISPATCH_UPCALL_PER_CPU feature is set.
- * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
- * datapath. Always present in notifications.
- * @OVS_DP_ATTR_MEGAFLOW_STATS: Statistics about mega flow masks usage for the
- * datapath. Always present in notifications.
- *
- * These attributes follow the &struct ovs_header within the Generic Netlink
- * payload for %OVS_DP_* commands.
- */
-enum ovs_datapath_attr {
- OVS_DP_ATTR_UNSPEC,
- OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
- OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
- OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
- OVS_DP_ATTR_MEGAFLOW_STATS, /* struct ovs_dp_megaflow_stats */
- OVS_DP_ATTR_USER_FEATURES, /* OVS_DP_F_* */
- OVS_DP_ATTR_PAD,
- OVS_DP_ATTR_MASKS_CACHE_SIZE,
- OVS_DP_ATTR_PER_CPU_PIDS, /* Netlink PIDS to receive upcalls */
- __OVS_DP_ATTR_MAX
-};
-
-#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
-
-/* All 64-bit integers within Netlink messages are 4-byte aligned only. */
-struct ovs_dp_stats {
- __u64 n_hit; /* Number of flow table matches. */
- __u64 n_missed; /* Number of flow table misses. */
- __u64 n_lost; /* Number of misses not sent to userspace. */
- __u64 n_flows; /* Number of flows present */
-};
-
-struct ovs_dp_megaflow_stats {
- __u64 n_mask_hit; /* Number of masks used for flow lookups. */
- __u32 n_masks; /* Number of masks for the datapath. */
- __u32 pad0; /* Pad for future expension. */
- __u64 n_cache_hit; /* Number of cache matches for flow lookups. */
- __u64 pad1; /* Pad for future expension. */
-};
-
-struct ovs_vport_stats {
- __u64 rx_packets; /* total packets received */
- __u64 tx_packets; /* total packets transmitted */
- __u64 rx_bytes; /* total bytes received */
- __u64 tx_bytes; /* total bytes transmitted */
- __u64 rx_errors; /* bad packets received */
- __u64 tx_errors; /* packet transmit problems */
- __u64 rx_dropped; /* no space in linux buffers */
- __u64 tx_dropped; /* no space available in linux */
-};
-
-/* Allow last Netlink attribute to be unaligned */
-#define OVS_DP_F_UNALIGNED (1 << 0)
-
-/* Allow datapath to associate multiple Netlink PIDs to each vport */
-#define OVS_DP_F_VPORT_PIDS (1 << 1)
-
-/* Allow tc offload recirc sharing */
-#define OVS_DP_F_TC_RECIRC_SHARING (1 << 2)
-
-/* Allow per-cpu dispatch of upcalls */
-#define OVS_DP_F_DISPATCH_UPCALL_PER_CPU (1 << 3)
-
-/* Fixed logical ports. */
-#define OVSP_LOCAL ((__u32)0)
-
-/* Packet transfer. */
-
-#define OVS_PACKET_FAMILY "ovs_packet"
-#define OVS_PACKET_VERSION 0x1
-
-enum ovs_packet_cmd {
- OVS_PACKET_CMD_UNSPEC,
-
- /* Kernel-to-user notifications. */
- OVS_PACKET_CMD_MISS, /* Flow table miss. */
- OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
-
- /* Userspace commands. */
- OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
-};
-
-/**
- * enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
- * @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
- * packet as received, from the start of the Ethernet header onward. For
- * %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
- * actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
- * the flow key extracted from the packet as originally received.
- * @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
- * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
- * userspace to adapt its flow setup strategy by comparing its notion of the
- * flow key against the kernel's. When used with %OVS_PACKET_CMD_EXECUTE, only
- * metadata key fields (e.g. priority, skb mark) are honored. All the packet
- * header fields are parsed from the packet instead.
- * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
- * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
- * Also used in upcall when %OVS_ACTION_ATTR_USERSPACE has optional
- * %OVS_USERSPACE_ATTR_ACTIONS attribute.
- * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
- * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
- * %OVS_USERSPACE_ATTR_USERDATA attribute, with the same length and content
- * specified there.
- * @OVS_PACKET_ATTR_EGRESS_TUN_KEY: Present for an %OVS_PACKET_CMD_ACTION
- * notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
- * %OVS_USERSPACE_ATTR_EGRESS_TUN_PORT attribute, which is sent only if the
- * output port is actually a tunnel port. Contains the output tunnel key
- * extracted from the packet as nested %OVS_TUNNEL_KEY_ATTR_* attributes.
- * @OVS_PACKET_ATTR_MRU: Present for an %OVS_PACKET_CMD_ACTION and
- * @OVS_PACKET_ATTR_LEN: Packet size before truncation.
- * %OVS_PACKET_ATTR_USERSPACE action specify the Maximum received fragment
- * size.
- *
- * These attributes follow the &struct ovs_header within the Generic Netlink
- * payload for %OVS_PACKET_* commands.
- */
-enum ovs_packet_attr {
- OVS_PACKET_ATTR_UNSPEC,
- OVS_PACKET_ATTR_PACKET, /* Packet data. */
- OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
- OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
- OVS_PACKET_ATTR_USERDATA, /* OVS_ACTION_ATTR_USERSPACE arg. */
- OVS_PACKET_ATTR_EGRESS_TUN_KEY, /* Nested OVS_TUNNEL_KEY_ATTR_*
- attributes. */
- OVS_PACKET_ATTR_UNUSED1,
- OVS_PACKET_ATTR_UNUSED2,
- OVS_PACKET_ATTR_PROBE, /* Packet operation is a feature probe,
- error logging should be suppressed. */
- OVS_PACKET_ATTR_MRU, /* Maximum received IP fragment size. */
- OVS_PACKET_ATTR_LEN, /* Packet size before truncation. */
- OVS_PACKET_ATTR_HASH, /* Packet hash. */
- __OVS_PACKET_ATTR_MAX
-};
-
-#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
-
-/* Virtual ports. */
-
-#define OVS_VPORT_FAMILY "ovs_vport"
-#define OVS_VPORT_MCGROUP "ovs_vport"
-#define OVS_VPORT_VERSION 0x1
-
-enum ovs_vport_cmd {
- OVS_VPORT_CMD_UNSPEC,
- OVS_VPORT_CMD_NEW,
- OVS_VPORT_CMD_DEL,
- OVS_VPORT_CMD_GET,
- OVS_VPORT_CMD_SET
-};
-
-enum ovs_vport_type {
- OVS_VPORT_TYPE_UNSPEC,
- OVS_VPORT_TYPE_NETDEV, /* network device */
- OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
- OVS_VPORT_TYPE_GRE, /* GRE tunnel. */
- OVS_VPORT_TYPE_VXLAN, /* VXLAN tunnel. */
- OVS_VPORT_TYPE_GENEVE, /* Geneve tunnel. */
- OVS_VPORT_TYPE_LISP = 105, /* LISP tunnel */
- OVS_VPORT_TYPE_STT = 106, /* STT tunnel */
- OVS_VPORT_TYPE_ERSPAN = 107, /* ERSPAN tunnel. */
- OVS_VPORT_TYPE_IP6ERSPAN = 108, /* ERSPAN tunnel. */
- OVS_VPORT_TYPE_IP6GRE = 109,
- OVS_VPORT_TYPE_GTPU = 110,
- OVS_VPORT_TYPE_BAREUDP = 111, /* Bareudp tunnel. */
- __OVS_VPORT_TYPE_MAX
-};
-
-#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
-
-/**
- * enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
- * @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
- * @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
- * of vport.
- * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
- * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
- * plus a null terminator.
- * @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
- * @OVS_VPORT_ATTR_UPCALL_PID: The array of Netlink socket pids in userspace
- * among which OVS_PACKET_CMD_MISS upcalls will be distributed for packets
- * received on this port. If this is a single-element array of value 0,
- * upcalls should not be sent.
- * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
- * packets sent or received through the vport.
- *
- * These attributes follow the &struct ovs_header within the Generic Netlink
- * payload for %OVS_VPORT_* commands.
- *
- * For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
- * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
- * optional; if not specified a free port number is automatically selected.
- * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
- * of vport. %OVS_VPORT_ATTR_STATS is optional and other attributes are
- * ignored.
- *
- * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
- * look up the vport to operate on; otherwise dp_idx from the &struct
- * ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
- */
-enum ovs_vport_attr {
- OVS_VPORT_ATTR_UNSPEC,
- OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
- OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
- OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
- OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
- OVS_VPORT_ATTR_UPCALL_PID, /* array of u32 Netlink socket PIDs for */
- /* receiving upcalls */
- OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
- OVS_VPORT_ATTR_PAD,
- OVS_VPORT_ATTR_IFINDEX,
- OVS_VPORT_ATTR_NETNSID,
- __OVS_VPORT_ATTR_MAX
-};
-
-#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
-
-enum {
- OVS_VXLAN_EXT_UNSPEC,
- OVS_VXLAN_EXT_GBP,
- /* place new values here to fill gap. */
- OVS_VXLAN_EXT_GPE = 8,
- __OVS_VXLAN_EXT_MAX,
-};
-
-#define OVS_VXLAN_EXT_MAX (__OVS_VXLAN_EXT_MAX - 1)
-
-enum {
- OVS_BAREUDP_EXT_UNSPEC,
- OVS_BAREUDP_EXT_MULTIPROTO_MODE,
- __OVS_BAREUDP_EXT_MAX,
-};
-
-#define OVS_BAREUDP_EXT_MAX (__OVS_BAREUDP_EXT_MAX - 1)
-
-/* OVS_VPORT_ATTR_OPTIONS attributes for tunnels.
- */
-enum {
- OVS_TUNNEL_ATTR_UNSPEC,
- OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */
- OVS_TUNNEL_ATTR_EXTENSION,
- __OVS_TUNNEL_ATTR_MAX
-};
-
-#define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1)
-
-/* Flows. */
-
-#define OVS_FLOW_FAMILY "ovs_flow"
-#define OVS_FLOW_MCGROUP "ovs_flow"
-#define OVS_FLOW_VERSION 0x1
-
-enum ovs_flow_cmd {
- OVS_FLOW_CMD_UNSPEC,
- OVS_FLOW_CMD_NEW,
- OVS_FLOW_CMD_DEL,
- OVS_FLOW_CMD_GET,
- OVS_FLOW_CMD_SET
-};
-
-struct ovs_flow_stats {
- __u64 n_packets; /* Number of matched packets. */
- __u64 n_bytes; /* Number of matched bytes. */
-};
-
-enum ovs_key_attr {
- OVS_KEY_ATTR_UNSPEC,
- OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
- OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
- OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
- OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
- OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
- OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
- OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
- OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
- OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
- OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
- OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
- OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
- OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
- OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
- OVS_KEY_ATTR_SKB_MARK, /* u32 skb mark */
- OVS_KEY_ATTR_TUNNEL, /* Nested set of ovs_tunnel attributes */
- OVS_KEY_ATTR_SCTP, /* struct ovs_key_sctp */
- OVS_KEY_ATTR_TCP_FLAGS, /* be16 TCP flags. */
- OVS_KEY_ATTR_DP_HASH, /* u32 hash value. Value 0 indicates the hash
- is not computed by the datapath. */
- OVS_KEY_ATTR_RECIRC_ID, /* u32 recirc id */
- OVS_KEY_ATTR_MPLS, /* array of struct ovs_key_mpls.
- * The implementation may restrict
- * the accepted length of the array. */
- OVS_KEY_ATTR_CT_STATE, /* u32 bitmask of OVS_CS_F_* */
- OVS_KEY_ATTR_CT_ZONE, /* u16 connection tracking zone. */
- OVS_KEY_ATTR_CT_MARK, /* u32 connection tracking mark */
- OVS_KEY_ATTR_CT_LABELS, /* 16-octet connection tracking labels */
- OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV4, /* struct ovs_key_ct_tuple_ipv4 */
- OVS_KEY_ATTR_CT_ORIG_TUPLE_IPV6, /* struct ovs_key_ct_tuple_ipv6 */
- OVS_KEY_ATTR_NSH, /* Nested set of ovs_nsh_key_* */
-
- /* User space decided to squat on types 29 and 30. They are defined
- * below, but should not be sent to the kernel.
- *
- * WARNING: No new types should be added unless they are defined
- * for both kernel and user space (no 'ifdef's). It's hard
- * to keep compatibility otherwise.
- */
- OVS_KEY_ATTR_PACKET_TYPE, /* be32 packet type */
- OVS_KEY_ATTR_ND_EXTENSIONS, /* struct ovs_key_nd_extensions */
-
- OVS_KEY_ATTR_TUNNEL_INFO, /* struct ip_tunnel_info.
- * For in-kernel use only.
- */
- __OVS_KEY_ATTR_MAX
-};
-
-#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
-
-enum ovs_tunnel_key_attr {
- OVS_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */
- OVS_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */
- OVS_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */
- OVS_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */
- OVS_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */
- OVS_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */
- OVS_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */
- OVS_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */
- OVS_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */
- OVS_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */
- OVS_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */
- OVS_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested OVS_VXLAN_EXT_* */
- OVS_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */
- OVS_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */
- OVS_TUNNEL_KEY_ATTR_PAD,
- OVS_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */
-#ifndef __KERNEL__
- /* Only used within userspace data path. */
- OVS_TUNNEL_KEY_ATTR_GTPU_OPTS, /* struct gtpu_metadata */
-#endif
- __OVS_TUNNEL_KEY_ATTR_MAX
-};
-
-#define OVS_TUNNEL_KEY_ATTR_MAX (__OVS_TUNNEL_KEY_ATTR_MAX - 1)
-
-/**
- * enum xlate_error - Different types of error during translation
- */
-
-#ifndef __KERNEL__
-enum xlate_error {
- XLATE_OK = 0,
- XLATE_BRIDGE_NOT_FOUND,
- XLATE_RECURSION_TOO_DEEP,
- XLATE_TOO_MANY_RESUBMITS,
- XLATE_STACK_TOO_DEEP,
- XLATE_NO_RECIRCULATION_CONTEXT,
- XLATE_RECIRCULATION_CONFLICT,
- XLATE_TOO_MANY_MPLS_LABELS,
- XLATE_INVALID_TUNNEL_METADATA,
- XLATE_UNSUPPORTED_PACKET_TYPE,
- XLATE_CONGESTION_DROP,
- XLATE_FORWARDING_DISABLED,
- XLATE_MAX,
-};
-#endif
-
-/**
- * enum ovs_frag_type - IPv4 and IPv6 fragment type
- * @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
- * @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
- * @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
- *
- * Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
- * ovs_key_ipv6.
- */
-enum ovs_frag_type {
- OVS_FRAG_TYPE_NONE,
- OVS_FRAG_TYPE_FIRST,
- OVS_FRAG_TYPE_LATER,
- __OVS_FRAG_TYPE_MAX
-};
-
-#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
-
-struct ovs_key_ethernet {
- __u8 eth_src[ETH_ALEN];
- __u8 eth_dst[ETH_ALEN];
-};
-
-struct ovs_key_mpls {
- __be32 mpls_lse;
-};
-
-struct ovs_key_ipv4 {
- __be32 ipv4_src;
- __be32 ipv4_dst;
- __u8 ipv4_proto;
- __u8 ipv4_tos;
- __u8 ipv4_ttl;
- __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
-};
-
-struct ovs_key_ipv6 {
- __be32 ipv6_src[4];
- __be32 ipv6_dst[4];
- __be32 ipv6_label; /* 20-bits in least-significant bits. */
- __u8 ipv6_proto;
- __u8 ipv6_tclass;
- __u8 ipv6_hlimit;
- __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
-};
-
-struct ovs_key_tcp {
- __be16 tcp_src;
- __be16 tcp_dst;
-};
-
-struct ovs_key_udp {
- __be16 udp_src;
- __be16 udp_dst;
-};
-
-struct ovs_key_sctp {
- __be16 sctp_src;
- __be16 sctp_dst;
-};
-
-struct ovs_key_icmp {
- __u8 icmp_type;
- __u8 icmp_code;
-};
-
-struct ovs_key_icmpv6 {
- __u8 icmpv6_type;
- __u8 icmpv6_code;
-};
-
-struct ovs_key_arp {
- __be32 arp_sip;
- __be32 arp_tip;
- __be16 arp_op;
- __u8 arp_sha[ETH_ALEN];
- __u8 arp_tha[ETH_ALEN];
-};
-
-struct ovs_key_nd {
- __be32 nd_target[4];
- __u8 nd_sll[ETH_ALEN];
- __u8 nd_tll[ETH_ALEN];
-};
-
-#ifndef __KERNEL__
-struct ovs_key_nd_extensions {
- __be32 nd_reserved;
- __u8 nd_options_type;
-};
-#endif
-
-#define OVS_CT_LABELS_LEN_32 4
-#define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32))
-struct ovs_key_ct_labels {
- union {
- __u8 ct_labels[OVS_CT_LABELS_LEN];
- __u32 ct_labels_32[OVS_CT_LABELS_LEN_32];
- };
-};
-
-enum ovs_nsh_key_attr {
- OVS_NSH_KEY_ATTR_UNSPEC,
- OVS_NSH_KEY_ATTR_BASE, /* struct ovs_nsh_key_base. */
- OVS_NSH_KEY_ATTR_MD1, /* struct ovs_nsh_key_md1. */
- OVS_NSH_KEY_ATTR_MD2, /* variable-length octets. */
- __OVS_NSH_KEY_ATTR_MAX
-};
-
-#define OVS_NSH_KEY_ATTR_MAX (__OVS_NSH_KEY_ATTR_MAX - 1)
-
-struct ovs_nsh_key_base {
- __u8 flags;
- __u8 ttl;
- __u8 mdtype;
- __u8 np;
- __be32 path_hdr;
-};
-
-#define NSH_MD1_CONTEXT_SIZE 4
-
-struct ovs_nsh_key_md1 {
- __be32 context[NSH_MD1_CONTEXT_SIZE];
-};
-
-/* OVS_KEY_ATTR_CT_STATE flags */
-#define OVS_CS_F_NEW 0x01 /* Beginning of a new connection. */
-#define OVS_CS_F_ESTABLISHED 0x02 /* Part of an existing connection. */
-#define OVS_CS_F_RELATED 0x04 /* Related to an established
- * connection. */
-#define OVS_CS_F_REPLY_DIR 0x08 /* Flow is in the reply direction. */
-#define OVS_CS_F_INVALID 0x10 /* Could not track connection. */
-#define OVS_CS_F_TRACKED 0x20 /* Conntrack has occurred. */
-#define OVS_CS_F_SRC_NAT 0x40 /* Packet's source address/port was
- mangled by NAT. */
-#define OVS_CS_F_DST_NAT 0x80 /* Packet's destination address/port
- was mangled by NAT. */
-
-#define OVS_CS_F_NAT_MASK (OVS_CS_F_SRC_NAT | OVS_CS_F_DST_NAT)
-
-struct ovs_key_ct_tuple_ipv4 {
- __be32 ipv4_src;
- __be32 ipv4_dst;
- __be16 src_port;
- __be16 dst_port;
- __u8 ipv4_proto;
-};
-
-struct ovs_key_ct_tuple_ipv6 {
- __be32 ipv6_src[4];
- __be32 ipv6_dst[4];
- __be16 src_port;
- __be16 dst_port;
- __u8 ipv6_proto;
-};
-
-/**
- * enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
- * @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
- * key. Always present in notifications. Required for all requests (except
- * dumps).
- * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
- * the actions to take for packets that match the key. Always present in
- * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
- * %OVS_FLOW_CMD_SET requests. An %OVS_FLOW_CMD_SET without
- * %OVS_FLOW_ATTR_ACTIONS will not modify the actions. To clear the actions,
- * an %OVS_FLOW_ATTR_ACTIONS without any nested attributes must be given.
- * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
- * flow. Present in notifications if the stats would be nonzero. Ignored in
- * requests.
- * @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
- * TCP flags seen on packets in this flow. Only present in notifications for
- * TCP flows, and only if it would be nonzero. Ignored in requests.
- * @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
- * the system monotonic clock, at which a packet was last processed for this
- * flow. Only present in notifications if a packet has been processed for this
- * flow. Ignored in requests.
- * @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
- * last-used time, accumulated TCP flags, and statistics for this flow.
- * Otherwise ignored in requests. Never present in notifications.
- * @OVS_FLOW_ATTR_MASK: Nested %OVS_KEY_ATTR_* attributes specifying the
- * mask bits for wildcarded flow match. Mask bit value '1' specifies exact
- * match with corresponding flow key bit, while mask bit value '0' specifies
- * a wildcarded match. Omitting attribute is treated as wildcarding all
- * corresponding fields. Optional for all requests. If not present,
- * all flow key bits are exact match bits.
- * @OVS_FLOW_ATTR_UFID: A value between 1-16 octets specifying a unique
- * identifier for the flow. Causes the flow to be indexed by this value rather
- * than the value of the %OVS_FLOW_ATTR_KEY attribute. Optional for all
- * requests. Present in notifications if the flow was created with this
- * attribute.
- * @OVS_FLOW_ATTR_UFID_FLAGS: A 32-bit value of OR'd %OVS_UFID_F_*
- * flags that provide alternative semantics for flow installation and
- * retrieval. Optional for all requests.
- *
- * These attributes follow the &struct ovs_header within the Generic Netlink
- * payload for %OVS_FLOW_* commands.
- */
-enum ovs_flow_attr {
- OVS_FLOW_ATTR_UNSPEC,
- OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
- OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
- OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
- OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
- OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
- OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
- OVS_FLOW_ATTR_MASK, /* Sequence of OVS_KEY_ATTR_* attributes. */
- OVS_FLOW_ATTR_PROBE, /* Flow operation is a feature probe, error
- * logging should be suppressed. */
- OVS_FLOW_ATTR_UFID, /* Variable length unique flow identifier. */
- OVS_FLOW_ATTR_UFID_FLAGS,/* u32 of OVS_UFID_F_*. */
- OVS_FLOW_ATTR_PAD,
- __OVS_FLOW_ATTR_MAX
-};
-
-#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
-
-/**
- * Omit attributes for notifications.
- *
- * If a datapath request contains an OVS_UFID_F_OMIT_* flag, then the datapath
- * may omit the corresponding 'ovs_flow_attr' from the response.
- */
-#define OVS_UFID_F_OMIT_KEY (1 << 0)
-#define OVS_UFID_F_OMIT_MASK (1 << 1)
-#define OVS_UFID_F_OMIT_ACTIONS (1 << 2)
-
-/**
- * enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
- * @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
- * @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
- * %UINT32_MAX samples all packets and intermediate values sample intermediate
- * fractions of packets.
- * @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
- * Actions are passed as nested attributes.
- *
- * Executes the specified actions with the given probability on a per-packet
- * basis.
- */
-enum ovs_sample_attr {
- OVS_SAMPLE_ATTR_UNSPEC,
- OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
- OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
- __OVS_SAMPLE_ATTR_MAX,
-
-#ifdef __KERNEL__
- OVS_SAMPLE_ATTR_ARG /* struct sample_arg */
-#endif
-};
-
-#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
-
-#ifdef __KERNEL__
-struct sample_arg {
- bool exec; /* When true, actions in sample will not
- * change flow keys. False otherwise.
- */
- u32 probability; /* Same value as
- * 'OVS_SAMPLE_ATTR_PROBABILITY'.
- */
-};
-#endif
-
-/**
- * enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
- * @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
- * message should be sent. Required.
- * @OVS_USERSPACE_ATTR_USERDATA: If present, its variable-length argument is
- * copied to the %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA.
- * @OVS_USERSPACE_ATTR_EGRESS_TUN_PORT: If present, u32 output port to get
- * tunnel info.
- * @OVS_USERSPACE_ATTR_ACTIONS: If present, send actions with upcall.
- */
-enum ovs_userspace_attr {
- OVS_USERSPACE_ATTR_UNSPEC,
- OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
- OVS_USERSPACE_ATTR_USERDATA, /* Optional user-specified cookie. */
- OVS_USERSPACE_ATTR_EGRESS_TUN_PORT, /* Optional, u32 output port
- * to get tunnel info. */
- OVS_USERSPACE_ATTR_ACTIONS, /* Optional flag to get actions. */
- __OVS_USERSPACE_ATTR_MAX
-};
-
-#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
-
-struct ovs_action_trunc {
- uint32_t max_len; /* Max packet size in bytes. */
-};
-
-/**
- * struct ovs_action_push_mpls - %OVS_ACTION_ATTR_PUSH_MPLS action argument.
- * @mpls_lse: MPLS label stack entry to push.
- * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame.
- *
- * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and
- * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected.
- */
-struct ovs_action_push_mpls {
- __be32 mpls_lse;
- __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
-};
-
-/**
- * struct ovs_action_add_mpls - %OVS_ACTION_ATTR_ADD_MPLS action
- * argument.
- * @mpls_lse: MPLS label stack entry to push.
- * @mpls_ethertype: Ethertype to set in the encapsulating ethernet frame.
- * @tun_flags: MPLS tunnel attributes.
- *
- * The only values @mpls_ethertype should ever be given are %ETH_P_MPLS_UC and
- * %ETH_P_MPLS_MC, indicating MPLS unicast or multicast. Other are rejected.
- */
-struct ovs_action_add_mpls {
- __be32 mpls_lse;
- __be16 mpls_ethertype; /* Either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC */
- __u16 tun_flags;
-};
-
-#define OVS_MPLS_L3_TUNNEL_FLAG_MASK (1 << 0) /* Flag to specify the place of
- * insertion of MPLS header.
- * When false, the MPLS header
- * will be inserted at the start
- * of the packet.
- * When true, the MPLS header
- * will be inserted at the start
- * of the l3 header.
- */
-
-/**
- * struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
- * @vlan_tpid: Tag protocol identifier (TPID) to push.
- * @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
- * (but it will not be set in the 802.1Q header that is pushed).
- *
- * The @vlan_tpid value is typically %ETH_P_8021Q or %ETH_P_8021AD.
- * The only acceptable TPID values are those that the kernel module also parses
- * as 802.1Q or 802.1AD headers, to prevent %OVS_ACTION_ATTR_PUSH_VLAN followed
- * by %OVS_ACTION_ATTR_POP_VLAN from having surprising results.
- */
-struct ovs_action_push_vlan {
- __be16 vlan_tpid; /* 802.1Q or 802.1ad TPID. */
- __be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
-};
-
-/* Data path hash algorithm for computing Datapath hash.
- *
- * The algorithm type only specifies the fields in a flow
- * will be used as part of the hash. Each datapath is free
- * to use its own hash algorithm. The hash value will be
- * opaque to the user space daemon.
- */
-enum ovs_hash_alg {
- OVS_HASH_ALG_L4,
-#ifndef __KERNEL__
- OVS_HASH_ALG_SYM_L4,
-#endif
- __OVS_HASH_MAX
-};
-
-/*
- * struct ovs_action_hash - %OVS_ACTION_ATTR_HASH action argument.
- * @hash_alg: Algorithm used to compute hash prior to recirculation.
- * @hash_basis: basis used for computing hash.
- */
-struct ovs_action_hash {
- uint32_t hash_alg; /* One of ovs_hash_alg. */
- uint32_t hash_basis;
-};
-
-#ifndef __KERNEL__
-#define TNL_PUSH_HEADER_SIZE 512
-
-/*
- * struct ovs_action_push_tnl - %OVS_ACTION_ATTR_TUNNEL_PUSH
- * @tnl_port: To identify tunnel port to pass header info.
- * @out_port: Physical port to send encapsulated packet.
- * @header_len: Length of the header to be pushed.
- * @tnl_type: This is only required to format this header. Otherwise
- * ODP layer can not parse %header.
- * @header: Partial header for the tunnel. Tunnel push action can use
- * this header to build final header according to actual packet parameters.
- */
-struct ovs_action_push_tnl {
- odp_port_t tnl_port;
- odp_port_t out_port;
- uint32_t header_len;
- uint32_t tnl_type; /* For logging. */
- uint32_t header[TNL_PUSH_HEADER_SIZE / 4];
-};
-#endif
-
-/**
- * enum ovs_ct_attr - Attributes for %OVS_ACTION_ATTR_CT action.
- * @OVS_CT_ATTR_COMMIT: If present, commits the connection to the conntrack
- * table. This allows future packets for the same connection to be identified
- * as 'established' or 'related'. The flow key for the current packet will
- * retain the pre-commit connection state.
- * @OVS_CT_ATTR_ZONE: u16 connection tracking zone.
- * @OVS_CT_ATTR_MARK: u32 value followed by u32 mask. For each bit set in the
- * mask, the corresponding bit in the value is copied to the connection
- * tracking mark field in the connection.
- * @OVS_CT_ATTR_LABELS: %OVS_CT_LABELS_LEN value followed by %OVS_CT_LABELS_LEN
- * mask. For each bit set in the mask, the corresponding bit in the value is
- * copied to the connection tracking label field in the connection.
- * @OVS_CT_ATTR_HELPER: variable length string defining conntrack ALG.
- * @OVS_CT_ATTR_NAT: Nested OVS_NAT_ATTR_* for performing L3 network address
- * translation (NAT) on the packet.
- * @OVS_CT_ATTR_FORCE_COMMIT: Like %OVS_CT_ATTR_COMMIT, but instead of doing
- * nothing if the connection is already committed will check that the current
- * packet is in conntrack entry's original direction. If directionality does
- * not match, will delete the existing conntrack entry and create a new one.
- * @OVS_CT_ATTR_EVENTMASK: Mask of bits indicating which conntrack event types
- * (enum ip_conntrack_events IPCT_*) should be reported. For any bit set to
- * zero, the corresponding event type is not generated. Default behavior
- * depends on system configuration, but typically all event types are
- * generated, hence listening on NFNLGRP_CONNTRACK_UPDATE events may get a lot
- * of events. Explicitly passing this attribute allows limiting the updates
- * received to the events of interest. The bit 1 << IPCT_NEW, 1 <<
- * IPCT_RELATED, and 1 << IPCT_DESTROY must be set to ones for those events to
- * be received on NFNLGRP_CONNTRACK_NEW and NFNLGRP_CONNTRACK_DESTROY groups,
- * respectively. Remaining bits control the changes for which an event is
- * delivered on the NFNLGRP_CONNTRACK_UPDATE group.
- * @OVS_CT_ATTR_TIMEOUT: Variable length string defining conntrack timeout.
- */
-enum ovs_ct_attr {
- OVS_CT_ATTR_UNSPEC,
- OVS_CT_ATTR_COMMIT, /* No argument, commits connection. */
- OVS_CT_ATTR_ZONE, /* u16 zone id. */
- OVS_CT_ATTR_MARK, /* mark to associate with this connection. */
- OVS_CT_ATTR_LABELS, /* label to associate with this connection. */
- OVS_CT_ATTR_HELPER, /* netlink helper to assist detection of
- related connections. */
- OVS_CT_ATTR_NAT, /* Nested OVS_NAT_ATTR_* */
- OVS_CT_ATTR_FORCE_COMMIT, /* No argument */
- OVS_CT_ATTR_EVENTMASK, /* u32 mask of IPCT_* events. */
- OVS_CT_ATTR_TIMEOUT, /* Associate timeout with this connection for
- * fine-grain timeout tuning. */
-
- __OVS_CT_ATTR_MAX
-};
-
-#define OVS_CT_ATTR_MAX (__OVS_CT_ATTR_MAX - 1)
-
-/*
- * struct ovs_action_push_eth - %OVS_ACTION_ATTR_PUSH_ETH action argument.
- * @addresses: Source and destination MAC addresses.
- */
-struct ovs_action_push_eth {
- struct ovs_key_ethernet addresses;
-};
-
-/**
- * enum ovs_nat_attr - Attributes for %OVS_CT_ATTR_NAT.
- *
- * @OVS_NAT_ATTR_SRC: Flag for Source NAT (mangle source address/port).
- * @OVS_NAT_ATTR_DST: Flag for Destination NAT (mangle destination
- * address/port). Only one of (@OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST) may be
- * specified. Effective only for packets for ct_state NEW connections.
- * Committed connections are mangled by the NAT action according to the
- * committed NAT type regardless of the flags specified. As a corollary, a NAT
- * action without a NAT type flag will only mangle packets of committed
- * connections. The following NAT attributes only apply for NEW connections,
- * and they may be included only when the CT action has the @OVS_CT_ATTR_COMMIT
- * flag and either @OVS_NAT_ATTR_SRC, @OVS_NAT_ATTR_DST is also included.
- * @OVS_NAT_ATTR_IP_MIN: struct in_addr or struct in6_addr
- * @OVS_NAT_ATTR_IP_MAX: struct in_addr or struct in6_addr
- * @OVS_NAT_ATTR_PROTO_MIN: u16 L4 protocol specific lower boundary (port)
- * @OVS_NAT_ATTR_PROTO_MAX: u16 L4 protocol specific upper boundary (port)
- * @OVS_NAT_ATTR_PERSISTENT: Flag for persistent IP mapping across reboots
- * @OVS_NAT_ATTR_PROTO_HASH: Flag for pseudo random L4 port mapping (MD5)
- * @OVS_NAT_ATTR_PROTO_RANDOM: Flag for fully randomized L4 port mapping
- */
-enum ovs_nat_attr {
- OVS_NAT_ATTR_UNSPEC,
- OVS_NAT_ATTR_SRC,
- OVS_NAT_ATTR_DST,
- OVS_NAT_ATTR_IP_MIN,
- OVS_NAT_ATTR_IP_MAX,
- OVS_NAT_ATTR_PROTO_MIN,
- OVS_NAT_ATTR_PROTO_MAX,
- OVS_NAT_ATTR_PERSISTENT,
- OVS_NAT_ATTR_PROTO_HASH,
- OVS_NAT_ATTR_PROTO_RANDOM,
- __OVS_NAT_ATTR_MAX,
-};
-
-#define OVS_NAT_ATTR_MAX (__OVS_NAT_ATTR_MAX - 1)
-
-/*
- * enum ovs_check_pkt_len_attr - Attributes for %OVS_ACTION_ATTR_CHECK_PKT_LEN.
- *
- * @OVS_CHECK_PKT_LEN_ATTR_PKT_LEN: u16 Packet length to check for.
- * @OVS_CHECK_PKT_LEN_ATTR_USERSPACE_COND: u8 comparison condition to send
- * the packet to userspace. One of OVS_CHECK_PKT_LEN_COND_*.
- * @OVS_CHECK_PKT_LEN_ATTR_USERPACE - Nested OVS_USERSPACE_ATTR_* actions.
- */
-enum ovs_check_pkt_len_attr {
- OVS_CHECK_PKT_LEN_ATTR_UNSPEC,
- OVS_CHECK_PKT_LEN_ATTR_PKT_LEN,
- OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_GREATER,
- OVS_CHECK_PKT_LEN_ATTR_ACTIONS_IF_LESS_EQUAL,
- __OVS_CHECK_PKT_LEN_ATTR_MAX,
-
-#ifdef __KERNEL__
- OVS_CHECK_PKT_LEN_ATTR_ARG /* struct check_pkt_len_arg */
-#endif
-};
-
-#define OVS_CHECK_PKT_LEN_ATTR_MAX (__OVS_CHECK_PKT_LEN_ATTR_MAX - 1)
-
-#ifdef __KERNEL__
-struct check_pkt_len_arg {
- u16 pkt_len; /* Same value as OVS_CHECK_PKT_LEN_ATTR_PKT_LEN'. */
- bool exec_for_greater; /* When true, actions in IF_GREATE will
- * not change flow keys. False otherwise.
- */
- bool exec_for_lesser_equal; /* When true, actions in IF_LESS_EQUAL
- * will not change flow keys. False
- * otherwise.
- */
-};
-#endif
-
-/**
- * enum ovs_action_attr - Action types.
- *
- * @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
- * @OVS_ACTION_ATTR_TRUNC: Output packet to port with truncated packet size.
- * @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
- * %OVS_USERSPACE_ATTR_* attributes.
- * @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q or 802.1ad header
- * onto the packet.
- * @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q or 802.1ad header
- * from the packet.
- * @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
- * the nested %OVS_SAMPLE_ATTR_* attributes.
- * @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
- * single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
- * value.
- * @OVS_ACTION_ATTR_SET_MASKED: Replaces the contents of an existing header. A
- * nested %OVS_KEY_ATTR_* attribute specifies a header to modify, its value,
- * and a mask. For every bit set in the mask, the corresponding bit value
- * is copied from the value to the packet header field, rest of the bits are
- * left unchanged. The non-masked value bits must be passed in as zeroes.
- * Masking is not supported for the %OVS_KEY_ATTR_TUNNEL attribute.
- * @OVS_ACTION_ATTR_RECIRC: Recirculate within the data path.
- * @OVS_ACTION_ATTR_HASH: Compute and set flow hash value.
- * @OVS_ACTION_ATTR_PUSH_MPLS: Push a new MPLS label stack entry onto the
- * top of the packets MPLS label stack. Set the ethertype of the
- * encapsulating frame to either %ETH_P_MPLS_UC or %ETH_P_MPLS_MC to
- * indicate the new packet contents.
- * @OVS_ACTION_ATTR_POP_MPLS: Pop an MPLS label stack entry off of the
- * packet's MPLS label stack. Set the encapsulating frame's ethertype to
- * indicate the new packet contents. This could potentially still be
- * %ETH_P_MPLS if the resulting MPLS label stack is not empty. If there
- * is no MPLS label stack, as determined by ethertype, no action is taken.
- * @OVS_ACTION_ATTR_CT: Track the connection. Populate the conntrack-related
- * entries in the flow key.
- * @OVS_ACTION_ATTR_PUSH_ETH: Push a new outermost Ethernet header onto the
- * packet.
- * @OVS_ACTION_ATTR_POP_ETH: Pop the outermost Ethernet header off the packet.
- * @OVS_ACTION_ATTR_CT_CLEAR: Clear conntrack state from the packet.
- * @OVS_ACTION_ATTR_PUSH_NSH: push NSH header to the packet.
- * @OVS_ACTION_ATTR_POP_NSH: pop the outermost NSH header off the packet.
- *
- * Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
- * fields within a header are modifiable, e.g. the IPv4 protocol and fragment
- * type may not be changed.
- *
- * @OVS_ACTION_ATTR_SET_TO_MASKED: Kernel internal masked set action translated
- * from the @OVS_ACTION_ATTR_SET.
- * @OVS_ACTION_ATTR_TUNNEL_PUSH: Push tunnel header described by struct
- * ovs_action_push_tnl.
- * @OVS_ACTION_ATTR_TUNNEL_POP: Lookup tunnel port by port-no passed and pop
- * tunnel header.
- * @OVS_ACTION_ATTR_METER: Run packet through a meter, which may drop the
- * packet, or modify the packet (e.g., change the DSCP field).
- * @OVS_ACTION_ATTR_CLONE: make a copy of the packet and execute a list of
- * actions without affecting the original packet and key.
- * @OVS_ACTION_ATTR_CHECK_PKT_LEN: Check the packet length and execute a set
- * of actions if greater than the specified packet length, else execute
- * another set of actions.
- * @OVS_ACTION_ATTR_ADD_MPLS: Push a new MPLS label stack entry at the
- * start of the packet or at the start of the l3 header depending on the value
- * of l3 tunnel flag in the tun_flags field of OVS_ACTION_ATTR_ADD_MPLS
- * argument.
- * @OVS_ACTION_ATTR_DROP: Explicit drop action.
- */
-
-enum ovs_action_attr {
- OVS_ACTION_ATTR_UNSPEC,
- OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
- OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
- OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
- OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
- OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
- OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
- OVS_ACTION_ATTR_RECIRC, /* u32 recirc_id. */
- OVS_ACTION_ATTR_HASH, /* struct ovs_action_hash. */
- OVS_ACTION_ATTR_PUSH_MPLS, /* struct ovs_action_push_mpls. */
- OVS_ACTION_ATTR_POP_MPLS, /* __be16 ethertype. */
- OVS_ACTION_ATTR_SET_MASKED, /* One nested OVS_KEY_ATTR_* including
- * data immediately followed by a mask.
- * The data must be zero for the unmasked
- * bits. */
- OVS_ACTION_ATTR_CT, /* Nested OVS_CT_ATTR_* . */
- OVS_ACTION_ATTR_TRUNC, /* u32 struct ovs_action_trunc. */
- OVS_ACTION_ATTR_PUSH_ETH, /* struct ovs_action_push_eth. */
- OVS_ACTION_ATTR_POP_ETH, /* No argument. */
- OVS_ACTION_ATTR_CT_CLEAR, /* No argument. */
- OVS_ACTION_ATTR_PUSH_NSH, /* Nested OVS_NSH_KEY_ATTR_*. */
- OVS_ACTION_ATTR_POP_NSH, /* No argument. */
- OVS_ACTION_ATTR_METER, /* u32 meter number. */
- OVS_ACTION_ATTR_CLONE, /* Nested OVS_CLONE_ATTR_*. */
- OVS_ACTION_ATTR_CHECK_PKT_LEN, /* Nested OVS_CHECK_PKT_LEN_ATTR_*. */
- OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */
-
-#ifndef __KERNEL__
- OVS_ACTION_ATTR_TUNNEL_PUSH, /* struct ovs_action_push_tnl*/
- OVS_ACTION_ATTR_TUNNEL_POP, /* u32 port number. */
- OVS_ACTION_ATTR_DROP, /* u32 xlate_error. */
- OVS_ACTION_ATTR_LB_OUTPUT, /* u32 bond-id. */
-#endif
- __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted
- * from userspace. */
-
-#ifdef __KERNEL__
- OVS_ACTION_ATTR_SET_TO_MASKED, /* Kernel module internal masked
- * set action converted from
- * OVS_ACTION_ATTR_SET. */
-#endif
-};
-
-#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
-
-/* Meters. */
-#define OVS_METER_FAMILY "ovs_meter"
-#define OVS_METER_MCGROUP "ovs_meter"
-#define OVS_METER_VERSION 0x1
-
-enum ovs_meter_cmd {
- OVS_METER_CMD_UNSPEC,
- OVS_METER_CMD_FEATURES, /* Get features supported by the datapath. */
- OVS_METER_CMD_SET, /* Add or modify a meter. */
- OVS_METER_CMD_DEL, /* Delete a meter. */
- OVS_METER_CMD_GET /* Get meter stats. */
-};
-
-enum ovs_meter_attr {
- OVS_METER_ATTR_UNSPEC,
- OVS_METER_ATTR_ID, /* u32 meter ID within datapath. */
- OVS_METER_ATTR_KBPS, /* No argument. If set, units in kilobits
- * per second. Otherwise, units in
- * packets per second.
- */
- OVS_METER_ATTR_STATS, /* struct ovs_flow_stats for the meter. */
- OVS_METER_ATTR_BANDS, /* Nested attributes for meter bands. */
- OVS_METER_ATTR_USED, /* u64 msecs last used in monotonic time. */
- OVS_METER_ATTR_CLEAR, /* Flag to clear stats, used. */
- OVS_METER_ATTR_MAX_METERS, /* u32 number of meters supported. */
- OVS_METER_ATTR_MAX_BANDS, /* u32 max number of bands per meter. */
- OVS_METER_ATTR_PAD,
- __OVS_METER_ATTR_MAX
-};
-
-#define OVS_METER_ATTR_MAX (__OVS_METER_ATTR_MAX - 1)
-
-enum ovs_band_attr {
- OVS_BAND_ATTR_UNSPEC,
- OVS_BAND_ATTR_TYPE, /* u32 OVS_METER_BAND_TYPE_* constant. */
- OVS_BAND_ATTR_RATE, /* u32 band rate in meter units (see above). */
- OVS_BAND_ATTR_BURST, /* u32 burst size in meter units. */
- OVS_BAND_ATTR_STATS, /* struct ovs_flow_stats for the band. */
- __OVS_BAND_ATTR_MAX
-};
-
-#define OVS_BAND_ATTR_MAX (__OVS_BAND_ATTR_MAX - 1)
-
-enum ovs_meter_band_type {
- OVS_METER_BAND_TYPE_UNSPEC,
- OVS_METER_BAND_TYPE_DROP, /* Drop exceeding packets. */
- __OVS_METER_BAND_TYPE_MAX
-};
-
-#define OVS_METER_BAND_TYPE_MAX (__OVS_METER_BAND_TYPE_MAX - 1)
-
-/* Conntrack limit */
-#define OVS_CT_LIMIT_FAMILY "ovs_ct_limit"
-#define OVS_CT_LIMIT_MCGROUP "ovs_ct_limit"
-#define OVS_CT_LIMIT_VERSION 0x1
-
-enum ovs_ct_limit_cmd {
- OVS_CT_LIMIT_CMD_UNSPEC,
- OVS_CT_LIMIT_CMD_SET, /* Add or modify ct limit. */
- OVS_CT_LIMIT_CMD_DEL, /* Delete ct limit. */
- OVS_CT_LIMIT_CMD_GET /* Get ct limit. */
-};
-
-enum ovs_ct_limit_attr {
- OVS_CT_LIMIT_ATTR_UNSPEC,
- OVS_CT_LIMIT_ATTR_ZONE_LIMIT, /* Nested struct ovs_zone_limit. */
- __OVS_CT_LIMIT_ATTR_MAX
-};
-
-#define OVS_CT_LIMIT_ATTR_MAX (__OVS_CT_LIMIT_ATTR_MAX - 1)
-
-#define OVS_ZONE_LIMIT_DEFAULT_ZONE -1
-
-struct ovs_zone_limit {
- int zone_id;
- __u32 limit;
- __u32 count;
-};
-
-#define OVS_CLONE_ATTR_EXEC 0 /* Specify an u32 value. When nonzero,
- * actions in clone will not change flow
- * keys. False otherwise.
- */
-
-#endif /* _LINUX_OPENVSWITCH_H */
diff --git a/datapath/linux/compat/include/linux/overflow.h b/datapath/linux/compat/include/linux/overflow.h
deleted file mode 100644
index 13ae6cf6a..000000000
--- a/datapath/linux/compat/include/linux/overflow.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR MIT */
-#if defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE)
-#include_next <linux/overflow.h>
-#else
-#ifndef __LINUX_OVERFLOW_H
-#define __LINUX_OVERFLOW_H
-
-#include <linux/compiler.h>
-
-/*
- * In the fallback code below, we need to compute the minimum and
- * maximum values representable in a given type. These macros may also
- * be useful elsewhere, so we provide them outside the
- * COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW block.
- *
- * It would seem more obvious to do something like
- *
- * #define type_min(T) (T)(is_signed_type(T) ? (T)1 << (8*sizeof(T)-1) : 0)
- * #define type_max(T) (T)(is_signed_type(T) ? ((T)1 << (8*sizeof(T)-1)) - 1 : ~(T)0)
- *
- * Unfortunately, the middle expressions, strictly speaking, have
- * undefined behaviour, and at least some versions of gcc warn about
- * the type_max expression (but not if -fsanitize=undefined is in
- * effect; in that case, the warning is deferred to runtime...).
- *
- * The slightly excessive casting in type_min is to make sure the
- * macros also produce sensible values for the exotic type _Bool. [The
- * overflow checkers only almost work for _Bool, but that's
- * a-feature-not-a-bug, since people shouldn't be doing arithmetic on
- * _Bools. Besides, the gcc builtins don't allow _Bool* as third
- * argument.]
- *
- * Idea stolen from
- * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html -
- * credit to Christian Biere.
- */
-#define is_signed_type(type) (((type)(-1)) < (type)1)
-#define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type)))
-#define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T)))
-#define type_min(T) ((T)((T)-type_max(T)-(T)1))
-
-
-#ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW
-/*
- * For simplicity and code hygiene, the fallback code below insists on
- * a, b and *d having the same type (similar to the min() and max()
- * macros), whereas gcc's type-generic overflow checkers accept
- * different types. Hence we don't just make check_add_overflow an
- * alias for __builtin_add_overflow, but add type checks similar to
- * below.
- */
-#define check_add_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- __builtin_add_overflow(__a, __b, __d); \
-})
-
-#define check_sub_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- __builtin_sub_overflow(__a, __b, __d); \
-})
-
-#define check_mul_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- __builtin_mul_overflow(__a, __b, __d); \
-})
-
-#else
-
-
-/* Checking for unsigned overflow is relatively easy without causing UB. */
-#define __unsigned_add_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = __a + __b; \
- *__d < __a; \
-})
-#define __unsigned_sub_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = __a - __b; \
- __a < __b; \
-})
-/*
- * If one of a or b is a compile-time constant, this avoids a division.
- */
-#define __unsigned_mul_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = __a * __b; \
- __builtin_constant_p(__b) ? \
- __b > 0 && __a > type_max(typeof(__a)) / __b : \
- __a > 0 && __b > type_max(typeof(__b)) / __a; \
-})
-
-/*
- * For signed types, detecting overflow is much harder, especially if
- * we want to avoid UB. But the interface of these macros is such that
- * we must provide a result in *d, and in fact we must produce the
- * result promised by gcc's builtins, which is simply the possibly
- * wrapped-around value. Fortunately, we can just formally do the
- * operations in the widest relevant unsigned type (u64) and then
- * truncate the result - gcc is smart enough to generate the same code
- * with and without the (u64) casts.
- */
-
-/*
- * Adding two signed integers can overflow only if they have the same
- * sign, and overflow has happened iff the result has the opposite
- * sign.
- */
-#define __signed_add_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = (u64)__a + (u64)__b; \
- (((~(__a ^ __b)) & (*__d ^ __a)) \
- & type_min(typeof(__a))) != 0; \
-})
-
-/*
- * Subtraction is similar, except that overflow can now happen only
- * when the signs are opposite. In this case, overflow has happened if
- * the result has the opposite sign of a.
- */
-#define __signed_sub_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = (u64)__a - (u64)__b; \
- ((((__a ^ __b)) & (*__d ^ __a)) \
- & type_min(typeof(__a))) != 0; \
-})
-
-/*
- * Signed multiplication is rather hard. gcc always follows C99, so
- * division is truncated towards 0. This means that we can write the
- * overflow check like this:
- *
- * (a > 0 && (b > MAX/a || b < MIN/a)) ||
- * (a < -1 && (b > MIN/a || b < MAX/a) ||
- * (a == -1 && b == MIN)
- *
- * The redundant casts of -1 are to silence an annoying -Wtype-limits
- * (included in -Wextra) warning: When the type is u8 or u16, the
- * __b_c_e in check_mul_overflow obviously selects
- * __unsigned_mul_overflow, but unfortunately gcc still parses this
- * code and warns about the limited range of __b.
- */
-
-#define __signed_mul_overflow(a, b, d) ({ \
- typeof(a) __a = (a); \
- typeof(b) __b = (b); \
- typeof(d) __d = (d); \
- typeof(a) __tmax = type_max(typeof(a)); \
- typeof(a) __tmin = type_min(typeof(a)); \
- (void) (&__a == &__b); \
- (void) (&__a == __d); \
- *__d = (u64)__a * (u64)__b; \
- (__b > 0 && (__a > __tmax/__b || __a < __tmin/__b)) || \
- (__b < (typeof(__b))-1 && (__a > __tmin/__b || __a < __tmax/__b)) || \
- (__b == (typeof(__b))-1 && __a == __tmin); \
-})
-
-
-#define check_add_overflow(a, b, d) \
- __builtin_choose_expr(is_signed_type(typeof(a)), \
- __signed_add_overflow(a, b, d), \
- __unsigned_add_overflow(a, b, d))
-
-#define check_sub_overflow(a, b, d) \
- __builtin_choose_expr(is_signed_type(typeof(a)), \
- __signed_sub_overflow(a, b, d), \
- __unsigned_sub_overflow(a, b, d))
-
-#define check_mul_overflow(a, b, d) \
- __builtin_choose_expr(is_signed_type(typeof(a)), \
- __signed_mul_overflow(a, b, d), \
- __unsigned_mul_overflow(a, b, d))
-
-
-#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
-
-/** check_shl_overflow() - Calculate a left-shifted value and check overflow
- *
- * @a: Value to be shifted
- * @s: How many bits left to shift
- * @d: Pointer to where to store the result
- *
- * Computes *@d = (@a << @s)
- *
- * Returns true if '*d' cannot hold the result or when 'a << s' doesn't
- * make sense. Example conditions:
- * - 'a << s' causes bits to be lost when stored in *d.
- * - 's' is garbage (e.g. negative) or so large that the result of
- * 'a << s' is guaranteed to be 0.
- * - 'a' is negative.
- * - 'a << s' sets the sign bit, if any, in '*d'.
- *
- * '*d' will hold the results of the attempted shift, but is not
- * considered "safe for use" if false is returned.
- */
-#define check_shl_overflow(a, s, d) ({ \
- typeof(a) _a = a; \
- typeof(s) _s = s; \
- typeof(d) _d = d; \
- u64 _a_full = _a; \
- unsigned int _to_shift = \
- _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \
- *_d = (_a_full << _to_shift); \
- (_to_shift != _s || *_d < 0 || _a < 0 || \
- (*_d >> _to_shift) != _a); \
-})
-
-/**
- * array_size() - Calculate size of 2-dimensional array.
- *
- * @a: dimension one
- * @b: dimension two
- *
- * Calculates size of 2-dimensional array: @a * @b.
- *
- * Returns: number of bytes needed to represent the array or SIZE_MAX on
- * overflow.
- */
-static inline __must_check size_t array_size(size_t a, size_t b)
-{
- size_t bytes;
-
- if (check_mul_overflow(a, b, &bytes))
- return SIZE_MAX;
-
- return bytes;
-}
-
-/**
- * array3_size() - Calculate size of 3-dimensional array.
- *
- * @a: dimension one
- * @b: dimension two
- * @c: dimension three
- *
- * Calculates size of 3-dimensional array: @a * @b * @c.
- *
- * Returns: number of bytes needed to represent the array or SIZE_MAX on
- * overflow.
- */
-static inline __must_check size_t array3_size(size_t a, size_t b, size_t c)
-{
- size_t bytes;
-
- if (check_mul_overflow(a, b, &bytes))
- return SIZE_MAX;
- if (check_mul_overflow(bytes, c, &bytes))
- return SIZE_MAX;
-
- return bytes;
-}
-
-static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
-{
- size_t bytes;
-
- if (check_mul_overflow(n, size, &bytes))
- return SIZE_MAX;
- if (check_add_overflow(bytes, c, &bytes))
- return SIZE_MAX;
-
- return bytes;
-}
-
-/**
- * struct_size() - Calculate size of structure with trailing array.
- * @p: Pointer to the structure.
- * @member: Name of the array member.
- * @n: Number of elements in the array.
- *
- * Calculates size of memory needed for structure @p followed by an
- * array of @n @member elements.
- *
- * Return: number of bytes needed or SIZE_MAX on overflow.
- */
-#define struct_size(p, member, n) \
- __ab_c_size(n, \
- sizeof(*(p)->member) + __must_be_array((p)->member),\
- sizeof(*(p)))
-
-#endif /* __LINUX_OVERFLOW_H */
-#endif /* defined(HAVE_OVERFLOW_H) && defined(HAVE_STRUCT_SIZE) */
diff --git a/datapath/linux/compat/include/linux/percpu.h b/datapath/linux/compat/include/linux/percpu.h
deleted file mode 100644
index a039142e2..000000000
--- a/datapath/linux/compat/include/linux/percpu.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __LINUX_PERCPU_WRAPPER_H
-#define __LINUX_PERCPU_WRAPPER_H 1
-
-#include_next <linux/percpu.h>
-
-#if !defined this_cpu_ptr
-#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
-#endif
-
-#if !defined this_cpu_read
-#define this_cpu_read(ptr) percpu_read(ptr)
-#endif
-
-#if !defined this_cpu_inc
-#define this_cpu_inc(ptr) percpu_add(ptr, 1)
-#endif
-
-#if !defined this_cpu_dec
-#define this_cpu_dec(ptr) percpu_sub(ptr, 1)
-#endif
-
-#ifndef alloc_percpu_gfp
-#define NEED_ALLOC_PERCPU_GFP
-
-void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp);
-
-#define alloc_percpu_gfp(type, gfp) \
- (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type), \
- __alignof__(type), gfp)
-#endif
-
-
-#endif
diff --git a/datapath/linux/compat/include/linux/random.h b/datapath/linux/compat/include/linux/random.h
deleted file mode 100644
index 5c088a2d8..000000000
--- a/datapath/linux/compat/include/linux/random.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __LINUX_RANDOM_WRAPPER_H
-#define __LINUX_RANDOM_WRAPPER_H 1
-
-#include_next <linux/random.h>
-
-#ifndef HAVE_PRANDOM_U32
-#define prandom_u32() random32()
-#endif
-
-#ifndef HAVE_PRANDOM_U32_MAX
-static inline u32 prandom_u32_max(u32 ep_ro)
-{
- return (u32)(((u64) prandom_u32() * ep_ro) >> 32);
-}
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/rbtree.h b/datapath/linux/compat/include/linux/rbtree.h
deleted file mode 100644
index dbf20ff0e..000000000
--- a/datapath/linux/compat/include/linux/rbtree.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __LINUX_RBTREE_WRAPPER_H
-#define __LINUX_RBTREE_WRAPPER_H 1
-
-#include_next <linux/rbtree.h>
-
-#ifndef HAVE_RBTREE_RB_LINK_NODE_RCU
-#include <linux/rcupdate.h>
-
-static inline void rb_link_node_rcu(struct rb_node *node, struct rb_node *parent,
- struct rb_node **rb_link)
-{
- node->__rb_parent_color = (unsigned long)parent;
- node->rb_left = node->rb_right = NULL;
-
- rcu_assign_pointer(*rb_link, node);
-}
-#endif
-
-#endif /* __LINUX_RBTREE_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/rculist.h b/datapath/linux/compat/include/linux/rculist.h
deleted file mode 100644
index 40fd5e171..000000000
--- a/datapath/linux/compat/include/linux/rculist.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __LINUX_RCULIST_WRAPPER_H
-#define __LINUX_RCULIST_WRAPPER_H
-
-#include_next <linux/rculist.h>
-
-#ifndef hlist_first_rcu
-#define hlist_first_rcu(head) (*((struct hlist_node __rcu **)(&(head)->first)))
-#define hlist_next_rcu(node) (*((struct hlist_node __rcu **)(&(node)->next)))
-#define hlist_pprev_rcu(node) (*((struct hlist_node __rcu **)((node)->pprev)))
-#endif
-
-/*
- * Check during list traversal that we are within an RCU reader
- */
-
-#define check_arg_count_one(dummy)
-
-#ifdef CONFIG_PROVE_RCU_LIST
-#define __list_check_rcu(dummy, cond, extra...) \
- ({ \
- check_arg_count_one(extra); \
- RCU_LOCKDEP_WARN(!cond && !rcu_read_lock_any_held(), \
- "RCU-list traversed in non-reader section!"); \
- })
-#else
-#define __list_check_rcu(dummy, cond, extra...) \
- ({ check_arg_count_one(extra); })
-#endif
-
-#undef hlist_for_each_entry_rcu
-#define hlist_for_each_entry_rcu(pos, head, member, cond...) \
- for (__list_check_rcu(dummy, ## cond, 0), \
- pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
- typeof(*(pos)), member); \
- pos; \
- pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(\
- &(pos)->member)), typeof(*(pos)), member))
-
-#endif
diff --git a/datapath/linux/compat/include/linux/rcupdate.h b/datapath/linux/compat/include/linux/rcupdate.h
deleted file mode 100644
index 85e3c3b76..000000000
--- a/datapath/linux/compat/include/linux/rcupdate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef __RCUPDATE_WRAPPER_H
-#define __RCUPDATE_WRAPPER_H 1
-
-#include_next <linux/rcupdate.h>
-
-#ifndef rcu_dereference_check
-#define rcu_dereference_check(p, c) rcu_dereference(p)
-#endif
-
-#ifndef rcu_dereference_protected
-#define rcu_dereference_protected(p, c) (p)
-#endif
-
-#ifndef rcu_dereference_raw
-#define rcu_dereference_raw(p) rcu_dereference_check(p, 1)
-#endif
-
-#ifndef rcu_access_pointer
-#define rcu_access_pointer(p) rcu_dereference(p)
-#endif
-
-#ifndef HAVE_RCU_READ_LOCK_HELD
-static inline int rcu_read_lock_held(void)
-{
- return 1;
-}
-#endif
-
-#ifndef RCU_INITIALIZER
-#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
-#endif
-
-#ifndef RCU_INIT_POINTER
-#define RCU_INIT_POINTER(p, v) \
- do { \
- p = RCU_INITIALIZER(v); \
- } while (0)
-
-#endif
-
-#endif /* linux/rcupdate.h wrapper */
diff --git a/datapath/linux/compat/include/linux/reciprocal_div.h b/datapath/linux/compat/include/linux/reciprocal_div.h
deleted file mode 100644
index f50d8e4ee..000000000
--- a/datapath/linux/compat/include/linux/reciprocal_div.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _LINUX_RECIPROCAL_DIV_WRAPPER_H
-#define _LINUX_RECIPROCAL_DIV_WRAPPER_H 1
-
-#include <linux/types.h>
-
-/*
- * This algorithm is based on the paper "Division by Invariant
- * Integers Using Multiplication" by Torbjörn Granlund and Peter
- * L. Montgomery.
- *
- * The assembler implementation from Agner Fog, which this code is
- * based on, can be found here:
- * http://www.agner.org/optimize/asmlib.zip
- *
- * This optimization for A/B is helpful if the divisor B is mostly
- * runtime invariant. The reciprocal of B is calculated in the
- * slow-path with reciprocal_value(). The fast-path can then just use
- * a much faster multiplication operation with a variable dividend A
- * to calculate the division A/B.
- */
-
-#define reciprocal_value rpl_reciprocal_value
-struct reciprocal_value {
- u32 m;
- u8 sh1, sh2;
-};
-
-struct reciprocal_value rpl_reciprocal_value(u32 d);
-
-#define reciprocal_divide rpl_reciprocal_divide
-static inline u32 rpl_reciprocal_divide(u32 a, struct reciprocal_value R)
-{
- u32 t = (u32)(((u64)a * R.m) >> 32);
- return (t + ((a - t) >> R.sh1)) >> R.sh2;
-}
-
-#endif /* _LINUX_RECIPROCAL_DIV_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/rtnetlink.h b/datapath/linux/compat/include/linux/rtnetlink.h
deleted file mode 100644
index cd1e1a0c0..000000000
--- a/datapath/linux/compat/include/linux/rtnetlink.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef __RTNETLINK_WRAPPER_H
-#define __RTNETLINK_WRAPPER_H 1
-
-#include_next <linux/rtnetlink.h>
-
-#ifndef HAVE_LOCKDEP_RTNL_IS_HELD
-#ifdef CONFIG_PROVE_LOCKING
-static inline int lockdep_rtnl_is_held(void)
-{
- return 1;
-}
-#endif
-#endif
-
-#ifndef rcu_dereference_rtnl
-/**
- * rcu_dereference_rtnl - rcu_dereference with debug checking
- * @p: The pointer to read, prior to dereferencing
- *
- * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
- * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference()
- */
-#define rcu_dereference_rtnl(p) \
- rcu_dereference_check(p, rcu_read_lock_held() || \
- lockdep_rtnl_is_held())
-#endif
-
-#ifndef rtnl_dereference
-/**
- * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
- * @p: The pointer to read, prior to dereferencing
- *
- * Return the value of the specified RCU-protected pointer, but omit
- * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
- * caller holds RTNL.
- */
-#define rtnl_dereference(p) \
- rcu_dereference_protected(p, lockdep_rtnl_is_held())
-#endif
-
-#endif /* linux/rtnetlink.h wrapper */
diff --git a/datapath/linux/compat/include/linux/skbuff.h b/datapath/linux/compat/include/linux/skbuff.h
deleted file mode 100644
index 396a5e406..000000000
--- a/datapath/linux/compat/include/linux/skbuff.h
+++ /dev/null
@@ -1,491 +0,0 @@
-#ifndef __LINUX_SKBUFF_WRAPPER_H
-#define __LINUX_SKBUFF_WRAPPER_H 1
-
-#include <linux/version.h>
-#include <linux/types.h>
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
-/* This should be before skbuff.h to make sure that we rewrite
- * the calls there. */
-struct sk_buff;
-
-int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
- gfp_t gfp_mask);
-#define pskb_expand_head rpl_pskb_expand_head
-#endif
-
-#include_next <linux/skbuff.h>
-#include <linux/jhash.h>
-
-#ifndef HAVE_IGNORE_DF_RENAME
-#define ignore_df local_df
-#endif
-
-
-#ifndef HAVE_NULL_COMPUTE_PSEUDO
-static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto)
-{
- return 0;
-}
-#endif
-
-#ifndef HAVE_SKB_CHECKSUM_CONVERT
-static inline bool __skb_checksum_convert_check(struct sk_buff *skb)
-{
-#ifdef HAVE_SKBUFF_CSUM_VALID
- return (skb->ip_summed == CHECKSUM_NONE && skb->csum_valid);
-#else
- return skb->ip_summed == CHECKSUM_NONE;
-#endif
-}
-
-static inline void __skb_checksum_convert(struct sk_buff *skb,
- __sum16 check, __wsum pseudo)
-{
- skb->csum = ~pseudo;
- skb->ip_summed = CHECKSUM_COMPLETE;
-}
-
-#define skb_checksum_try_convert(skb, proto, check, compute_pseudo) \
-do { \
- if (__skb_checksum_convert_check(skb)) \
- __skb_checksum_convert(skb, check, \
- compute_pseudo(skb, proto)); \
-} while (0)
-
-#endif
-
-#ifndef SKB_CHECKSUM_SIMPLE_VALIDATE
-
-#ifndef __skb_checksum_validate
-#define __skb_checksum_validate(skb, proto, complete, \
- zero_okay, check, compute_pseudo) \
-({ \
- __sum16 __ret = 0; \
- __ret; \
-})
-#endif
-
-#define skb_checksum_simple_validate(skb) \
- __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo)
-#endif
-
-#ifndef HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET
-static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
- const int offset, void *to,
- const unsigned int len)
-{
- memcpy(to, skb->data + offset, len);
-}
-
-static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
- const int offset,
- const void *from,
- const unsigned int len)
-{
- memcpy(skb->data + offset, from, len);
-}
-
-#endif /* !HAVE_SKB_COPY_FROM_LINEAR_DATA_OFFSET */
-
-#ifndef HAVE_SKB_INNER_TRANSPORT_OFFSET
-static inline int skb_inner_transport_offset(const struct sk_buff *skb)
-{
- return skb_inner_transport_header(skb) - skb->data;
-}
-#endif
-
-#ifndef HAVE_SKB_RESET_TAIL_POINTER
-static inline void skb_reset_tail_pointer(struct sk_buff *skb)
-{
- skb->tail = skb->data;
-}
-#endif
-/*
- * The networking layer reserves some headroom in skb data (via
- * dev_alloc_skb). This is used to avoid having to reallocate skb data when
- * the header has to grow. In the default case, if the header has to grow
- * 16 bytes or less we avoid the reallocation.
- *
- * Unfortunately this headroom changes the DMA alignment of the resulting
- * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
- * on some architectures. An architecture can override this value,
- * perhaps setting it to a cacheline in size (since that will maintain
- * cacheline alignment of the DMA). It must be a power of 2.
- *
- * Various parts of the networking layer expect at least 16 bytes of
- * headroom, you should not reduce this.
- */
-#ifndef NET_SKB_PAD
-#define NET_SKB_PAD 16
-#endif
-
-#ifndef HAVE_SKB_COW_HEAD
-static inline int __skb_cow(struct sk_buff *skb, unsigned int headroom,
- int cloned)
-{
- int delta = 0;
-
- if (headroom < NET_SKB_PAD)
- headroom = NET_SKB_PAD;
- if (headroom > skb_headroom(skb))
- delta = headroom - skb_headroom(skb);
-
- if (delta || cloned)
- return pskb_expand_head(skb, ALIGN(delta, NET_SKB_PAD), 0,
- GFP_ATOMIC);
- return 0;
-}
-
-static inline int skb_cow_head(struct sk_buff *skb, unsigned int headroom)
-{
- return __skb_cow(skb, headroom, skb_header_cloned(skb));
-}
-#endif /* !HAVE_SKB_COW_HEAD */
-
-#ifndef HAVE_SKB_DST_ACCESSOR_FUNCS
-static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
-{
- return (struct dst_entry *)skb->dst;
-}
-
-static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
-{
- skb->dst = dst;
-}
-
-static inline struct rtable *skb_rtable(const struct sk_buff *skb)
-{
- return (struct rtable *)skb->dst;
-}
-#endif
-
-#ifndef CHECKSUM_PARTIAL
-#define CHECKSUM_PARTIAL CHECKSUM_HW
-#endif
-#ifndef CHECKSUM_COMPLETE
-#define CHECKSUM_COMPLETE CHECKSUM_HW
-#endif
-
-#ifndef HAVE_SKB_WARN_LRO
-#ifndef NETIF_F_LRO
-static inline bool skb_warn_if_lro(const struct sk_buff *skb)
-{
- return false;
-}
-#else
-extern void __skb_warn_lro_forwarding(const struct sk_buff *skb);
-
-static inline bool skb_warn_if_lro(const struct sk_buff *skb)
-{
- /* LRO sets gso_size but not gso_type, whereas if GSO is really
- * wanted then gso_type will be set. */
- struct skb_shared_info *shinfo = skb_shinfo(skb);
- if (shinfo->gso_size != 0 && unlikely(shinfo->gso_type == 0)) {
- __skb_warn_lro_forwarding(skb);
- return true;
- }
- return false;
-}
-#endif /* NETIF_F_LRO */
-#endif /* HAVE_SKB_WARN_LRO */
-
-#ifndef HAVE_CONSUME_SKB
-#define consume_skb kfree_skb
-#endif
-
-#ifndef HAVE_SKB_FRAG_PAGE
-#include <linux/mm.h>
-
-static inline struct page *skb_frag_page(const skb_frag_t *frag)
-{
- return frag->page;
-}
-
-static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
-{
- frag->page = page;
-}
-static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size)
-{
- frag->size = size;
-}
-static inline void __skb_frag_ref(skb_frag_t *frag)
-{
- get_page(skb_frag_page(frag));
-}
-static inline void __skb_frag_unref(skb_frag_t *frag)
-{
- put_page(skb_frag_page(frag));
-}
-
-static inline void skb_frag_ref(struct sk_buff *skb, int f)
-{
- __skb_frag_ref(&skb_shinfo(skb)->frags[f]);
-}
-
-static inline void skb_frag_unref(struct sk_buff *skb, int f)
-{
- __skb_frag_unref(&skb_shinfo(skb)->frags[f]);
-}
-
-#endif
-
-#ifndef HAVE_SKB_RESET_MAC_LEN
-static inline void skb_reset_mac_len(struct sk_buff *skb)
-{
- skb->mac_len = skb->network_header - skb->mac_header;
-}
-#endif
-
-#ifndef HAVE_SKB_UNCLONE
-static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
-{
- might_sleep_if(pri & __GFP_WAIT);
-
- if (skb_cloned(skb))
- return pskb_expand_head(skb, 0, 0, pri);
-
- return 0;
-}
-#endif
-
-#ifndef HAVE_SKB_ORPHAN_FRAGS
-static inline int skb_orphan_frags(struct sk_buff *skb, gfp_t gfp_mask)
-{
- return 0;
-}
-#endif
-
-#ifndef HAVE_SKB_GET_HASH
-#define skb_get_hash skb_get_rxhash
-#endif /* HAVE_SKB_GET_HASH */
-
-#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);
-#endif
-
-#ifndef HAVE_SKB_ZEROCOPY
-#define skb_zerocopy rpl_skb_zerocopy
-int rpl_skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len,
- int hlen);
-#endif
-
-#ifndef HAVE_SKB_CLEAR_HASH
-static inline void skb_clear_hash(struct sk_buff *skb)
-{
-#ifdef HAVE_RXHASH
- skb->rxhash = 0;
-#endif
- skb->l4_hash = 0;
-}
-#endif
-
-#ifndef HAVE_SKB_HAS_FRAG_LIST
-#define skb_has_frag_list skb_has_frags
-#endif
-
-#ifndef HAVE___SKB_FILL_PAGE_DESC
-static inline void __skb_fill_page_desc(struct sk_buff *skb, int i,
- struct page *page, int off, int size)
-{
- skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
-
- __skb_frag_set_page(frag, page);
- frag->page_offset = off;
- skb_frag_size_set(frag, size);
-}
-#endif
-
-#ifndef HAVE_SKB_ENSURE_WRITABLE
-#define skb_ensure_writable rpl_skb_ensure_writable
-int rpl_skb_ensure_writable(struct sk_buff *skb, int write_len);
-#endif
-
-#ifndef HAVE___SKB_VLAN_POP
-#define __skb_vlan_pop rpl___skb_vlan_pop
-int rpl___skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);
-#endif
-
-#ifndef HAVE_SKB_VLAN_POP
-#define skb_vlan_pop rpl_skb_vlan_pop
-int rpl_skb_vlan_pop(struct sk_buff *skb);
-#endif
-
-#ifndef HAVE_SKB_VLAN_PUSH
-#define skb_vlan_push rpl_skb_vlan_push
-int rpl_skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
-#endif
-
-#ifndef HAVE_KFREE_SKB_LIST
-void rpl_kfree_skb_list(struct sk_buff *segs);
-#define kfree_skb_list rpl_kfree_skb_list
-#endif
-
-#ifndef HAVE_SKB_CHECKSUM_START_OFFSET
-static inline int skb_checksum_start_offset(const struct sk_buff *skb)
-{
- return skb->csum_start - skb_headroom(skb);
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0)
-#define skb_postpull_rcsum rpl_skb_postpull_rcsum
-static inline void skb_postpull_rcsum(struct sk_buff *skb,
- const void *start, unsigned int len)
-{
- if (skb->ip_summed == CHECKSUM_COMPLETE)
- skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
- else if (skb->ip_summed == CHECKSUM_PARTIAL &&
- skb_checksum_start_offset(skb) < 0)
- skb->ip_summed = CHECKSUM_NONE;
-}
-
-#define skb_pull_rcsum rpl_skb_pull_rcsum
-static inline unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len)
-{
- unsigned char *data = skb->data;
-
- BUG_ON(len > skb->len);
- __skb_pull(skb, len);
- skb_postpull_rcsum(skb, data, len);
- return skb->data;
-}
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-#define skb_scrub_packet rpl_skb_scrub_packet
-void rpl_skb_scrub_packet(struct sk_buff *skb, bool xnet);
-#endif
-
-#define skb_pop_mac_header rpl_skb_pop_mac_header
-static inline void skb_pop_mac_header(struct sk_buff *skb)
-{
- skb->mac_header = skb->network_header;
-}
-
-#ifndef HAVE_SKB_CLEAR_HASH_IF_NOT_L4
-static inline void skb_clear_hash_if_not_l4(struct sk_buff *skb)
-{
- if (!skb->l4_hash)
- skb_clear_hash(skb);
-}
-#endif
-
-#ifndef HAVE_SKB_POSTPUSH_RCSUM
-static inline void skb_postpush_rcsum(struct sk_buff *skb,
- const void *start, unsigned int len)
-{
- /* For performing the reverse operation to skb_postpull_rcsum(),
- * we can instead of ...
- *
- * skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
- *
- * ... just use this equivalent version here to save a few
- * instructions. Feeding csum of 0 in csum_partial() and later
- * on adding skb->csum is equivalent to feed skb->csum in the
- * first place.
- */
- if (skb->ip_summed == CHECKSUM_COMPLETE)
- skb->csum = csum_partial(start, len, skb->csum);
-}
-#endif
-
-#define skb_checksum_start rpl_skb_checksum_start
-static inline unsigned char *skb_checksum_start(const struct sk_buff *skb)
-{
- return skb->head + skb->csum_start;
-}
-
-#ifndef HAVE_LCO_CSUM
-static inline __wsum lco_csum(struct sk_buff *skb)
-{
- unsigned char *csum_start = skb_checksum_start(skb);
- unsigned char *l4_hdr = skb_transport_header(skb);
- __wsum partial;
-
- /* Start with complement of inner checksum adjustment */
- partial = ~csum_unfold(*(__force __sum16 *)(csum_start +
- skb->csum_offset));
-
- /* Add in checksum of our headers (incl. outer checksum
- * adjustment filled in by caller) and return result.
- */
- return csum_partial(l4_hdr, csum_start - l4_hdr, partial);
-}
-#endif
-
-#ifndef HAVE_SKB_NFCT
-static inline struct nf_conntrack *skb_nfct(const struct sk_buff *skb)
-{
-#if IS_ENABLED(CONFIG_NF_CONNTRACK)
- return skb->nfct;
-#else
- return NULL;
-#endif
-}
-#endif
-
-#ifndef HAVE_SKB_PUT_ZERO
-static inline void *skb_put_zero(struct sk_buff *skb, unsigned int len)
-{
- void *tmp = skb_put(skb, len);
-
- memset(tmp, 0, len);
-
- return tmp;
-}
-#endif
-
-#ifndef HAVE_SKB_GSO_IPXIP6
-#define SKB_GSO_IPXIP6 (1 << 10)
-#endif
-
-#ifndef HAVE_SKB_SET_INNER_IPPROTO
-static inline void skb_set_inner_ipproto(struct sk_buff *skb,
- __u8 ipproto)
-{
-}
-#endif
-
-#ifndef HAVE_NF_RESET_CT
-#define nf_reset_ct nf_reset
-#endif
-
-#ifndef HAVE___SKB_SET_HASH
-static inline void
-__skb_set_hash(struct sk_buff *skb, __u32 hash, bool is_sw, bool is_l4)
-{
-#ifdef HAVE_RXHASH
- skb->rxhash = hash;
-#else
- skb->hash = hash;
-#endif
- skb->l4_hash = is_l4;
-#ifdef HAVE_SW_HASH
- skb->sw_hash = is_sw;
-#endif
-}
-#endif
-
-#ifndef HAVE_SKB_GET_HASH_RAW
-static inline __u32 skb_get_hash_raw(const struct sk_buff *skb)
-{
-#ifdef HAVE_RXHASH
- return skb->rxhash;
-#else
- return skb->hash;
-#endif
-}
-#endif
-
-#ifndef skb_list_walk_safe
-/* Iterate through singly-linked GSO fragments of an skb. */
-#define skb_list_walk_safe(first, skb, next_skb) \
- for ((skb) = (first), (next_skb) = (skb) ? (skb)->next : NULL; (skb); \
- (skb) = (next_skb), (next_skb) = (skb) ? (skb)->next : NULL)
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/static_key.h b/datapath/linux/compat/include/linux/static_key.h
deleted file mode 100644
index 432feccb9..000000000
--- a/datapath/linux/compat/include/linux/static_key.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef _STATIC_KEY_WRAPPER_H
-#define _STATIC_KEY_WRAPPER_H
-
-#include <linux/atomic.h>
-#include_next <linux/static_key.h>
-#ifndef HAVE_UPSTREAM_STATIC_KEY
-/*
- * This backport is based on upstream net-next commit 11276d5306b8
- * ("locking/static_keys: Add a new static_key interface").
- *
- * For kernel that does not support the new static key interface,
- * we do not backport the jump label support but the fall back version
- * of static key that is simply a conditional branch.
- */
-
-struct static_key_true {
- struct static_key key;
-};
-
-struct static_key_false {
- struct static_key key;
-};
-
-#define rpl_STATIC_KEY_INIT_TRUE { .enabled = ATOMIC_INIT(1) }
-#define rpl_STATIC_KEY_INIT_FALSE { .enabled = ATOMIC_INIT(0) }
-
-#define rpl_STATIC_KEY_TRUE_INIT \
- (struct static_key_true) { .key = rpl_STATIC_KEY_INIT_TRUE, }
-#define rpl_STATIC_KEY_FALSE_INIT \
- (struct static_key_false){ .key = rpl_STATIC_KEY_INIT_FALSE, }
-
-#define rpl_DEFINE_STATIC_KEY_TRUE(name) \
- struct static_key_true name = rpl_STATIC_KEY_TRUE_INIT
-
-#define rpl_DEFINE_STATIC_KEY_FALSE(name) \
- struct static_key_false name = rpl_STATIC_KEY_FALSE_INIT
-
-static inline int rpl_static_key_count(struct static_key *key)
-{
- return atomic_read(&key->enabled);
-}
-
-static inline void rpl_static_key_enable(struct static_key *key)
-{
- int count = rpl_static_key_count(key);
-
- WARN_ON_ONCE(count < 0 || count > 1);
-
- if (!count)
- static_key_slow_inc(key);
-}
-
-static inline void rpl_static_key_disable(struct static_key *key)
-{
- int count = rpl_static_key_count(key);
-
- WARN_ON_ONCE(count < 0 || count > 1);
-
- if (count)
- static_key_slow_dec(key);
-}
-
-#ifdef HAVE_DEFINE_STATIC_KEY
-#undef DEFINE_STATIC_KEY_TRUE
-#undef DEFINE_STATIC_KEY_FALSE
-#endif
-
-#define DEFINE_STATIC_KEY_TRUE rpl_DEFINE_STATIC_KEY_TRUE
-#define DEFINE_STATIC_KEY_FALSE rpl_DEFINE_STATIC_KEY_FALSE
-
-#define static_branch_likely(x) likely(static_key_enabled(&(x)->key))
-#define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key))
-
-#define static_branch_enable(x) rpl_static_key_enable(&(x)->key)
-#define static_branch_disable(x) rpl_static_key_disable(&(x)->key)
-
-#ifndef HAVE_DECLARE_STATIC_KEY
-#define DECLARE_STATIC_KEY_TRUE(name) \
- extern struct static_key_true name
-#define DECLARE_STATIC_KEY_FALSE(name) \
- extern struct static_key_false name
-#endif
-
-#endif /* HAVE_UPSTREAM_STATIC_KEY */
-
-#endif /* _STATIC_KEY_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/stddef.h b/datapath/linux/compat/include/linux/stddef.h
deleted file mode 100644
index 5b44c0dee..000000000
--- a/datapath/linux/compat/include/linux/stddef.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __LINUX_STDDEF_WRAPPER_H
-#define __LINUX_STDDEF_WRAPPER_H 1
-
-#include_next <linux/stddef.h>
-
-#ifdef __KERNEL__
-
-#ifndef offsetofend
-#define offsetofend(TYPE, MEMBER) \
- (offsetof(TYPE, MEMBER) + sizeof(((TYPE *)0)->MEMBER))
-#endif
-
-#endif /* __KERNEL__ */
-
-#endif
diff --git a/datapath/linux/compat/include/linux/timekeeping.h b/datapath/linux/compat/include/linux/timekeeping.h
deleted file mode 100644
index 3a3b18331..000000000
--- a/datapath/linux/compat/include/linux/timekeeping.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _LINUX_TIMEKEEPING_WRAPPER_H
-#define _LINUX_TIMEKEEPING_WRAPPER_H
-
-#ifndef HAVE_KTIME_GET_TS64
-#define ktime_get_ts64 ktime_get_ts
-#define timespec64 timespec
-#else
-#include_next <linux/timekeeping.h>
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/types.h b/datapath/linux/compat/include/linux/types.h
deleted file mode 100644
index a58623e70..000000000
--- a/datapath/linux/compat/include/linux/types.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __LINUX_TYPES_WRAPPER_H
-#define __LINUX_TYPES_WRAPPER_H 1
-
-#include_next <linux/types.h>
-
-#ifndef HAVE_CSUM_TYPES
-typedef __u16 __bitwise __sum16;
-typedef __u32 __bitwise __wsum;
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/u64_stats_sync.h b/datapath/linux/compat/include/linux/u64_stats_sync.h
deleted file mode 100644
index 9342f73d0..000000000
--- a/datapath/linux/compat/include/linux/u64_stats_sync.h
+++ /dev/null
@@ -1,155 +0,0 @@
-#ifndef _LINUX_U64_STATS_SYNC_WRAPPER_H
-#define _LINUX_U64_STATS_SYNC_WRAPPER_H
-
-#include <linux/version.h>
-
-#if defined(HAVE_U64_STATS_FETCH_BEGIN_IRQ) && \
- LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
-#include_next <linux/u64_stats_sync.h>
-#else
-
-/*
- * To properly implement 64bits network statistics on 32bit and 64bit hosts,
- * we provide a synchronization point, that is a noop on 64bit or UP kernels.
- *
- * Key points :
- * 1) Use a seqcount on SMP 32bits, with low overhead.
- * 2) Whole thing is a noop on 64bit arches or UP kernels.
- * 3) Write side must ensure mutual exclusion or one seqcount update could
- * be lost, thus blocking readers forever.
- * If this synchronization point is not a mutex, but a spinlock or
- * spinlock_bh() or disable_bh() :
- * 3.1) Write side should not sleep.
- * 3.2) Write side should not allow preemption.
- * 3.3) If applicable, interrupts should be disabled.
- *
- * 4) If reader fetches several counters, there is no guarantee the whole values
- * are consistent (remember point 1) : this is a noop on 64bit arches anyway)
- *
- * 5) readers are allowed to sleep or be preempted/interrupted : They perform
- * pure reads. But if they have to fetch many values, it's better to not allow
- * preemptions/interruptions to avoid many retries.
- *
- * 6) If counter might be written by an interrupt, readers should block interrupts.
- * (On UP, there is no seqcount_t protection, a reader allowing interrupts could
- * read partial values)
- *
- * 7) For irq or softirq uses, readers can use u64_stats_fetch_begin_irq() and
- * u64_stats_fetch_retry_irq() helpers
- *
- * Usage :
- *
- * Stats producer (writer) should use following template granted it already got
- * an exclusive access to counters (a lock is already taken, or per cpu
- * data is used [in a non preemptable context])
- *
- * spin_lock_bh(...) or other synchronization to get exclusive access
- * ...
- * u64_stats_update_begin(&stats->syncp);
- * stats->bytes64 += len; // non atomic operation
- * stats->packets64++; // non atomic operation
- * u64_stats_update_end(&stats->syncp);
- *
- * While a consumer (reader) should use following template to get consistent
- * snapshot for each variable (but no guarantee on several ones)
- *
- * u64 tbytes, tpackets;
- * unsigned int start;
- *
- * do {
- * start = u64_stats_fetch_begin(&stats->syncp);
- * tbytes = stats->bytes64; // non atomic operation
- * tpackets = stats->packets64; // non atomic operation
- * } while (u64_stats_fetch_retry(&stats->syncp, start));
- *
- *
- * Example of use in drivers/net/loopback.c, using per_cpu containers,
- * in BH disabled context.
- */
-#include <linux/seqlock.h>
-
-struct u64_stats_sync {
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- seqcount_t seq;
-#endif
-};
-
-#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
-# define u64_stats_init(syncp) seqcount_init(syncp.seq)
-#else
-# define u64_stats_init(syncp) do { } while (0)
-#endif
-
-static inline void u64_stats_update_begin(struct u64_stats_sync *syncp)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- write_seqcount_begin(&syncp->seq);
-#endif
-}
-
-static inline void u64_stats_update_end(struct u64_stats_sync *syncp)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- write_seqcount_end(&syncp->seq);
-#endif
-}
-
-static inline unsigned int u64_stats_fetch_begin(const struct u64_stats_sync *syncp)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- return read_seqcount_begin(&syncp->seq);
-#else
-#if BITS_PER_LONG==32
- preempt_disable();
-#endif
- return 0;
-#endif
-}
-
-static inline bool u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
- unsigned int start)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- return read_seqcount_retry(&syncp->seq, start);
-#else
-#if BITS_PER_LONG==32
- preempt_enable();
-#endif
- return false;
-#endif
-}
-
-/*
- * In case irq handlers can update u64 counters, readers can use following helpers
- * - SMP 32bit arches use seqcount protection, irq safe.
- * - UP 32bit must disable irqs.
- * - 64bit have no problem atomically reading u64 values, irq safe.
- */
-static inline unsigned int u64_stats_fetch_begin_irq(const struct u64_stats_sync *syncp)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- return read_seqcount_begin(&syncp->seq);
-#else
-#if BITS_PER_LONG==32
- local_irq_disable();
-#endif
- return 0;
-#endif
-}
-
-static inline bool u64_stats_fetch_retry_irq(const struct u64_stats_sync *syncp,
- unsigned int start)
-{
-#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
- return read_seqcount_retry(&syncp->seq, start);
-#else
-#if BITS_PER_LONG==32
- local_irq_enable();
-#endif
- return false;
-#endif
-}
-
-#endif /* !HAVE_U64_STATS_FETCH_BEGIN_IRQ || kernel < 3.13 */
-
-#endif /* _LINUX_U64_STATS_SYNC_WRAPPER_H */
diff --git a/datapath/linux/compat/include/linux/udp.h b/datapath/linux/compat/include/linux/udp.h
deleted file mode 100644
index 22e57d4c0..000000000
--- a/datapath/linux/compat/include/linux/udp.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __LINUX_UDP_WRAPPER_H
-#define __LINUX_UDP_WRAPPER_H 1
-
-#include_next <linux/udp.h>
-#include <linux/ipv6.h>
-
-#ifndef HAVE_NO_CHECK6_TX
-static inline void udp_set_no_check6_tx(struct sock *sk, bool val)
-{
-#ifdef HAVE_SK_NO_CHECK_TX
- sk->sk_no_check_tx = val;
-#endif
-}
-
-static inline void udp_set_no_check6_rx(struct sock *sk, bool val)
-{
-#ifdef HAVE_SK_NO_CHECK_TX
- sk->sk_no_check_rx = val;
-#else
- /* since netwroking stack is not checking for zero UDP checksum
- * check it in OVS module. */
- #define OVS_CHECK_UDP_TUNNEL_ZERO_CSUM
-#endif
-}
-#endif
-
-#ifdef OVS_CHECK_UDP_TUNNEL_ZERO_CSUM
-#define udp6_csum_zero_error rpl_udp6_csum_zero_error
-
-void rpl_udp6_csum_zero_error(struct sk_buff *skb);
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/linux/workqueue.h b/datapath/linux/compat/include/linux/workqueue.h
deleted file mode 100644
index ed573c226..000000000
--- a/datapath/linux/compat/include/linux/workqueue.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __LINUX_WORKQUEUE_WRAPPER_H
-#define __LINUX_WORKQUEUE_WRAPPER_H 1
-
-#include_next <linux/workqueue.h>
-
-#endif
diff --git a/datapath/linux/compat/include/net/checksum.h b/datapath/linux/compat/include/net/checksum.h
deleted file mode 100644
index d1f1125d1..000000000
--- a/datapath/linux/compat/include/net/checksum.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __NET_CHECKSUM_WRAPPER_H
-#define __NET_CHECKSUM_WRAPPER_H 1
-
-#include_next <net/checksum.h>
-
-#ifndef HAVE_CSUM_UNFOLD
-static inline __wsum csum_unfold(__sum16 n)
-{
- return (__force __wsum)n;
-}
-#endif /* !HAVE_CSUM_UNFOLD */
-
-/* Workaround for debugging included in certain versions of XenServer. It only
- * applies to 32-bit x86.
- */
-#if defined(HAVE_CSUM_COPY_DBG) && defined(CONFIG_X86_32)
-#define csum_and_copy_to_user(src, dst, len, sum, err_ptr) \
- csum_and_copy_to_user(src, dst, len, sum, NULL, err_ptr)
-#endif
-
-#ifndef HAVE_CSUM_REPLACE4
-static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
-{
- __be32 diff[] = { ~from, to };
-
- *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
-}
-
-static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to)
-{
- csum_replace4(sum, (__force __be32)from, (__force __be32)to);
-}
-#endif
-
-#ifndef CSUM_MANGLED_0
-#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
-#endif
-
-#endif /* checksum.h */
diff --git a/datapath/linux/compat/include/net/dst.h b/datapath/linux/compat/include/net/dst.h
deleted file mode 100644
index af78a6ca6..000000000
--- a/datapath/linux/compat/include/net/dst.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __NET_DST_WRAPPER_H
-#define __NET_DST_WRAPPER_H 1
-
-#include <linux/version.h>
-#include_next <net/dst.h>
-
-#ifndef HAVE_SKB_DST_ACCESSOR_FUNCS
-
-static inline void skb_dst_drop(struct sk_buff *skb)
-{
- if (skb->dst)
- dst_release(skb_dst(skb));
- skb->dst = NULL;
-}
-
-#endif
-
-#ifndef DST_OBSOLETE_NONE
-#define DST_OBSOLETE_NONE 0
-#endif
-
-#ifndef DST_NOCOUNT
-#define DST_NOCOUNT 0
-#endif
-
-#if !defined(HAVE___SKB_DST_COPY)
-static inline void __skb_dst_copy(struct sk_buff *nskb, unsigned long refdst)
-{
- nskb->_skb_refdst = refdst;
- if (!(nskb->_skb_refdst & SKB_DST_NOREF))
- dst_clone(skb_dst(nskb));
-}
-#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
- * into const section. Otherwise it might end into bss section.
- * We really want to avoid false sharing on this variable, and catch
- * any writes on it.
- */
- [RTAX_MAX] = 0xdeadbeef,
-};
-#define dst_default_metrics rpl_dst_default_metrics
-
-static inline void rpl_dst_init(struct dst_entry *dst, struct dst_ops *ops,
- struct net_device *dev, int initial_ref,
- int initial_obsolete, unsigned short flags)
-{
- /* XXX: It's easier to handle compatibility by zeroing, as we can
- * refer to fewer fields. Do that here.
- */
- memset(dst, 0, sizeof *dst);
-
- dst->dev = dev;
- if (dev)
- dev_hold(dev);
- dst->ops = ops;
- dst_init_metrics(dst, dst_default_metrics, true);
- dst->path = dst;
- dst->input = dst_discard;
-#ifndef HAVE_DST_DISCARD_SK
- dst->output = dst_discard;
-#else
- dst->output = dst_discard_sk;
-#endif
- dst->obsolete = initial_obsolete;
- atomic_set(&dst->__refcnt, initial_ref);
- dst->lastuse = jiffies;
- dst->flags = flags;
- if (!(flags & DST_NOCOUNT))
- dst_entries_add(ops, 1);
-}
-#define dst_init rpl_dst_init
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/net/dst_cache.h b/datapath/linux/compat/include/net/dst_cache.h
deleted file mode 100644
index 6084d4eea..000000000
--- a/datapath/linux/compat/include/net/dst_cache.h
+++ /dev/null
@@ -1,114 +0,0 @@
-#ifndef _NET_DST_CACHE_WRAPPER_H
-#define _NET_DST_CACHE_WRAPPER_H
-
-#ifdef USE_BUILTIN_DST_CACHE
-#include_next <net/dst_cache.h>
-#else
-
-#include <linux/jiffies.h>
-#include <net/dst.h>
-#if IS_ENABLED(CONFIG_IPV6)
-#include <net/ip6_fib.h>
-#endif
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/dst_cache.h>
-
-#else
-struct dst_cache {
- struct dst_cache_pcpu __percpu *cache;
- unsigned long reset_ts;
-};
-
-/**
- * dst_cache_get - perform cache lookup
- * @dst_cache: the cache
- *
- * The caller should use dst_cache_get_ip4() if it need to retrieve the
- * source address to be used when xmitting to the cached dst.
- * local BH must be disabled.
- */
-#define rpl_dst_cache_get dst_cache_get
-struct dst_entry *rpl_dst_cache_get(struct dst_cache *dst_cache);
-
-/**
- * dst_cache_get_ip4 - perform cache lookup and fetch ipv4 source address
- * @dst_cache: the cache
- * @saddr: return value for the retrieved source address
- *
- * local BH must be disabled.
- */
-#define rpl_dst_cache_get_ip4 dst_cache_get_ip4
-struct rtable *rpl_dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr);
-
-/**
- * dst_cache_set_ip4 - store the ipv4 dst into the cache
- * @dst_cache: the cache
- * @dst: the entry to be cached
- * @saddr: the source address to be stored inside the cache
- *
- * local BH must be disabled.
- */
-#define rpl_dst_cache_set_ip4 dst_cache_set_ip4
-void rpl_dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
- __be32 saddr);
-
-#if IS_ENABLED(CONFIG_IPV6)
-
-/**
- * dst_cache_set_ip6 - store the ipv6 dst into the cache
- * @dst_cache: the cache
- * @dst: the entry to be cached
- * @saddr: the source address to be stored inside the cache
- *
- * local BH must be disabled.
- */
-#define rpl_dst_cache_set_ip6 dst_cache_set_ip6
-void rpl_dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
- const struct in6_addr *addr);
-
-/**
- * dst_cache_get_ip6 - perform cache lookup and fetch ipv6 source address
- * @dst_cache: the cache
- * @saddr: return value for the retrieved source address
- *
- * local BH must be disabled.
- */
-#define rpl_dst_cache_get_ip6 dst_cache_get_ip6
-struct dst_entry *rpl_dst_cache_get_ip6(struct dst_cache *dst_cache,
- struct in6_addr *saddr);
-#endif
-
-/**
- * dst_cache_reset - invalidate the cache contents
- * @dst_cache: the cache
- *
- * This do not free the cached dst to avoid races and contentions.
- * the dst will be freed on later cache lookup.
- */
-static inline void dst_cache_reset(struct dst_cache *dst_cache)
-{
- dst_cache->reset_ts = jiffies;
-}
-
-/**
- * dst_cache_init - initialize the cache, allocating the required storage
- * @dst_cache: the cache
- * @gfp: allocation flags
- */
-#define rpl_dst_cache_init dst_cache_init
-int rpl_dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp);
-
-/**
- * dst_cache_destroy - empty the cache and free the allocated storage
- * @dst_cache: the cache
- *
- * No synchronization is enforced: it must be called only when the cache
- * is unsed.
- */
-#define rpl_dst_cache_destroy dst_cache_destroy
-void rpl_dst_cache_destroy(struct dst_cache *dst_cache);
-
-#endif /* USE_UPSTREAM_TUNNEL */
-#endif /* USE_BUILTIN_DST_CACHE */
-#endif
diff --git a/datapath/linux/compat/include/net/dst_metadata.h b/datapath/linux/compat/include/net/dst_metadata.h
deleted file mode 100644
index 4ffafccce..000000000
--- a/datapath/linux/compat/include/net/dst_metadata.h
+++ /dev/null
@@ -1,269 +0,0 @@
-#ifndef __NET_DST_METADATA_WRAPPER_H
-#define __NET_DST_METADATA_WRAPPER_H 1
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/dst_metadata.h>
-#else
-#include <linux/skbuff.h>
-
-#include <net/dsfield.h>
-#include <net/dst.h>
-#include <net/ipv6.h>
-#include <net/ip_tunnels.h>
-
-enum metadata_type {
- METADATA_IP_TUNNEL,
- METADATA_HW_PORT_MUX,
-};
-
-struct hw_port_info {
- struct net_device *lower_dev;
- u32 port_id;
-};
-
-struct metadata_dst {
- struct dst_entry dst;
- enum metadata_type type;
- union {
- struct ip_tunnel_info tun_info;
- struct hw_port_info port_info;
- } u;
-};
-
-#ifndef DST_METADATA
-#define DST_METADATA 0x0080
-#endif
-
-extern struct dst_ops md_dst_ops;
-
-static void rpl__metadata_dst_init(struct metadata_dst *md_dst,
- enum metadata_type type, u8 optslen)
-
-{
- struct dst_entry *dst;
-
- dst = &md_dst->dst;
- dst_init(dst, &md_dst_ops, NULL, 1, DST_OBSOLETE_NONE,
- DST_METADATA | DST_NOCOUNT);
-
-#if 0
- /* unused in OVS */
- dst->input = dst_md_discard;
- dst->output = dst_md_discard_out;
-#endif
- memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst));
- md_dst->type = type;
-}
-
-static struct
-metadata_dst *__rpl_metadata_dst_alloc(u8 optslen,
- enum metadata_type type,
- gfp_t flags)
-{
- struct metadata_dst *md_dst;
-
- md_dst = kmalloc(sizeof(*md_dst) + optslen, flags);
- if (!md_dst)
- return NULL;
-
- rpl__metadata_dst_init(md_dst, type, optslen);
-
- return md_dst;
-}
-static inline struct metadata_dst *rpl_tun_rx_dst(int md_size)
-{
- struct metadata_dst *tun_dst;
-
- tun_dst = __rpl_metadata_dst_alloc(md_size, METADATA_IP_TUNNEL,
- GFP_ATOMIC);
- if (!tun_dst)
- return NULL;
-
- tun_dst->u.tun_info.options_len = 0;
- tun_dst->u.tun_info.mode = 0;
- return tun_dst;
-}
-static inline struct metadata_dst *rpl__ip_tun_set_dst(__be32 saddr,
- __be32 daddr,
- __u8 tos, __u8 ttl,
- __be16 tp_dst,
- __be16 flags,
- __be64 tunnel_id,
- int md_size)
-{
- struct metadata_dst *tun_dst;
-
- tun_dst = rpl_tun_rx_dst(md_size);
- if (!tun_dst)
- return NULL;
-
- ip_tunnel_key_init(&tun_dst->u.tun_info.key,
- saddr, daddr, tos, ttl,
- 0, 0, tp_dst, tunnel_id, flags);
- return tun_dst;
-}
-
-static inline struct metadata_dst *rpl_ip_tun_rx_dst(struct sk_buff *skb,
- __be16 flags,
- __be64 tunnel_id,
- int md_size)
-{
- const struct iphdr *iph = ip_hdr(skb);
-
- return rpl__ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl,
- 0, flags, tunnel_id, md_size);
-}
-
-static inline
-struct metadata_dst *rpl__ipv6_tun_set_dst(const struct in6_addr *saddr,
- const struct in6_addr *daddr,
- __u8 tos, __u8 ttl,
- __be16 tp_dst,
- __be32 label,
- __be16 flags,
- __be64 tunnel_id,
- int md_size)
-{
- struct metadata_dst *tun_dst;
- struct ip_tunnel_info *info;
-
- tun_dst = rpl_tun_rx_dst(md_size);
- if (!tun_dst)
- return NULL;
-
- info = &tun_dst->u.tun_info;
- info->mode = IP_TUNNEL_INFO_IPV6;
- info->key.tun_flags = flags;
- info->key.tun_id = tunnel_id;
- info->key.tp_src = 0;
- info->key.tp_dst = tp_dst;
-
- info->key.u.ipv6.src = *saddr;
- info->key.u.ipv6.dst = *daddr;
-
- info->key.tos = tos;
- info->key.ttl = ttl;
- info->key.label = label;
-
- return tun_dst;
-}
-
-static inline struct metadata_dst *rpl_ipv6_tun_rx_dst(struct sk_buff *skb,
- __be16 flags,
- __be64 tunnel_id,
- int md_size)
-{
- const struct ipv6hdr *ip6h = ipv6_hdr(skb);
-
- return rpl__ipv6_tun_set_dst(&ip6h->saddr, &ip6h->daddr,
- ipv6_get_dsfield(ip6h), ip6h->hop_limit,
- 0, ip6_flowlabel(ip6h), flags, tunnel_id,
- md_size);
-}
-
-static void __metadata_dst_init(struct metadata_dst *md_dst, u8 optslen)
-{
- struct dst_entry *dst;
-
- dst = &md_dst->dst;
-
-#if 0
- dst_init(dst, &md_dst_ops, NULL, 1, DST_OBSOLETE_NONE,
- DST_METADATA | DST_NOCACHE | DST_NOCOUNT);
-
- dst->input = dst_md_discard;
- dst->output = dst_md_discard_out;
-#endif
-
- memset(dst + 1, 0, sizeof(*md_dst) + optslen - sizeof(*dst));
-}
-
-static inline struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags)
-{
- struct metadata_dst *md_dst;
-
- md_dst = kmalloc(sizeof(*md_dst) + optslen, flags);
- if (!md_dst)
- return NULL;
-
- __metadata_dst_init(md_dst, optslen);
- return md_dst;
-}
-
-#define skb_tunnel_info ovs_skb_tunnel_info
-
-static inline void ovs_tun_rx_dst(struct metadata_dst *md_dst, int optslen)
-{
- /* No need to allocate for OVS backport case. */
-#if 0
- struct metadata_dst *tun_dst;
- struct ip_tunnel_info *info;
-
- tun_dst = metadata_dst_alloc(md_size, GFP_ATOMIC);
- if (!tun_dst)
- return NULL;
-#endif
- __metadata_dst_init(md_dst, optslen);
-}
-
-static inline void ovs_ip_tun_rx_dst(struct metadata_dst *md_dst,
- struct sk_buff *skb, __be16 flags,
- __be64 tunnel_id, int md_size)
-{
- const struct iphdr *iph = ip_hdr(skb);
-
- ovs_tun_rx_dst(md_dst, md_size);
- ip_tunnel_key_init(&md_dst->u.tun_info.key,
- iph->saddr, iph->daddr, iph->tos, iph->ttl, 0,
- 0, 0, tunnel_id, flags);
-}
-
-static inline void ovs_ipv6_tun_rx_dst(struct metadata_dst *md_dst,
- struct sk_buff *skb,
- __be16 flags,
- __be64 tunnel_id,
- int md_size)
-{
- struct ip_tunnel_info *info = &md_dst->u.tun_info;
- const struct ipv6hdr *ip6h = ipv6_hdr(skb);
-
- ovs_tun_rx_dst(md_dst, md_size);
- info->mode = IP_TUNNEL_INFO_IPV6;
- info->key.tun_flags = flags;
- info->key.tun_id = tunnel_id;
- info->key.tp_src = 0;
- info->key.tp_dst = 0;
-
- info->key.u.ipv6.src = ip6h->saddr;
- info->key.u.ipv6.dst = ip6h->daddr;
-
- info->key.tos = ipv6_get_dsfield(ip6h);
- info->key.ttl = ip6h->hop_limit;
- info->key.label = ip6_flowlabel(ip6h);
-}
-
-#endif /* USE_UPSTREAM_TUNNEL */
-
-void ovs_ip_tunnel_rcv(struct net_device *dev, struct sk_buff *skb,
- struct metadata_dst *tun_dst);
-
-static inline struct metadata_dst *
-rpl_metadata_dst_alloc(u8 optslen, enum metadata_type type, gfp_t flags)
-{
-#if defined(HAVE_METADATA_DST_ALLOC_WITH_METADATA_TYPE) && defined(USE_UPSTREAM_TUNNEL)
- return metadata_dst_alloc(optslen, type, flags);
-#else
- return metadata_dst_alloc(optslen, flags);
-#endif
-}
-#define metadata_dst_alloc rpl_metadata_dst_alloc
-
-static inline bool rpl_skb_valid_dst(const struct sk_buff *skb)
-{
- struct dst_entry *dst = skb_dst(skb);
-
- return dst && !(dst->flags & DST_METADATA);
-}
-#define skb_valid_dst rpl_skb_valid_dst
-
-#endif /* __NET_DST_METADATA_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/erspan.h b/datapath/linux/compat/include/net/erspan.h
deleted file mode 100644
index 4a6a8f240..000000000
--- a/datapath/linux/compat/include/net/erspan.h
+++ /dev/null
@@ -1,342 +0,0 @@
-#ifndef USE_UPSTREAM_TUNNEL
-#ifndef __LINUX_ERSPAN_H
-#define __LINUX_ERSPAN_H
-
-/*
- * GRE header for ERSPAN encapsulation (8 octets [34:41]) -- 8 bytes
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |0|0|0|1|0|00000|000000000|00000| Protocol Type for ERSPAN |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Sequence Number (increments per packet per session) |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Note that in the above GRE header [RFC1701] out of the C, R, K, S,
- * s, Recur, Flags, Version fields only S (bit 03) is set to 1. The
- * other fields are set to zero, so only a sequence number follows.
- *
- * ERSPAN Version 1 (Type II) header (8 octets [42:49])
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Ver | VLAN | COS | En|T| Session ID |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Reserved | Index |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- *
- * ERSPAN Version 2 (Type III) header (12 octets [42:49])
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Ver | VLAN | COS |BSO|T| Session ID |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Timestamp |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | SGT |P| FT | Hw ID |D|Gra|O|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Platform Specific SubHeader (8 octets, optional)
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Platf ID | Platform Specific Info |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Platform Specific Info |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * GRE proto ERSPAN type II = 0x88BE, type III = 0x22EB
- */
-
-/* #include <uapi/linux/erspan.h> */
-/* Just insert uapi/linux/erspan.h here since
- * we don't pull in uapi to compat
- */
-/* ERSPAN version 2 metadata header */
-struct erspan_md2 {
- __be32 timestamp;
- __be16 sgt; /* security group tag */
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- __u8 hwid_upper:2,
- ft:5,
- p:1;
- __u8 o:1,
- gra:2,
- dir:1,
- hwid:4;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- __u8 p:1,
- ft:5,
- hwid_upper:2;
- __u8 hwid:4,
- dir:1,
- gra:2,
- o:1;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
-};
-
-struct erspan_metadata {
- int version;
- union {
- __be32 index; /* Version 1 (type II)*/
- struct erspan_md2 md2; /* Version 2 (type III) */
- } u;
-};
-
-#define ERSPAN_VERSION 0x1 /* ERSPAN type II */
-#define VER_MASK 0xf000
-#define VLAN_MASK 0x0fff
-#define COS_MASK 0xe000
-#define EN_MASK 0x1800
-#define T_MASK 0x0400
-#define ID_MASK 0x03ff
-#define INDEX_MASK 0xfffff
-
-#define ERSPAN_VERSION2 0x2 /* ERSPAN type III*/
-#define BSO_MASK EN_MASK
-#define SGT_MASK 0xffff0000
-#define P_MASK 0x8000
-#define FT_MASK 0x7c00
-#define HWID_MASK 0x03f0
-#define DIR_MASK 0x0008
-#define GRA_MASK 0x0006
-#define O_MASK 0x0001
-
-#define HWID_OFFSET 4
-#define DIR_OFFSET 3
-
-enum erspan_encap_type {
- ERSPAN_ENCAP_NOVLAN = 0x0, /* originally without VLAN tag */
- ERSPAN_ENCAP_ISL = 0x1, /* originally ISL encapsulated */
- ERSPAN_ENCAP_8021Q = 0x2, /* originally 802.1Q encapsulated */
- ERSPAN_ENCAP_INFRAME = 0x3, /* VLAN tag perserved in frame */
-};
-
-#define ERSPAN_V1_MDSIZE 4
-#define ERSPAN_V2_MDSIZE 8
-
-struct erspan_base_hdr {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- __u8 vlan_upper:4,
- ver:4;
- __u8 vlan:8;
- __u8 session_id_upper:2,
- t:1,
- en:2,
- cos:3;
- __u8 session_id:8;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- __u8 ver: 4,
- vlan_upper:4;
- __u8 vlan:8;
- __u8 cos:3,
- en:2,
- t:1,
- session_id_upper:2;
- __u8 session_id:8;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
-};
-
-static inline void set_session_id(struct erspan_base_hdr *ershdr, u16 id)
-{
- ershdr->session_id = id & 0xff;
- ershdr->session_id_upper = (id >> 8) & 0x3;
-}
-
-static inline u16 get_session_id(const struct erspan_base_hdr *ershdr)
-{
- return (ershdr->session_id_upper << 8) + ershdr->session_id;
-}
-
-static inline void set_vlan(struct erspan_base_hdr *ershdr, u16 vlan)
-{
- ershdr->vlan = vlan & 0xff;
- ershdr->vlan_upper = (vlan >> 8) & 0xf;
-}
-
-static inline u16 get_vlan(const struct erspan_base_hdr *ershdr)
-{
- return (ershdr->vlan_upper << 8) + ershdr->vlan;
-}
-
-static inline void set_hwid(struct erspan_md2 *md2, u8 hwid)
-{
- md2->hwid = hwid & 0xf;
- md2->hwid_upper = (hwid >> 4) & 0x3;
-}
-
-static inline u8 get_hwid(const struct erspan_md2 *md2)
-{
- return (md2->hwid_upper << 4) + md2->hwid;
-}
-
-static inline int erspan_hdr_len(int version)
-{
- return sizeof(struct erspan_base_hdr) +
- (version == 1 ? ERSPAN_V1_MDSIZE : ERSPAN_V2_MDSIZE);
-}
-
-static inline u8 tos_to_cos(u8 tos)
-{
- u8 dscp, cos;
-
- dscp = tos >> 2;
- cos = dscp >> 3;
- return cos;
-}
-
-static inline void erspan_build_header(struct sk_buff *skb,
- u32 id, u32 index,
- bool truncate, bool is_ipv4)
-{
- struct ethhdr *eth = (struct ethhdr *)skb->data;
- enum erspan_encap_type enc_type;
- struct erspan_base_hdr *ershdr;
- struct qtag_prefix {
- __be16 eth_type;
- __be16 tci;
- } *qp;
- u16 vlan_tci = 0;
- u8 tos;
- __be32 *idx;
-
- tos = is_ipv4 ? ip_hdr(skb)->tos :
- (ipv6_hdr(skb)->priority << 4) +
- (ipv6_hdr(skb)->flow_lbl[0] >> 4);
-
- enc_type = ERSPAN_ENCAP_NOVLAN;
-
- /* If mirrored packet has vlan tag, extract tci and
- * perserve vlan header in the mirrored frame.
- */
- if (eth->h_proto == htons(ETH_P_8021Q)) {
- qp = (struct qtag_prefix *)(skb->data + 2 * ETH_ALEN);
- vlan_tci = ntohs(qp->tci);
- enc_type = ERSPAN_ENCAP_INFRAME;
- }
-
- skb_push(skb, sizeof(*ershdr) + ERSPAN_V1_MDSIZE);
- ershdr = (struct erspan_base_hdr *)skb->data;
- memset(ershdr, 0, sizeof(*ershdr) + ERSPAN_V1_MDSIZE);
-
- /* Build base header */
- ershdr->ver = ERSPAN_VERSION;
- ershdr->cos = tos_to_cos(tos);
- ershdr->en = enc_type;
- ershdr->t = truncate;
- set_vlan(ershdr, vlan_tci);
- set_session_id(ershdr, id);
-
- /* Build metadata */
- idx = (__be32 *)(ershdr + 1);
- *idx = htonl(index & INDEX_MASK);
-}
-
-/* ERSPAN GRA: timestamp granularity
- * 00b --> granularity = 100 microseconds
- * 01b --> granularity = 100 nanoseconds
- * 10b --> granularity = IEEE 1588
- * Here we only support 100 microseconds.
- */
-static inline __be32 erspan_get_timestamp(void)
-{
- u64 h_usecs;
- ktime_t kt;
-
- kt = ktime_get_real();
- h_usecs = ktime_divns(kt, 100 * NSEC_PER_USEC);
-
- /* ERSPAN base header only has 32-bit,
- * so it wraps around 4 days.
- */
- return htonl((u32)h_usecs);
-}
-
-/* ERSPAN BSO (Bad/Short/Oversized), see RFC1757
- * 00b --> Good frame with no error, or unknown integrity
- * 01b --> Payload is a Short Frame
- * 10b --> Payload is an Oversized Frame
- * 11b --> Payload is a Bad Frame with CRC or Alignment Error
- */
-enum erspan_bso {
- BSO_NOERROR = 0x0,
- BSO_SHORT = 0x1,
- BSO_OVERSIZED = 0x2,
- BSO_BAD = 0x3,
-};
-
-static inline u8 erspan_detect_bso(struct sk_buff *skb)
-{
- /* BSO_BAD is not handled because the frame CRC
- * or alignment error information is in FCS.
- */
- if (skb->len < ETH_ZLEN)
- return BSO_SHORT;
-
- if (skb->len > ETH_FRAME_LEN)
- return BSO_OVERSIZED;
-
- return BSO_NOERROR;
-}
-
-static inline void erspan_build_header_v2(struct sk_buff *skb,
- u32 id, u8 direction, u16 hwid,
- bool truncate, bool is_ipv4)
-{
- struct ethhdr *eth = (struct ethhdr *)skb->data;
- struct erspan_base_hdr *ershdr;
- struct erspan_md2 *md2;
- struct qtag_prefix {
- __be16 eth_type;
- __be16 tci;
- } *qp;
- u16 vlan_tci = 0;
- u8 gra = 0; /* 100 usec */
- u8 bso = truncate; /* Bad/Short/Oversized */
- u8 sgt = 0;
- u8 tos;
-
- tos = is_ipv4 ? ip_hdr(skb)->tos :
- (ipv6_hdr(skb)->priority << 4) +
- (ipv6_hdr(skb)->flow_lbl[0] >> 4);
-
- /* Unlike v1, v2 does not have En field,
- * so only extract vlan tci field.
- */
- if (eth->h_proto == htons(ETH_P_8021Q)) {
- qp = (struct qtag_prefix *)(skb->data + 2 * ETH_ALEN);
- vlan_tci = ntohs(qp->tci);
- }
-
- bso = erspan_detect_bso(skb);
- skb_push(skb, sizeof(*ershdr) + ERSPAN_V2_MDSIZE);
- ershdr = (struct erspan_base_hdr *)skb->data;
- memset(ershdr, 0, sizeof(*ershdr) + ERSPAN_V2_MDSIZE);
-
- /* Build base header */
- ershdr->ver = ERSPAN_VERSION2;
- ershdr->cos = tos_to_cos(tos);
- ershdr->en = bso;
- ershdr->t = truncate;
- set_vlan(ershdr, vlan_tci);
- set_session_id(ershdr, id);
-
- /* Build metadata */
- md2 = (struct erspan_md2 *)(ershdr + 1);
- md2->timestamp = erspan_get_timestamp();
- md2->sgt = htons(sgt);
- md2->p = 1;
- md2->ft = 0;
- md2->dir = direction;
- md2->gra = gra;
- md2->o = 0;
- set_hwid(md2, hwid);
-}
-
-#endif
-#else
-#include_next <net/erspan.h>
-#endif
diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h
deleted file mode 100644
index 602ce38d3..000000000
--- a/datapath/linux/compat/include/net/genetlink.h
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef __NET_GENERIC_NETLINK_WRAPPER_H
-#define __NET_GENERIC_NETLINK_WRAPPER_H 1
-
-#include <linux/version.h>
-#include <linux/netlink.h>
-#include <net/net_namespace.h>
-#include_next <net/genetlink.h>
-
-#ifndef HAVE_GENL_NOTIFY_TAKES_FAMILY
-struct rpl_genl_family {
- struct genl_family compat_family;
- unsigned int id;
- unsigned int hdrsize;
- char name[GENL_NAMSIZ];
- unsigned int version;
- unsigned int maxattr;
- bool netnsok;
- bool parallel_ops;
- int (*pre_doit)(const struct genl_ops *ops,
- struct sk_buff *skb,
- struct genl_info *info);
- void (*post_doit)(const struct genl_ops *ops,
- struct sk_buff *skb,
- struct genl_info *info);
- struct nlattr ** attrbuf; /* private */
- const struct genl_ops * ops; /* private */
- const struct genl_multicast_group *mcgrps; /* private */
- unsigned int n_ops; /* private */
- unsigned int n_mcgrps; /* private */
- unsigned int mcgrp_offset; /* private */
- struct list_head family_list; /* private */
- struct module *module;
-};
-
-#define genl_family rpl_genl_family
-static inline void *rpl_genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
- struct genl_family *family, int flags, u8 cmd)
-{
- return genlmsg_put(skb, portid, seq, &family->compat_family, flags, cmd);
-}
-
-#define genlmsg_put rpl_genlmsg_put
-
-static inline int rpl_genl_unregister_family(struct genl_family *family)
-{
- return genl_unregister_family(&family->compat_family);
-}
-#define genl_unregister_family rpl_genl_unregister_family
-
-#define genl_set_err rpl_genl_set_err
-static inline int genl_set_err(struct genl_family *family, struct net *net,
- u32 portid, u32 group, int code)
-{
-#ifdef HAVE_VOID_NETLINK_SET_ERR
- netlink_set_err(net->genl_sock, portid, group, code);
- return 0;
-#else
- return netlink_set_err(net->genl_sock, portid, group, code);
-#endif
-}
-
-#define genlmsg_multicast_netns rpl_genlmsg_multicast_netns
-static inline int genlmsg_multicast_netns(struct genl_family *family,
- struct net *net, struct sk_buff *skb,
- u32 portid, unsigned int group, gfp_t flags)
-{
- return nlmsg_multicast(net->genl_sock, skb, portid, group, flags);
-}
-
-
-#define __genl_register_family rpl___genl_register_family
-int rpl___genl_register_family(struct genl_family *family);
-
-#define genl_register_family rpl_genl_register_family
-static inline int rpl_genl_register_family(struct genl_family *family)
-{
- family->module = THIS_MODULE;
- return rpl___genl_register_family(family);
-}
-#endif
-
-#ifdef HAVE_GENL_NOTIFY_TAKES_NET
-#define genl_notify rpl_genl_notify
-void rpl_genl_notify(struct genl_family *family, struct sk_buff *skb,
- struct genl_info *info , u32 group, gfp_t flags);
-#endif
-
-#ifndef HAVE_GENL_HAS_LISTENERS
-static inline int genl_has_listeners(struct genl_family *family,
- struct net *net, unsigned int group)
-{
-#ifdef HAVE_MCGRP_OFFSET
- if (WARN_ON_ONCE(group >= family->n_mcgrps))
- return -EINVAL;
- group = family->mcgrp_offset + group;
-#endif
- return netlink_has_listeners(net->genl_sock, group);
-}
-#else
-
-#ifndef HAVE_GENL_HAS_LISTENERS_TAKES_NET
-static inline int rpl_genl_has_listeners(struct genl_family *family,
- struct net *net, unsigned int group)
-{
-#ifdef HAVE_GENL_NOTIFY_TAKES_FAMILY
- return genl_has_listeners(family, net->genl_sock, group);
-#else
- return genl_has_listeners(&family->compat_family, net->genl_sock, group);
-#endif
-}
-
-#define genl_has_listeners rpl_genl_has_listeners
-#endif
-
-#endif /* HAVE_GENL_HAS_LISTENERS */
-
-#ifndef HAVE_NETLINK_EXT_ACK
-struct netlink_ext_ack;
-
-static inline int rpl_genlmsg_parse(const struct nlmsghdr *nlh,
- const struct genl_family *family,
- struct nlattr *tb[], int maxtype,
- const struct nla_policy *policy,
- struct netlink_ext_ack *extack)
-{
-#ifdef HAVE_GENLMSG_PARSE
- return genlmsg_parse(nlh, family, tb, maxtype, policy);
-#else
- return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
- policy);
-#endif
-}
-#define genlmsg_parse rpl_genlmsg_parse
-#endif
-
-#endif /* genetlink.h */
diff --git a/datapath/linux/compat/include/net/geneve.h b/datapath/linux/compat/include/net/geneve.h
deleted file mode 100644
index d9c9f0bf7..000000000
--- a/datapath/linux/compat/include/net/geneve.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef __NET_GENEVE_WRAPPER_H
-#define __NET_GENEVE_WRAPPER_H 1
-
-#ifdef CONFIG_INET
-#include <net/udp_tunnel.h>
-#endif
-
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/geneve.h>
-
-static inline int rpl_geneve_init_module(void)
-{
- return 0;
-}
-static inline void rpl_geneve_cleanup_module(void)
-{}
-
-#define geneve_xmit dev_queue_xmit
-
-#ifdef CONFIG_INET
-#ifndef HAVE_NAME_ASSIGN_TYPE
-static inline struct net_device *rpl_geneve_dev_create_fb(
- struct net *net, const char *name, u8 name_assign_type, u16 dst_port) {
- return geneve_dev_create_fb(net, name, dst_port);
-}
-#define geneve_dev_create_fb rpl_geneve_dev_create_fb
-#endif
-#endif
-
-#else
-/* Geneve Header:
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Virtual Network Identifier (VNI) | Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Variable Length Options |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Option Header:
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Option Class | Type |R|R|R| Length |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Variable Option Data |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-struct geneve_opt {
- __be16 opt_class;
- u8 type;
-#ifdef __LITTLE_ENDIAN_BITFIELD
- u8 length:5;
- u8 r3:1;
- u8 r2:1;
- u8 r1:1;
-#else
- u8 r1:1;
- u8 r2:1;
- u8 r3:1;
- u8 length:5;
-#endif
- u8 opt_data[];
-};
-
-#define GENEVE_CRIT_OPT_TYPE (1 << 7)
-
-struct genevehdr {
-#ifdef __LITTLE_ENDIAN_BITFIELD
- u8 opt_len:6;
- u8 ver:2;
- u8 rsvd1:6;
- u8 critical:1;
- u8 oam:1;
-#else
- u8 ver:2;
- u8 opt_len:6;
- u8 oam:1;
- u8 critical:1;
- u8 rsvd1:6;
-#endif
- __be16 proto_type;
- u8 vni[3];
- u8 rsvd2;
- struct geneve_opt options[];
-};
-
-#ifdef CONFIG_INET
-#define geneve_dev_create_fb rpl_geneve_dev_create_fb
-struct net_device *rpl_geneve_dev_create_fb(struct net *net, const char *name,
- u8 name_assign_type, u16 dst_port);
-#endif /*ifdef CONFIG_INET */
-
-int rpl_geneve_init_module(void);
-void rpl_geneve_cleanup_module(void);
-
-#define geneve_xmit rpl_geneve_xmit
-netdev_tx_t rpl_geneve_xmit(struct sk_buff *skb);
-
-#endif
-#define geneve_init_module rpl_geneve_init_module
-#define geneve_cleanup_module rpl_geneve_cleanup_module
-
-#define geneve_fill_metadata_dst ovs_geneve_fill_metadata_dst
-int ovs_geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-
-#endif /*ifdef__NET_GENEVE_H */
diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
deleted file mode 100644
index 57293b6c2..000000000
--- a/datapath/linux/compat/include/net/gre.h
+++ /dev/null
@@ -1,191 +0,0 @@
-#ifndef __LINUX_GRE_WRAPPER_H
-#define __LINUX_GRE_WRAPPER_H
-
-#include <linux/version.h>
-#include <linux/skbuff.h>
-#include <net/ip_tunnels.h>
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/gre.h>
-
-static inline int rpl_ipgre_init(void)
-{
- return 0;
-}
-static inline void rpl_ipgre_fini(void)
-{}
-
-static inline int rpl_ip6gre_init(void)
-{
- return 0;
-}
-
-static inline void rpl_ip6gre_fini(void)
-{}
-
-static inline int rpl_ip6_tunnel_init(void)
-{
- return 0;
-}
-
-static inline void rpl_ip6_tunnel_cleanup(void)
-{
-}
-
-static inline int rpl_gre_init(void)
-{
- return 0;
-}
-
-static inline void rpl_gre_exit(void)
-{
-}
-
-#define gre_fb_xmit dev_queue_xmit
-
-#ifdef CONFIG_INET
-#ifndef HAVE_NAME_ASSIGN_TYPE
-static inline struct net_device *rpl_gretap_fb_dev_create(
- struct net *net, const char *name, u8 name_assign_type) {
- return gretap_fb_dev_create(net, name);
-}
-#define gretap_fb_dev_create rpl_gretap_fb_dev_create
-#endif
-#endif
-
-#else
-#include_next <net/gre.h>
-
-#ifndef HAVE_GRE_CALC_HLEN
-static inline int gre_calc_hlen(__be16 o_flags)
-{
- int addend = 4;
-
- if (o_flags & TUNNEL_CSUM)
- addend += 4;
- if (o_flags & TUNNEL_KEY)
- addend += 4;
- if (o_flags & TUNNEL_SEQ)
- addend += 4;
- return addend;
-}
-
-#define ip_gre_calc_hlen gre_calc_hlen
-#else
-#ifdef HAVE_IP_GRE_CALC_HLEN
-#define gre_calc_hlen ip_gre_calc_hlen
-#endif
-#endif
-
-#define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
-static inline __be16 rpl_tnl_flags_to_gre_flags(__be16 tflags)
-{
- __be16 flags = 0;
-
- if (tflags & TUNNEL_CSUM)
- flags |= GRE_CSUM;
- if (tflags & TUNNEL_ROUTING)
- flags |= GRE_ROUTING;
- if (tflags & TUNNEL_KEY)
- flags |= GRE_KEY;
- if (tflags & TUNNEL_SEQ)
- flags |= GRE_SEQ;
- if (tflags & TUNNEL_STRICT)
- flags |= GRE_STRICT;
- if (tflags & TUNNEL_REC)
- flags |= GRE_REC;
- if (tflags & TUNNEL_VERSION)
- flags |= GRE_VERSION;
-
- return flags;
-}
-
-#define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
-static inline __be16 rpl_gre_flags_to_tnl_flags(__be16 flags)
-{
- __be16 tflags = 0;
-
- if (flags & GRE_CSUM)
- tflags |= TUNNEL_CSUM;
- if (flags & GRE_ROUTING)
- tflags |= TUNNEL_ROUTING;
- if (flags & GRE_KEY)
- tflags |= TUNNEL_KEY;
- if (flags & GRE_SEQ)
- tflags |= TUNNEL_SEQ;
- if (flags & GRE_STRICT)
- tflags |= TUNNEL_STRICT;
- if (flags & GRE_REC)
- tflags |= TUNNEL_REC;
- if (flags & GRE_VERSION)
- tflags |= TUNNEL_VERSION;
-
- return tflags;
-}
-#define gre_tnl_flags_to_gre_flags rpl_gre_tnl_flags_to_gre_flags
-static inline __be16 rpl_gre_tnl_flags_to_gre_flags(__be16 tflags)
-{
- __be16 flags = 0;
-
- if (tflags & TUNNEL_CSUM)
- flags |= GRE_CSUM;
- if (tflags & TUNNEL_ROUTING)
- flags |= GRE_ROUTING;
- if (tflags & TUNNEL_KEY)
- flags |= GRE_KEY;
- if (tflags & TUNNEL_SEQ)
- flags |= GRE_SEQ;
- if (tflags & TUNNEL_STRICT)
- flags |= GRE_STRICT;
- if (tflags & TUNNEL_REC)
- flags |= GRE_REC;
- if (tflags & TUNNEL_VERSION)
- flags |= GRE_VERSION;
-
- return flags;
-}
-
-#define gre_build_header rpl_gre_build_header
-void rpl_gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
- int hdr_len);
-
-int rpl_ipgre_init(void);
-void rpl_ipgre_fini(void);
-int rpl_ip6gre_init(void);
-void rpl_ip6gre_fini(void);
-int rpl_ip6_tunnel_init(void);
-void rpl_ip6_tunnel_cleanup(void);
-int rpl_gre_init(void);
-void rpl_gre_exit(void);
-
-#define gretap_fb_dev_create rpl_gretap_fb_dev_create
-struct net_device *rpl_gretap_fb_dev_create(struct net *net, const char *name,
- u8 name_assign_type);
-
-#define gre_parse_header rpl_gre_parse_header
-int rpl_gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
- bool *csum_err, __be16 proto, int nhs);
-
-#define gre_fb_xmit rpl_gre_fb_xmit
-netdev_tx_t rpl_gre_fb_xmit(struct sk_buff *skb);
-
-#define gre_add_protocol rpl_gre_add_protocol
-int rpl_gre_add_protocol(const struct gre_protocol *proto, u8 version);
-#define gre_del_protocol rpl_gre_del_protocol
-int rpl_gre_del_protocol(const struct gre_protocol *proto, u8 version);
-#endif /* USE_UPSTREAM_TUNNEL */
-
-#define ipgre_init rpl_ipgre_init
-#define ipgre_fini rpl_ipgre_fini
-#define ip6gre_init rpl_ip6gre_init
-#define ip6gre_fini rpl_ip6gre_fini
-#define ip6_tunnel_init rpl_ip6_tunnel_init
-#define ip6_tunnel_cleanup rpl_ip6_tunnel_cleanup
-#define gre_init rpl_gre_init
-#define gre_exit rpl_gre_exit
-
-#define gre_fill_metadata_dst ovs_gre_fill_metadata_dst
-int ovs_gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-
-
-#endif
diff --git a/datapath/linux/compat/include/net/inet_ecn.h b/datapath/linux/compat/include/net/inet_ecn.h
deleted file mode 100644
index f0591b322..000000000
--- a/datapath/linux/compat/include/net/inet_ecn.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _INET_ECN_WRAPPER_H_
-#define _INET_ECN_WRAPPER_H_
-
-#include_next <net/inet_ecn.h>
-
-#define INET_ECN_decapsulate rpl_INET_ECN_decapsulate
-static inline int INET_ECN_decapsulate(struct sk_buff *skb,
- __u8 outer, __u8 inner)
-{
- if (INET_ECN_is_not_ect(inner)) {
- switch (outer & INET_ECN_MASK) {
- case INET_ECN_NOT_ECT:
- return 0;
- case INET_ECN_ECT_0:
- case INET_ECN_ECT_1:
- return 1;
- case INET_ECN_CE:
- return 2;
- }
- }
-
- if (INET_ECN_is_ce(outer))
- INET_ECN_set_ce(skb);
-
- return 0;
-}
-
-#define IP_ECN_decapsulate rpl_IP_ECN_decapsulate
-static inline int IP_ECN_decapsulate(const struct iphdr *oiph,
- struct sk_buff *skb)
-{
- __u8 inner;
-
- if (skb->protocol == htons(ETH_P_IP))
- inner = ip_hdr(skb)->tos;
- else if (skb->protocol == htons(ETH_P_IPV6))
- inner = ipv6_get_dsfield(ipv6_hdr(skb));
- else
- return 0;
-
- return INET_ECN_decapsulate(skb, oiph->tos, inner);
-}
-
-#define IP6_ECN_decapsulate rpl_IP6_ECN_decapsulate
-static inline int IP6_ECN_decapsulate(const struct ipv6hdr *oipv6h,
- struct sk_buff *skb)
-{
- __u8 inner;
-
- if (skb->protocol == htons(ETH_P_IP))
- inner = ip_hdr(skb)->tos;
- else if (skb->protocol == htons(ETH_P_IPV6))
- inner = ipv6_get_dsfield(ipv6_hdr(skb));
- else
- return 0;
-
- return INET_ECN_decapsulate(skb, ipv6_get_dsfield(oipv6h), inner);
-}
-#endif
diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h
deleted file mode 100644
index 00784da2b..000000000
--- a/datapath/linux/compat/include/net/inet_frag.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef __NET_INET_FRAG_WRAPPER_H
-#define __NET_INET_FRAG_WRAPPER_H 1
-
-#include <linux/version.h>
-#include_next <net/inet_frag.h>
-
-#ifdef HAVE_INET_FRAGS_LAST_IN
-#define q_flags(q) (q->last_in)
-#define qp_flags(qp) (qp->q.last_in)
-#else
-#define q_flags(q) (q->flags)
-#define qp_flags(qp) (qp->q.flags)
-#endif
-
-#ifndef HAVE_CORRECT_MRU_HANDLING
-#ifndef HAVE_INET_FRAG_EVICTING
-static inline bool inet_frag_evicting(struct inet_frag_queue *q)
-{
-#ifdef HAVE_INET_FRAG_QUEUE_WITH_LIST_EVICTOR
- return !hlist_unhashed(&q->list_evictor);
-#else
- return (q_flags(q) & INET_FRAG_FIRST_IN) && q->fragments != NULL;
-#endif /* HAVE_INET_FRAG_QUEUE_WITH_LIST_EVICTOR */
-}
-#endif /* HAVE_INET_FRAG_EVICTING */
-#endif /* HAVE_CORRECT_MRU_HANDLING */
-
-/* Upstream commit 3fd588eb90bf ("inet: frag: remove lru list") dropped this
- * function, but we call it from our compat code. Provide a noop version. */
-#ifndef HAVE_INET_FRAG_LRU_MOVE
-#define inet_frag_lru_move(q)
-#endif
-
-#ifdef HAVE_INET_FRAG_FQDIR
-#define netns_frags fqdir
-#endif
-
-#ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS
-#ifdef HAVE_FRAG_PERCPU_COUNTER_BATCH
-static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
-{
- __percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
-}
-#define sub_frag_mem_limit rpl_sub_frag_mem_limit
-
-static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
-{
- __percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
-}
-#define add_frag_mem_limit rpl_add_frag_mem_limit
-#else /* !frag_percpu_counter_batch */
-static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
-{
-#ifdef HAVE_INET_FRAG_FQDIR
- atomic_long_sub(i, &nf->mem);
-#else
- atomic_sub(i, &nf->mem);
-#endif
-}
-#define sub_frag_mem_limit rpl_sub_frag_mem_limit
-
-static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
-{
-#ifdef HAVE_INET_FRAG_FQDIR
- atomic_long_add(i, &nf->mem);
-#else
- atomic_add(i, &nf->mem);
-#endif
-}
-#define add_frag_mem_limit rpl_add_frag_mem_limit
-#endif /* frag_percpu_counter_batch */
-#endif
-
-#ifdef HAVE_VOID_INET_FRAGS_INIT
-static inline int rpl_inet_frags_init(struct inet_frags *frags)
-{
- inet_frags_init(frags);
- return 0;
-}
-#define inet_frags_init rpl_inet_frags_init
-#endif
-
-#endif /* inet_frag.h */
diff --git a/datapath/linux/compat/include/net/inetpeer.h b/datapath/linux/compat/include/net/inetpeer.h
deleted file mode 100644
index c5f5eb12b..000000000
--- a/datapath/linux/compat/include/net/inetpeer.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _NET_INETPEER_WRAPPER_H
-#define _NET_INETPEER_WRAPPER_H
-
-#include_next <net/inetpeer.h>
-
-#ifndef HAVE_INETPEER_VIF_SUPPORT
-static inline struct inet_peer *rpl_inet_getpeer_v4(struct inet_peer_base *base,
- __be32 v4daddr, int vif,
- int create)
-{
- return inet_getpeer_v4(base, v4daddr, create);
-}
-#define inet_getpeer_v4 rpl_inet_getpeer_v4
-#endif /* HAVE_INETPEER_VIF_SUPPORT */
-
-#endif /* _NET_INETPEER_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/ip.h b/datapath/linux/compat/include/net/ip.h
deleted file mode 100644
index ad5ac33ee..000000000
--- a/datapath/linux/compat/include/net/ip.h
+++ /dev/null
@@ -1,143 +0,0 @@
-#ifndef __NET_IP_WRAPPER_H
-#define __NET_IP_WRAPPER_H 1
-
-#include_next <net/ip.h>
-
-#include <net/route.h>
-#include <linux/version.h>
-
-#ifndef HAVE_INET_GET_LOCAL_PORT_RANGE_USING_NET
-static inline void rpl_inet_get_local_port_range(struct net *net, int *low,
- int *high)
-{
- inet_get_local_port_range(low, high);
-}
-#define inet_get_local_port_range rpl_inet_get_local_port_range
-
-#endif
-
-#ifndef IPSKB_FRAG_PMTU
-#define IPSKB_FRAG_PMTU BIT(6)
-#endif
-
-/* IPv4 datagram length is stored into 16bit field (tot_len) */
-#ifndef IP_MAX_MTU
-#define IP_MAX_MTU 0xFFFFU
-#endif
-
-#ifndef HAVE_IP_SKB_DST_MTU
-static inline bool rpl_ip_sk_use_pmtu(const struct sock *sk)
-{
- return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
-}
-#define ip_sk_use_pmtu rpl_ip_sk_use_pmtu
-
-static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
- bool forwarding)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)
- struct net *net = dev_net(dst->dev);
-
- if (net->ipv4.sysctl_ip_fwd_use_pmtu ||
- dst_metric_locked(dst, RTAX_MTU) ||
- !forwarding)
- return dst_mtu(dst);
-#endif
-
- return min(dst->dev->mtu, IP_MAX_MTU);
-}
-
-static inline unsigned int rpl_ip_skb_dst_mtu(const struct sk_buff *skb)
-{
- if (!skb->sk || ip_sk_use_pmtu(skb->sk)) {
- bool forwarding = IPCB(skb)->flags & IPSKB_FORWARDED;
- return ip_dst_mtu_maybe_forward(skb_dst(skb), forwarding);
- } else {
- return min(skb_dst(skb)->dev->mtu, IP_MAX_MTU);
- }
-}
-#define ip_skb_dst_mtu rpl_ip_skb_dst_mtu
-#endif /* HAVE_IP_SKB_DST_MTU */
-
-#ifdef HAVE_IP_FRAGMENT_TAKES_SOCK
-#ifdef HAVE_IP_LOCAL_OUT_TAKES_NET
-#define OVS_VPORT_OUTPUT_PARAMS struct net *net, struct sock *sock, struct sk_buff *skb
-#else
-#define OVS_VPORT_OUTPUT_PARAMS struct sock *sock, struct sk_buff *skb
-#endif
-#else
-#define OVS_VPORT_OUTPUT_PARAMS struct sk_buff *skb
-#endif
-
-/* Prior to upstream commit d6b915e29f4a ("ip_fragment: don't forward
- * defragmented DF packet"), IPCB(skb)->frag_max_size was not always populated
- * correctly, which would lead to reassembled packets not being refragmented.
- * So, we backport all of ip_defrag() in these cases.
- */
-#ifndef HAVE_CORRECT_MRU_HANDLING
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
-static inline bool ip_defrag_user_in_between(u32 user,
- enum ip_defrag_users lower_bond,
- enum ip_defrag_users upper_bond)
-{
- return user >= lower_bond && user <= upper_bond;
-}
-#endif /* < v4.2 */
-
-int rpl_ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
- int (*output)(OVS_VPORT_OUTPUT_PARAMS));
-#define ip_do_fragment rpl_ip_do_fragment
-
-/* If backporting IP defrag, then init/exit functions need to be called from
- * compat_{in,ex}it() to prepare the backported fragmentation cache. In this
- * case we declare the functions which are defined in
- * datapath/linux/compat/ip_fragment.c. */
-int rpl_ip_defrag(struct net *net, struct sk_buff *skb, u32 user);
-#define ip_defrag rpl_ip_defrag
-int __init rpl_ipfrag_init(void);
-void rpl_ipfrag_fini(void);
-void ovs_netns_frags_init(struct net *net);
-void ovs_netns_frags_exit(struct net *net);
-
-#else /* HAVE_CORRECT_MRU_HANDLING */
-
-#ifndef HAVE_IP_DO_FRAGMENT_TAKES_NET
-static inline int rpl_ip_do_fragment(struct net *net, struct sock *sk,
- struct sk_buff *skb,
- int (*output)(OVS_VPORT_OUTPUT_PARAMS))
-{
- return ip_do_fragment(sk, skb, output);
-}
-#define ip_do_fragment rpl_ip_do_fragment
-#endif /* IP_DO_FRAGMENT_TAKES_NET */
-
-/* We have no good way to detect the presence of upstream commit 8282f27449bf
- * ("inet: frag: Always orphan skbs inside ip_defrag()"), but it should be
- * always included in kernels 4.5+. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
-static inline int rpl_ip_defrag(struct net *net, struct sk_buff *skb, u32 user)
-{
- skb_orphan(skb);
-#ifndef HAVE_IP_DEFRAG_TAKES_NET
- return ip_defrag(skb, user);
-#else
- return ip_defrag(net, skb, user);
-#endif
-}
-#define ip_defrag rpl_ip_defrag
-#endif
-
-/* If we can use upstream defrag then we can rely on the upstream
- * defrag module to init/exit correctly. In this case the calls in
- * compat_{in,ex}it() can be no-ops. */
-static inline int rpl_ipfrag_init(void) { return 0; }
-static inline void rpl_ipfrag_fini(void) { }
-static inline void ovs_netns_frags_init(struct net *net) { }
-static inline void ovs_netns_frags_exit(struct net *net) { }
-#endif /* HAVE_CORRECT_MRU_HANDLING */
-
-#define ipfrag_init rpl_ipfrag_init
-#define ipfrag_fini rpl_ipfrag_fini
-
-#endif
diff --git a/datapath/linux/compat/include/net/ip6_fib.h b/datapath/linux/compat/include/net/ip6_fib.h
deleted file mode 100644
index 0cc435813..000000000
--- a/datapath/linux/compat/include/net/ip6_fib.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Linux INET6 implementation
- *
- * Authors:
- * Pedro Roque <roque@di.fc.ul.pt>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#ifndef _IP6_FIB_WRAPPER_H
-#define _IP6_FIB_WRAPPER_H
-
-#include_next <net/ip6_fib.h>
-
-#ifndef HAVE_RT6_GET_COOKIE
-
-#ifndef RTF_PCPU
-#define RTF_PCPU 0x40000000
-#endif
-
-#ifndef RTF_LOCAL
-#define RTF_LOCAL 0x80000000
-#endif
-
-#define rt6_get_cookie rpl_rt6_get_cookie
-static inline u32 rt6_get_cookie(const struct rt6_info *rt)
-{
- if (rt->rt6i_flags & RTF_PCPU ||
-#ifdef HAVE_DST_NOCACHE
- (unlikely(rt->dst.flags & DST_NOCACHE) && rt->dst.from))
-#else
- (unlikely(!list_empty(&rt->rt6i_uncached)) && rt->dst.from))
-#endif
- rt = (struct rt6_info *)(rt->dst.from);
-
- return rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
-}
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/net/ip6_route.h b/datapath/linux/compat/include/net/ip6_route.h
deleted file mode 100644
index 7c78fd5c6..000000000
--- a/datapath/linux/compat/include/net/ip6_route.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __NET_IP6_ROUTE_WRAPPER
-#define __NET_IP6_ROUTE_WRAPPER
-
-#include <net/route.h>
-#include <net/ip.h> /* For OVS_VPORT_OUTPUT_PARAMS */
-#include <net/ipv6.h>
-
-#include_next<net/ip6_route.h>
-
-#ifndef HAVE_NF_IPV6_OPS_FRAGMENT
-int rpl_ip6_fragment(struct sock *sk, struct sk_buff *skb,
- int (*output)(OVS_VPORT_OUTPUT_PARAMS));
-#define ip6_fragment rpl_ip6_fragment
-#endif /* HAVE_NF_IPV6_OPS_FRAGMENT */
-
-#endif /* _NET_IP6_ROUTE_WRAPPER */
diff --git a/datapath/linux/compat/include/net/ip6_tunnel.h b/datapath/linux/compat/include/net/ip6_tunnel.h
deleted file mode 100644
index e0a33a646..000000000
--- a/datapath/linux/compat/include/net/ip6_tunnel.h
+++ /dev/null
@@ -1,208 +0,0 @@
-#ifndef NET_IP6_TUNNEL_WRAPPER_H
-#define NET_IP6_TUNNEL_WRAPPER_H 1
-
-#ifdef HAVE_IP6_TNL_PARM_ERSPAN_VER
-#include_next <net/ip6_tunnel.h>
-#else
-
-#include <linux/ipv6.h>
-#include <linux/netdevice.h>
-#include <linux/if_tunnel.h>
-#include <linux/ip6_tunnel.h>
-#include <net/ip_tunnels.h>
-#include <net/dst_cache.h>
-#include <net/dst_metadata.h>
-#include "gso.h"
-
-#define IP6TUNNEL_ERR_TIMEO (30*HZ)
-
-/* capable of sending packets */
-#define IP6_TNL_F_CAP_XMIT 0x10000
-/* capable of receiving packets */
-#define IP6_TNL_F_CAP_RCV 0x20000
-/* determine capability on a per-packet basis */
-#define IP6_TNL_F_CAP_PER_PACKET 0x40000
-
-#ifndef IP6_TNL_F_ALLOW_LOCAL_REMOTE
-#define IP6_TNL_F_ALLOW_LOCAL_REMOTE 0
-#endif
-
-struct rpl__ip6_tnl_parm {
- char name[IFNAMSIZ]; /* name of tunnel device */
- int link; /* ifindex of underlying L2 interface */
- __u8 proto; /* tunnel protocol */
- __u8 encap_limit; /* encapsulation limit for tunnel */
- __u8 hop_limit; /* hop limit for tunnel */
- bool collect_md;
- __be32 flowinfo; /* traffic class and flowlabel for tunnel */
- __u32 flags; /* tunnel flags */
- struct in6_addr laddr; /* local tunnel end-point address */
- struct in6_addr raddr; /* remote tunnel end-point address */
-
- __be16 i_flags;
- __be16 o_flags;
- __be32 i_key;
- __be32 o_key;
-
- __u32 fwmark;
- __u32 index; /* ERSPAN type II index */
- __u8 erspan_ver; /* ERSPAN version */
- __u8 dir; /* direction */
- __u16 hwid; /* hwid */
-};
-
-#define __ip6_tnl_parm rpl__ip6_tnl_parm
-
-/* IPv6 tunnel */
-struct rpl_ip6_tnl {
- struct rpl_ip6_tnl __rcu *next; /* next tunnel in list */
- struct net_device *dev; /* virtual device associated with tunnel */
- struct net *net; /* netns for packet i/o */
- struct __ip6_tnl_parm parms; /* tunnel configuration parameters */
- struct flowi fl; /* flowi template for xmit */
- struct dst_cache dst_cache; /* cached dst */
- struct gro_cells gro_cells;
-
- int err_count;
- unsigned long err_time;
-
- /* These fields used only by GRE */
- __u32 i_seqno; /* The last seen seqno */
- __u32 o_seqno; /* The last output seqno */
- int hlen; /* tun_hlen + encap_hlen */
- int tun_hlen; /* Precalculated header length */
- int encap_hlen; /* Encap header length (FOU,GUE) */
- struct ip_tunnel_encap encap;
- int mlink;
-};
-
-#define ip6_tnl rpl_ip6_tnl
-
-struct rpl_ip6_tnl_encap_ops {
- size_t (*encap_hlen)(struct ip_tunnel_encap *e);
- int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
- u8 *protocol, struct flowi6 *fl6);
-};
-
-#define ip6_tnl_encap_ops rpl_ip6_tnl_encap_ops
-
-#ifdef CONFIG_INET
-
-#ifndef MAX_IPTUN_ENCAP_OPS
-#define MAX_IPTUN_ENCAP_OPS 8
-#endif
-
-extern const struct ip6_tnl_encap_ops __rcu *
- rpl_ip6tun_encaps[MAX_IPTUN_ENCAP_OPS];
-
-int rpl_ip6_tnl_encap_add_ops(const struct ip6_tnl_encap_ops *ops,
- unsigned int num);
-#define ip6_tnl_encap_add_ops rpl_ip6_tnl_encap_add_ops
-int rpl_ip6_tnl_encap_del_ops(const struct ip6_tnl_encap_ops *ops,
- unsigned int num);
-#define ip6_tnl_encap_del_ops rpl_ip6_tnl_encap_del_ops
-int rpl_ip6_tnl_encap_setup(struct ip6_tnl *t,
- struct ip_tunnel_encap *ipencap);
-#define ip6_tnl_encap_setup rpl_ip6_tnl_encap_setup
-
-#ifndef HAVE_TUNNEL_ENCAP_TYPES
-enum tunnel_encap_types {
- TUNNEL_ENCAP_NONE,
- TUNNEL_ENCAP_FOU,
- TUNNEL_ENCAP_GUE,
-};
-
-#endif
-static inline int ip6_encap_hlen(struct ip_tunnel_encap *e)
-{
- const struct ip6_tnl_encap_ops *ops;
- int hlen = -EINVAL;
-
- if (e->type == TUNNEL_ENCAP_NONE)
- return 0;
-
- if (e->type >= MAX_IPTUN_ENCAP_OPS)
- return -EINVAL;
-
- rcu_read_lock();
- ops = rcu_dereference(rpl_ip6tun_encaps[e->type]);
- if (likely(ops && ops->encap_hlen))
- hlen = ops->encap_hlen(e);
- rcu_read_unlock();
-
- return hlen;
-}
-
-static inline int ip6_tnl_encap(struct sk_buff *skb, struct ip6_tnl *t,
- u8 *protocol, struct flowi6 *fl6)
-{
- const struct ip6_tnl_encap_ops *ops;
- int ret = -EINVAL;
-
- if (t->encap.type == TUNNEL_ENCAP_NONE)
- return 0;
-
- if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
- return -EINVAL;
-
- rcu_read_lock();
- ops = rcu_dereference(rpl_ip6tun_encaps[t->encap.type]);
- if (likely(ops && ops->build_header))
- ret = ops->build_header(skb, &t->encap, protocol, fl6);
- rcu_read_unlock();
-
- return ret;
-}
-
-/* Tunnel encapsulation limit destination sub-option */
-
-struct ipv6_tlv_tnl_enc_lim {
- __u8 type; /* type-code for option */
- __u8 length; /* option length */
- __u8 encap_limit; /* tunnel encapsulation limit */
-} __packed;
-
-int rpl_ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
- const struct in6_addr *raddr);
-#define ip6_tnl_rcv_ctl rpl_ip6_tnl_rcv_ctl
-int rpl_ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb,
- const struct tnl_ptk_info *tpi,
- struct metadata_dst *tun_dst,
- bool log_ecn_error);
-#define ip6_tnl_rcv rpl_ip6_tnl_rcv
-int rpl_ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
- const struct in6_addr *raddr);
-#define ip6_tnl_xmit_ctl rpl_ip6_tnl_xmit_ctl
-int rpl_ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev, __u8 dsfield,
- struct flowi6 *fl6, int encap_limit, __u32 *pmtu,
- __u8 proto);
-#define ip6_tnl_xmit rpl_ip6_tnl_xmit
-__u16 rpl_ip6_tnl_parse_tlv_enc_lim(struct sk_buff *skb, __u8 *raw);
-#define ip6_tnl_parse_tlv_enc_lim rpl_ip6_tnl_parse_tlv_enc_lim
-__u32 rpl_ip6_tnl_get_cap(struct ip6_tnl *t, const struct in6_addr *laddr,
- const struct in6_addr *raddr);
-#define ip6_tnl_get_cap rpl_ip6_tnl_get_cap
-struct net *rpl_ip6_tnl_get_link_net(const struct net_device *dev);
-#define ip6_tnl_get_link_net rpl_ip6_tnl_get_link_net
-int rpl_ip6_tnl_get_iflink(const struct net_device *dev);
-#define ip6_tnl_get_iflink rpl_ip6_tnl_get_iflink
-int rpl_ip6_tnl_change_mtu(struct net_device *dev, int new_mtu);
-#define ip6_tnl_change_mtu rpl_ip6_tnl_change_mtu
-
-static inline void ip6tunnel_xmit(struct sock *sk, struct sk_buff *skb,
- struct net_device *dev)
-{
- int pkt_len, err;
-
- memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
- pkt_len = skb->len - skb_inner_network_offset(skb);
- err = ip6_local_out(dev_net(skb_dst(skb)->dev), sk, skb);
- if (unlikely(net_xmit_eval(err)))
- pkt_len = -1;
- iptunnel_xmit_stats(dev, pkt_len);
-}
-#endif
-
-#endif /* HAVE_IP6_TNL_PARM_ERSPAN_VER */
-
-#endif
diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
deleted file mode 100644
index 617a753c7..000000000
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ /dev/null
@@ -1,513 +0,0 @@
-#ifndef __NET_IP_TUNNELS_WRAPPER_H
-#define __NET_IP_TUNNELS_WRAPPER_H 1
-
-#include <linux/version.h>
-
-#ifdef USE_UPSTREAM_TUNNEL
-/* Block all ip_tunnel functions.
- * Only function that do not depend on ip_tunnel structure can
- * be used. Those needs to be explicitly defined in this header file. */
-#include_next <net/ip_tunnels.h>
-
-#ifndef TUNNEL_ERSPAN_OPT
-#define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000)
-#endif
-#define ovs_ip_tunnel_encap ip_tunnel_encap
-
-#ifndef HAVE_IP_TUNNEL_INFO_OPTS_SET_FLAGS
-static inline void rpl_ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
- const void *from, int len,
- __be16 flags)
-{
- memcpy(ip_tunnel_info_opts(info), from, len);
- info->options_len = len;
- info->key.tun_flags |= flags;
-}
-
-#define ip_tunnel_info_opts_set rpl_ip_tunnel_info_opts_set
-#endif
-
-#else /* USE_UPSTREAM_TUNNEL */
-
-#include <linux/if_tunnel.h>
-#include <linux/types.h>
-#include <net/dsfield.h>
-#include <net/dst_cache.h>
-#include <net/flow.h>
-#include <net/inet_ecn.h>
-#include <net/ip.h>
-#include <net/rtnetlink.h>
-#include <net/gro_cells.h>
-
-#ifndef MAX_IPTUN_ENCAP_OPS
-#define MAX_IPTUN_ENCAP_OPS 8
-#endif
-
-#ifndef HAVE_TUNNEL_ENCAP_TYPES
-enum tunnel_encap_types {
- TUNNEL_ENCAP_NONE,
- TUNNEL_ENCAP_FOU,
- TUNNEL_ENCAP_GUE,
-};
-
-#define HAVE_TUNNEL_ENCAP_TYPES 1
-#endif
-
-#define __iptunnel_pull_header rpl___iptunnel_pull_header
-int rpl___iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
- __be16 inner_proto, bool raw_proto, bool xnet);
-
-#define iptunnel_pull_header rpl_iptunnel_pull_header
-static inline int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
- __be16 inner_proto, bool xnet)
-{
- return rpl___iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet);
-}
-
-int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
- int gso_type_mask,
- void (*fix_segment)(struct sk_buff *));
-
-/* This is required to compile upstream gre.h. gre_handle_offloads()
- * is defined in gre.h and needs iptunnel_handle_offloads(). This provides
- * default signature for this function.
- * rpl prefix is to make OVS build happy.
- */
-#define iptunnel_handle_offloads rpl_iptunnel_handle_offloads
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
-struct sk_buff *rpl_iptunnel_handle_offloads(struct sk_buff *skb,
- bool csum_help,
- int gso_type_mask);
-#else
-int rpl_iptunnel_handle_offloads(struct sk_buff *skb,
- bool csum_help,
- int gso_type_mask);
-#endif
-
-#define iptunnel_xmit rpl_iptunnel_xmit
-void rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
- __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl,
- __be16 df, bool xnet);
-#define ip_tunnel_xmit rpl_ip_tunnel_xmit
-void rpl_ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
- const struct iphdr *tnl_params, const u8 protocol);
-
-
-#ifndef TUNNEL_CSUM
-#define TUNNEL_CSUM __cpu_to_be16(0x01)
-#define TUNNEL_ROUTING __cpu_to_be16(0x02)
-#define TUNNEL_KEY __cpu_to_be16(0x04)
-#define TUNNEL_SEQ __cpu_to_be16(0x08)
-#define TUNNEL_STRICT __cpu_to_be16(0x10)
-#define TUNNEL_REC __cpu_to_be16(0x20)
-#define TUNNEL_VERSION __cpu_to_be16(0x40)
-#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
-#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
-#define TUNNEL_OAM __cpu_to_be16(0x0200)
-#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
-#define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800)
-#define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000)
-#define TUNNEL_NOCACHE __cpu_to_be16(0x2000)
-#define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000)
-
-#undef TUNNEL_OPTIONS_PRESENT
-#define TUNNEL_OPTIONS_PRESENT \
- (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT)
-
-struct tnl_ptk_info {
- __be16 flags;
- __be16 proto;
- __be32 key;
- __be32 seq;
- int hdr_len;
-};
-
-#define PACKET_RCVD 0
-#define PACKET_REJECT 1
-#define PACKET_NEXT 2
-#endif
-
-#define IP_TNL_HASH_BITS 7
-#define IP_TNL_HASH_SIZE (1 << IP_TNL_HASH_BITS)
-
-/* Keep error state on tunnel for 30 sec */
-#define IPTUNNEL_ERR_TIMEO (30*HZ)
-
-/* Used to memset ip_tunnel padding. */
-#define IP_TUNNEL_KEY_SIZE offsetofend(struct ip_tunnel_key, tp_dst)
-
-/* Used to memset ipv4 address padding. */
-#define IP_TUNNEL_KEY_IPV4_PAD offsetofend(struct ip_tunnel_key, u.ipv4.dst)
-#define IP_TUNNEL_KEY_IPV4_PAD_LEN \
- (sizeof_field(struct ip_tunnel_key, u) - \
- sizeof_field(struct ip_tunnel_key, u.ipv4))
-
-struct ip_tunnel_key {
- __be64 tun_id;
- union {
- struct {
- __be32 src;
- __be32 dst;
- } ipv4;
- struct {
- struct in6_addr src;
- struct in6_addr dst;
- } ipv6;
- } u;
- __be16 tun_flags;
- u8 tos; /* TOS for IPv4, TC for IPv6 */
- u8 ttl; /* TTL for IPv4, HL for IPv6 */
- __be32 label; /* Flow Label for IPv6 */
- __be16 tp_src;
- __be16 tp_dst;
-};
-
-/* Flags for ip_tunnel_info mode. */
-#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
-#define IP_TUNNEL_INFO_IPV6 0x02 /* key contains IPv6 addresses */
-
-struct ip_tunnel_info {
- struct ip_tunnel_key key;
- struct dst_cache dst_cache;
- u8 options_len;
- u8 mode;
-};
-
-/* 6rd prefix/relay information */
-#ifdef CONFIG_IPV6_SIT_6RD
-struct ip_tunnel_6rd_parm {
- struct in6_addr prefix;
- __be32 relay_prefix;
- u16 prefixlen;
- u16 relay_prefixlen;
-};
-#endif
-
-struct ip_tunnel_encap {
- u16 type;
- u16 flags;
- __be16 sport;
- __be16 dport;
-};
-
-struct ip_tunnel_prl_entry {
- struct ip_tunnel_prl_entry __rcu *next;
- __be32 addr;
- u16 flags;
- struct rcu_head rcu_head;
-};
-
-static inline unsigned short ip_tunnel_info_af(const struct ip_tunnel_info *tun_info)
-{
- return tun_info->mode & IP_TUNNEL_INFO_IPV6 ? AF_INET6 : AF_INET;
-}
-
-static inline void *ip_tunnel_info_opts(struct ip_tunnel_info *info)
-{
- return info + 1;
-}
-
-static inline void ip_tunnel_info_opts_get(void *to,
- const struct ip_tunnel_info *info)
-{
- memcpy(to, info + 1, info->options_len);
-}
-
-static inline void ip_tunnel_info_opts_set(struct ip_tunnel_info *info,
- const void *from, int len,
- __be16 flags)
-{
- memcpy(ip_tunnel_info_opts(info), from, len);
- info->options_len = len;
- info->key.tun_flags |= flags;
-}
-
-static inline void ip_tunnel_key_init(struct ip_tunnel_key *key,
- __be32 saddr, __be32 daddr,
- u8 tos, u8 ttl, __be32 label,
- __be16 tp_src, __be16 tp_dst,
- __be64 tun_id, __be16 tun_flags)
-{
- key->tun_id = tun_id;
- key->u.ipv4.src = saddr;
- key->u.ipv4.dst = daddr;
- memset((unsigned char *)key + IP_TUNNEL_KEY_IPV4_PAD,
- 0, IP_TUNNEL_KEY_IPV4_PAD_LEN);
- key->tos = tos;
- key->ttl = ttl;
- key->label = label;
- key->tun_flags = tun_flags;
-
- /* For the tunnel types on the top of IPsec, the tp_src and tp_dst of
- * the upper tunnel are used.
- * E.g: GRE over IPSEC, the tp_src and tp_port are zero.
- */
- key->tp_src = tp_src;
- key->tp_dst = tp_dst;
-
- /* Clear struct padding. */
- if (sizeof(*key) != IP_TUNNEL_KEY_SIZE)
- memset((unsigned char *)key + IP_TUNNEL_KEY_SIZE,
- 0, sizeof(*key) - IP_TUNNEL_KEY_SIZE);
-}
-
-#define ip_tunnel_collect_metadata() true
-
-#undef TUNNEL_NOCACHE
-#define TUNNEL_NOCACHE 0
-
-static inline bool
-ip_tunnel_dst_cache_usable(const struct sk_buff *skb,
- const struct ip_tunnel_info *info)
-{
- if (skb->mark)
- return false;
- if (!info)
- return true;
- if (info->key.tun_flags & TUNNEL_NOCACHE)
- return false;
-
- return true;
-}
-
-#define ip_tunnel_dst rpl_ip_tunnel_dst
-struct rpl_ip_tunnel_dst {
- struct dst_entry __rcu *dst;
- __be32 saddr;
-};
-
-#define ip_tunnel rpl_ip_tunnel
-struct rpl_ip_tunnel {
- struct ip_tunnel __rcu *next;
- struct hlist_node hash_node;
- struct net_device *dev;
- struct net *net; /* netns for packet i/o */
-
- unsigned long err_time; /* Time when the last ICMP error
- * arrived */
- int err_count; /* Number of arrived ICMP errors */
-
- /* These four fields used only by GRE */
- u32 i_seqno; /* The last seen seqno */
- u32 o_seqno; /* The last output seqno */
- int tun_hlen; /* Precalculated header length */
-
- /* These four fields used only by ERSPAN */
- u32 index; /* ERSPAN type II index */
- u8 erspan_ver; /* ERSPAN version */
- u8 dir; /* ERSPAN direction */
- u16 hwid; /* ERSPAN hardware ID */
-
- struct dst_cache dst_cache;
-
- struct ip_tunnel_parm parms;
-
- int mlink;
- int encap_hlen; /* Encap header length (FOU,GUE) */
- int hlen; /* tun_hlen + encap_hlen */
- struct ip_tunnel_encap encap;
-
- /* for SIT */
-#ifdef CONFIG_IPV6_SIT_6RD
- struct ip_tunnel_6rd_parm ip6rd;
-#endif
- struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */
- unsigned int prl_count; /* # of entries in PRL */
- unsigned int ip_tnl_net_id;
- struct gro_cells gro_cells;
- __u32 fwmark;
- bool collect_md;
- bool ignore_df;
-};
-
-#define ip_tunnel_net rpl_ip_tunnel_net
-struct rpl_ip_tunnel_net {
- struct net_device *fb_tunnel_dev;
- struct hlist_head tunnels[IP_TNL_HASH_SIZE];
- struct ip_tunnel __rcu *collect_md_tun;
-};
-
-
-struct ip_tunnel_encap_ops {
- size_t (*encap_hlen)(struct ip_tunnel_encap *e);
- int (*build_header)(struct sk_buff *skb, struct ip_tunnel_encap *e,
- const u8 *protocol, struct flowi4 *fl4);
-};
-
-extern const struct ip_tunnel_encap_ops __rcu *
- rpl_iptun_encaps[MAX_IPTUN_ENCAP_OPS];
-
-#define ip_encap_hlen rpl_ip_encap_hlen
-static inline int rpl_ip_encap_hlen(struct ip_tunnel_encap *e)
-{
- const struct ip_tunnel_encap_ops *ops;
- int hlen = -EINVAL;
-
- if (e->type == TUNNEL_ENCAP_NONE)
- return 0;
-
- if (e->type >= MAX_IPTUN_ENCAP_OPS)
- return -EINVAL;
-
- rcu_read_lock();
- ops = rcu_dereference(rpl_iptun_encaps[e->type]);
- if (likely(ops && ops->encap_hlen))
- hlen = ops->encap_hlen(e);
- rcu_read_unlock();
-
- return hlen;
-}
-
-static inline int ovs_ip_tunnel_encap(struct sk_buff *skb, struct ip_tunnel *t,
- const u8 *protocol, struct flowi4 *fl4)
-{
- const struct ip_tunnel_encap_ops *ops;
- int ret = -EINVAL;
-
- if (t->encap.type == TUNNEL_ENCAP_NONE)
- return 0;
-
- if (t->encap.type >= MAX_IPTUN_ENCAP_OPS)
- return -EINVAL;
-
- rcu_read_lock();
- ops = rcu_dereference(rpl_iptun_encaps[t->encap.type]);
- if (likely(ops && ops->build_header))
- ret = ops->build_header(skb, &t->encap, protocol, fl4);
- rcu_read_unlock();
-
- return ret;
-}
-
-#define ip_tunnel_get_stats64 rpl_ip_tunnel_get_stats64
-#if !defined(HAVE_VOID_NDO_GET_STATS64) && !defined(HAVE_RHEL7_MAX_MTU)
-struct rtnl_link_stats64 *rpl_ip_tunnel_get_stats64(struct net_device *dev,
- struct rtnl_link_stats64 *tot);
-#else
-void rpl_ip_tunnel_get_stats64(struct net_device *dev,
- struct rtnl_link_stats64 *tot);
-#endif
-#define ip_tunnel_get_dsfield rpl_ip_tunnel_get_dsfield
-static inline u8 rpl_ip_tunnel_get_dsfield(const struct iphdr *iph,
- const struct sk_buff *skb)
-{
- if (skb->protocol == htons(ETH_P_IP))
- return iph->tos;
- else if (skb->protocol == htons(ETH_P_IPV6))
- return ipv6_get_dsfield((const struct ipv6hdr *)iph);
- else
- return 0;
-}
-
-#define ip_tunnel_ecn_encap rpl_ip_tunnel_ecn_encap
-static inline u8 rpl_ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph,
- const struct sk_buff *skb)
-{
- u8 inner = ip_tunnel_get_dsfield(iph, skb);
-
- return INET_ECN_encapsulate(tos, inner);
-}
-
-static inline void iptunnel_xmit_stats(struct net_device *dev, int pkt_len)
-{
- if (pkt_len > 0) {
- struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
-
- u64_stats_update_begin(&tstats->syncp);
- tstats->tx_bytes += pkt_len;
- tstats->tx_packets++;
- u64_stats_update_end(&tstats->syncp);
- put_cpu_ptr(tstats);
- } else {
- struct net_device_stats *err_stats = &dev->stats;
-
- if (pkt_len < 0) {
- err_stats->tx_errors++;
- err_stats->tx_aborted_errors++;
- } else {
- err_stats->tx_dropped++;
- }
- }
-}
-
-static inline __be64 key32_to_tunnel_id(__be32 key)
-{
-#ifdef __BIG_ENDIAN
- return (__force __be64)key;
-#else
- return (__force __be64)((__force u64)key << 32);
-#endif
-}
-
-/* Returns the least-significant 32 bits of a __be64. */
-static inline __be32 tunnel_id_to_key32(__be64 tun_id)
-{
-#ifdef __BIG_ENDIAN
- return (__force __be32)tun_id;
-#else
- return (__force __be32)((__force u64)tun_id >> 32);
-#endif
-}
-
-#define ip_tunnel_init rpl_ip_tunnel_init
-int rpl_ip_tunnel_init(struct net_device *dev);
-
-#define ip_tunnel_uninit rpl_ip_tunnel_uninit
-void rpl_ip_tunnel_uninit(struct net_device *dev);
-
-#define ip_tunnel_change_mtu rpl_ip_tunnel_change_mtu
-int rpl_ip_tunnel_change_mtu(struct net_device *dev, int new_mtu);
-
-#define ip_tunnel_newlink rpl_ip_tunnel_newlink
-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
-void rpl_ip_tunnel_dellink(struct net_device *dev, struct list_head *head);
-
-#define ip_tunnel_init_net rpl_ip_tunnel_init_net
-int rpl_ip_tunnel_init_net(struct net *net, int ip_tnl_net_id,
- struct rtnl_link_ops *ops, char *devname);
-
-#define ip_tunnel_delete_net rpl_ip_tunnel_delete_net
-void rpl_ip_tunnel_delete_net(struct ip_tunnel_net *itn, struct rtnl_link_ops *ops);
-
-#define ip_tunnel_setup rpl_ip_tunnel_setup
-void rpl_ip_tunnel_setup(struct net_device *dev, int net_id);
-
-#define ip_tunnel_get_iflink rpl_ip_tunnel_get_iflink
-int rpl_ip_tunnel_get_iflink(const struct net_device *dev);
-
-#define ip_tunnel_get_link_net rpl_ip_tunnel_get_link_net
-struct net *rpl_ip_tunnel_get_link_net(const struct net_device *dev);
-
-#define __ip_tunnel_change_mtu rpl___ip_tunnel_change_mtu
-int rpl___ip_tunnel_change_mtu(struct net_device *dev, int new_mtu, bool strict);
-
-#define ip_tunnel_lookup rpl_ip_tunnel_lookup
-struct ip_tunnel *rpl_ip_tunnel_lookup(struct ip_tunnel_net *itn,
- int link, __be16 flags,
- __be32 remote, __be32 local,
- __be32 key);
-
-static inline int iptunnel_pull_offloads(struct sk_buff *skb)
-{
- if (skb_is_gso(skb)) {
- int err;
-
- err = skb_unclone(skb, GFP_ATOMIC);
- if (unlikely(err))
- return err;
- skb_shinfo(skb)->gso_type &= ~(NETIF_F_GSO_ENCAP_ALL >>
- NETIF_F_GSO_SHIFT);
- }
-
- skb->encapsulation = 0;
- return 0;
-}
-#endif /* USE_UPSTREAM_TUNNEL */
-
-#define skb_is_encapsulated ovs_skb_is_encapsulated
-bool ovs_skb_is_encapsulated(struct sk_buff *skb);
-
-#endif /* __NET_IP_TUNNELS_H */
diff --git a/datapath/linux/compat/include/net/ipv6.h b/datapath/linux/compat/include/net/ipv6.h
deleted file mode 100644
index 6379457e8..000000000
--- a/datapath/linux/compat/include/net/ipv6.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __NET_IPV6_WRAPPER_H
-#define __NET_IPV6_WRAPPER_H 1
-
-#include <linux/version.h>
-
-#include_next <net/ipv6.h>
-
-#ifndef NEXTHDR_SCTP
-#define NEXTHDR_SCTP 132 /* Stream Control Transport Protocol */
-#endif
-
-#ifndef HAVE_IP6_FH_F_SKIP_RH
-
-enum {
- IP6_FH_F_FRAG = (1 << 0),
- IP6_FH_F_AUTH = (1 << 1),
- IP6_FH_F_SKIP_RH = (1 << 2),
-};
-
-/* This function is upstream, but not the version which skips routing
- * headers with 0 segments_left. We fixed it when we introduced
- * IP6_FH_F_SKIP_RH.
- */
-#define ipv6_find_hdr rpl_ipv6_find_hdr
-extern int rpl_ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
- int target, unsigned short *fragoff, int *fragflg);
-#endif
-
-#ifndef HAVE___IPV6_ADDR_JHASH
-static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 unused)
-{
- return ipv6_addr_jhash(a);
-}
-#endif
-
-#define ip6_flowlabel rpl_ip6_flowlabel
-static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
-{
- return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
-}
-
-#ifndef HAVE_IP6_MAKE_FLOWLABEL_FL6
-#define ip6_make_flowlabel rpl_ip6_make_flowlabel
-static inline __be32 rpl_ip6_make_flowlabel(struct net *net,
- struct sk_buff *skb,
- __be32 flowlabel, bool autolabel,
- struct flowi6 *fl6)
-{
-#ifndef HAVE_NETNS_SYSCTL_IPV6_AUTO_FLOWLABELS
- if (!flowlabel && autolabel) {
-#else
- if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
-#endif
- u32 hash;
-
- hash = skb_get_hash(skb);
-
- /* Since this is being sent on the wire obfuscate hash a bit
- * to minimize possbility that any useful information to an
- * attacker is leaked. Only lower 20 bits are relevant.
- */
- hash ^= hash >> 12;
-
- flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK;
- }
-
- return flowlabel;
-}
-#endif
-
-#ifndef IPV6_TCLASS_SHIFT
-#define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
-#define IPV6_TCLASS_SHIFT 20
-#endif
-
-#define ip6_tclass rpl_ip6_tclass
-static inline u8 ip6_tclass(__be32 flowinfo)
-{
- return ntohl(flowinfo & IPV6_TCLASS_MASK) >> IPV6_TCLASS_SHIFT;
-}
-
-#define ip6_make_flowinfo rpl_ip6_make_flowinfo
-static inline __be32 ip6_make_flowinfo(unsigned int tclass, __be32 flowlabel)
-{
- return htonl(tclass << IPV6_TCLASS_SHIFT) | flowlabel;
-}
-
-#endif
diff --git a/datapath/linux/compat/include/net/ipv6_frag.h b/datapath/linux/compat/include/net/ipv6_frag.h
deleted file mode 100644
index 5d1cc901b..000000000
--- a/datapath/linux/compat/include/net/ipv6_frag.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __NET_IPV6_FRAG_WRAPPER_H
-#define __NET_IPV6_FRAG_WRAPPER_H
-
-#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) && defined(HAVE_IPV6_FRAG_H)
-#include_next <net/ipv6_frag.h>
-#endif
-
-#endif /* __NET_IPV6_FRAG_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/lisp.h b/datapath/linux/compat/include/net/lisp.h
deleted file mode 100644
index 6b43c77e2..000000000
--- a/datapath/linux/compat/include/net/lisp.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __NET_LISP_WRAPPER_H
-#define __NET_LISP_WRAPPER_H 1
-
-#ifdef CONFIG_INET
-#include <net/udp_tunnel.h>
-#endif
-
-
-#ifdef CONFIG_INET
-#define lisp_dev_create_fb rpl_lisp_dev_create_fb
-struct net_device *rpl_lisp_dev_create_fb(struct net *net, const char *name,
- u8 name_assign_type, u16 dst_port);
-#endif /*ifdef CONFIG_INET */
-
-#define lisp_init_module rpl_lisp_init_module
-int rpl_lisp_init_module(void);
-
-#define lisp_cleanup_module rpl_lisp_cleanup_module
-void rpl_lisp_cleanup_module(void);
-
-#define lisp_xmit rpl_lisp_xmit
-netdev_tx_t rpl_lisp_xmit(struct sk_buff *skb);
-
-#define lisp_fill_metadata_dst ovs_lisp_fill_metadata_dst
-int ovs_lisp_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-
-#endif /*ifdef__NET_LISP_H */
diff --git a/datapath/linux/compat/include/net/mpls.h b/datapath/linux/compat/include/net/mpls.h
deleted file mode 100644
index 9359a2369..000000000
--- a/datapath/linux/compat/include/net/mpls.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014 Nicira, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- */
-
-#ifndef _NET_MPLS_WRAPPER_H
-#define _NET_MPLS_WRAPPER_H 1
-
-#include <linux/if_ether.h>
-#include <linux/netdevice.h>
-
-#define MPLS_HLEN 4
-
-struct mpls_shim_hdr {
- __be32 label_stack_entry;
-};
-
-static inline bool eth_p_mpls(__be16 eth_type)
-{
- return eth_type == htons(ETH_P_MPLS_UC) ||
- eth_type == htons(ETH_P_MPLS_MC);
-}
-
-/* Starting from kernel 4.9, commit 48d2ab609b6b ("net: mpls: Fixups for GSO")
- * and commit 85de4a2101ac ("openvswitch: use mpls_hdr") introduced
- * behavioural changes to mpls_gso kernel module. It now assumes that
- * skb_network_header() points to the mpls header and
- * skb_inner_network_header() points to the L3 header. However, the old
- * mpls_gso kernel module assumes that the skb_network_header() points
- * to the L3 header. We shall backport the following function to ensure
- * MPLS GSO works properly for kernels older than the one which contains
- * these commits.
- */
-#ifdef MPLS_HEADER_IS_L3
-static inline struct mpls_shim_hdr *mpls_hdr(const struct sk_buff *skb)
-{
- return (struct mpls_shim_hdr *)skb_network_header(skb);
-}
-#else
-#define mpls_hdr rpl_mpls_hdr
-/*
- * For non-MPLS skbs this will correspond to the network header.
- * For MPLS skbs it will be before the network_header as the MPLS
- * label stack lies between the end of the mac header and the network
- * header. That is, for MPLS skbs the end of the mac header
- * is the top of the MPLS label stack.
- */
-static inline struct mpls_shim_hdr *rpl_mpls_hdr(const struct sk_buff *skb)
-{
- return (struct mpls_shim_hdr *) (skb_mac_header(skb) + skb->mac_len);
-}
-#endif
-
-#endif /* _NET_MPLS_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h
deleted file mode 100644
index 427072249..000000000
--- a/datapath/linux/compat/include/net/net_namespace.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __NET_NET_NAMESPACE_WRAPPER_H
-#define __NET_NET_NAMESPACE_WRAPPER_H 1
-
-#include_next <net/net_namespace.h>
-
-#ifndef HAVE_POSSIBLE_NET_T
-typedef struct {
-#ifdef CONFIG_NET_NS
- struct net *net;
-#endif
-} possible_net_t;
-
-static inline void rpl_write_pnet(possible_net_t *pnet, struct net *net)
-{
-#ifdef CONFIG_NET_NS
- pnet->net = net;
-#endif
-}
-
-static inline struct net *rpl_read_pnet(const possible_net_t *pnet)
-{
-#ifdef CONFIG_NET_NS
- return pnet->net;
-#else
- return &init_net;
-#endif
-}
-#else /* Linux >= 4.1 */
-#define rpl_read_pnet read_pnet
-#define rpl_write_pnet write_pnet
-#endif /* Linux >= 4.1 */
-
-#endif /* net/net_namespace.h wrapper */
diff --git a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h
deleted file mode 100644
index c4c0f79ab..000000000
--- a/datapath/linux/compat/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _NF_DEFRAG_IPV6_WRAPPER_H
-#define _NF_DEFRAG_IPV6_WRAPPER_H
-
-#include <linux/kconfig.h>
-#include_next <net/netfilter/ipv6/nf_defrag_ipv6.h>
-
-/* Upstream commit 029f7f3b8701 ("netfilter: ipv6: nf_defrag: avoid/free clone
- * operations") changed the semantics of nf_ct_frag6_gather(), so we need
- * to backport for all prior kernels, i.e. kernel < 4.5.0.
- *
- * Upstream commit 48cac18ecf1d ("ipv6: orphan skbs in reassembly unit") fixes
- * a bug that requires all kernels prior to this fix, i.e. kernel < 4.11.0
- * to be backported.
- */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
-#define OVS_NF_DEFRAG6_BACKPORT 1
-int rpl_nf_ct_frag6_gather(struct net *net, struct sk_buff *skb, u32 user);
-#define nf_ct_frag6_gather rpl_nf_ct_frag6_gather
-
-/* If backporting IPv6 defrag, then init/exit functions need to be called from
- * compat_{in,ex}it() to prepare the backported fragmentation cache. In this
- * case we declare the functions which are defined in
- * datapath/linux/compat/nf_conntrack_reasm.c.
- *
- * Otherwise, if we can use upstream defrag then we can rely on the upstream
- * nf_defrag_ipv6 module to init/exit correctly. In this case the calls in
- * compat_{in,ex}it() can be no-ops.
- */
-int __init rpl_nf_ct_frag6_init(void);
-void rpl_nf_ct_frag6_cleanup(void);
-void ovs_netns_frags6_init(struct net *net);
-void ovs_netns_frags6_exit(struct net *net);
-#else /* !OVS_NF_DEFRAG6_BACKPORT */
-static inline int __init rpl_nf_ct_frag6_init(void) { return 0; }
-static inline void rpl_nf_ct_frag6_cleanup(void) { }
-static inline void ovs_netns_frags6_init(struct net *net) { }
-static inline void ovs_netns_frags6_exit(struct net *net) { }
-#endif /* OVS_NF_DEFRAG6_BACKPORT */
-#define nf_ct_frag6_init rpl_nf_ct_frag6_init
-#define nf_ct_frag6_cleanup rpl_nf_ct_frag6_cleanup
-
-#endif /* __NF_DEFRAG_IPV6_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack.h
deleted file mode 100644
index 50db914a3..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _NF_CONNTRACK_WRAPPER_H
-#define _NF_CONNTRACK_WRAPPER_H
-
-#include_next <net/netfilter/nf_conntrack.h>
-
-#ifndef HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET
-static inline bool rpl_nf_ct_get_tuplepr(const struct sk_buff *skb,
- unsigned int nhoff,
- u_int16_t l3num, struct net *net,
- struct nf_conntrack_tuple *tuple)
-{
- return nf_ct_get_tuplepr(skb, nhoff, l3num, tuple);
-}
-#define nf_ct_get_tuplepr rpl_nf_ct_get_tuplepr
-#endif
-
-#ifndef HAVE_NF_CT_SET
-static inline void
-nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info)
-{
- skb->nfct = &ct->ct_general;
- skb->nfctinfo = info;
-}
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
-int rpl_nf_ct_netns_get(struct net *net, u8 nfproto);
-void rpl_nf_ct_netns_put(struct net *net, u8 nfproto);
-#define nf_ct_netns_get rpl_nf_ct_netns_get
-#define nf_ct_netns_put rpl_nf_ct_netns_put
-#endif
-
-#endif /* _NF_CONNTRACK_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
deleted file mode 100644
index bc18c56b8..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_core.h
+++ /dev/null
@@ -1,137 +0,0 @@
-#ifndef _NF_CONNTRACK_CORE_WRAPPER_H
-#define _NF_CONNTRACK_CORE_WRAPPER_H
-
-#include_next <net/netfilter/nf_conntrack_core.h>
-
-#ifndef HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE
-
-#include <net/netfilter/nf_conntrack_zones.h>
-
-/* Released via destroy_conntrack() */
-static inline struct nf_conn *
-rpl_nf_ct_tmpl_alloc(struct net *net, const struct nf_conntrack_zone *zone,
- gfp_t flags)
-{
- struct nf_conn *tmpl;
-
- tmpl = kzalloc(sizeof(*tmpl), flags);
- if (tmpl == NULL)
- return NULL;
-
- tmpl->status = IPS_TEMPLATE;
- write_pnet(&tmpl->ct_net, net);
-
- if (nf_ct_zone_add(tmpl, flags, zone) < 0)
- goto out_free;
-
- atomic_set(&tmpl->ct_general.use, 0);
-
- return tmpl;
-out_free:
- kfree(tmpl);
- return NULL;
-}
-#define nf_ct_tmpl_alloc rpl_nf_ct_tmpl_alloc
-
-static inline void rpl_nf_ct_tmpl_free(struct nf_conn *tmpl)
-{
- nf_ct_ext_destroy(tmpl);
- nf_ct_ext_free(tmpl);
- kfree(tmpl);
-}
-#define nf_ct_tmpl_free rpl_nf_ct_tmpl_free
-
-static inline struct nf_conntrack_tuple_hash *
-rpl_nf_conntrack_find_get(struct net *net,
- const struct nf_conntrack_zone *zone,
- const struct nf_conntrack_tuple *tuple)
-{
- return nf_conntrack_find_get(net, zone->id, tuple);
-}
-#define nf_conntrack_find_get rpl_nf_conntrack_find_get
-#endif /* HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE */
-
-#ifndef HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET
-static inline bool rpl_nf_ct_get_tuple(const struct sk_buff *skb,
- unsigned int nhoff,
- unsigned int dataoff, u_int16_t l3num,
- u_int8_t protonum,
- struct net *net,
- struct nf_conntrack_tuple *tuple,
- const struct nf_conntrack_l3proto *l3proto,
- const struct nf_conntrack_l4proto *l4proto)
-{
- return nf_ct_get_tuple(skb, nhoff, dataoff, l3num, protonum, tuple,
- l3proto, l4proto);
-}
-#define nf_ct_get_tuple rpl_nf_ct_get_tuple
-#endif /* HAVE_NF_CT_GET_TUPLEPR_TAKES_STRUCT_NET */
-
-#ifdef HAVE_NF_CONN_TIMER
-
-#ifndef HAVE_NF_CT_DELETE
-#include <net/netfilter/nf_conntrack_timestamp.h>
-#endif
-
-static inline bool rpl_nf_ct_delete(struct nf_conn *ct, u32 portid, int report)
-{
- if (del_timer(&ct->timeout))
-#ifdef HAVE_NF_CT_DELETE
- return nf_ct_delete(ct, portid, report);
-#else
- {
- struct nf_conn_tstamp *tstamp;
-
- tstamp = nf_conn_tstamp_find(ct);
- if (tstamp && tstamp->stop == 0)
- tstamp->stop = ktime_to_ns(ktime_get_real());
-
- if (!test_bit(IPS_DYING_BIT, &ct->status) &&
- unlikely(nf_conntrack_event(IPCT_DESTROY, ct) < 0)) {
- /* destroy event was not delivered */
- nf_ct_delete_from_lists(ct);
- nf_ct_dying_timeout(ct);
- return false;
- }
- set_bit(IPS_DYING_BIT, &ct->status);
- nf_ct_delete_from_lists(ct);
- nf_ct_put(ct);
- return true;
- }
-#endif
- return false;
-}
-#define nf_ct_delete rpl_nf_ct_delete
-#endif /* HAVE_NF_CONN_TIMER */
-
-#ifndef HAVE_NF_CONNTRACK_IN_TAKES_NF_HOOK_STATE
-static inline unsigned int
-rpl_nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state)
-{
- int err;
-
- /* Repeat if requested, see nf_iterate(). */
- do {
- err = nf_conntrack_in(state->net, state->pf, state->hook, skb);
- } while (err == NF_REPEAT);
-
- return err;
-}
-#define nf_conntrack_in rpl_nf_conntrack_in
-#endif /* HAVE_NF_CONNTRACK_IN_TAKES_NF_HOOK_STATE */
-
-#ifdef HAVE_NF_CT_INVERT_TUPLEPR
-static inline bool rpl_nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
- const struct nf_conntrack_tuple *orig)
-{
- return nf_ct_invert_tuplepr(inverse, orig);
-}
-#else
-static inline bool rpl_nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
- const struct nf_conntrack_tuple *orig)
-{
- return nf_ct_invert_tuple(inverse, orig);
-}
-#endif /* HAVE_NF_CT_INVERT_TUPLEPR */
-
-#endif /* _NF_CONNTRACK_CORE_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_count.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_count.h
deleted file mode 100644
index 2143136aa..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_count.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef _NF_CONNTRACK_COUNT_WRAPPER_H
-#define _NF_CONNTRACK_COUNT_WRAPPER_H
-
-#include <linux/list.h>
-#include <net/netfilter/nf_conntrack_tuple.h>
-#include <net/netfilter/nf_conntrack_zones.h>
-
-#ifdef HAVE_UPSTREAM_NF_CONNCOUNT
-#include_next <net/netfilter/nf_conntrack_count.h>
-
-static inline int rpl_nf_conncount_modinit(void)
-{
- return 0;
-}
-
-static inline void rpl_nf_conncount_modexit(void)
-{
-}
-
-#else
-#define CONFIG_NETFILTER_CONNCOUNT 1
-struct nf_conncount_data;
-
-struct nf_conncount_list {
- spinlock_t list_lock;
- struct list_head head; /* connections with the same filtering key */
- unsigned int count; /* length of list */
-};
-
-struct nf_conncount_data
-*rpl_nf_conncount_init(struct net *net, unsigned int family,
- unsigned int keylen);
-
-void rpl_nf_conncount_destroy(struct net *net, unsigned int family,
- struct nf_conncount_data *data);
-
-unsigned int rpl_nf_conncount_count(struct net *net,
- struct nf_conncount_data *data,
- const u32 *key,
- const struct nf_conntrack_tuple *tuple,
- const struct nf_conntrack_zone *zone);
-
-#define nf_conncount_init rpl_nf_conncount_init
-#define nf_conncount_destroy rpl_nf_conncount_destroy
-#define nf_conncount_count rpl_nf_conncount_count
-
-int rpl_nf_conncount_modinit(void);
-void rpl_nf_conncount_modexit(void);
-#endif /* HAVE_UPSTREAM_NF_CONNCOUNT */
-
-#define nf_conncount_mod_init rpl_nf_conncount_modinit
-#define nf_conncount_modexit rpl_nf_conncount_modexit
-
-#endif /* _NF_CONNTRACK_COUNT_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_expect.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_expect.h
deleted file mode 100644
index a13f0ce60..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_expect.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _NF_CONNTRACK_EXPECT_WRAPPER_H
-#define _NF_CONNTRACK_EXPECT_WRAPPER_H
-
-#include_next <net/netfilter/nf_conntrack_expect.h>
-
-#ifndef HAVE_NF_CT_ZONE_INIT
-
-#include <net/netfilter/nf_conntrack.h>
-#include <net/netfilter/nf_conntrack_zones.h>
-
-static inline struct nf_conntrack_expect *
-rpl___nf_ct_expect_find(struct net *net,
- const struct nf_conntrack_zone *zone,
- const struct nf_conntrack_tuple *tuple)
-{
- return __nf_ct_expect_find(net, zone->id, tuple);
-}
-#define __nf_ct_expect_find rpl___nf_ct_expect_find
-
-#endif /* HAVE_NF_CT_ZONE_INIT */
-#endif /* _NF_CONNTRACK_EXPECT_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_helper.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_helper.h
deleted file mode 100644
index 78f97375b..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_helper.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _NF_CONNTRACK_HELPER_WRAPPER_H
-#define _NF_CONNTRACK_HELPER_WRAPPER_H
-
-#include_next <net/netfilter/nf_conntrack_helper.h>
-
-#ifndef HAVE_NF_CONNTRACK_HELPER_PUT
-static inline void nf_conntrack_helper_put(struct nf_conntrack_helper *helper) {
- module_put(helper->me);
-}
-#endif
-
-#ifndef HAVE_NF_CT_HELPER_EXT_ADD_TAKES_HELPER
-static inline struct nf_conn_help *
-rpl_nf_ct_helper_ext_add(struct nf_conn *ct,
- struct nf_conntrack_helper *helper, gfp_t gfp)
-{
- return nf_ct_helper_ext_add(ct, gfp);
-}
-#define nf_ct_helper_ext_add rpl_nf_ct_helper_ext_add
-#endif /* HAVE_NF_CT_HELPER_EXT_ADD_TAKES_HELPER */
-
-#ifndef HAVE_NF_NAT_HELPER_TRY_MODULE_GET
-static inline int rpl_nf_nat_helper_try_module_get(const char *name, u16 l3num,
- u8 protonum)
-{
- request_module("ip_nat_%s", name);
- return 0;
-}
-#define nf_nat_helper_try_module_get rpl_nf_nat_helper_try_module_get
-#endif /* HAVE_NF_NAT_HELPER_TRY_MODULE_GET */
-
-#ifndef HAVE_NF_NAT_HELPER_PUT
-void rpl_nf_nat_helper_put(struct nf_conntrack_helper *helper)
-{
-}
-#define nf_nat_helper_put rpl_nf_nat_helper_put
-#endif /* HAVE_NF_NAT_HELPER_PUT */
-
-#endif /* _NF_CONNTRACK_HELPER_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_labels.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_labels.h
deleted file mode 100644
index 14cb35716..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_labels.h
+++ /dev/null
@@ -1,107 +0,0 @@
-#ifndef _NF_CONNTRACK_LABELS_WRAPPER_H
-#define _NF_CONNTRACK_LABELS_WRAPPER_H
-
-#include <linux/kconfig.h>
-#include <linux/version.h>
-#include_next <net/netfilter/nf_conntrack_labels.h>
-
-#ifndef NF_CT_LABELS_MAX_SIZE
-#define NF_CT_LABELS_MAX_SIZE ((XT_CONNLABEL_MAXBIT + 1) / BITS_PER_BYTE)
-#endif
-
-#ifndef HAVE_NF_CONNLABELS_GET_TAKES_BIT
-#if IS_ENABLED(CONFIG_NF_CONNTRACK_LABELS)
-
-/* XXX: This doesn't lock others out from doing the same configuration
- * simultaneously. */
-static inline int rpl_nf_connlabels_get(struct net *net, unsigned int bits)
-{
-#ifndef HAVE_NF_CONNLABELS_GET
- size_t words;
-
- words = BIT_WORD(bits) + 1;
- if (words > NF_CT_LABELS_MAX_SIZE / sizeof(long))
- return -ERANGE;
-
- net->ct.labels_used++;
- if (words > net->ct.label_words)
- net->ct.label_words = words;
-
- return 0;
-#else
- return nf_connlabels_get(net, bits + 1);
-#endif /* HAVE_NF_CONNLABELS_GET */
-}
-#define nf_connlabels_get rpl_nf_connlabels_get
-
-static inline void rpl_nf_connlabels_put(struct net *net)
-{
-#ifndef HAVE_NF_CONNLABELS_GET
- net->ct.labels_used--;
- if (net->ct.labels_used == 0)
- net->ct.label_words = 0;
-#else
- nf_connlabels_put(net);
-#endif /* HAVE_NF_CONNLABELS_GET */
-}
-#define nf_connlabels_put rpl_nf_connlabels_put
-
-#else /* CONFIG_NF_CONNTRACK_LABELS */
-#define nf_connlabels_get rpl_nf_connlabels_get
-static inline int nf_connlabels_get(struct net *net, unsigned int bits)
-{
- return -ERANGE;
-}
-
-#define nf_connlabels_put rpl_nf_connlabels_put
-static inline void nf_connlabels_put(struct net *net) { }
-#endif /* CONFIG_NF_CONNTRACK_LABELS */
-#endif /* HAVE_NF_CONNLABELS_GET_TAKES_BIT */
-
-/* Upstream commit 5a8145f7b222 ("netfilter: labels: don't emit ct event if
- * labels were not changed"), released in Linux 4.7, introduced a functional
- * change to trigger conntrack event for a label change only when the labels
- * actually changed. There is no way we can detect this from the headers, so
- * provide replacements that work the same for OVS (where labels size is 128
- * bits == 16 bytes == 4 4-byte words). */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
-static int replace_u32(u32 *address, u32 mask, u32 new)
-{
- u32 old, tmp;
-
- do {
- old = *address;
- tmp = (old & mask) ^ new;
- if (old == tmp)
- return 0;
- } while (cmpxchg(address, old, tmp) != old);
-
- return 1;
-}
-
-static int rpl_nf_connlabels_replace(struct nf_conn *ct,
- const u32 *data,
- const u32 *mask, unsigned int words32)
-{
- struct nf_conn_labels *labels;
- unsigned int i;
- int changed = 0;
- u32 *dst;
-
- labels = nf_ct_labels_find(ct);
- if (!labels)
- return -ENOSPC;
-
- dst = (u32 *) labels->bits;
- for (i = 0; i < words32; i++)
- changed |= replace_u32(&dst[i], mask ? ~mask[i] : 0, data[i]);
-
- if (changed)
- nf_conntrack_event_cache(IPCT_LABEL, ct);
-
- return 0;
-}
-#define nf_connlabels_replace rpl_nf_connlabels_replace
-#endif
-
-#endif /* _NF_CONNTRACK_LABELS_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_seqadj.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_seqadj.h
deleted file mode 100644
index b11d1a578..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_seqadj.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _NF_CONNTRACK_SEQADJ_WRAPPER_H
-#define _NF_CONNTRACK_SEQADJ_WRAPPER_H
-
-#ifdef HAVE_NF_CT_SEQ_ADJUST
-#include_next <net/netfilter/nf_conntrack_seqadj.h>
-#else
-
-#include <net/netfilter/nf_nat_helper.h>
-
-/* TCP sequence number adjustment. Returns 1 on success, 0 on failure */
-static inline int
-nf_ct_seq_adjust(struct sk_buff *skb,
- struct nf_conn *ct, enum ip_conntrack_info ctinfo,
- unsigned int protoff)
-{
- typeof(nf_nat_seq_adjust_hook) seq_adjust;
-
- seq_adjust = rcu_dereference(nf_nat_seq_adjust_hook);
- if (!seq_adjust ||
- !seq_adjust(skb, ct, ctinfo, ip_hdrlen(skb))) {
- NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
- return 0;
- }
-
- return 1;
-}
-
-#endif /* HAVE_NF_CT_SEQ_ADJUST */
-
-#endif /* _NF_CONNTRACK_SEQADJ_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_timeout.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_timeout.h
deleted file mode 100644
index 134e72b83..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_timeout.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _NF_CONNTRACK_TIMEOUT_WRAPPER_H
-#define _NF_CONNTRACK_TIMEOUT_WRAPPER_H
-
-#include_next <net/netfilter/nf_conntrack_timeout.h>
-
-#ifndef HAVE_NF_CT_SET_TIMEOUT
-
-#ifndef HAVE_NF_CT_TIMEOUT
-#define nf_ct_timeout ctnl_timeout
-#endif
-
-#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
-int rpl_nf_ct_set_timeout(struct net *net, struct nf_conn *ct, u8 l3num, u8 l4num,
- const char *timeout_name);
-void rpl_nf_ct_destroy_timeout(struct nf_conn *ct);
-#else
-static inline int rpl_nf_ct_set_timeout(struct net *net, struct nf_conn *ct,
- u8 l3num, u8 l4num,
- const char *timeout_name)
-{
- return -EOPNOTSUPP;
-}
-
-static inline void rpl_nf_ct_destroy_timeout(struct nf_conn *ct)
-{
- return;
-}
-#endif /* CONFIG_NF_CONNTRACK_TIMEOUT */
-
-#define nf_ct_set_timeout rpl_nf_ct_set_timeout
-#define nf_ct_destroy_timeout rpl_nf_ct_destroy_timeout
-
-#endif /* HAVE_NF_CT_SET_TIMEOUT */
-#endif /* _NF_CONNTRACK_TIMEOUT_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h b/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
deleted file mode 100644
index d46c098c7..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_conntrack_zones.h
+++ /dev/null
@@ -1,101 +0,0 @@
-#ifndef _NF_CONNTRACK_ZONES_WRAPPER_H
-#define _NF_CONNTRACK_ZONES_WRAPPER_H
-
-#include <linux/version.h>
-
-#include_next <net/netfilter/nf_conntrack_zones.h>
-
-#ifndef HAVE_NF_CT_ZONE_INIT
-
-#include <linux/kconfig.h>
-#include <linux/types.h>
-#include <linux/netfilter/nf_conntrack_tuple_common.h>
-
-#define NF_CT_DEFAULT_ZONE_ID 0
-
-#define NF_CT_ZONE_DIR_ORIG (1 << IP_CT_DIR_ORIGINAL)
-#define NF_CT_ZONE_DIR_REPL (1 << IP_CT_DIR_REPLY)
-
-#define NF_CT_DEFAULT_ZONE_DIR (NF_CT_ZONE_DIR_ORIG | NF_CT_ZONE_DIR_REPL)
-
-#define NF_CT_FLAG_MARK 1
-
-struct rpl_nf_conntrack_zone {
- u16 id;
- u8 flags;
- u8 dir;
-};
-#define nf_conntrack_zone rpl_nf_conntrack_zone
-
-extern const struct nf_conntrack_zone nf_ct_zone_dflt;
-
-#if IS_ENABLED(CONFIG_NF_CONNTRACK)
-#include <net/netfilter/nf_conntrack_extend.h>
-
-static inline const struct nf_conntrack_zone *
-rpl_nf_ct_zone(const struct nf_conn *ct)
-{
- const struct nf_conntrack_zone *nf_ct_zone = NULL;
-
-#ifdef CONFIG_NF_CONNTRACK_ZONES
- nf_ct_zone = nf_ct_ext_find(ct, NF_CT_EXT_ZONE);
-#endif
- return nf_ct_zone ? nf_ct_zone : &nf_ct_zone_dflt;
-}
-#define nf_ct_zone rpl_nf_ct_zone
-
-static inline const struct nf_conntrack_zone *
-nf_ct_zone_init(struct nf_conntrack_zone *zone, u16 id, u8 dir, u8 flags)
-{
- zone->id = id;
- zone->flags = flags;
- zone->dir = dir;
-
- return zone;
-}
-
-static inline int nf_ct_zone_add(struct nf_conn *ct, gfp_t flags,
- const struct nf_conntrack_zone *info)
-{
-#ifdef CONFIG_NF_CONNTRACK_ZONES
- struct nf_conntrack_zone *nf_ct_zone;
-
- nf_ct_zone = nf_ct_ext_add(ct, NF_CT_EXT_ZONE, flags);
- if (!nf_ct_zone)
- return -ENOMEM;
-
- nf_ct_zone_init(nf_ct_zone, info->id, info->dir,
- info->flags);
-#endif
- return 0;
-}
-
-static inline bool nf_ct_zone_matches_dir(const struct nf_conntrack_zone *zone,
- enum ip_conntrack_dir dir)
-{
- return zone->dir & (1 << dir);
-}
-
-static inline u16 nf_ct_zone_id(const struct nf_conntrack_zone *zone,
- enum ip_conntrack_dir dir)
-{
- return nf_ct_zone_matches_dir(zone, dir) ?
- zone->id : NF_CT_DEFAULT_ZONE_ID;
-}
-
-static inline bool nf_ct_zone_equal(const struct nf_conn *a,
- const struct nf_conntrack_zone *b,
- enum ip_conntrack_dir dir)
-{
- return nf_ct_zone_id(nf_ct_zone(a), dir) ==
- nf_ct_zone_id(b, dir);
-}
-
-static inline bool nf_ct_zone_equal_any(const struct nf_conn *a,
- const struct nf_conntrack_zone *b)
-{
- return nf_ct_zone(a)->id == b->id;
-}
-#endif /* IS_ENABLED(CONFIG_NF_CONNTRACK) */
-#endif /* HAVE_NF_CT_ZONE_INIT */
-#endif /* _NF_CONNTRACK_ZONES_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netfilter/nf_nat.h b/datapath/linux/compat/include/net/netfilter/nf_nat.h
deleted file mode 100644
index 773e569cb..000000000
--- a/datapath/linux/compat/include/net/netfilter/nf_nat.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef _NF_NAT_WRAPPER_H
-#define _NF_NAT_WRAPPER_H
-
-#include_next <net/netfilter/nf_nat.h>
-
-#ifndef HAVE_NF_CT_NAT_EXT_ADD
-
-static inline struct nf_conn_nat *
-nf_ct_nat_ext_add(struct nf_conn *ct)
-{
- struct nf_conn_nat *nat = nfct_nat(ct);
- if (nat)
- return nat;
-
- if (!nf_ct_is_confirmed(ct))
- nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC);
-
- return nat;
-}
-#endif /* HAVE_NF_CT_NAT_EXT_ADD */
-
-#ifndef HAVE_NF_NAT_ALLOC_NULL_BINDING
-static inline unsigned int
-nf_nat_alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
-{
- /* Force range to this IP; let proto decide mapping for
- * per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).
- * Use reply in case it's already been mangled (eg local packet).
- */
- union nf_inet_addr ip =
- (HOOK2MANIP(hooknum) == NF_NAT_MANIP_SRC ?
- ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3 :
- ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3);
- struct nf_nat_range range = {
- .flags = NF_NAT_RANGE_MAP_IPS,
- .min_addr = ip,
- .max_addr = ip,
- };
- return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum));
-}
-
-#endif /* HAVE_NF_NAT_ALLOC_NULL_BINDING */
-
-#endif /* _NF_NAT_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h
deleted file mode 100644
index 84e073974..000000000
--- a/datapath/linux/compat/include/net/netlink.h
+++ /dev/null
@@ -1,185 +0,0 @@
-#ifndef __NET_NETLINK_WRAPPER_H
-#define __NET_NETLINK_WRAPPER_H 1
-
-#include <linux/version.h>
-#include_next <net/netlink.h>
-#include_next <linux/in6.h>
-
-#ifndef HAVE_NLA_GET_BE16
-/**
- * nla_get_be16 - return payload of __be16 attribute
- * @nla: __be16 netlink attribute
- */
-static inline __be16 nla_get_be16(const struct nlattr *nla)
-{
- return *(__be16 *) nla_data(nla);
-}
-#endif /* !HAVE_NLA_GET_BE16 */
-
-#ifndef HAVE_NLA_PUT_BE16
-static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
-{
- return nla_put(skb, attrtype, sizeof(__be16), &value);
-}
-#endif
-
-#ifndef HAVE_NLA_PUT_BE32
-static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
-{
- return nla_put(skb, attrtype, sizeof(__be32), &value);
-}
-#endif
-
-#ifndef HAVE_NLA_PUT_BE64
-static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
-{
- return nla_put(skb, attrtype, sizeof(__be64), &value);
-}
-#endif
-
-#ifndef nla_for_each_nested
-#define nla_for_each_nested(pos, nla, rem) \
- nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
-#endif
-
-#ifndef HAVE_NLA_FIND_NESTED
-static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
-{
- return nla_find(nla_data(nla), nla_len(nla), attrtype);
-}
-#endif
-
-#ifndef HAVE_NLA_IS_LAST
-static inline bool nla_is_last(const struct nlattr *nla, int rem)
-{
- return nla->nla_len == rem;
-}
-#endif
-
-#ifndef HAVE_NLA_PUT_IN_ADDR
-static inline int nla_put_in_addr(struct sk_buff *skb, int attrtype,
- __be32 addr)
-{
- return nla_put_be32(skb, attrtype, addr);
-}
-
-static inline int nla_put_in6_addr(struct sk_buff *skb, int attrtype,
- const struct in6_addr *addr)
-{
- return nla_put(skb, attrtype, sizeof(*addr), addr);
-}
-
-static inline __be32 nla_get_in_addr(const struct nlattr *nla)
-{
- return *(__be32 *) nla_data(nla);
-}
-
-static inline struct in6_addr nla_get_in6_addr(const struct nlattr *nla)
-{
- struct in6_addr tmp;
-
- nla_memcpy(&tmp, nla, sizeof(tmp));
- return tmp;
-}
-#endif
-
-#ifndef HAVE_NLA_PUT_64BIT
-static inline bool nla_need_padding_for_64bit(struct sk_buff *skb)
-{
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
- /* The nlattr header is 4 bytes in size, that's why we test
- * if the skb->data _is_ aligned. A NOP attribute, plus
- * nlattr header for next attribute, will make nla_data()
- * 8-byte aligned.
- */
- if (IS_ALIGNED((unsigned long)skb_tail_pointer(skb), 8))
- return true;
-#endif
- return false;
-}
-
-static inline int nla_align_64bit(struct sk_buff *skb, int padattr)
-{
- if (nla_need_padding_for_64bit(skb) &&
- !nla_reserve(skb, padattr, 0))
- return -EMSGSIZE;
-
- return 0;
-}
-
-static inline int nla_total_size_64bit(int payload)
-{
- return NLA_ALIGN(nla_attr_size(payload))
-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
- + NLA_ALIGN(nla_attr_size(0))
-#endif
- ;
-}
-
-#define nla_put_64bit rpl_nla_put_64bit
-int rpl_nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
- const void *data, int padattr);
-
-#define __nla_put_64bit rpl___nla_put_64bit
-void rpl___nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
- const void *data, int padattr);
-
-#define __nla_reserve_64bit rpl___nla_reserve_64bit
-struct nlattr *rpl___nla_reserve_64bit(struct sk_buff *skb, int attrtype,
- int attrlen, int padattr);
-
-static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
- u64 value, int padattr)
-{
- return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr);
-}
-
-#define nla_put_be64 rpl_nla_put_be64
-static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value,
- int padattr)
-{
- return nla_put_64bit(skb, attrtype, sizeof(__be64), &value, padattr);
-}
-
-#endif
-
-#ifndef HAVE_NLA_PARSE_DEPRECATED_STRICT
-#define nla_parse_nested_deprecated nla_parse_nested
-#define nla_parse_deprecated_strict nla_parse
-#define genlmsg_parse_deprecated genlmsg_parse
-
-#ifndef HAVE_NETLINK_EXT_ACK
-struct netlink_ext_ack;
-
-static inline int rpl_nla_parse_nested(struct nlattr *tb[], int maxtype,
- const struct nlattr *nla,
- const struct nla_policy *policy,
- struct netlink_ext_ack *extack)
-{
- return nla_parse_nested(tb, maxtype, nla, policy);
-}
-#undef nla_parse_nested_deprecated
-#define nla_parse_nested_deprecated rpl_nla_parse_nested
-
-static inline int rpl_nla_parse(struct nlattr **tb, int maxtype,
- const struct nlattr *head, int len,
- const struct nla_policy *policy,
- struct netlink_ext_ack *extack)
-{
- return nla_parse(tb, maxtype, head, len, policy);
-}
-#undef nla_parse_deprecated_strict
-#define nla_parse_deprecated_strict rpl_nla_parse
-#endif
-#endif /* HAVE_NLA_PARSE_DEPRECATED_STRICT */
-
-#ifndef HAVE_NLA_NEST_START_NOFLAG
-static inline struct nlattr *rpl_nla_nest_start_noflag(struct sk_buff *skb,
- int attrtype)
-{
- return nla_nest_start(skb, attrtype);
-}
-#define nla_nest_start_noflag rpl_nla_nest_start_noflag
-#endif
-
-#endif /* net/netlink.h */
diff --git a/datapath/linux/compat/include/net/nsh.h b/datapath/linux/compat/include/net/nsh.h
deleted file mode 100644
index 76894910c..000000000
--- a/datapath/linux/compat/include/net/nsh.h
+++ /dev/null
@@ -1,313 +0,0 @@
-#ifndef __NET_NSH_H
-#define __NET_NSH_H 1
-
-#include <linux/skbuff.h>
-
-/*
- * Network Service Header:
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Ver|O|U| TTL | Length |U|U|U|U|MD Type| Next Protocol |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Service Path Identifier (SPI) | Service Index |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | |
- * ~ Mandatory/Optional Context Headers ~
- * | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Version: The version field is used to ensure backward compatibility
- * going forward with future NSH specification updates. It MUST be set
- * to 0x0 by the sender, in this first revision of NSH. Given the
- * widespread implementation of existing hardware that uses the first
- * nibble after an MPLS label stack for ECMP decision processing, this
- * document reserves version 01b and this value MUST NOT be used in
- * future versions of the protocol. Please see [RFC7325] for further
- * discussion of MPLS-related forwarding requirements.
- *
- * O bit: Setting this bit indicates an Operations, Administration, and
- * Maintenance (OAM) packet. The actual format and processing of SFC
- * OAM packets is outside the scope of this specification (see for
- * example [I-D.ietf-sfc-oam-framework] for one approach).
- *
- * The O bit MUST be set for OAM packets and MUST NOT be set for non-OAM
- * packets. The O bit MUST NOT be modified along the SFP.
- *
- * SF/SFF/SFC Proxy/Classifier implementations that do not support SFC
- * OAM procedures SHOULD discard packets with O bit set, but MAY support
- * a configurable parameter to enable forwarding received SFC OAM
- * packets unmodified to the next element in the chain. Forwarding OAM
- * packets unmodified by SFC elements that do not support SFC OAM
- * procedures may be acceptable for a subset of OAM functions, but can
- * result in unexpected outcomes for others, thus it is recommended to
- * analyze the impact of forwarding an OAM packet for all OAM functions
- * prior to enabling this behavior. The configurable parameter MUST be
- * disabled by default.
- *
- * TTL: Indicates the maximum SFF hops for an SFP. This field is used
- * for service plane loop detection. The initial TTL value SHOULD be
- * configurable via the control plane; the configured initial value can
- * be specific to one or more SFPs. If no initial value is explicitly
- * provided, the default initial TTL value of 63 MUST be used. Each SFF
- * involved in forwarding an NSH packet MUST decrement the TTL value by
- * 1 prior to NSH forwarding lookup. Decrementing by 1 from an incoming
- * value of 0 shall result in a TTL value of 63. The packet MUST NOT be
- * forwarded if TTL is, after decrement, 0.
- *
- * All other flag fields, marked U, are unassigned and available for
- * future use, see Section 11.2.1. Unassigned bits MUST be set to zero
- * upon origination, and MUST be ignored and preserved unmodified by
- * other NSH supporting elements. Elements which do not understand the
- * meaning of any of these bits MUST NOT modify their actions based on
- * those unknown bits.
- *
- * Length: The total length, in 4-byte words, of NSH including the Base
- * Header, the Service Path Header, the Fixed Length Context Header or
- * Variable Length Context Header(s). The length MUST be 0x6 for MD
- * Type equal to 0x1, and MUST be 0x2 or greater for MD Type equal to
- * 0x2. The length of the NSH header MUST be an integer multiple of 4
- * bytes, thus variable length metadata is always padded out to a
- * multiple of 4 bytes.
- *
- * MD Type: Indicates the format of NSH beyond the mandatory Base Header
- * and the Service Path Header. MD Type defines the format of the
- * metadata being carried.
- *
- * 0x0 - This is a reserved value. Implementations SHOULD silently
- * discard packets with MD Type 0x0.
- *
- * 0x1 - This indicates that the format of the header includes a fixed
- * length Context Header (see Figure 4 below).
- *
- * 0x2 - This does not mandate any headers beyond the Base Header and
- * Service Path Header, but may contain optional variable length Context
- * Header(s). The semantics of the variable length Context Header(s)
- * are not defined in this document. The format of the optional
- * variable length Context Headers is provided in Section 2.5.1.
- *
- * 0xF - This value is reserved for experimentation and testing, as per
- * [RFC3692]. Implementations not explicitly configured to be part of
- * an experiment SHOULD silently discard packets with MD Type 0xF.
- *
- * Next Protocol: indicates the protocol type of the encapsulated data.
- * NSH does not alter the inner payload, and the semantics on the inner
- * protocol remain unchanged due to NSH service function chaining.
- * Please see the IANA Considerations section below, Section 11.2.5.
- *
- * This document defines the following Next Protocol values:
- *
- * 0x1: IPv4
- * 0x2: IPv6
- * 0x3: Ethernet
- * 0x4: NSH
- * 0x5: MPLS
- * 0xFE: Experiment 1
- * 0xFF: Experiment 2
- *
- * Packets with Next Protocol values not supported SHOULD be silently
- * dropped by default, although an implementation MAY provide a
- * configuration parameter to forward them. Additionally, an
- * implementation not explicitly configured for a specific experiment
- * [RFC3692] SHOULD silently drop packets with Next Protocol values 0xFE
- * and 0xFF.
- *
- * Service Path Identifier (SPI): Identifies a service path.
- * Participating nodes MUST use this identifier for Service Function
- * Path selection. The initial classifier MUST set the appropriate SPI
- * for a given classification result.
- *
- * Service Index (SI): Provides location within the SFP. The initial
- * classifier for a given SFP SHOULD set the SI to 255, however the
- * control plane MAY configure the initial value of SI as appropriate
- * (i.e., taking into account the length of the service function path).
- * The Service Index MUST be decremented by a value of 1 by Service
- * Functions or by SFC Proxy nodes after performing required services
- * and the new decremented SI value MUST be used in the egress packet's
- * NSH. The initial Classifier MUST send the packet to the first SFF in
- * the identified SFP for forwarding along an SFP. If re-classification
- * occurs, and that re-classification results in a new SPI, the
- * (re)classifier is, in effect, the initial classifier for the
- * resultant SPI.
- *
- * The SI is used in conjunction the with Service Path Identifier for
- * Service Function Path Selection and for determining the next SFF/SF
- * in the path. The SI is also valuable when troubleshooting or
- * reporting service paths. Additionally, while the TTL field is the
- * main mechanism for service plane loop detection, the SI can also be
- * used for detecting service plane loops.
- *
- * When the Base Header specifies MD Type = 0x1, a Fixed Length Context
- * Header (16-bytes) MUST be present immediately following the Service
- * Path Header. The value of a Fixed Length Context
- * Header that carries no metadata MUST be set to zero.
- *
- * When the base header specifies MD Type = 0x2, zero or more Variable
- * Length Context Headers MAY be added, immediately following the
- * Service Path Header (see Figure 5). Therefore, Length = 0x2,
- * indicates that only the Base Header followed by the Service Path
- * Header are present. The optional Variable Length Context Headers
- * MUST be of an integer number of 4-bytes. The base header Length
- * field MUST be used to determine the offset to locate the original
- * packet or frame for SFC nodes that require access to that
- * information.
- *
- * The format of the optional variable length Context Headers
- *
- * 0 1 2 3
- * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Metadata Class | Type |U| Length |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Variable Metadata |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Metadata Class (MD Class): Defines the scope of the 'Type' field to
- * provide a hierarchical namespace. The IANA Considerations
- * Section 11.2.4 defines how the MD Class values can be allocated to
- * standards bodies, vendors, and others.
- *
- * Type: Indicates the explicit type of metadata being carried. The
- * definition of the Type is the responsibility of the MD Class owner.
- *
- * Unassigned bit: One unassigned bit is available for future use. This
- * bit MUST NOT be set, and MUST be ignored on receipt.
- *
- * Length: Indicates the length of the variable metadata, in bytes. In
- * case the metadata length is not an integer number of 4-byte words,
- * the sender MUST add pad bytes immediately following the last metadata
- * byte to extend the metadata to an integer number of 4-byte words.
- * The receiver MUST round up the length field to the nearest 4-byte
- * word boundary, to locate and process the next field in the packet.
- * The receiver MUST access only those bytes in the metadata indicated
- * by the length field (i.e., actual number of bytes) and MUST ignore
- * the remaining bytes up to the nearest 4-byte word boundary. The
- * Length may be 0 or greater.
- *
- * A value of 0 denotes a Context Header without a Variable Metadata
- * field.
- *
- * [0] https://datatracker.ietf.org/doc/draft-ietf-sfc-nsh/
- */
-
-/**
- * struct nsh_md1_ctx - Keeps track of NSH context data
- * @nshc<1-4>: NSH Contexts.
- */
-struct nsh_md1_ctx {
- __be32 context[4];
-};
-
-struct nsh_md2_tlv {
- __be16 md_class;
- u8 type;
- u8 length;
- u8 md_value[];
-};
-
-struct nshhdr {
- __be16 ver_flags_ttl_len;
- u8 mdtype;
- u8 np;
- __be32 path_hdr;
- union {
- struct nsh_md1_ctx md1;
- struct nsh_md2_tlv md2;
- };
-};
-
-/* Masking NSH header fields. */
-#define NSH_VER_MASK 0xc000
-#define NSH_VER_SHIFT 14
-#define NSH_FLAGS_MASK 0x3000
-#define NSH_FLAGS_SHIFT 12
-#define NSH_TTL_MASK 0x0fc0
-#define NSH_TTL_SHIFT 6
-#define NSH_LEN_MASK 0x003f
-#define NSH_LEN_SHIFT 0
-
-#define NSH_MDTYPE_MASK 0x0f
-#define NSH_MDTYPE_SHIFT 0
-
-#define NSH_SPI_MASK 0xffffff00
-#define NSH_SPI_SHIFT 8
-#define NSH_SI_MASK 0x000000ff
-#define NSH_SI_SHIFT 0
-
-/* MD Type Registry. */
-#define NSH_M_TYPE1 0x01
-#define NSH_M_TYPE2 0x02
-#define NSH_M_EXP1 0xFE
-#define NSH_M_EXP2 0xFF
-
-/* NSH Base Header Length */
-#define NSH_BASE_HDR_LEN 8
-
-/* NSH MD Type 1 header Length. */
-#define NSH_M_TYPE1_LEN 24
-
-/* NSH header maximum Length. */
-#define NSH_HDR_MAX_LEN 252
-
-/* NSH context headers maximum Length. */
-#define NSH_CTX_HDRS_MAX_LEN 244
-
-static inline struct nshhdr *nsh_hdr(struct sk_buff *skb)
-{
- return (struct nshhdr *)skb_network_header(skb);
-}
-
-static inline u16 nsh_hdr_len(const struct nshhdr *nsh)
-{
- return ((ntohs(nsh->ver_flags_ttl_len) & NSH_LEN_MASK)
- >> NSH_LEN_SHIFT) << 2;
-}
-
-static inline u8 nsh_get_ver(const struct nshhdr *nsh)
-{
- return (ntohs(nsh->ver_flags_ttl_len) & NSH_VER_MASK)
- >> NSH_VER_SHIFT;
-}
-
-static inline u8 nsh_get_flags(const struct nshhdr *nsh)
-{
- return (ntohs(nsh->ver_flags_ttl_len) & NSH_FLAGS_MASK)
- >> NSH_FLAGS_SHIFT;
-}
-
-static inline u8 nsh_get_ttl(const struct nshhdr *nsh)
-{
- return (ntohs(nsh->ver_flags_ttl_len) & NSH_TTL_MASK)
- >> NSH_TTL_SHIFT;
-}
-
-static inline void __nsh_set_xflag(struct nshhdr *nsh, u16 xflag, u16 xmask)
-{
- nsh->ver_flags_ttl_len
- = (nsh->ver_flags_ttl_len & ~htons(xmask)) | htons(xflag);
-}
-
-static inline void nsh_set_flags_and_ttl(struct nshhdr *nsh, u8 flags, u8 ttl)
-{
- __nsh_set_xflag(nsh, ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK) |
- ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK),
- NSH_FLAGS_MASK | NSH_TTL_MASK);
-}
-
-static inline void nsh_set_flags_ttl_len(struct nshhdr *nsh, u8 flags,
- u8 ttl, u8 len)
-{
- len = len >> 2;
- __nsh_set_xflag(nsh, ((flags << NSH_FLAGS_SHIFT) & NSH_FLAGS_MASK) |
- ((ttl << NSH_TTL_SHIFT) & NSH_TTL_MASK) |
- ((len << NSH_LEN_SHIFT) & NSH_LEN_MASK),
- NSH_FLAGS_MASK | NSH_TTL_MASK | NSH_LEN_MASK);
-}
-
-int ovs_nsh_init(void);
-void ovs_nsh_cleanup(void);
-
-int ovs_nsh_push(struct sk_buff *skb, const struct nshhdr *pushed_nh);
-int ovs_nsh_pop(struct sk_buff *skb);
-
-#endif /* __NET_NSH_H */
diff --git a/datapath/linux/compat/include/net/protocol.h b/datapath/linux/compat/include/net/protocol.h
deleted file mode 100644
index 0247a26c7..000000000
--- a/datapath/linux/compat/include/net/protocol.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _NET_PROTOCOL_WRAPPER_H
-#define _NET_PROTOCOL_WRAPPER_H
-
-#include_next <net/protocol.h>
-
-#ifdef HAVE_UDP_OFFLOAD
-
-#ifndef HAVE_UDP_ADD_OFFLOAD_TAKES_NET
-#define udp_add_offload(net, prot) udp_add_offload(prot)
-#endif
-
-#else
-
-#define udp_add_offload(net, prot) 0
-#define udp_del_offload(prot) do {} while(0)
-
-#endif /* HAVE_UDP_OFFLOAD */
-
-#endif /* _NET_PROTOCOL_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/route.h b/datapath/linux/compat/include/net/route.h
deleted file mode 100644
index 9e4a1f18a..000000000
--- a/datapath/linux/compat/include/net/route.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __NET_ROUTE_H_WRAPPER
-#define __NET_ROUTE_H_WRAPPER
-
-#include_next <net/route.h>
-
-#endif
diff --git a/datapath/linux/compat/include/net/rtnetlink.h b/datapath/linux/compat/include/net/rtnetlink.h
deleted file mode 100644
index e026cab95..000000000
--- a/datapath/linux/compat/include/net/rtnetlink.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#ifndef __NET_RTNETLINK_WRAPPER_H
-#define __NET_RTNETLINK_WRAPPER_H
-#include_next <net/rtnetlink.h>
-
-#define rtnl_delete_link rpl_rtnl_delete_link
-int rpl_rtnl_delete_link(struct net_device *dev);
-
-#ifndef HAVE_NAME_ASSIGN_TYPE
-#ifdef HAVE_RTNL_CREATE_LINK_SRC_NET
-static inline struct net_device *rpl_rtnl_create_link(struct net *net, const char *ifname,
- unsigned char name_assign_type,
- const struct rtnl_link_ops *ops,
- struct nlattr *tb[])
-{
- return rtnl_create_link(net, net, (char *)ifname, ops, tb);
-}
-
-#else
-static inline struct net_device *rpl_rtnl_create_link(struct net *net, const char *ifname,
- unsigned char name_assign_type,
- const struct rtnl_link_ops *ops,
- struct nlattr *tb[])
-{
- return rtnl_create_link(net, (char *)ifname, ops, tb);
-}
-#endif
-#else
-/* This function is only defined to avoid warning related to ifname. Some backported
- * function did not changed the name to const type. */
-static inline struct net_device *rpl_rtnl_create_link(struct net *net, const char *ifname,
- unsigned char name_assign_type,
- const struct rtnl_link_ops *ops,
- struct nlattr *tb[])
-{
-#ifdef HAVE_RTNL_CREATE_LINK_TAKES_EXTACK
- return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb, NULL);
-#else
- return rtnl_create_link(net, (char *) ifname, name_assign_type, ops, tb);
-#endif
-}
-#endif
-
-#define rtnl_create_link rpl_rtnl_create_link
-#endif
diff --git a/datapath/linux/compat/include/net/sctp/checksum.h b/datapath/linux/compat/include/net/sctp/checksum.h
deleted file mode 100644
index 7832abce0..000000000
--- a/datapath/linux/compat/include/net/sctp/checksum.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef __SCTP_CHECKSUM_WRAPPER_H
-#define __SCTP_CHECKSUM_WRAPPER_H 1
-
-#include_next <net/sctp/checksum.h>
-
-#ifndef HAVE_SCTP_COMPUTE_CKSUM
-static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
- unsigned int offset)
-{
- const struct sk_buff *iter;
-
- __u32 crc32 = sctp_start_cksum(skb->data + offset,
- skb_headlen(skb) - offset);
- skb_walk_frags(skb, iter)
- crc32 = sctp_update_cksum((__u8 *) iter->data,
- skb_headlen(iter), crc32);
-
- /* Open-code sctp_end_cksum() to avoid a sparse warning due to a bug in
- * sparse annotations in Linux fixed in 3.10 in commit eee1d5a14 (sctp:
- * Correct type and usage of sctp_end_cksum()). */
- return cpu_to_le32(~crc32);
-}
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/net/sock.h b/datapath/linux/compat/include/net/sock.h
deleted file mode 100644
index 2900704ec..000000000
--- a/datapath/linux/compat/include/net/sock.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __NET_SOCK_WRAPPER_H
-#define __NET_SOCK_WRAPPER_H 1
-
-#include_next <net/sock.h>
-
-#ifndef __sk_user_data
-#define __sk_user_data(sk) ((*((void __rcu **)&(sk)->sk_user_data)))
-
-#define rcu_dereference_sk_user_data(sk) rcu_dereference(__sk_user_data((sk)))
-#define rcu_assign_sk_user_data(sk, ptr) rcu_assign_pointer(__sk_user_data((sk)), ptr)
-#endif
-
-#endif
diff --git a/datapath/linux/compat/include/net/stt.h b/datapath/linux/compat/include/net/stt.h
deleted file mode 100644
index d2e63d163..000000000
--- a/datapath/linux/compat/include/net/stt.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __NET_STT_H
-#define __NET_STT_H 1
-
-#include <linux/kconfig.h>
-#include <linux/errno.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) && IS_ENABLED(CONFIG_NETFILTER)
-#include <net/ip_tunnels.h>
-#define OVS_STT
-
-struct stthdr {
- __u8 version;
- __u8 flags;
- __u8 l4_offset;
- __u8 reserved;
- __be16 mss;
- __be16 vlan_tci;
- __be64 key;
-};
-
-/* Padding after the end of the tunnel headers to provide alignment
- * for inner packet IP header after 14 byte Ethernet header.
- */
-#define STT_ETH_PAD 2
-
-#define STT_BASE_HLEN (sizeof(struct stthdr) + STT_ETH_PAD)
-#define STT_HEADER_LEN (sizeof(struct tcphdr) + STT_BASE_HLEN)
-
-static inline struct stthdr *stt_hdr(const struct sk_buff *skb)
-{
- return (struct stthdr *)(skb_transport_header(skb) +
- sizeof(struct tcphdr));
-}
-
-struct net_device *ovs_stt_dev_create_fb(struct net *net, const char *name,
- u8 name_assign_type, u16 dst_port);
-
-netdev_tx_t ovs_stt_xmit(struct sk_buff *skb);
-
-int ovs_stt_init_module(void);
-
-void ovs_stt_cleanup_module(void);
-#else
-static inline int ovs_stt_init_module(void)
-{
- return 0;
-}
-
-static inline void ovs_stt_cleanup_module(void)
-{}
-
-static inline struct net_device *ovs_stt_dev_create_fb(struct net *net, const char *name,
- u8 name_assign_type, u16 dst_port)
-{
- return ERR_PTR(-EOPNOTSUPP);
-}
-static inline netdev_tx_t ovs_stt_xmit(struct sk_buff *skb)
-{
- BUG();
- return NETDEV_TX_OK;
-}
-#endif
-
-#define stt_dev_create_fb ovs_stt_dev_create_fb
-#define stt_init_module ovs_stt_init_module
-#define stt_cleanup_module ovs_stt_cleanup_module
-
-#define stt_fill_metadata_dst ovs_stt_fill_metadata_dst
-int ovs_stt_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-
-#endif /*ifdef__NET_STT_H */
diff --git a/datapath/linux/compat/include/net/tun_proto.h b/datapath/linux/compat/include/net/tun_proto.h
deleted file mode 100644
index 2ea3deba4..000000000
--- a/datapath/linux/compat/include/net/tun_proto.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef __NET_TUN_PROTO_H
-#define __NET_TUN_PROTO_H
-
-#include <linux/kernel.h>
-
-/* One byte protocol values as defined by VXLAN-GPE and NSH. These will
- * hopefully get a shared IANA registry.
- */
-#define TUN_P_IPV4 0x01
-#define TUN_P_IPV6 0x02
-#define TUN_P_ETHERNET 0x03
-#define TUN_P_NSH 0x04
-#define TUN_P_MPLS_UC 0x05
-
-static inline __be16 tun_p_to_eth_p(u8 proto)
-{
- switch (proto) {
- case TUN_P_IPV4:
- return htons(ETH_P_IP);
- case TUN_P_IPV6:
- return htons(ETH_P_IPV6);
- case TUN_P_ETHERNET:
- return htons(ETH_P_TEB);
- case TUN_P_NSH:
- return htons(ETH_P_NSH);
- case TUN_P_MPLS_UC:
- return htons(ETH_P_MPLS_UC);
- }
- return 0;
-}
-
-static inline u8 tun_p_from_eth_p(__be16 proto)
-{
- switch (proto) {
- case htons(ETH_P_IP):
- return TUN_P_IPV4;
- case htons(ETH_P_IPV6):
- return TUN_P_IPV6;
- case htons(ETH_P_TEB):
- return TUN_P_ETHERNET;
- case htons(ETH_P_NSH):
- return TUN_P_NSH;
- case htons(ETH_P_MPLS_UC):
- return TUN_P_MPLS_UC;
- }
- return 0;
-}
-
-#endif
diff --git a/datapath/linux/compat/include/net/udp.h b/datapath/linux/compat/include/net/udp.h
deleted file mode 100644
index 447999218..000000000
--- a/datapath/linux/compat/include/net/udp.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef __NET_UDP_WRAPPER_H
-#define __NET_UDP_WRAPPER_H 1
-
-#include <net/ip.h>
-
-#ifdef inet_get_local_port_range
-/* Earlier RHEL7 kernels backport udp_flow_src_port() using an older version of
- * inet_get_local_port_range(). */
-#undef inet_get_local_port_range
-#include_next <net/udp.h>
-#define inet_get_local_port_range rpl_inet_get_local_port_range
-#else
-#include_next <net/udp.h>
-#endif
-
-#ifndef HAVE_UDP_FLOW_SRC_PORT
-static inline __be16 rpl_udp_flow_src_port(struct net *net, struct sk_buff *skb,
- int min, int max, bool use_eth)
-{
- u32 hash;
-
- if (min >= max) {
- /* Use default range */
- inet_get_local_port_range(net, &min, &max);
- }
-
- hash = skb_get_hash(skb);
- if (unlikely(!hash) && use_eth) {
- /* Can't find a normal hash, caller has indicated an Ethernet
- * packet so use that to compute a hash.
- */
- hash = jhash(skb->data, 2 * ETH_ALEN,
- (__force u32) skb->protocol);
- }
-
- /* Since this is being sent on the wire obfuscate hash a bit
- * to minimize possbility that any useful information to an
- * attacker is leaked. Only upper 16 bits are relevant in the
- * computation for 16 bit port value.
- */
- hash ^= hash << 16;
-
- return htons((((u64) hash * (max - min)) >> 32) + min);
-}
-
-#define udp_flow_src_port rpl_udp_flow_src_port
-#endif
-
-#ifndef HAVE_UDP_V4_CHECK
-static inline __sum16 udp_v4_check(int len, __be32 saddr,
- __be32 daddr, __wsum base)
-{
- return csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, base);
-}
-#endif
-
-#ifndef USE_UPSTREAM_TUNNEL
-#define udp_set_csum rpl_udp_set_csum
-void rpl_udp_set_csum(bool nocheck, struct sk_buff *skb,
- __be32 saddr, __be32 daddr, int len);
-#endif
-#endif
diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
deleted file mode 100644
index 6e4063359..000000000
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ /dev/null
@@ -1,208 +0,0 @@
-#ifndef __NET_UDP_TUNNEL_WRAPPER_H
-#define __NET_UDP_TUNNEL_WRAPPER_H
-
-#include <linux/version.h>
-#include <linux/kconfig.h>
-
-#include <net/addrconf.h>
-#include <net/dst_metadata.h>
-#include <linux/netdev_features.h>
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/udp_tunnel.h>
-
-#else
-
-#include <net/addrconf.h>
-#include <net/ip_tunnels.h>
-#include <net/udp.h>
-
-struct udp_port_cfg {
- u8 family;
-
- /* Used only for kernel-created sockets */
- union {
- struct in_addr local_ip;
-#if IS_ENABLED(CONFIG_IPV6)
- struct in6_addr local_ip6;
-#endif
- };
-
- union {
- struct in_addr peer_ip;
-#if IS_ENABLED(CONFIG_IPV6)
- struct in6_addr peer_ip6;
-#endif
- };
-
- __be16 local_udp_port;
- __be16 peer_udp_port;
- unsigned int use_udp_checksums:1,
- use_udp6_tx_checksums:1,
- use_udp6_rx_checksums:1,
- ipv6_v6only:1;
-};
-
-#ifdef HAVE_NDO_UDP_TUNNEL_ADD
-enum udp_parsable_tunnel_type {
- UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */
- UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */
- UDP_TUNNEL_TYPE_VXLAN_GPE, /* draft-ietf-nvo3-vxlan-gpe */
-};
-
-struct udp_tunnel_info {
- unsigned short type;
- sa_family_t sa_family;
- __be16 port;
-};
-#endif
-
-#define udp_sock_create4 rpl_udp_sock_create4
-int rpl_udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
- struct socket **sockp);
-
-#define udp_sock_create6 rpl_udp_sock_create6
-#if IS_ENABLED(CONFIG_IPV6)
-int rpl_udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
- struct socket **sockp);
-#else
-static inline int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
- struct socket **sockp)
-{
- return -EPFNOSUPPORT;
-}
-#endif
-
-#define udp_sock_create rpl_udp_sock_create
-static inline int udp_sock_create(struct net *net,
- struct udp_port_cfg *cfg,
- struct socket **sockp)
-{
- if (cfg->family == AF_INET)
- return udp_sock_create4(net, cfg, sockp);
-
- if (cfg->family == AF_INET6)
- return udp_sock_create6(net, cfg, sockp);
-
- return -EPFNOSUPPORT;
-}
-
-typedef int (*udp_tunnel_encap_rcv_t)(struct sock *sk, struct sk_buff *skb);
-typedef void (*udp_tunnel_encap_destroy_t)(struct sock *sk);
-typedef struct sk_buff **(*udp_tunnel_gro_receive_t)(struct sock *sk,
- struct sk_buff **head,
- struct sk_buff *skb);
-typedef int (*udp_tunnel_gro_complete_t)(struct sock *sk, struct sk_buff *skb,
- int nhoff);
-
-struct udp_tunnel_sock_cfg {
- void *sk_user_data; /* user data used by encap_rcv call back */
- /* Used for setting up udp_sock fields, see udp.h for details */
- __u8 encap_type;
- udp_tunnel_encap_rcv_t encap_rcv;
- udp_tunnel_encap_destroy_t encap_destroy;
-#ifdef HAVE_UDP_TUNNEL_SOCK_CFG_GRO_RECEIVE
- udp_tunnel_gro_receive_t gro_receive;
- udp_tunnel_gro_complete_t gro_complete;
-#endif
-};
-
-/* Setup the given (UDP) sock to receive UDP encapsulated packets */
-#define setup_udp_tunnel_sock rpl_setup_udp_tunnel_sock
-void rpl_setup_udp_tunnel_sock(struct net *net, struct socket *sock,
- struct udp_tunnel_sock_cfg *sock_cfg);
-
-/* Transmit the skb using UDP encapsulation. */
-#define udp_tunnel_xmit_skb rpl_udp_tunnel_xmit_skb
-void rpl_udp_tunnel_xmit_skb(struct rtable *rt,
- struct sock *sk, struct sk_buff *skb,
- __be32 src, __be32 dst, __u8 tos, __u8 ttl,
- __be16 df, __be16 src_port, __be16 dst_port,
- bool xnet, bool nocheck);
-
-
-#define udp_tunnel_sock_release rpl_udp_tunnel_sock_release
-void rpl_udp_tunnel_sock_release(struct socket *sock);
-
-#define udp_tunnel_encap_enable rpl_udp_tunnel_encap_enable
-static inline void udp_tunnel_encap_enable(struct socket *sock)
-{
-#if IS_ENABLED(CONFIG_IPV6)
- if (sock->sk->sk_family == PF_INET6)
-#ifdef HAVE_IPV6_STUB
- ipv6_stub->udpv6_encap_enable();
-#else
- udpv6_encap_enable();
-#endif
- else
-#endif
- udp_encap_enable();
-}
-
-#if IS_ENABLED(CONFIG_IPV6)
-#define udp_tunnel6_xmit_skb rpl_udp_tunnel6_xmit_skb
-int rpl_udp_tunnel6_xmit_skb(struct dst_entry *dst, struct sock *sk,
- struct sk_buff *skb,
- struct net_device *dev, struct in6_addr *saddr,
- struct in6_addr *daddr,
- __u8 prio, __u8 ttl, __be32 label, __be16 src_port,
- __be16 dst_port, bool nocheck);
-#endif
-
-static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
-{
- struct udphdr *uh;
-
- uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr));
- skb_shinfo(skb)->gso_type |= uh->check ?
- SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
-}
-
-void ovs_udp_gso(struct sk_buff *skb);
-void ovs_udp_csum_gso(struct sk_buff *skb);
-
-static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
- bool udp_csum)
-{
- void (*fix_segment)(struct sk_buff *);
- int type = 0;
-
- type |= udp_csum ? SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
-#ifndef USE_UPSTREAM_TUNNEL_GSO
- if (!udp_csum)
- fix_segment = ovs_udp_gso;
- else
- fix_segment = ovs_udp_csum_gso;
- /* This functuin is not used by vxlan lan tunnel. On older
- * udp offload only supports vxlan, therefore fallback to software
- * segmentation.
- */
- type = 0;
-#else
- fix_segment = NULL;
-#endif
-
- return ovs_iptunnel_handle_offloads(skb, type, fix_segment);
-}
-
-#define udp_tunnel_handle_offloads rpl_udp_tunnel_handle_offloads
-static inline void ovs_udp_tun_rx_dst(struct metadata_dst *md_dst,
- struct sk_buff *skb,
- unsigned short family,
- __be16 flags, __be64 tunnel_id, int md_size)
-{
- struct ip_tunnel_info *info = &md_dst->u.tun_info;
-
- if (family == AF_INET)
- ovs_ip_tun_rx_dst(md_dst, skb, flags, tunnel_id, md_size);
- else
- ovs_ipv6_tun_rx_dst(md_dst, skb, flags, tunnel_id, md_size);
-
- info->key.tp_src = udp_hdr(skb)->source;
- info->key.tp_dst = udp_hdr(skb)->dest;
- if (udp_hdr(skb)->check)
- info->key.tun_flags |= TUNNEL_CSUM;
-}
-#endif /* USE_UPSTREAM_TUNNEL */
-
-#endif
diff --git a/datapath/linux/compat/include/net/vrf.h b/datapath/linux/compat/include/net/vrf.h
deleted file mode 100644
index f5b6e8900..000000000
--- a/datapath/linux/compat/include/net/vrf.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * include/net/net_vrf.h - adds vrf dev structure definitions
- * Copyright (c) 2015 Cumulus Networks
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __LINUX_NET_VRF_WRAPPER_H
-#define __LINUX_NET_VRF_WRAPPER_H
-
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)
-#include_next <net/vrf.h>
-#else
-
-static inline int vrf_master_ifindex_rcu(const struct net_device *dev)
-{
- return 0;
-}
-#endif
-
-#endif /* __LINUX_NET_VRF_WRAPPER_H */
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
deleted file mode 100644
index 18f5474d9..000000000
--- a/datapath/linux/compat/include/net/vxlan.h
+++ /dev/null
@@ -1,444 +0,0 @@
-#ifndef __NET_VXLAN_WRAPPER_H
-#define __NET_VXLAN_WRAPPER_H 1
-
-#ifdef CONFIG_INET
-#include <net/udp_tunnel.h>
-#endif
-
-#ifdef USE_UPSTREAM_TUNNEL
-#include_next <net/vxlan.h>
-
-static inline int rpl_vxlan_init_module(void)
-{
- return 0;
-}
-static inline void rpl_vxlan_cleanup_module(void)
-{}
-
-#define vxlan_xmit dev_queue_xmit
-
-#ifdef CONFIG_INET
-#ifndef HAVE_NAME_ASSIGN_TYPE
-static inline struct net_device *rpl_vxlan_dev_create(
- struct net *net, const char *name, u8 name_assign_type,
- struct vxlan_config *conf) {
- return vxlan_dev_create(net, name, conf);
-}
-#define vxlan_dev_create rpl_vxlan_dev_create
-#endif
-#endif
-
-#else /* USE_UPSTREAM_TUNNEL */
-
-#include <linux/ip.h>
-#include <linux/ipv6.h>
-#include <linux/if_vlan.h>
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <linux/udp.h>
-#include <net/dst_cache.h>
-#include <net/dst_metadata.h>
-
-#include "compat.h"
-#include "gso.h"
-
-/* VXLAN protocol (RFC 7348) header:
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |R|R|R|R|I|R|R|R| Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | VXLAN Network Identifier (VNI) | Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * I = VXLAN Network Identifier (VNI) present.
- */
-struct vxlanhdr {
- __be32 vx_flags;
- __be32 vx_vni;
-};
-
-/* VXLAN header flags. */
-#define VXLAN_HF_VNI cpu_to_be32(BIT(27))
-
-#define VXLAN_N_VID (1u << 24)
-#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
-#define VXLAN_VNI_MASK cpu_to_be32(VXLAN_VID_MASK << 8)
-#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
-
-#define VNI_HASH_BITS 10
-#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
-#define FDB_HASH_BITS 8
-#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
-
-/* Remote checksum offload for VXLAN (VXLAN_F_REMCSUM_[RT]X):
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |R|R|R|R|I|R|R|R|R|R|C| Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | VXLAN Network Identifier (VNI) |O| Csum start |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * C = Remote checksum offload bit. When set indicates that the
- * remote checksum offload data is present.
- *
- * O = Offset bit. Indicates the checksum offset relative to
- * checksum start.
- *
- * Csum start = Checksum start divided by two.
- *
- * http://tools.ietf.org/html/draft-herbert-vxlan-rco
- */
-
-/* VXLAN-RCO header flags. */
-#define VXLAN_HF_RCO cpu_to_be32(BIT(21))
-
-/* Remote checksum offload header option */
-#define VXLAN_RCO_MASK cpu_to_be32(0x7f) /* Last byte of vni field */
-#define VXLAN_RCO_UDP cpu_to_be32(0x80) /* Indicate UDP RCO (TCP when not set *) */
-#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
-#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
-#define VXLAN_MAX_REMCSUM_START (0x7f << VXLAN_RCO_SHIFT)
-
-/*
- * VXLAN Group Based Policy Extension (VXLAN_F_GBP):
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | VXLAN Network Identifier (VNI) | Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * G = Group Policy ID present.
- *
- * D = Don't Learn bit. When set, this bit indicates that the egress
- * VTEP MUST NOT learn the source address of the encapsulated frame.
- *
- * A = Indicates that the group policy has already been applied to
- * this packet. Policies MUST NOT be applied by devices when the
- * A bit is set.
- *
- * https://tools.ietf.org/html/draft-smith-vxlan-group-policy
- */
-struct vxlanhdr_gbp {
- u8 vx_flags;
-#ifdef __LITTLE_ENDIAN_BITFIELD
- u8 reserved_flags1:3,
- policy_applied:1,
- reserved_flags2:2,
- dont_learn:1,
- reserved_flags3:1;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- u8 reserved_flags1:1,
- dont_learn:1,
- reserved_flags2:2,
- policy_applied:1,
- reserved_flags3:3;
-#else
-#error "Please fix <asm/byteorder.h>"
-#endif
- __be16 policy_id;
- __be32 vx_vni;
-};
-
-/* VXLAN-GBP header flags. */
-#define VXLAN_HF_GBP cpu_to_be32(BIT(31))
-
-#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | cpu_to_be32(0xFFFFFF))
-
-/* skb->mark mapping
- *
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |R|R|R|R|R|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-#define VXLAN_GBP_DONT_LEARN (BIT(6) << 16)
-#define VXLAN_GBP_POLICY_APPLIED (BIT(3) << 16)
-#define VXLAN_GBP_ID_MASK (0xFFFF)
-
-/*
- * VXLAN Generic Protocol Extension (VXLAN_F_GPE):
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |R|R|Ver|I|P|R|O| Reserved |Next Protocol |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | VXLAN Network Identifier (VNI) | Reserved |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- * Ver = Version. Indicates VXLAN GPE protocol version.
- *
- * P = Next Protocol Bit. The P bit is set to indicate that the
- * Next Protocol field is present.
- *
- * O = OAM Flag Bit. The O bit is set to indicate that the packet
- * is an OAM packet.
- *
- * Next Protocol = This 8 bit field indicates the protocol header
- * immediately following the VXLAN GPE header.
- *
- * https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-01
- */
-
-struct vxlanhdr_gpe {
-#if defined(__LITTLE_ENDIAN_BITFIELD)
- u8 oam_flag:1,
- reserved_flags1:1,
- np_applied:1,
- instance_applied:1,
- version:2,
-reserved_flags2:2;
-#elif defined(__BIG_ENDIAN_BITFIELD)
- u8 reserved_flags2:2,
- version:2,
- instance_applied:1,
- np_applied:1,
- reserved_flags1:1,
- oam_flag:1;
-#endif
- u8 reserved_flags3;
- u8 reserved_flags4;
- u8 next_protocol;
- __be32 vx_vni;
-};
-
-/* VXLAN-GPE header flags. */
-#define VXLAN_HF_VER cpu_to_be32(BIT(29) | BIT(28))
-#define VXLAN_HF_NP cpu_to_be32(BIT(26))
-#define VXLAN_HF_OAM cpu_to_be32(BIT(24))
-
-#define VXLAN_GPE_USED_BITS (VXLAN_HF_VER | VXLAN_HF_NP | VXLAN_HF_OAM | \
- cpu_to_be32(0xff))
-
-struct vxlan_metadata {
- u32 gbp;
-};
-
-/* per UDP socket information */
-struct vxlan_sock {
- struct hlist_node hlist;
- struct socket *sock;
- struct hlist_head vni_list[VNI_HASH_SIZE];
- atomic_t refcnt;
- u32 flags;
-#ifdef HAVE_UDP_OFFLOAD
- struct udp_offload udp_offloads;
-#endif
-};
-
-union vxlan_addr {
- struct sockaddr_in sin;
- struct sockaddr_in6 sin6;
- struct sockaddr sa;
-};
-
-struct vxlan_rdst {
- union vxlan_addr remote_ip;
- __be16 remote_port;
- __be32 remote_vni;
- u32 remote_ifindex;
- struct list_head list;
- struct rcu_head rcu;
- struct dst_cache dst_cache;
-};
-
-struct vxlan_config {
- union vxlan_addr remote_ip;
- union vxlan_addr saddr;
- __be32 vni;
- int remote_ifindex;
- int mtu;
- __be16 dst_port;
- u16 port_min;
- u16 port_max;
- u8 tos;
- u8 ttl;
- __be32 label;
- u32 flags;
- unsigned long age_interval;
- unsigned int addrmax;
- bool no_share;
-};
-
-/* Pseudo network device */
-struct vxlan_dev {
- struct hlist_node hlist; /* vni hash table */
- struct list_head next; /* vxlan's per namespace list */
- struct vxlan_sock __rcu *vn4_sock; /* listening socket for IPv4 */
-#if IS_ENABLED(CONFIG_IPV6)
- struct vxlan_sock __rcu *vn6_sock; /* listening socket for IPv6 */
-#endif
- struct net_device *dev;
- struct net *net; /* netns for packet i/o */
- struct vxlan_rdst default_dst; /* default destination */
- u32 flags; /* VXLAN_F_* in vxlan.h */
-
- struct timer_list age_timer;
- spinlock_t hash_lock;
- unsigned int addrcnt;
-
- struct vxlan_config cfg;
-
- struct hlist_head fdb_head[FDB_HASH_SIZE];
-};
-
-#define VXLAN_F_LEARN 0x01
-#define VXLAN_F_PROXY 0x02
-#define VXLAN_F_RSC 0x04
-#define VXLAN_F_L2MISS 0x08
-#define VXLAN_F_L3MISS 0x10
-#define VXLAN_F_IPV6 0x20
-#define VXLAN_F_UDP_ZERO_CSUM_TX 0x40
-#define VXLAN_F_UDP_ZERO_CSUM6_TX 0x80
-#define VXLAN_F_UDP_ZERO_CSUM6_RX 0x100
-#define VXLAN_F_REMCSUM_TX 0x200
-#define VXLAN_F_REMCSUM_RX 0x400
-#define VXLAN_F_GBP 0x800
-#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000
-#define VXLAN_F_COLLECT_METADATA 0x2000
-#define VXLAN_F_GPE 0x4000
-
-/* Flags that are used in the receive path. These flags must match in
- * order for a socket to be shareable
- */
-#define VXLAN_F_RCV_FLAGS (VXLAN_F_GBP | \
- VXLAN_F_GPE | \
- VXLAN_F_UDP_ZERO_CSUM6_RX | \
- VXLAN_F_REMCSUM_RX | \
- VXLAN_F_REMCSUM_NOPARTIAL | \
- VXLAN_F_COLLECT_METADATA)
-
-/* Flags that can be set together with VXLAN_F_GPE. */
-#define VXLAN_F_ALLOWED_GPE (VXLAN_F_GPE | \
- VXLAN_F_IPV6 | \
- VXLAN_F_UDP_ZERO_CSUM_TX | \
- VXLAN_F_UDP_ZERO_CSUM6_TX | \
- VXLAN_F_UDP_ZERO_CSUM6_RX | \
- VXLAN_F_COLLECT_METADATA)
-
-#define vxlan_dev_create rpl_vxlan_dev_create
-struct net_device *rpl_vxlan_dev_create(struct net *net, const char *name,
- u8 name_assign_type, struct vxlan_config *conf);
-
-static inline netdev_features_t vxlan_features_check(struct sk_buff *skb,
- netdev_features_t features)
-{
- u8 l4_hdr = 0;
-
- if (!skb->encapsulation)
- return features;
-
- switch (vlan_get_protocol(skb)) {
- case htons(ETH_P_IP):
- l4_hdr = ip_hdr(skb)->protocol;
- break;
- case htons(ETH_P_IPV6):
- l4_hdr = ipv6_hdr(skb)->nexthdr;
- break;
- default:
- return features;;
- }
-
- if ((l4_hdr == IPPROTO_UDP) && (
-#ifdef HAVE_INNER_PROTOCOL_TYPE
- skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
-#endif
-#ifdef HAVE_INNER_PROTOCOL
- skb->inner_protocol != htons(ETH_P_TEB) ||
-#endif
- (skb_inner_mac_header(skb) - skb_transport_header(skb) !=
- sizeof(struct udphdr) + sizeof(struct vxlanhdr)) ||
- (skb->ip_summed != CHECKSUM_NONE &&
- !can_checksum_protocol(features, inner_eth_hdr(skb)->h_proto))))
- return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
-
- return features;
-}
-
-/* IP header + UDP + VXLAN + Ethernet header */
-#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
-/* IPv6 header + UDP + VXLAN + Ethernet header */
-#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
-
-static inline struct vxlanhdr *vxlan_hdr(struct sk_buff *skb)
-{
- return (struct vxlanhdr *)(udp_hdr(skb) + 1);
-}
-
-static inline __be32 vxlan_vni(__be32 vni_field)
-{
-#if defined(__BIG_ENDIAN)
- return (__force __be32)((__force u32)vni_field >> 8);
-#else
- return (__force __be32)((__force u32)(vni_field & VXLAN_VNI_MASK) << 8);
-#endif
-}
-
-static inline __be32 vxlan_vni_field(__be32 vni)
-{
-#if defined(__BIG_ENDIAN)
- return (__force __be32)((__force u32)vni << 8);
-#else
- return (__force __be32)((__force u32)vni >> 8);
-#endif
-}
-
-static inline __be32 vxlan_tun_id_to_vni(__be64 tun_id)
-{
-#if defined(__BIG_ENDIAN)
- return (__force __be32)tun_id;
-#else
- return (__force __be32)((__force u64)tun_id >> 32);
-#endif
-}
-
-static inline __be64 vxlan_vni_to_tun_id(__be32 vni)
-{
-#if defined(__BIG_ENDIAN)
- return (__force __be64)vni;
-#else
- return (__force __be64)((u64)(__force u32)vni << 32);
-#endif
-}
-
-static inline size_t vxlan_rco_start(__be32 vni_field)
-{
- return be32_to_cpu(vni_field & VXLAN_RCO_MASK) << VXLAN_RCO_SHIFT;
-}
-
-static inline size_t vxlan_rco_offset(__be32 vni_field)
-{
- return (vni_field & VXLAN_RCO_UDP) ?
- offsetof(struct udphdr, check) :
- offsetof(struct tcphdr, check);
-}
-
-static inline __be32 vxlan_compute_rco(unsigned int start, unsigned int offset)
-{
- __be32 vni_field = cpu_to_be32(start >> VXLAN_RCO_SHIFT);
-
- if (offset == offsetof(struct udphdr, check))
- vni_field |= VXLAN_RCO_UDP;
- return vni_field;
-}
-
-static inline void vxlan_get_rx_port(struct net_device *netdev)
-{
- ASSERT_RTNL();
- call_netdevice_notifiers(NETDEV_OFFLOAD_PUSH_VXLAN, netdev);
-}
-
-static inline unsigned short vxlan_get_sk_family(struct vxlan_sock *vs)
-{
- return vs->sock->sk->sk_family;
-}
-
-int rpl_vxlan_init_module(void);
-void rpl_vxlan_cleanup_module(void);
-
-#define vxlan_fill_metadata_dst ovs_vxlan_fill_metadata_dst
-int ovs_vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
-
-#define vxlan_xmit rpl_vxlan_xmit
-netdev_tx_t rpl_vxlan_xmit(struct sk_buff *skb);
-
-#endif /* USE_UPSTREAM_TUNNEL */
-
-#define vxlan_init_module rpl_vxlan_init_module
-#define vxlan_cleanup_module rpl_vxlan_cleanup_module
-
-#endif
diff --git a/datapath/linux/compat/include/uapi/linux/netfilter.h b/datapath/linux/compat/include/uapi/linux/netfilter.h
deleted file mode 100644
index 56895b17b..000000000
--- a/datapath/linux/compat/include/uapi/linux/netfilter.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _NETFILTER_WRAPPER_H
-#define _NETFILTER_WRAPPER_H
-
-#include_next <uapi/linux/netfilter.h>
-
-/*
- * NFPROTO_INET was introduced in net-next commit 1d49144c0aaa
- * ("netfilter: nf_tables: add "inet" table for IPv4/IPv6") in v3.14.
- * Define this symbol to support back to v3.10 kernel. */
-#ifndef HAVE_NFPROTO_INET
-#define NFPROTO_INET 1
-#endif
-
-#endif /* _NETFILTER_WRAPPER_H */