aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndy Zhou <azhou@nicira.com>2014-10-03 18:35:28 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-06 00:32:20 -0400
commit0b5e8b8eeae40bae6ad7c7e91c97c3c0d0e57882 (patch)
tree1e3263634ab52faac57459120033776cf1a08542 /include
parentc259c132ad284576ab44308d5d17ea6a16c971b5 (diff)
net: Add Geneve tunneling protocol driver
This adds a device level support for Geneve -- Generic Network Virtualization Encapsulation. The protocol is documented at http://tools.ietf.org/html/draft-gross-geneve-01 Only protocol layer Geneve support is provided by this driver. Openvswitch can be used for configuring, set up and tear down functional Geneve tunnels. Signed-off-by: Jesse Gross <jesse@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/geneve.h91
-rw-r--r--include/net/ip_tunnels.h2
2 files changed, 93 insertions, 0 deletions
diff --git a/include/net/geneve.h b/include/net/geneve.h
new file mode 100644
index 000000000000..ce98865318bf
--- /dev/null
+++ b/include/net/geneve.h
@@ -0,0 +1,91 @@
1#ifndef __NET_GENEVE_H
2#define __NET_GENEVE_H 1
3
4#include <net/udp_tunnel.h>
5
6struct geneve_sock;
7
8typedef void (geneve_rcv_t)(struct geneve_sock *gs, struct sk_buff *skb);
9
10struct geneve_sock {
11 struct hlist_node hlist;
12 geneve_rcv_t *rcv;
13 void *rcv_data;
14 struct work_struct del_work;
15 struct socket *sock;
16 struct rcu_head rcu;
17 atomic_t refcnt;
18 struct udp_offload udp_offloads;
19};
20
21/* Geneve Header:
22 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
23 * |Ver| Opt Len |O|C| Rsvd. | Protocol Type |
24 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
25 * | Virtual Network Identifier (VNI) | Reserved |
26 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
27 * | Variable Length Options |
28 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
29 *
30 * Option Header:
31 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 * | Option Class | Type |R|R|R| Length |
33 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
34 * | Variable Option Data |
35 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 */
37
38struct geneve_opt {
39 __be16 opt_class;
40 u8 type;
41#ifdef __LITTLE_ENDIAN_BITFIELD
42 u8 length:5;
43 u8 r3:1;
44 u8 r2:1;
45 u8 r1:1;
46#else
47 u8 r1:1;
48 u8 r2:1;
49 u8 r3:1;
50 u8 length:5;
51#endif
52 u8 opt_data[];
53};
54
55#define GENEVE_CRIT_OPT_TYPE (1 << 7)
56
57struct genevehdr {
58#ifdef __LITTLE_ENDIAN_BITFIELD
59 u8 opt_len:6;
60 u8 ver:2;
61 u8 rsvd1:6;
62 u8 critical:1;
63 u8 oam:1;
64#else
65 u8 ver:2;
66 u8 opt_len:6;
67 u8 oam:1;
68 u8 critical:1;
69 u8 rsvd1:6;
70#endif
71 __be16 proto_type;
72 u8 vni[3];
73 u8 rsvd2;
74 struct geneve_opt options[];
75};
76
77#define GENEVE_VER 0
78#define GENEVE_BASE_HLEN (sizeof(struct udphdr) + sizeof(struct genevehdr))
79
80struct geneve_sock *geneve_sock_add(struct net *net, __be16 port,
81 geneve_rcv_t *rcv, void *data,
82 bool no_share, bool ipv6);
83
84void geneve_sock_release(struct geneve_sock *vs);
85
86int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
87 struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos,
88 __u8 ttl, __be16 df, __be16 src_port, __be16 dst_port,
89 __be16 tun_flags, u8 vni[3], u8 opt_len, u8 *opt,
90 bool xnet);
91#endif
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index 7f538ba6e267..a9ce1556d773 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -95,6 +95,8 @@ struct ip_tunnel {
95#define TUNNEL_VERSION __cpu_to_be16(0x40) 95#define TUNNEL_VERSION __cpu_to_be16(0x40)
96#define TUNNEL_NO_KEY __cpu_to_be16(0x80) 96#define TUNNEL_NO_KEY __cpu_to_be16(0x80)
97#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100) 97#define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
98#define TUNNEL_OAM __cpu_to_be16(0x0200)
99#define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
98 100
99struct tnl_ptk_info { 101struct tnl_ptk_info {
100 __be16 flags; 102 __be16 flags;