1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
3 * SR-IPv6 implementation
6 * David Lebrun <david.lebrun@uclouvain.be>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
15 #ifndef _UAPI_LINUX_SEG6_IPTUNNEL_H
16 #define _UAPI_LINUX_SEG6_IPTUNNEL_H
18 #include <linux/seg6.h> /* For struct ipv6_sr_hdr. */
25 #define SEG6_IPTUNNEL_MAX (__SEG6_IPTUNNEL_MAX - 1)
27 struct seg6_iptunnel_encap
{
29 struct ipv6_sr_hdr srh
[0];
32 #define SEG6_IPTUN_ENCAP_SIZE(x) ((sizeof(*x)) + (((x)->srh->hdrlen + 1) << 3))
35 SEG6_IPTUN_MODE_INLINE
,
36 SEG6_IPTUN_MODE_ENCAP
,
37 SEG6_IPTUN_MODE_L2ENCAP
,
42 static inline size_t seg6_lwt_headroom(struct seg6_iptunnel_encap
*tuninfo
)
46 switch (tuninfo
->mode
) {
47 case SEG6_IPTUN_MODE_INLINE
:
49 case SEG6_IPTUN_MODE_ENCAP
:
50 head
= sizeof(struct ipv6hdr
);
52 case SEG6_IPTUN_MODE_L2ENCAP
:
56 return ((tuninfo
->srh
->hdrlen
+ 1) << 3) + head
;