xref: /linux-6.15/include/uapi/linux/ioam6.h (revision db67f219)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  *  IPv6 IOAM implementation
4  *
5  *  Author:
6  *  Justin Iurman <[email protected]>
7  */
8 
9 #ifndef _UAPI_LINUX_IOAM6_H
10 #define _UAPI_LINUX_IOAM6_H
11 
12 #include <asm/byteorder.h>
13 #include <linux/types.h>
14 
15 /*
16  * IPv6 IOAM Option Header
17  */
18 struct ioam6_hdr {
19 	__u8 opt_type;
20 	__u8 opt_len;
21 	__u8 :8;				/* reserved */
22 #define IOAM6_TYPE_PREALLOC 0
23 	__u8 type;
24 } __attribute__((packed));
25 
26 /*
27  * IOAM Trace Header
28  */
29 struct ioam6_trace_hdr {
30 	__be16	namespace_id;
31 
32 #if defined(__LITTLE_ENDIAN_BITFIELD)
33 
34 	__u8	:1,				/* unused */
35 		:1,				/* unused */
36 		overflow:1,
37 		nodelen:5;
38 
39 	__u8	remlen:7,
40 		:1;				/* unused */
41 
42 	union {
43 		__be32 type_be32;
44 
45 		struct {
46 			__u32	bit7:1,
47 				bit6:1,
48 				bit5:1,
49 				bit4:1,
50 				bit3:1,
51 				bit2:1,
52 				bit1:1,
53 				bit0:1,
54 				bit15:1,	/* unused */
55 				bit14:1,	/* unused */
56 				bit13:1,	/* unused */
57 				bit12:1,	/* unused */
58 				bit11:1,
59 				bit10:1,
60 				bit9:1,
61 				bit8:1,
62 				bit23:1,	/* reserved */
63 				bit22:1,
64 				bit21:1,	/* unused */
65 				bit20:1,	/* unused */
66 				bit19:1,	/* unused */
67 				bit18:1,	/* unused */
68 				bit17:1,	/* unused */
69 				bit16:1,	/* unused */
70 				:8;		/* reserved */
71 		} type;
72 	};
73 
74 #elif defined(__BIG_ENDIAN_BITFIELD)
75 
76 	__u8	nodelen:5,
77 		overflow:1,
78 		:1,				/* unused */
79 		:1;				/* unused */
80 
81 	__u8	:1,				/* unused */
82 		remlen:7;
83 
84 	union {
85 		__be32 type_be32;
86 
87 		struct {
88 			__u32	bit0:1,
89 				bit1:1,
90 				bit2:1,
91 				bit3:1,
92 				bit4:1,
93 				bit5:1,
94 				bit6:1,
95 				bit7:1,
96 				bit8:1,
97 				bit9:1,
98 				bit10:1,
99 				bit11:1,
100 				bit12:1,	/* unused */
101 				bit13:1,	/* unused */
102 				bit14:1,	/* unused */
103 				bit15:1,	/* unused */
104 				bit16:1,	/* unused */
105 				bit17:1,	/* unused */
106 				bit18:1,	/* unused */
107 				bit19:1,	/* unused */
108 				bit20:1,	/* unused */
109 				bit21:1,	/* unused */
110 				bit22:1,
111 				bit23:1,	/* reserved */
112 				:8;		/* reserved */
113 		} type;
114 	};
115 
116 #else
117 #error "Please fix <asm/byteorder.h>"
118 #endif
119 
120 	__u8	data[0];
121 } __attribute__((packed));
122 
123 #endif /* _UAPI_LINUX_IOAM6_H */
124