3ed6f9193b0ec023cf657d189f105f8e5c2f0565
[cascardo/ovs.git] / datapath / linux / compat / include / net / ip_tunnels.h
1 #ifndef __NET_IP_TUNNELS_WRAPPER_H
2 #define __NET_IP_TUNNELS_WRAPPER_H 1
3
4 #include <linux/version.h>
5
6 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0)
7 #include_next <net/ip_tunnels.h>
8 #endif
9
10 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
11
12 #include <linux/if_tunnel.h>
13 #include <linux/netdevice.h>
14 #include <linux/skbuff.h>
15 #include <linux/types.h>
16 #include <net/dsfield.h>
17 #include <net/flow.h>
18 #include <net/inet_ecn.h>
19 #include <net/ip.h>
20 #include <net/rtnetlink.h>
21
22 struct sk_buff *ovs_iptunnel_handle_offloads(struct sk_buff *skb,
23                                              bool csum_help, int gso_type_mask,
24                                              void (*fix_segment)(struct sk_buff *));
25
26 #define iptunnel_xmit rpl_iptunnel_xmit
27 int rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
28                       __be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl,
29                       __be16 df, bool xnet);
30
31 #define iptunnel_pull_header rpl_iptunnel_pull_header
32 int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto);
33
34 #else
35
36 #define ovs_iptunnel_handle_offloads(skb, csum_help, gso_type_mask, fix_segment) \
37         iptunnel_handle_offloads(skb, csum_help, gso_type_mask)
38
39 #endif /* 3.18 */
40
41 #ifndef TUNNEL_CSUM
42 #define TUNNEL_CSUM     __cpu_to_be16(0x01)
43 #define TUNNEL_ROUTING  __cpu_to_be16(0x02)
44 #define TUNNEL_KEY      __cpu_to_be16(0x04)
45 #define TUNNEL_SEQ      __cpu_to_be16(0x08)
46 #define TUNNEL_STRICT   __cpu_to_be16(0x10)
47 #define TUNNEL_REC      __cpu_to_be16(0x20)
48 #define TUNNEL_VERSION  __cpu_to_be16(0x40)
49 #define TUNNEL_NO_KEY   __cpu_to_be16(0x80)
50
51 struct tnl_ptk_info {
52         __be16 flags;
53         __be16 proto;
54         __be32 key;
55         __be32 seq;
56 };
57
58 #define PACKET_RCVD     0
59 #define PACKET_REJECT   1
60 #endif
61
62 #ifndef TUNNEL_DONT_FRAGMENT
63 #define TUNNEL_DONT_FRAGMENT    __cpu_to_be16(0x0100)
64 #endif
65
66 #ifndef TUNNEL_OAM
67 #define TUNNEL_OAM      __cpu_to_be16(0x0200)
68 #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
69 #endif
70
71 #ifndef TUNNEL_GENEVE_OPT
72 #define TUNNEL_GENEVE_OPT      __cpu_to_be16(0x0800)
73 #endif
74
75 #ifndef TUNNEL_VXLAN_OPT
76 #define TUNNEL_VXLAN_OPT       __cpu_to_be16(0x1000)
77 #endif
78
79 /* Older kernels defined TUNNEL_OPTIONS_PRESENT to GENEVE only */
80 #undef TUNNEL_OPTIONS_PRESENT
81 #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT)
82
83 #define skb_is_encapsulated ovs_skb_is_encapsulated
84 bool ovs_skb_is_encapsulated(struct sk_buff *skb);
85
86 #endif /* __NET_IP_TUNNELS_H */