]>
git.proxmox.com Git - ovs.git/blob - datapath/linux/compat/include/net/gre.h
1 #ifndef __LINUX_GRE_WRAPPER_H
2 #define __LINUX_GRE_WRAPPER_H
4 #include <linux/version.h>
5 #include <linux/skbuff.h>
6 #include <net/ip_tunnels.h>
8 #ifdef USE_UPSTREAM_TUNNEL
9 #include_next <net/gre.h>
11 static inline int rpl_ipgre_init(void)
15 static inline void rpl_ipgre_fini(void)
18 static inline int rpl_ip6gre_init(void)
23 static inline void rpl_ip6gre_fini(void)
26 static inline int rpl_ip6_tunnel_init(void)
31 static inline void rpl_ip6_tunnel_cleanup(void)
35 static inline int rpl_gre_init(void)
40 static inline void rpl_gre_exit(void)
44 #define gre_fb_xmit dev_queue_xmit
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
);
52 #define gretap_fb_dev_create rpl_gretap_fb_dev_create
57 #include_next <net/gre.h>
59 #ifndef HAVE_GRE_CALC_HLEN
60 static inline int gre_calc_hlen(__be16 o_flags
)
64 if (o_flags
& TUNNEL_CSUM
)
66 if (o_flags
& TUNNEL_KEY
)
68 if (o_flags
& TUNNEL_SEQ
)
73 #define ip_gre_calc_hlen gre_calc_hlen
75 #ifdef HAVE_IP_GRE_CALC_HLEN
76 #define gre_calc_hlen ip_gre_calc_hlen
80 #define tnl_flags_to_gre_flags rpl_tnl_flags_to_gre_flags
81 static inline __be16
rpl_tnl_flags_to_gre_flags(__be16 tflags
)
85 if (tflags
& TUNNEL_CSUM
)
87 if (tflags
& TUNNEL_ROUTING
)
89 if (tflags
& TUNNEL_KEY
)
91 if (tflags
& TUNNEL_SEQ
)
93 if (tflags
& TUNNEL_STRICT
)
95 if (tflags
& TUNNEL_REC
)
97 if (tflags
& TUNNEL_VERSION
)
103 #define gre_flags_to_tnl_flags rpl_gre_flags_to_tnl_flags
104 static inline __be16
rpl_gre_flags_to_tnl_flags(__be16 flags
)
108 if (flags
& GRE_CSUM
)
109 tflags
|= TUNNEL_CSUM
;
110 if (flags
& GRE_ROUTING
)
111 tflags
|= TUNNEL_ROUTING
;
113 tflags
|= TUNNEL_KEY
;
115 tflags
|= TUNNEL_SEQ
;
116 if (flags
& GRE_STRICT
)
117 tflags
|= TUNNEL_STRICT
;
119 tflags
|= TUNNEL_REC
;
120 if (flags
& GRE_VERSION
)
121 tflags
|= TUNNEL_VERSION
;
125 #define gre_tnl_flags_to_gre_flags rpl_gre_tnl_flags_to_gre_flags
126 static inline __be16
rpl_gre_tnl_flags_to_gre_flags(__be16 tflags
)
130 if (tflags
& TUNNEL_CSUM
)
132 if (tflags
& TUNNEL_ROUTING
)
133 flags
|= GRE_ROUTING
;
134 if (tflags
& TUNNEL_KEY
)
136 if (tflags
& TUNNEL_SEQ
)
138 if (tflags
& TUNNEL_STRICT
)
140 if (tflags
& TUNNEL_REC
)
142 if (tflags
& TUNNEL_VERSION
)
143 flags
|= GRE_VERSION
;
148 #define gre_build_header rpl_gre_build_header
149 void rpl_gre_build_header(struct sk_buff
*skb
, const struct tnl_ptk_info
*tpi
,
152 int rpl_ipgre_init(void);
153 void rpl_ipgre_fini(void);
154 int rpl_ip6gre_init(void);
155 void rpl_ip6gre_fini(void);
156 int rpl_ip6_tunnel_init(void);
157 void rpl_ip6_tunnel_cleanup(void);
158 int rpl_gre_init(void);
159 void rpl_gre_exit(void);
161 #define gretap_fb_dev_create rpl_gretap_fb_dev_create
162 struct net_device
*rpl_gretap_fb_dev_create(struct net
*net
, const char *name
,
163 u8 name_assign_type
);
165 #define gre_parse_header rpl_gre_parse_header
166 int rpl_gre_parse_header(struct sk_buff
*skb
, struct tnl_ptk_info
*tpi
,
167 bool *csum_err
, __be16 proto
, int nhs
);
169 #define gre_fb_xmit rpl_gre_fb_xmit
170 netdev_tx_t
rpl_gre_fb_xmit(struct sk_buff
*skb
);
172 #define gre_add_protocol rpl_gre_add_protocol
173 int rpl_gre_add_protocol(const struct gre_protocol
*proto
, u8 version
);
174 #define gre_del_protocol rpl_gre_del_protocol
175 int rpl_gre_del_protocol(const struct gre_protocol
*proto
, u8 version
);
176 #endif /* USE_UPSTREAM_TUNNEL */
178 #define ipgre_init rpl_ipgre_init
179 #define ipgre_fini rpl_ipgre_fini
180 #define ip6gre_init rpl_ip6gre_init
181 #define ip6gre_fini rpl_ip6gre_fini
182 #define ip6_tunnel_init rpl_ip6_tunnel_init
183 #define ip6_tunnel_cleanup rpl_ip6_tunnel_cleanup
184 #define gre_init rpl_gre_init
185 #define gre_exit rpl_gre_exit
187 #define gre_fill_metadata_dst ovs_gre_fill_metadata_dst
188 int ovs_gre_fill_metadata_dst(struct net_device
*dev
, struct sk_buff
*skb
);