openvswitch: fix a sparse warning
[deliverable/linux.git] / include / net / geneve.h
CommitLineData
0b5e8b8e
AZ
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
This page took 0.027757 seconds and 5 git commands to generate.