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