datapath: Restructure vxlan tunneling.
[sliver-openvswitch.git] / datapath / linux / compat / include / net / vxlan.h
1 #ifndef __NET_VXLAN_WRAPPER_H
2 #define __NET_VXLAN_WRAPPER_H  1
3
4 #include <linux/skbuff.h>
5 #include <linux/netdevice.h>
6 #include <linux/udp.h>
7
8 /* per UDP socket information */
9 struct vxlan_sock {
10         struct hlist_node hlist;
11         struct rcu_head   rcu;
12         struct socket     *sock;
13         struct list_head  handler_list;
14 };
15
16 struct vxlan_handler;
17 typedef int (vxlan_rcv_t)(struct vxlan_handler *vh, struct sk_buff *skb, __be32 key);
18
19 struct vxlan_handler {
20         vxlan_rcv_t       *rcv;
21         struct list_head   node;
22         void              *data;
23         struct vxlan_sock *vs;
24         atomic_t           refcnt;
25         struct rcu_head    rcu;
26         struct work_struct del_work;
27         int                priority;
28 };
29
30 void vxlan_handler_put(struct vxlan_handler *vh);
31
32 struct vxlan_handler *vxlan_handler_add(struct net *net,
33                                         __be16 portno, vxlan_rcv_t *rcv,
34                                         void *data, int priority, bool create);
35
36 int vxlan_xmit_skb(struct net *net, struct vxlan_handler *vh,
37                    struct rtable *rt, struct sk_buff *skb,
38                    __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
39                    __be16 src_port, __be16 dst_port, __be32 vni);
40
41 __be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
42
43 #endif