1 /* 2 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 18 #ifndef _TLV_HDR_H_ 19 #define _TLV_HDR_H_ 20 21 #define _TLV_USERID_WIDTH_ 6 22 #define _TLV_DATA_WIDTH_ 32 23 #define _TLV_TAG_WIDTH_ 9 24 25 #define _TLV_MRV_EN_LEN_WIDTH_ 9 26 #define _TLV_MRV_DIS_LEN_WIDTH_ 12 27 28 #define _TLV_16_DATA_WIDTH_ 16 29 #define _TLV_16_TAG_WIDTH_ 5 30 #define _TLV_16_LEN_WIDTH_ 4 31 #define _TLV_CTAG_WIDTH_ 5 32 #define _TLV_44_DATA_WIDTH_ 44 33 #define _TLV_64_DATA_WIDTH_ 64 34 #define _TLV_76_DATA_WIDTH_ 64 35 #define _TLV_CDATA_WIDTH_ 32 36 #define _TLV_CDATA_76_WIDTH_ 64 37 38 struct tlv_usr_16_tlword_t { 39 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 40 uint16_t tlv_cflg_reserved : 1, 41 tlv_tag : _TLV_16_TAG_WIDTH_, 42 tlv_len : _TLV_16_LEN_WIDTH_, 43 tlv_usrid : _TLV_USERID_WIDTH_; 44 #else 45 uint16_t tlv_usrid : _TLV_USERID_WIDTH_, 46 tlv_len : _TLV_16_LEN_WIDTH_, 47 tlv_tag : _TLV_16_TAG_WIDTH_, 48 tlv_cflg_reserved : 1; 49 #endif 50 }; 51 52 struct tlv_16_tlword_t { 53 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 54 uint16_t tlv_cflg_reserved : 1, 55 tlv_len : _TLV_16_LEN_WIDTH_, 56 tlv_tag : _TLV_16_TAG_WIDTH_, 57 tlv_reserved : 6; 58 #else 59 uint16_t tlv_reserved : 6, 60 tlv_tag : _TLV_16_TAG_WIDTH_, 61 tlv_len : _TLV_16_LEN_WIDTH_, 62 tlv_cflg_reserved : 1; 63 #endif 64 }; 65 66 struct tlv_mac_usr_32_tlword_t { 67 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 68 uint32_t tlv_cflg_reserved : 1, 69 tlv_tag : _TLV_TAG_WIDTH_, 70 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 71 tlv_src_linkid : 3, 72 tlv_mrv : 1, 73 tlv_usrid : _TLV_USERID_WIDTH_; 74 #else 75 uint32_t tlv_usrid : _TLV_USERID_WIDTH_, 76 tlv_mrv : 1, 77 tlv_src_linkid : 3, 78 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 79 tlv_tag : _TLV_TAG_WIDTH_, 80 tlv_cflg_reserved : 1; 81 #endif 82 }; 83 84 struct tlv_mac_32_tlword_t { 85 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 86 uint32_t tlv_cflg_reserved : 1, 87 tlv_tag : _TLV_TAG_WIDTH_, 88 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 89 tlv_src_linkid : 3, 90 tlv_mrv : 1, 91 tlv_reserved : 6; 92 #else 93 uint32_t tlv_reserved : 6, 94 tlv_mrv : 1, 95 tlv_src_linkid : 3, 96 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 97 tlv_tag : _TLV_TAG_WIDTH_, 98 tlv_cflg_reserved : 1; 99 #endif 100 }; 101 102 struct tlv_mac_usr_64_tlword_t { 103 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 104 uint64_t tlv_cflg_reserved : 1, 105 tlv_tag : _TLV_TAG_WIDTH_, 106 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 107 tlv_src_linkid : 3, 108 tlv_mrv : 1, 109 tlv_usrid : _TLV_USERID_WIDTH_, 110 #else 111 uint64_t tlv_usrid : _TLV_USERID_WIDTH_, 112 tlv_mrv : 1, 113 tlv_src_linkid : 3, 114 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 115 tlv_tag : _TLV_TAG_WIDTH_, 116 tlv_cflg_reserved : 1, 117 #endif 118 tlv_reserved : 32; 119 }; 120 121 struct tlv_mac_64_tlword_t { 122 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 123 uint64_t tlv_cflg_reserved : 1, 124 tlv_tag : _TLV_TAG_WIDTH_, 125 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 126 tlv_src_linkid : 3, 127 tlv_mrv : 1, 128 tlv_reserved : 38; 129 #else 130 uint64_t tlv_usrid_reserved : _TLV_USERID_WIDTH_, 131 tlv_mrv : 1, 132 tlv_src_linkid : 3, 133 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 134 tlv_tag : _TLV_TAG_WIDTH_, 135 tlv_cflg_reserved : 1, 136 tlv_reserved : 32; 137 #endif 138 }; 139 140 struct tlv_mac_usr_44_tlword_t { 141 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 142 uint64_t tlv_compression : 1, 143 tlv_tag : _TLV_TAG_WIDTH_, 144 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 145 tlv_src_linkid : 3, 146 tlv_mrv : 1, 147 tlv_usrid : _TLV_USERID_WIDTH_, 148 tlv_reserved : 10, 149 pad_44to64_bit : 22; 150 #else 151 uint64_t tlv_usrid : _TLV_USERID_WIDTH_, 152 tlv_mrv : 1, 153 tlv_src_linkid : 3, 154 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 155 tlv_tag : _TLV_TAG_WIDTH_, 156 tlv_compression : 1, 157 pad_44to64_bit : 22, 158 tlv_reserved : 10; 159 #endif 160 }; 161 162 struct tlv_mac_44_tlword_t { 163 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 164 uint64_t tlv_compression : 1, 165 tlv_tag : _TLV_TAG_WIDTH_, 166 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 167 tlv_src_linkid : 3, 168 tlv_mrv : 1, 169 tlv_reserved : 16, 170 pad_44to64_bit : 22; 171 #else 172 uint64_t tlv_usrid_reserved : _TLV_USERID_WIDTH_, 173 tlv_mrv : 1, 174 tlv_src_linkid : 3, 175 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 176 tlv_tag : _TLV_TAG_WIDTH_, 177 tlv_compression : 1, 178 pad_44to64_bit : 22, 179 tlv_reserved : 10; 180 #endif 181 }; 182 183 struct tlv_mac_usr_76_tlword_t { 184 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 185 uint64_t tlv_compression : 1, 186 tlv_tag : _TLV_TAG_WIDTH_, 187 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 188 tlv_src_linkid : 3, 189 tlv_mrv : 1, 190 tlv_usrid : _TLV_USERID_WIDTH_, 191 #else 192 uint64_t tlv_usrid : _TLV_USERID_WIDTH_, 193 tlv_mrv : 1, 194 tlv_src_linkid : 3, 195 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 196 tlv_tag : _TLV_TAG_WIDTH_, 197 tlv_compression : 1, 198 #endif 199 tlv_reserved : 32; 200 uint64_t pad_64to128_bit : 64; 201 }; 202 203 struct tlv_mac_76_tlword_t { 204 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 205 uint64_t tlv_compression : 1, 206 tlv_tag : _TLV_TAG_WIDTH_, 207 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 208 tlv_src_linkid : 3, 209 tlv_mrv : 1, 210 tlv_reserved : 38; 211 #else 212 uint64_t tlv_usrid_reserved : _TLV_USERID_WIDTH_, 213 tlv_mrv : 1, 214 tlv_src_linkid : 3, 215 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 216 tlv_tag : _TLV_TAG_WIDTH_, 217 tlv_compression : 1, 218 tlv_reserved : 32; 219 #endif 220 uint64_t pad_64to128_bit : 64; 221 }; 222 223 struct tlv_usr_c_44_tlword_t { 224 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 225 uint64_t tlv_compression : 1, 226 tlv_ctag : _TLV_CTAG_WIDTH_, 227 tlv_usrid : _TLV_USERID_WIDTH_, 228 tlv_cdata : _TLV_CDATA_WIDTH_, 229 pad_44to64_bit : 20; 230 #else 231 uint64_t tlv_cdata_lower_20 : 20, 232 tlv_usrid : _TLV_USERID_WIDTH_, 233 tlv_ctag : _TLV_CTAG_WIDTH_, 234 tlv_compression : 1, 235 pad_44to64_bit : 20, 236 tlv_cdata_upper_12 : 12; 237 #endif 238 }; 239 240 struct tlv_usr_c_76_tlword_t { 241 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 242 uint64_t tlv_compression : 1, 243 tlv_ctag : _TLV_CTAG_WIDTH_, 244 tlv_usrid : _TLV_USERID_WIDTH_, 245 tlv_cdata_lower_52 : 52; 246 uint64_t tlv_cdata_upper_12 : 12, 247 pad_76to128_bit : 52; 248 #else 249 uint64_t tlv_cdata_lower_20 : 20, 250 tlv_usrid : _TLV_USERID_WIDTH_, 251 tlv_ctag : _TLV_CTAG_WIDTH_, 252 tlv_compression : 1, 253 tlv_cdata_middle_32 : 32; 254 uint64_t pad_76to96_bit : 20, 255 tlv_cdata_upper_12 : 12, 256 pad_96to128_bit : 32; 257 #endif 258 }; 259 260 struct tlv_usr_32_hdr { 261 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 262 uint32_t tlv_cflg_reserved : 1, 263 tlv_tag : _TLV_TAG_WIDTH_, 264 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 265 tlv_src_linkid : 3, 266 tlv_mrv : 1, 267 tlv_usrid : _TLV_USERID_WIDTH_; 268 #else 269 uint32_t tlv_usrid : _TLV_USERID_WIDTH_, 270 tlv_mrv : 1, 271 tlv_src_linkid : 3, 272 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 273 tlv_tag : _TLV_TAG_WIDTH_, 274 tlv_cflg_reserved : 1; 275 #endif 276 }; 277 278 struct tlv_32_hdr { 279 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 280 uint32_t tlv_cflg_reserved : 1, 281 tlv_tag : _TLV_TAG_WIDTH_, 282 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 283 tlv_src_linkid : 3, 284 tlv_mrv : 1, 285 tlv_reserved : 6; 286 #else 287 uint32_t tlv_reserved : 6, 288 tlv_mrv : 1, 289 tlv_src_linkid : 3, 290 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 291 tlv_tag : _TLV_TAG_WIDTH_, 292 tlv_cflg_reserved : 1; 293 #endif 294 }; 295 296 struct tlv_mlo_usr_64_tlw32_t { 297 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 298 uint32_t tlv_cflg_reserved : 1, 299 tlv_tag : _TLV_TAG_WIDTH_, 300 tlv_len : _TLV_MRV_EN_LEN_WIDTH_, 301 tlv_dst_linkid : 3, 302 tlv_src_linkid : 3, 303 tlv_mrv : 1, 304 tlv_usrid : _TLV_USERID_WIDTH_; 305 #else 306 uint32_t tlv_usrid : _TLV_USERID_WIDTH_, 307 tlv_mrv : 1, 308 tlv_src_linkid : 3, 309 tlv_dst_linkid : 3, 310 tlv_len : _TLV_MRV_EN_LEN_WIDTH_, 311 tlv_tag : _TLV_TAG_WIDTH_, 312 tlv_cflg_reserved : 1; 313 #endif 314 uint32_t pad_32to64_bit : 32; 315 }; 316 317 struct tlv_mlo_64_tlw32_t { 318 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 319 uint32_t tlv_cflg_reserved : 1, 320 tlv_tag : _TLV_TAG_WIDTH_, 321 tlv_len : _TLV_MRV_EN_LEN_WIDTH_, 322 tlv_dst_linkid : 3, 323 tlv_src_linkid : 3, 324 tlv_mrv : 1, 325 tlv_reserved : _TLV_USERID_WIDTH_; 326 #else 327 uint32_t tlv_reserved : _TLV_USERID_WIDTH_, 328 tlv_mrv : 1, 329 tlv_src_linkid : 3, 330 tlv_dst_linkid : 3, 331 tlv_len : _TLV_MRV_EN_LEN_WIDTH_, 332 tlv_tag : _TLV_TAG_WIDTH_, 333 tlv_cflg_reserved : 1; 334 #endif 335 uint32_t pad_32to64_bit : 32; 336 }; 337 338 struct tlv_mac_usr_64_tlw32_t { 339 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 340 uint32_t tlv_cflg_reserved : 1, 341 tlv_tag : _TLV_TAG_WIDTH_, 342 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 343 tlv_src_linkid : 3, 344 tlv_mrv : 1, 345 tlv_usrid : _TLV_USERID_WIDTH_; 346 #else 347 uint32_t tlv_usrid : _TLV_USERID_WIDTH_, 348 tlv_mrv : 1, 349 tlv_src_linkid : 3, 350 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 351 tlv_tag : _TLV_TAG_WIDTH_, 352 tlv_cflg_reserved : 1; 353 #endif 354 uint32_t pad_32to64_bit : 32; 355 }; 356 357 struct tlv_mac_64_tlw32_t { 358 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 359 uint32_t tlv_cflg_reserved : 1, 360 tlv_tag : _TLV_TAG_WIDTH_, 361 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 362 tlv_src_linkid : 3, 363 tlv_mrv : 1, 364 tlv_reserved : _TLV_USERID_WIDTH_; 365 #else 366 uint32_t tlv_reserved : _TLV_USERID_WIDTH_, 367 tlv_mrv : 1, 368 tlv_src_linkid : 3, 369 tlv_len : _TLV_MRV_DIS_LEN_WIDTH_, 370 tlv_tag : _TLV_TAG_WIDTH_, 371 tlv_cflg_reserved : 1; 372 #endif 373 uint32_t pad_32to64_bit : 32; 374 }; 375 376 struct tlv_usr_c_44_tlw32_t { 377 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 378 uint32_t tlv_compression : 1, 379 tlv_ctag : _TLV_CTAG_WIDTH_, 380 tlv_usrid : _TLV_USERID_WIDTH_, 381 tlv_cdata_lower_20 : 20; 382 uint32_t tlv_cdata_upper_12 : 12, 383 pad_44to64_bit : 20; 384 #else 385 uint32_t tlv_cdata_lower_20 : 20, 386 tlv_usrid : _TLV_USERID_WIDTH_, 387 tlv_ctag : _TLV_CTAG_WIDTH_, 388 tlv_compression : 1; 389 uint32_t pad_44to64_bit : 20, 390 tlv_cdata_upper_12 : 12; 391 #endif 392 }; 393 394 struct tlv_usr_c_76_tlw32_t { 395 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN 396 uint32_t tlv_compression : 1, 397 tlv_ctag : _TLV_CTAG_WIDTH_, 398 tlv_usrid : _TLV_USERID_WIDTH_, 399 tlv_cdata_lower_20 : 20; 400 uint32_t tlv_cdata_middle_32 : 32; 401 uint32_t tlv_cdata_upper_12 : 12, 402 pad_76to96_bit : 20; 403 uint32_t pad_96to128_bit : 32; 404 #else 405 uint32_t tlv_cdata_lower_20 : 20, 406 tlv_usrid : _TLV_USERID_WIDTH_, 407 tlv_ctag : _TLV_CTAG_WIDTH_, 408 tlv_compression : 1; 409 uint32_t tlv_cdata_middle_32 : 32; 410 uint32_t pad_76to96_bit : 20, 411 tlv_cdata_upper_12 : 12; 412 uint32_t pad_96to128_bit : 32; 413 #endif 414 }; 415 416 #endif 417