]> git.proxmox.com Git - ovs.git/blob - datapath/linux/compat/include/net/gre.h
58fa97a8d23aeb0d73d92fe7deb22d234207a901
[ovs.git] / datapath / linux / compat / include / net / gre.h
1 #ifndef __LINUX_GRE_WRAPPER_H
2 #define __LINUX_GRE_WRAPPER_H
3
4 #include <linux/version.h>
5 #include <linux/skbuff.h>
6 #include <net/ip_tunnels.h>
7
8 #ifdef USE_UPSTREAM_TUNNEL
9 #include_next <net/gre.h>
10
11 static inline int rpl_ipgre_init(void)
12 {
13 return 0;
14 }
15 static inline void rpl_ipgre_fini(void)
16 {}
17
18 static inline int rpl_ip6gre_init(void)
19 {
20 return 0;
21 }
22
23 static inline void rpl_ip6gre_fini(void)
24 {}
25
26 static inline int rpl_ip6_tunnel_init(void)
27 {
28 return 0;
29 }
30
31 static inline void rpl_ip6_tunnel_cleanup(void)
32 {
33 }
34
35 static inline int rpl_gre_init(void)
36 {
37 return 0;
38 }
39
40 static inline void rpl_gre_exit(void)
41 {
42 }
43
44 #define gre_fb_xmit dev_queue_xmit
45
46 #ifdef CONFIG_INET
47 #ifndef HAVE_NAME_ASSIGN_TYPE
48 static inline struct net_device *rpl_gretap_fb_dev_create(
49 struct net *net, const char *name, u8 name_assign_type) {
50 return gretap_fb_dev_create(net, name);
51 }
52 #define gretap_fb_dev_create rpl_gretap_fb_dev_create
53 #endif
54 #endif
55
56 #else
57 #include_next <net/gre.h>
58
59 #define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
60 static inline __be16 rpl_tnl_flags_to_gre_flags(__be16 tflags)
61 {
62 __be16 flags = 0;
63
64 if (tflags & TUNNEL_CSUM)
65 flags |= GRE_CSUM;
66 if (tflags & TUNNEL_ROUTING)
67 flags |= GRE_ROUTING;
68 if (tflags & TUNNEL_KEY)
69 flags |= GRE_KEY;
70 if (tflags & TUNNEL_SEQ)
71 flags |= GRE_SEQ;
72 if (tflags & TUNNEL_STRICT)
73 flags |= GRE_STRICT;
74 if (tflags & TUNNEL_REC)
75 flags |= GRE_REC;
76 if (tflags & TUNNEL_VERSION)
77 flags |= GRE_VERSION;
78
79 return flags;
80 }
81
82 #define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
83 static inline __be16 rpl_gre_flags_to_tnl_flags(__be16 flags)
84 {
85 __be16 tflags = 0;
86
87 if (flags & GRE_CSUM)
88 tflags |= TUNNEL_CSUM;
89 if (flags & GRE_ROUTING)
90 tflags |= TUNNEL_ROUTING;
91 if (flags & GRE_KEY)
92 tflags |= TUNNEL_KEY;
93 if (flags & GRE_SEQ)
94 tflags |= TUNNEL_SEQ;
95 if (flags & GRE_STRICT)
96 tflags |= TUNNEL_STRICT;
97 if (flags & GRE_REC)
98 tflags |= TUNNEL_REC;
99 if (flags & GRE_VERSION)
100 tflags |= TUNNEL_VERSION;
101
102 return tflags;
103 }
104 #define gre_tnl_flags_to_gre_flags rpl_gre_tnl_flags_to_gre_flags
105 static inline __be16 rpl_gre_tnl_flags_to_gre_flags(__be16 tflags)
106 {
107 __be16 flags = 0;
108
109 if (tflags & TUNNEL_CSUM)
110 flags |= GRE_CSUM;
111 if (tflags & TUNNEL_ROUTING)
112 flags |= GRE_ROUTING;
113 if (tflags & TUNNEL_KEY)
114 flags |= GRE_KEY;
115 if (tflags & TUNNEL_SEQ)
116 flags |= GRE_SEQ;
117 if (tflags & TUNNEL_STRICT)
118 flags |= GRE_STRICT;
119 if (tflags & TUNNEL_REC)
120 flags |= GRE_REC;
121 if (tflags & TUNNEL_VERSION)
122 flags |= GRE_VERSION;
123
124 return flags;
125 }
126
127 #define gre_build_header rpl_gre_build_header
128 void rpl_gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
129 int hdr_len);
130
131 int rpl_ipgre_init(void);
132 void rpl_ipgre_fini(void);
133 int rpl_ip6gre_init(void);
134 void rpl_ip6gre_fini(void);
135 int rpl_ip6_tunnel_init(void);
136 void rpl_ip6_tunnel_cleanup(void);
137 int rpl_gre_init(void);
138 void rpl_gre_exit(void);
139
140 #define gretap_fb_dev_create rpl_gretap_fb_dev_create
141 struct net_device *rpl_gretap_fb_dev_create(struct net *net, const char *name,
142 u8 name_assign_type);
143
144 #define gre_parse_header rpl_gre_parse_header
145 int rpl_gre_parse_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
146 bool *csum_err, __be16 proto, int nhs);
147
148 #define gre_fb_xmit rpl_gre_fb_xmit
149 netdev_tx_t rpl_gre_fb_xmit(struct sk_buff *skb);
150
151 #define gre_add_protocol rpl_gre_add_protocol
152 int rpl_gre_add_protocol(const struct gre_protocol *proto, u8 version);
153 #define gre_del_protocol rpl_gre_del_protocol
154 int rpl_gre_del_protocol(const struct gre_protocol *proto, u8 version);
155 #endif /* USE_UPSTREAM_TUNNEL */
156
157 #define ipgre_init rpl_ipgre_init
158 #define ipgre_fini rpl_ipgre_fini
159 #define ip6gre_init rpl_ip6gre_init
160 #define ip6gre_fini rpl_ip6gre_fini
161 #define ip6_tunnel_init rpl_ip6_tunnel_init
162 #define ip6_tunnel_cleanup rpl_ip6_tunnel_cleanup
163 #define gre_init rpl_gre_init
164 #define gre_exit rpl_gre_exit
165
166 #define gre_fill_metadata_dst ovs_gre_fill_metadata_dst
167 int ovs_gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb);
168
169
170 #endif