1 /*
2 * This header was generated from the Linux kernel headers by update_headers.py,
3 * to provide necessary information from kernel to userspace, such as constants,
4 * structures, and macros, and thus, contains no copyrightable information.
5 */
6 #ifndef _UAPI_LINUX_SEG6_IPTUNNEL_H
7 #define _UAPI_LINUX_SEG6_IPTUNNEL_H
8 #include <linux/seg6.h>
9 enum {
10 SEG6_IPTUNNEL_UNSPEC,
11 SEG6_IPTUNNEL_SRH,
12 __SEG6_IPTUNNEL_MAX,
13 };
14 #define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1)
15 struct seg6_iptunnel_encap {
16 int mode;
17 struct ipv6_sr_hdr srh[0];
18 };
19 #define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3))
20 enum {
21 SEG6_IPTUN_MODE_INLINE,
22 SEG6_IPTUN_MODE_ENCAP,
23 SEG6_IPTUN_MODE_L2ENCAP,
24 };
25 #ifdef __KERNEL__
seg6_lwt_headroom(struct seg6_iptunnel_encap * tuninfo)26 static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap *tuninfo)
27 {
28 int head = 0;
29 switch (tuninfo->mode) {
30 case SEG6_IPTUN_MODE_INLINE:
31 break;
32 case SEG6_IPTUN_MODE_ENCAP:
33 head = sizeof(struct ipv6hdr);
34 break;
35 case SEG6_IPTUN_MODE_L2ENCAP:
36 return 0;
37 }
38 return ((tuninfo->srh->hdrlen + 1) << 3) + head;
39 }
40 #endif
41 #endif
42