xref: /openbmc/linux/include/net/fou.h (revision b17f709a)
1 #ifndef __NET_FOU_H
2 #define __NET_FOU_H
3 
4 #include <linux/skbuff.h>
5 
6 #include <net/flow.h>
7 #include <net/gue.h>
8 #include <net/ip_tunnels.h>
9 #include <net/udp.h>
10 
11 int fou_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
12 		     u8 *protocol, struct flowi4 *fl4);
13 int gue_build_header(struct sk_buff *skb, struct ip_tunnel_encap *e,
14 		     u8 *protocol, struct flowi4 *fl4);
15 
16 static size_t fou_encap_hlen(struct ip_tunnel_encap *e)
17 {
18 	return sizeof(struct udphdr);
19 }
20 
21 static size_t gue_encap_hlen(struct ip_tunnel_encap *e)
22 {
23 	size_t len;
24 	bool need_priv = false;
25 
26 	len = sizeof(struct udphdr) + sizeof(struct guehdr);
27 
28 	if (e->flags & TUNNEL_ENCAP_FLAG_REMCSUM) {
29 		len += GUE_PLEN_REMCSUM;
30 		need_priv = true;
31 	}
32 
33 	len += need_priv ? GUE_LEN_PRIV : 0;
34 
35 	return len;
36 }
37 
38 #endif
39