1 /*
2  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  * This file sir_mac_prot_def.h contains the MAC/PHY protocol
22  * definitions used across various projects.
23  */
24 
25 #ifndef __MAC_PROT_DEFS_H
26 #define __MAC_PROT_DEFS_H
27 
28 #include <linux/if_ether.h>
29 
30 #include "cds_api.h"
31 #include "sir_types.h"
32 #include "wni_cfg.h"
33 #include <lim_fils_defs.h>
34 
35 /* /Capability information related */
36 #define CAPABILITY_INFO_DELAYED_BA_BIT 14
37 #define CAPABILITY_INFO_IMMEDIATE_BA_BIT 15
38 
39 /* / 11h MAC defaults */
40 #define SIR_11A_CHANNEL_BEGIN           34
41 #define SIR_11A_CHANNEL_END             165
42 #define SIR_11B_CHANNEL_BEGIN           1
43 #define SIR_11B_CHANNEL_END             14
44 #define SIR_11A_FREQUENCY_OFFSET        4
45 #define SIR_11B_FREQUENCY_OFFSET        1
46 #define SIR_11P_CHANNEL_BEGIN           170
47 #define SIR_11P_CHANNEL_END             184
48 
49 /* / Current version of 802.11 */
50 #define SIR_MAC_PROTOCOL_VERSION 0
51 
52 /* Frame Type definitions */
53 
54 #define SIR_MAC_MGMT_FRAME    0x0
55 #define SIR_MAC_CTRL_FRAME    0x1
56 #define SIR_MAC_DATA_FRAME    0x2
57 
58 /* Data frame subtype definitions */
59 #define SIR_MAC_DATA_DATA                 0
60 #define SIR_MAC_DATA_DATA_ACK             1
61 #define SIR_MAC_DATA_DATA_POLL            2
62 #define SIR_MAC_DATA_DATA_ACK_POLL        3
63 #define SIR_MAC_DATA_NULL                 4
64 #define SIR_MAC_DATA_NULL_ACK             5
65 #define SIR_MAC_DATA_NULL_POLL            6
66 #define SIR_MAC_DATA_NULL_ACK_POLL        7
67 #define SIR_MAC_DATA_QOS_DATA             8
68 #define SIR_MAC_DATA_QOS_DATA_ACK         9
69 #define SIR_MAC_DATA_QOS_DATA_POLL        10
70 #define SIR_MAC_DATA_QOS_DATA_ACK_POLL    11
71 #define SIR_MAC_DATA_QOS_NULL             12
72 #define SIR_MAC_DATA_QOS_NULL_ACK         13
73 #define SIR_MAC_DATA_QOS_NULL_POLL        14
74 #define SIR_MAC_DATA_QOS_NULL_ACK_POLL    15
75 
76 #define SIR_MAC_DATA_QOS_MASK             8
77 #define SIR_MAC_DATA_NULL_MASK            4
78 #define SIR_MAC_DATA_POLL_MASK            2
79 #define SIR_MAC_DATA_ACK_MASK             1
80 
81 /* Management frame subtype definitions */
82 
83 #define SIR_MAC_MGMT_ASSOC_REQ    0x0
84 #define SIR_MAC_MGMT_ASSOC_RSP    0x1
85 #define SIR_MAC_MGMT_REASSOC_REQ  0x2
86 #define SIR_MAC_MGMT_REASSOC_RSP  0x3
87 #define SIR_MAC_MGMT_PROBE_REQ    0x4
88 #define SIR_MAC_MGMT_PROBE_RSP    0x5
89 #define SIR_MAC_MGMT_TIME_ADVERT  0x6
90 #define SIR_MAC_MGMT_BEACON       0x8
91 #define SIR_MAC_MGMT_ATIM         0x9
92 #define SIR_MAC_MGMT_DISASSOC     0xA
93 #define SIR_MAC_MGMT_AUTH         0xB
94 #define SIR_MAC_MGMT_DEAUTH       0xC
95 #define SIR_MAC_MGMT_ACTION       0xD
96 #define SIR_MAC_MGMT_RESERVED15   0xF
97 
98 #define SIR_MAC_ACTION_TX             1
99 
100 #define SIR_MAC_BA_POLICY_IMMEDIATE     1
101 #define SIR_MAC_BA_DEFAULT_BUFF_SIZE    64
102 
103 #define MAX_BA_BUFF_SIZE    256
104 #define MAX_EHT_BA_BUFF_SIZE 1024
105 
106 #ifdef ANI_SUPPORT_11H
107 #define SIR_MAC_BASIC_MEASUREMENT_TYPE         0
108 #define SIR_MAC_CCA_MEASUREMENT_TYPE           1
109 #define SIR_MAC_RPI_MEASUREMENT_TYPE           2
110 #endif /* ANI_SUPPORT_11H */
111 
112 /* RRM related. */
113 /* Refer IEEE Std 802.11k-2008, Section 7.3.2.21, table 7.29 */
114 #define SIR_MAC_RRM_CHANNEL_LOAD_TYPE          3
115 #define SIR_MAC_RRM_NOISE_HISTOGRAM_BEACON     4
116 #define SIR_MAC_RRM_BEACON_TYPE                5
117 #define SIR_MAC_RRM_FRAME_TYPE                 6
118 #define SIR_MAC_RRM_STA_STATISTICS_TYPE        7
119 #define SIR_MAC_RRM_LCI_TYPE                   8
120 #define SIR_MAC_RRM_TSM_TYPE                   9
121 #define SIR_MAC_RRM_LOCATION_CIVIC_TYPE        11
122 #define SIR_MAC_RRM_FINE_TIME_MEAS_TYPE        16
123 
124 #define SIR_MAC_VHT_OPMODE_SIZE                3
125 
126 #define NUM_OF_SOUNDING_DIMENSIONS	1 /*Nss - 1, (Nss = 2 for 2x2)*/
127 
128 /* ----------------------------------------------------------------------------- */
129 /* EID (Element ID) definitions */
130 /* and their min/max lengths */
131 /* ----------------------------------------------------------------------------- */
132 
133 #define SIR_MAC_TIM_EID_MIN                3
134 
135 #define SIR_MAC_WPA_EID                221
136 
137 #define SIR_MAC_MAX_SUPPORTED_MCS_SET    16
138 
139 #define VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1       390
140 #define VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1       390
141 #define VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_2_2       780
142 #define VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_2_2       780
143 
144 #define VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1_SGI80 433
145 #define VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1_SGI80 433
146 #define VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_2_2_SGI80 866
147 #define VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_2_2_SGI80 866
148 
149 #define VHT_CAP_NO_160M_SUPP 0
150 #define VHT_CAP_160_SUPP 1
151 #define VHT_CAP_160_AND_80P80_SUPP 2
152 
153 #define VHT_NO_EXTD_NSS_BW_SUPP			0
154 #define VHT_EXTD_NSS_80_HALF_NSS_160		1
155 #define VHT_EXTD_NSS_80_HALF_NSS_80P80		2
156 #define VHT_EXTD_NSS_80_3QUART_NSS_80P80	3
157 #define VHT_EXTD_NSS_160_HALF_NSS_80P80		1
158 #define VHT_EXTD_NSS_160_3QUART_NSS_80P80	2
159 #define VHT_EXTD_NSS_2X_NSS_160_1X_NSS_80P80	3
160 #define VHT_EXTD_NSS_2X_NSS_80_1X_NSS_80P80	3
161 
162 #define VHT_MAX_NSS 8
163 
164 #define VHT_MCS_1x1 0xFFFC
165 #define VHT_MCS_2x2 0xFFF3
166 
167 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
168 #define SIR_MAC_QCOM_VENDOR_EID      200
169 #define SIR_MAC_QCOM_VENDOR_OUI      "\x00\xA0\xC6"
170 #define SIR_MAC_QCOM_VENDOR_SIZE     3
171 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
172 
173 #define SIR_MAC_MAX_ADD_IE_LENGTH       2048
174 
175 /* / Minimum length of each IE */
176 #define SIR_MAC_RSN_IE_MIN_LENGTH   2
177 #define SIR_MAC_WPA_IE_MIN_LENGTH   6
178 
179 #ifdef FEATURE_WLAN_ESE
180 #define ESE_VERSION_4               4
181 #define ESE_VERSION_SUPPORTED       ESE_VERSION_4
182 
183 /* When station sends Radio Management Cap. */
184 /* State should be normal=1 */
185 /* Mbssid Mask should be 0 */
186 #define RM_STATE_NORMAL             1
187 #endif
188 
189 #define SIR_MAC_OUI_VERSION_1         1
190 
191 /* OWE DH Parameter element https://tools.ietf.org/html/rfc8110 */
192 #define SIR_DH_PARAMETER_ELEMENT_EXT_EID 32
193 
194 #define SIR_MSCS_ELEMENT_EXT_EID 88
195 
196 /* OUI and type definition for WPA IE in network byte order */
197 #define SIR_MAC_WPA_OUI             0x01F25000
198 #define SIR_MAC_WSC_OUI             "\x00\x50\xf2\x04"
199 #define SIR_MAC_WSC_OUI_SIZE        4
200 #define SIR_MAC_P2P_OUI             "\x50\x6f\x9a\x09"
201 #define SIR_MAC_P2P_OUI_SIZE        4
202 #define SIR_P2P_NOA_ATTR            12
203 #define SIR_MAX_NOA_ATTR_LEN        31
204 #define SIR_P2P_IE_HEADER_LEN       6
205 
206 #define SIR_MAC_CISCO_OUI "\x00\x40\x96"
207 #define SIR_MAC_CISCO_OUI_SIZE 3
208 
209 #define SIR_MAC_QCN_OUI_TYPE   "\x8c\xfd\xf0\x01"
210 #define SIR_MAC_QCN_OUI_TYPE_SIZE  4
211 
212 /* MBO OUI definitions */
213 #define SIR_MAC_MBO_OUI "\x50\x6f\x9a\x16"
214 #define SIR_MAC_MBO_OUI_SIZE 4
215 #define SIR_MBO_ELEM_OFFSET  (2 + SIR_MAC_MBO_OUI_SIZE)
216 
217 /* min size of wme oui header: oui(3) + type + subtype + version */
218 #define SIR_MAC_OUI_WME_HDR_MIN       6
219 
220 /* ----------------------------------------------------------------------------- */
221 
222 /* OFFSET definitions for fixed fields in Management frames */
223 
224 /* Beacon/Probe Response offsets */
225 #define SIR_MAC_B_PR_CAPAB_OFFSET            10
226 #define SIR_MAC_B_PR_SSID_OFFSET             12
227 
228 /* Association/Reassociation offsets */
229 #define SIR_MAC_REASSOC_REQ_SSID_OFFSET      10
230 #define SIR_MAC_ASSOC_RSP_STATUS_CODE_OFFSET 2
231 
232 /* Association Request offsets */
233 #define SIR_MAC_ASSOC_REQ_SSID_OFFSET        4
234 
235 /* / Transaction sequence number definitions (used in Authentication frames) */
236 #define    SIR_MAC_AUTH_FRAME_1        1
237 #define    SIR_MAC_AUTH_FRAME_2        2
238 #define    SIR_MAC_AUTH_FRAME_3        3
239 #define    SIR_MAC_AUTH_FRAME_4        4
240 
241 /* / Protocol defined MAX definitions */
242 #define SIR_MAC_MAX_NUMBER_OF_RATES          12
243 #define SIR_MAC_KEY_LENGTH                   13 /* WEP Maximum key length size */
244 #define SIR_MAC_AUTH_CHALLENGE_LENGTH        253
245 #define SIR_MAC_SAP_AUTH_CHALLENGE_LENGTH    128
246 #define SIR_MAC_WEP_IV_LENGTH                4
247 #define SIR_MAC_WEP_ICV_LENGTH               4
248 #define SIR_MAC_CHALLENGE_ID_LEN             2
249 
250 /* 2 bytes each for auth algo number, transaction number and status code */
251 #define SIR_MAC_AUTH_FRAME_INFO_LEN          6
252 /* 2 bytes for ID and length + SIR_MAC_AUTH_CHALLENGE_LENGTH */
253 #define SIR_MAC_AUTH_CHALLENGE_BODY_LEN    (SIR_MAC_CHALLENGE_ID_LEN + \
254 					    SIR_MAC_AUTH_CHALLENGE_LENGTH)
255 
256 /* / MAX key length when ULA is used */
257 #define SIR_MAC_MAX_KEY_LENGTH               32
258 
259 /* / Macro definitions for get/set on FC fields */
260 #define SIR_MAC_GET_PROT_VERSION(x)      ((((uint16_t) x) & 0x0300) >> 8)
261 #define SIR_MAC_GET_FRAME_TYPE(x)        ((((uint16_t) x) & 0x0C00) >> 8)
262 #define SIR_MAC_GET_FRAME_SUB_TYPE(x)    ((((uint16_t) x) & 0xF000) >> 12)
263 #define SIR_MAC_GET_WEP_BIT_IN_FC(x)     (((uint16_t) x) & 0x0040)
264 #define SIR_MAC_SET_PROT_VERSION(x)      ((uint16_t) x)
265 #define SIR_MAC_SET_FRAME_TYPE(x)        (((uint16_t) x) << 2)
266 #define SIR_MAC_SET_FRAME_SUB_TYPE(x)    (((uint16_t) x) << 4)
267 #define SIR_MAC_SET_WEP_BIT_IN_FC(x)     (((uint16_t) x) << 14)
268 
269 /* / Macro definitions for get/set on capabilityInfo bits */
270 #define SIR_MAC_GET_ESS(x)               (((uint16_t) x) & 0x0001)
271 #define SIR_MAC_GET_IBSS(x)              ((((uint16_t) x) & 0x0002) >> 1)
272 #define SIR_MAC_GET_CF_POLLABLE(x)       ((((uint16_t) x) & 0x0004) >> 2)
273 #define SIR_MAC_GET_CF_POLL_REQ(x)       ((((uint16_t) x) & 0x0008) >> 3)
274 #define SIR_MAC_GET_PRIVACY(x)           ((((uint16_t) x) & 0x0010) >> 4)
275 #define SIR_MAC_GET_SHORT_PREAMBLE(x)    ((((uint16_t) x) & 0x0020) >> 5)
276 #define SIR_MAC_GET_SPECTRUM_MGMT(x)     ((((uint16_t) x) & 0x0100) >> 8)
277 #define SIR_MAC_GET_QOS(x)               ((((uint16_t) x) & 0x0200) >> 9)
278 #define SIR_MAC_GET_SHORT_SLOT_TIME(x)   ((((uint16_t) x) & 0x0400) >> 10)
279 #define SIR_MAC_GET_APSD(x)              ((((uint16_t) x) & 0x0800) >> 11)
280 #define SIR_MAC_GET_RRM(x)               ((((uint16_t) x) & 0x1000) >> 12)
281 #define SIR_MAC_GET_BLOCK_ACK(x)         ((((uint16_t) x) & 0xc000) >> CAPABILITY_INFO_DELAYED_BA_BIT)
282 #define SIR_MAC_SET_ESS(x)               (((uint16_t) x) | 0x0001)
283 #define SIR_MAC_SET_IBSS(x)              (((uint16_t) x) | 0x0002)
284 #define SIR_MAC_SET_CF_POLLABLE(x)       (((uint16_t) x) | 0x0004)
285 #define SIR_MAC_SET_CF_POLL_REQ(x)       (((uint16_t) x) | 0x0008)
286 #define SIR_MAC_SET_PRIVACY(x)           (((uint16_t) x) | 0x0010)
287 #define SIR_MAC_SET_SHORT_PREAMBLE(x)    (((uint16_t) x) | 0x0020)
288 #define SIR_MAC_SET_SPECTRUM_MGMT(x)     (((uint16_t) x) | 0x0100)
289 #define SIR_MAC_SET_QOS(x)               (((uint16_t) x) | 0x0200)
290 #define SIR_MAC_SET_SHORT_SLOT_TIME(x)   (((uint16_t) x) | 0x0400)
291 #define SIR_MAC_SET_APSD(x)              (((uint16_t) x) | 0x0800)
292 #define SIR_MAC_SET_RRM(x)               (((uint16_t) x) | 0x1000)
293 #define SIR_MAC_SET_GROUP_ACK(x)         (((uint16_t) x) | 0x4000)
294 
295 #define SIR_MAC_GET_VHT_MAX_AMPDU_EXPO(x) ((((uint32_t) x) & 0x03800000) >> 23)
296 
297 /* bitname must be one of the above, eg ESS, CF_POLLABLE, etc. */
298 #define SIR_MAC_CLEAR_CAPABILITY(u16value, bitname) \
299 	((u16value) &= (~(SIR_MAC_SET_ ## bitname(0))))
300 
301 #define IS_WES_MODE_ENABLED(x) \
302 	((x)->mlme_cfg->lfr.wes_mode_enabled)
303 
304 #define SIR_MAC_VENDOR_AP_1_OUI             "\x00\x0C\x43"
305 #define SIR_MAC_VENDOR_AP_1_OUI_LEN         3
306 
307 #define SIR_MAC_VENDOR_AP_3_OUI             "\x00\x03\x7F"
308 #define SIR_MAC_VENDOR_AP_3_OUI_LEN         3
309 
310 #define SIR_MAC_VENDOR_AP_4_OUI             "\x8C\xFD\xF0"
311 #define SIR_MAC_VENDOR_AP_4_OUI_LEN         3
312 
313 #define SIR_MAC_BA_2K_JUMP_AP_VENDOR_OUI             "\x00\x14\x6C"
314 #define SIR_MAC_BA_2K_JUMP_AP_VENDOR_OUI_LEN         3
315 
316 #define SIR_MAC_BAD_HTC_HE_VENDOR_OUI1             "\x00\x50\xF2\x11"
317 #define SIR_MAC_BAD_HTC_HE_VENDOR_OUI2             "\x00\x50\xF2\x12"
318 #define SIR_MAC_BAD_HTC_HE_VENDOR_OUI_LEN         4
319 
320 /* Maximum allowable size of a beacon,probe rsp and fils discovery frame */
321 #define SIR_MAX_BEACON_SIZE     512
322 #define SIR_MAX_PROBE_RESP_SIZE 512
323 #define SIR_MAX_FD_TMPL_SIZE    512
324 
325 
326 /* / Frame control field format (2 bytes) */
327 typedef struct sSirMacFrameCtl {
328 
329 #ifndef ANI_LITTLE_BIT_ENDIAN
330 
331 	uint8_t subType:4;
332 	uint8_t type:2;
333 	uint8_t protVer:2;
334 
335 	uint8_t order:1;
336 	uint8_t wep:1;
337 	uint8_t moreData:1;
338 	uint8_t powerMgmt:1;
339 	uint8_t retry:1;
340 	uint8_t moreFrag:1;
341 	uint8_t fromDS:1;
342 	uint8_t toDS:1;
343 
344 #else
345 
346 	uint8_t protVer:2;
347 	uint8_t type:2;
348 	uint8_t subType:4;
349 
350 	uint8_t toDS:1;
351 	uint8_t fromDS:1;
352 	uint8_t moreFrag:1;
353 	uint8_t retry:1;
354 	uint8_t powerMgmt:1;
355 	uint8_t moreData:1;
356 	uint8_t wep:1;
357 	uint8_t order:1;
358 
359 #endif
360 
361 } qdf_packed tSirMacFrameCtl, *tpSirMacFrameCtl;
362 
363 /* / Sequence control field */
364 typedef struct sSirMacSeqCtl {
365 
366 #ifndef ANI_LITTLE_BIT_ENDIAN
367 
368 	uint8_t seqNumLo:4;
369 	uint8_t fragNum:4;
370 
371 	uint8_t seqNumHi:8;
372 
373 #else
374 
375 	uint8_t fragNum:4;
376 	uint8_t seqNumLo:4;
377 	uint8_t seqNumHi:8;
378 
379 #endif
380 } qdf_packed tSirMacSeqCtl, *tpSirMacSeqCtl;
381 
382 /* / QoS control field */
383 typedef struct sSirMacQosCtl {
384 
385 #ifndef ANI_LITTLE_BIT_ENDIAN
386 
387 	uint8_t rsvd:1;
388 	uint8_t ackPolicy:2;
389 	uint8_t esop_txopUnit:1;
390 	uint8_t tid:4;
391 
392 	uint8_t txop:8;
393 
394 #else
395 
396 	uint8_t tid:4;
397 	uint8_t esop_txopUnit:1;
398 	uint8_t ackPolicy:2;
399 	uint8_t rsvd:1;
400 
401 	uint8_t txop:8;
402 
403 #endif
404 } qdf_packed tSirMacQosCtl, *tpSirMacQosCtl;
405 
406 /* / Length (in bytes) of MAC header in 3 address format */
407 #define SIR_MAC_HDR_LEN_3A    24
408 
409 typedef uint8_t tSirMacAddr[ETH_ALEN];
410 
411 /* / 3 address MAC data header format (24/26 bytes) */
412 typedef struct sSirMacDot3Hdr {
413 	tSirMacAddr da;
414 	tSirMacAddr sa;
415 	uint16_t length;
416 } qdf_packed tSirMacDot3Hdr, *tpSirMacDot3Hdr;
417 
418 /* / 3 address MAC data header format (24/26 bytes) */
419 typedef struct sSirMacDataHdr3a {
420 	tSirMacFrameCtl fc;
421 	uint8_t durationLo;
422 	uint8_t durationHi;
423 	tSirMacAddr addr1;
424 	tSirMacAddr addr2;
425 	tSirMacAddr addr3;
426 	tSirMacSeqCtl seqControl;
427 	tSirMacQosCtl qosControl;
428 } qdf_packed tSirMacDataHdr3a, *tpSirMacDataHdr3a;
429 
430 /* / Management header format */
431 typedef struct sSirMacMgmtHdr {
432 	tSirMacFrameCtl fc;
433 	uint8_t durationLo;
434 	uint8_t durationHi;
435 	tSirMacAddr da;
436 	tSirMacAddr sa;
437 	tSirMacAddr bssId;
438 	tSirMacSeqCtl seqControl;
439 } qdf_packed tSirMacMgmtHdr, *tpSirMacMgmtHdr;
440 
441 /* / ERP information field */
442 typedef struct sSirMacErpInfo {
443 #ifndef ANI_LITTLE_BIT_ENDIAN
444 	uint8_t reserved:5;
445 	uint8_t barkerPreambleMode:1;
446 	uint8_t useProtection:1;
447 	uint8_t nonErpPresent:1;
448 #else
449 	uint8_t nonErpPresent:1;
450 	uint8_t useProtection:1;
451 	uint8_t barkerPreambleMode:1;
452 	uint8_t reserved:5;
453 #endif
454 } qdf_packed tSirMacErpInfo, *tpSirMacErpInfo;
455 
456 /* / Capability information field */
457 typedef struct sSirMacCapabilityInfo {
458 #ifndef ANI_LITTLE_BIT_ENDIAN
459 	uint16_t immediateBA:1;
460 	uint16_t delayedBA:1;
461 	uint16_t dsssOfdm:1;
462 	uint16_t rrm:1;
463 	uint16_t apsd:1;
464 	uint16_t shortSlotTime:1;
465 	uint16_t qos:1;
466 	uint16_t spectrumMgt:1;
467 	uint16_t channelAgility:1;
468 	uint16_t criticalUpdateFlag:1;
469 	uint16_t shortPreamble:1;
470 	uint16_t privacy:1;
471 	uint16_t cfPollReq:1;
472 	uint16_t cfPollable:1;
473 	uint16_t ibss:1;
474 	uint16_t ess:1;
475 #else
476 	uint16_t ess:1;
477 	uint16_t ibss:1;
478 	uint16_t cfPollable:1;
479 	uint16_t cfPollReq:1;
480 	uint16_t privacy:1;
481 	uint16_t shortPreamble:1;
482 	uint16_t criticalUpdateFlag:1;
483 	uint16_t channelAgility:1;
484 	uint16_t spectrumMgt:1;
485 	uint16_t qos:1;
486 	uint16_t shortSlotTime:1;
487 	uint16_t apsd:1;
488 	uint16_t rrm:1;
489 	uint16_t dsssOfdm:1;
490 	uint16_t delayedBA:1;
491 	uint16_t immediateBA:1;
492 #endif
493 } qdf_packed tSirMacCapabilityInfo, *tpSirMacCapabilityInfo;
494 
495 typedef struct sSirMacCfParamSet {
496 	uint8_t cfpCount;
497 	uint8_t cfpPeriod;
498 	uint16_t cfpMaxDuration;
499 	uint16_t cfpDurRemaining;
500 } qdf_packed tSirMacCfParamSet;
501 
502 typedef struct sSirMacTim {
503 	uint8_t dtimCount;
504 	uint8_t dtimPeriod;
505 	uint8_t bitmapControl;
506 	uint8_t bitmapLength;
507 	uint8_t bitmap[251];
508 } qdf_packed tSirMacTim;
509 
510 /* 12 Bytes long because this structure can be used to represent rate */
511 /* and extended rate set IEs */
512 /* The parser assume this to be at least 12 */
513 typedef struct sSirMacRateSet {
514 	uint8_t numRates;
515 	uint8_t rate[SIR_MAC_MAX_NUMBER_OF_RATES];
516 } qdf_packed tSirMacRateSet;
517 
518 /** struct merged_mac_rate_set - merged mac rate set
519  * @num_rates: num of rates
520  * @rate: rate list
521  */
522 struct merged_mac_rate_set {
523 	uint8_t num_rates;
524 	uint8_t rate[2 * WLAN_SUPPORTED_RATES_IE_MAX_LEN];
525 };
526 
527 /* Reserve 1 byte for NULL character in the SSID name field to print in %s */
528 typedef struct sSirMacSSid {
529 	uint8_t length;
530 	uint8_t ssId[WLAN_SSID_MAX_LEN +1];
531 } qdf_packed tSirMacSSid;
532 
533 typedef struct sSirMacWpaInfo {
534 	uint8_t length;
535 	uint8_t info[WLAN_MAX_IE_LEN];
536 } qdf_packed tSirMacWpaInfo, *tpSirMacWpaInfo,
537 tSirMacRsnInfo, *tpSirMacRsnInfo;
538 
539 typedef struct sSirMacWapiInfo {
540 	uint8_t length;
541 	uint8_t info[WLAN_MAX_IE_LEN];
542 } qdf_packed tSirMacWapiInfo, *tpSirMacWapiInfo;
543 
544 typedef struct sSirMacFHParamSet {
545 	uint16_t dwellTime;
546 	uint8_t hopSet;
547 	uint8_t hopPattern;
548 	uint8_t hopIndex;
549 } tSirMacFHParamSet, *tpSirMacFHParamSet;
550 
551 typedef struct sSirMacIBSSParams {
552 	uint16_t atim;
553 } tSirMacIBSSParams, *tpSirMacIBSSParams;
554 
555 typedef struct sSirMacRRMEnabledCap {
556 #ifndef ANI_LITTLE_BIT_ENDIAN
557 	uint8_t reserved:6;
558 	uint8_t AntennaInformation:1;
559 	uint8_t BSSAvailAdmission:1;
560 	uint8_t BssAvgAccessDelay:1;
561 	uint8_t RSNIMeasurement:1;
562 	uint8_t RCPIMeasurement:1;
563 	uint8_t NeighborTSFOffset:1;
564 	uint8_t MeasurementPilotEnabled:1;
565 	uint8_t MeasurementPilot:3;
566 	uint8_t nonOperatinChanMax:3;
567 	uint8_t operatingChanMax:3;
568 	uint8_t RRMMIBEnabled:1;
569 	uint8_t APChanReport:1;
570 	uint8_t triggeredTCM:1;
571 	uint8_t TCMCapability:1;
572 	uint8_t LCIAzimuth:1;
573 	uint8_t LCIMeasurement:1;
574 	uint8_t statistics:1;
575 	uint8_t NoiseHistogram:1;
576 	uint8_t ChannelLoad:1;
577 	uint8_t FrameMeasurement:1;
578 	uint8_t BeaconRepCond:1;
579 	uint8_t BeaconTable:1;
580 	uint8_t BeaconActive:1;
581 	uint8_t BeaconPassive:1;
582 	uint8_t repeated:1;
583 	uint8_t parallel:1;
584 	uint8_t NeighborRpt:1;
585 	uint8_t LinkMeasurement:1;
586 	uint8_t present;
587 #else
588 	uint8_t present;
589 	uint8_t LinkMeasurement:1;
590 	uint8_t NeighborRpt:1;
591 	uint8_t parallel:1;
592 	uint8_t repeated:1;
593 	uint8_t BeaconPassive:1;
594 	uint8_t BeaconActive:1;
595 	uint8_t BeaconTable:1;
596 	uint8_t BeaconRepCond:1;
597 	uint8_t FrameMeasurement:1;
598 	uint8_t ChannelLoad:1;
599 	uint8_t NoiseHistogram:1;
600 	uint8_t statistics:1;
601 	uint8_t LCIMeasurement:1;
602 	uint8_t LCIAzimuth:1;
603 	uint8_t TCMCapability:1;
604 	uint8_t triggeredTCM:1;
605 	uint8_t APChanReport:1;
606 	uint8_t RRMMIBEnabled:1;
607 	uint8_t operatingChanMax:3;
608 	uint8_t nonOperatinChanMax:3;
609 	uint8_t MeasurementPilot:3;
610 	uint8_t MeasurementPilotEnabled:1;
611 	uint8_t NeighborTSFOffset:1;
612 	uint8_t RCPIMeasurement:1;
613 	uint8_t RSNIMeasurement:1;
614 	uint8_t BssAvgAccessDelay:1;
615 	uint8_t BSSAvailAdmission:1;
616 	uint8_t AntennaInformation:1;
617 	uint8_t reserved:6;
618 #endif
619 } tSirMacRRMEnabledCap, *tpSirMacRRMEnabledCap;
620 
621 #define MU_EDCA_DEF_AIFSN     0
622 #define MU_EDCA_DEF_CW_MAX    15
623 #define MU_EDCA_DEF_CW_MIN    15
624 #define MU_EDCA_DEF_TIMER     255
625 /* access category record */
626 typedef struct sSirMacAciAifsn {
627 #ifndef ANI_LITTLE_BIT_ENDIAN
628 	uint8_t rsvd:1;
629 	uint8_t aci:2;
630 	uint8_t acm:1;
631 	uint8_t aifsn:4;
632 #else
633 	uint8_t aifsn:4;
634 	uint8_t acm:1;
635 	uint8_t aci:2;
636 	uint8_t rsvd:1;
637 #endif
638 } qdf_packed tSirMacAciAifsn;
639 
640 /* contention window size */
641 typedef struct sSirMacCW {
642 #ifndef ANI_LITTLE_BIT_ENDIAN
643 	uint8_t max:4;
644 	uint8_t min:4;
645 #else
646 	uint8_t min:4;
647 	uint8_t max:4;
648 #endif
649 } qdf_packed tSirMacCW;
650 
651 typedef struct sSirMacEdcaParamRecord {
652 	tSirMacAciAifsn aci;
653 	tSirMacCW cw;
654 	union {
655 		uint16_t txoplimit;
656 		uint16_t mu_edca_timer;
657 	};
658 	uint8_t no_ack;
659 } qdf_packed tSirMacEdcaParamRecord;
660 
661 typedef struct sSirMacQosInfo {
662 #ifndef ANI_LITTLE_BIT_ENDIAN
663 	uint8_t uapsd:1;
664 	uint8_t txopreq:1;
665 	uint8_t qreq:1;
666 	uint8_t qack:1;
667 	uint8_t count:4;
668 #else
669 	uint8_t count:4;
670 	uint8_t qack:1;
671 	uint8_t qreq:1;
672 	uint8_t txopreq:1;
673 	uint8_t uapsd:1;
674 #endif
675 } qdf_packed tSirMacQosInfo;
676 
677 typedef struct sSirMacQosInfoStation {
678 #ifdef ANI_LITTLE_BIT_ENDIAN
679 	uint8_t acvo_uapsd:1;
680 	uint8_t acvi_uapsd:1;
681 	uint8_t acbk_uapsd:1;
682 	uint8_t acbe_uapsd:1;
683 	uint8_t qack:1;
684 	uint8_t maxSpLen:2;
685 	uint8_t moreDataAck:1;
686 #else
687 	uint8_t moreDataAck:1;
688 	uint8_t maxSpLen:2;
689 	uint8_t qack:1;
690 	uint8_t acbe_uapsd:1;
691 	uint8_t acbk_uapsd:1;
692 	uint8_t acvi_uapsd:1;
693 	uint8_t acvo_uapsd:1;
694 #endif
695 } qdf_packed tSirMacQosInfoStation, *tpSirMacQosInfoStation;
696 
697 typedef struct sSirMacEdcaParamSetIE {
698 	uint8_t type;
699 	uint8_t length;
700 	tSirMacQosInfo qosInfo;
701 	uint8_t rsvd;
702 	tSirMacEdcaParamRecord acbe;    /* best effort */
703 	tSirMacEdcaParamRecord acbk;    /* background */
704 	tSirMacEdcaParamRecord acvi;    /* video */
705 	tSirMacEdcaParamRecord acvo;    /* voice */
706 } qdf_packed tSirMacEdcaParamSetIE;
707 
708 /* ts info direction field can take any of these values */
709 #define SIR_MAC_DIRECTION_UPLINK    0
710 #define SIR_MAC_DIRECTION_DNLINK    1
711 #define SIR_MAC_DIRECTION_DIRECT    2
712 #define SIR_MAC_DIRECTION_BIDIR     3
713 
714 /* access policy */
715 /* reserved                         0 */
716 #define SIR_MAC_ACCESSPOLICY_EDCA   1
717 #define SIR_MAC_ACCESSPOLICY_HCCA   2
718 #define SIR_MAC_ACCESSPOLICY_BOTH   3
719 
720 /* frame classifier types */
721 #define SIR_MAC_TCLASTYPE_ETHERNET 0
722 #define SIR_MAC_TCLASTYPE_TCPUDPIP 1
723 #define SIR_MAC_TCLASTYPE_8021DQ   2
724 /* reserved                        3-255 */
725 
726 typedef struct sSirMacTclasParamEthernet {
727 	tSirMacAddr srcAddr;
728 	tSirMacAddr dstAddr;
729 	uint16_t type;
730 } qdf_packed tSirMacTclasParamEthernet;
731 
732 typedef struct sSirMacTclasParamIPv4 {
733 	uint8_t version;
734 	uint8_t srcIpAddr[4];
735 	uint8_t dstIpAddr[4];
736 	uint16_t srcPort;
737 	uint16_t dstPort;
738 	uint8_t dscp;
739 	uint8_t protocol;
740 	uint8_t rsvd;
741 } qdf_packed tSirMacTclasParamIPv4;
742 
743 #define SIR_MAC_TCLAS_IPV4  4
744 
745 typedef struct sSirMacTclasParamIPv6 {
746 	uint8_t version;
747 	uint8_t srcIpAddr[16];
748 	uint8_t dstIpAddr[16];
749 	uint16_t srcPort;
750 	uint16_t dstPort;
751 	uint8_t flowLabel[3];
752 } qdf_packed tSirMacTclasParamIPv6;
753 
754 typedef struct sSirMacTclasParam8021dq {
755 	uint16_t tag;
756 } qdf_packed tSirMacTclasParam8021dq;
757 
758 typedef struct sSirMacTclasIE {
759 	uint8_t type;
760 	uint8_t length;
761 	uint8_t userPrio;
762 	uint8_t classifierType;
763 	uint8_t classifierMask;
764 } qdf_packed tSirMacTclasIE;
765 
766 typedef struct sSirMacTsDelayIE {
767 	uint8_t type;
768 	uint8_t length;
769 	uint32_t delay;
770 } qdf_packed tSirMacTsDelayIE;
771 
772 typedef struct sSirMacScheduleInfo {
773 #ifndef ANI_LITTLE_BIT_ENDIAN
774 	uint16_t rsvd:9;
775 	uint16_t direction:2;
776 	uint16_t tsid:4;
777 	uint16_t aggregation:1;
778 #else
779 	uint16_t aggregation:1;
780 	uint16_t tsid:4;
781 	uint16_t direction:2;
782 	uint16_t rsvd:9;
783 #endif
784 } qdf_packed tSirMacScheduleInfo;
785 
786 typedef struct sSirMacScheduleIE {
787 	uint8_t type;
788 	uint8_t length;
789 	tSirMacScheduleInfo info;
790 	uint32_t svcStartTime;
791 	uint32_t svcInterval;
792 	uint16_t maxSvcDuration;
793 	uint16_t specInterval;
794 } qdf_packed tSirMacScheduleIE;
795 
796 typedef struct sSirMacQosCapabilityIE {
797 	uint8_t type;
798 	uint8_t length;
799 	tSirMacQosInfo qosInfo;
800 } qdf_packed tSirMacQosCapabilityIE;
801 
802 typedef struct sSirMacQosCapabilityStaIE {
803 	uint8_t type;
804 	uint8_t length;
805 	tSirMacQosInfoStation qosInfo;
806 } qdf_packed tSirMacQosCapabilityStaIE;
807 
808 typedef uint32_t tSirMacTimeStamp[2];
809 
810 typedef uint16_t tSirMacBeaconInterval;
811 
812 typedef uint16_t tSirMacListenInterval;
813 
814 typedef uint8_t tSirMacChanNum;
815 
816 /* IE definitions */
817 typedef struct sSirMacSSidIE {
818 	uint8_t type;
819 	tSirMacSSid ssId;
820 } qdf_packed tSirMacSSidIE;
821 
822 typedef struct sSirMacRateSetIE {
823 	uint8_t type;
824 	tSirMacRateSet supportedRateSet;
825 } qdf_packed tSirMacRateSetIE;
826 
827 typedef struct sSirMacDsParamSetIE {
828 	uint8_t type;
829 	uint8_t length;
830 	tSirMacChanNum channelNumber;
831 } qdf_packed tSirMacDsParamSetIE;
832 
833 typedef struct sSirMacCfParamSetIE {
834 	uint8_t type;
835 	uint8_t length;
836 	tSirMacCfParamSet cfParams;
837 } qdf_packed tSirMacCfParamSetIE;
838 
839 typedef struct sSirMacNonErpPresentIE {
840 	uint8_t type;
841 	uint8_t length;
842 	uint8_t erp;
843 } qdf_packed tSirMacNonErpPresentIE;
844 
845 typedef struct sSirMacPowerCapabilityIE {
846 	uint8_t type;
847 	uint8_t length;
848 	uint8_t minTxPower;
849 	uint8_t maxTxPower;
850 } tSirMacPowerCapabilityIE;
851 
852 typedef struct sSirMacSupportedChannelIE {
853 	uint8_t type;
854 	uint8_t length;
855 	uint8_t supportedChannels[96];
856 } tSirMacSupportedChannelIE;
857 
858 typedef struct sSirMacMeasReqField {
859 	uint8_t channelNumber;
860 	uint8_t measStartTime[8];
861 	uint16_t measDuration;
862 } tSirMacMeasReqField, *tpSirMacMeasReqField;
863 
864 typedef struct sSirMacMeasReqIE {
865 	uint8_t type;
866 	uint8_t length;
867 	uint8_t measToken;
868 	uint8_t measReqMode;
869 	uint8_t measType;
870 	tSirMacMeasReqField measReqField;
871 } tSirMacMeasReqIE, *tpSirMacMeasReqIE;
872 
873 /* VHT Capabilities Info */
874 typedef struct sSirMacVHTCapabilityInfo {
875 #ifndef ANI_LITTLE_BIT_ENDIAN
876 	uint32_t extended_nss_bw_supp:2;
877 	uint32_t txAntPattern:1;
878 	uint32_t rxAntPattern:1;
879 	uint32_t vhtLinkAdaptCap:2;
880 	uint32_t maxAMPDULenExp:3;
881 	uint32_t htcVHTCap:1;
882 	uint32_t vhtTXOPPS:1;
883 	uint32_t muBeamformeeCap:1;
884 	uint32_t muBeamformerCap:1;
885 	uint32_t numSoundingDim:3;
886 	uint32_t csnofBeamformerAntSup:3;
887 	uint32_t suBeamformeeCap:1;
888 	uint32_t suBeamFormerCap:1;
889 	uint32_t rxSTBC:3;
890 	uint32_t txSTBC:1;
891 	uint32_t shortGI160and80plus80MHz:1;
892 	uint32_t shortGI80MHz:1;
893 	uint32_t ldpcCodingCap:1;
894 	uint32_t supportedChannelWidthSet:2;
895 	uint32_t maxMPDULen:2;
896 #else
897 	uint32_t maxMPDULen:2;
898 	uint32_t supportedChannelWidthSet:2;
899 	uint32_t ldpcCodingCap:1;
900 	uint32_t shortGI80MHz:1;
901 	uint32_t shortGI160and80plus80MHz:1;
902 	uint32_t txSTBC:1;
903 	uint32_t rxSTBC:3;
904 	uint32_t suBeamFormerCap:1;
905 	uint32_t suBeamformeeCap:1;
906 	uint32_t csnofBeamformerAntSup:3;
907 	uint32_t numSoundingDim:3;
908 	uint32_t muBeamformerCap:1;
909 	uint32_t muBeamformeeCap:1;
910 	uint32_t vhtTXOPPS:1;
911 	uint32_t htcVHTCap:1;
912 	uint32_t maxAMPDULenExp:3;
913 	uint32_t vhtLinkAdaptCap:2;
914 	uint32_t rxAntPattern:1;
915 	uint32_t txAntPattern:1;
916 	uint32_t extended_nss_bw_supp:2;
917 #endif
918 } qdf_packed tSirMacVHTCapabilityInfo;
919 
920 typedef struct sSirMacVHTTxSupDataRateInfo {
921 #ifndef ANI_LITTLE_BIT_ENDIAN
922 	uint16_t reserved:2;
923 	uint16_t vht_extended_nss_bw_cap:1;
924 	uint16_t txSupDataRate:13;
925 #else
926 	uint16_t txSupDataRate:13;
927 	uint16_t vht_extended_nss_bw_cap:1;
928 	uint16_t reserved:2;
929 #endif
930 } qdf_packed tSirMacVHTTxSupDataRateInfo;
931 
932 typedef struct sSirMacVHTRxSupDataRateInfo {
933 #ifndef ANI_LITTLE_BIT_ENDIAN
934 	uint16_t max_nsts_total:3;
935 	uint16_t rxSupDataRate:13;
936 #else
937 	uint16_t rxSupDataRate:13;
938 	uint16_t max_nsts_total:3;
939 #endif
940 } qdf_packed tSirMacVHTRxSupDataRateInfo;
941 
942 /**
943  * struct sSirVhtMcsInfo - VHT MCS information
944  * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams
945  * @rx_highest: Indicates highest long GI VHT PPDU data rate
946  *      STA can receive. Rate expressed in units of 1 Mbps.
947  *      If this field is 0 this value should not be used to
948  *      consider the highest RX data rate supported.
949  * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
950  * @tx_highest: Indicates highest long GI VHT PPDU data rate
951  *      STA can transmit. Rate expressed in units of 1 Mbps.
952  *      If this field is 0 this value should not be used to
953  *      consider the highest TX data rate supported.
954  */
955 typedef struct sSirVhtMcsInfo {
956 	uint16_t rxMcsMap;
957 	uint16_t rxHighest;
958 	uint16_t txMcsMap;
959 	uint16_t txHighest;
960 } tSirVhtMcsInfo;
961 
962 /**
963  * struct sSirVHtCap - VHT capabilities
964  *
965  * This structure is the "VHT capabilities element" as
966  * described in 802.11ac D3.0 8.4.2.160
967  * @vht_cap_info: VHT capability info
968  * @supp_mcs: VHT MCS supported rates
969  */
970 typedef struct sSirVHtCap {
971 	uint32_t vhtCapInfo;
972 	tSirVhtMcsInfo suppMcs;
973 } tSirVHTCap;
974 
975 /* */
976 /* Determines the current operating mode of the 802.11n STA */
977 /* */
978 
979 typedef enum eSirMacHTOperatingMode {
980 	eSIR_HT_OP_MODE_PURE,   /* No Protection */
981 	eSIR_HT_OP_MODE_OVERLAP_LEGACY, /* Overlap Legacy device present, protection is optional */
982 	eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT,     /* No legacy device, but 20 MHz HT present */
983 	eSIR_HT_OP_MODE_MIXED   /* Protetion is required */
984 } tSirMacHTOperatingMode;
985 
986 /* Spatial Multiplexing(SM) Power Save mode */
987 typedef enum eSirMacHTMIMOPowerSaveState {
988 	eSIR_HT_MIMO_PS_STATIC = 0,     /* Static SM Power Save mode */
989 	eSIR_HT_MIMO_PS_DYNAMIC = 1,    /* Dynamic SM Power Save mode */
990 	eSIR_HT_MIMO_PS_NA = 2, /* reserved */
991 	eSIR_HT_MIMO_PS_NO_LIMIT = 3    /* SM Power Save disabled */
992 } tSirMacHTMIMOPowerSaveState;
993 
994 typedef enum eSirMacHTChannelWidth {
995 	eHT_CHANNEL_WIDTH_20MHZ = 0,
996 	eHT_CHANNEL_WIDTH_40MHZ = 1,
997 	eHT_CHANNEL_WIDTH_80MHZ = 2,
998 	eHT_CHANNEL_WIDTH_160MHZ = 3,
999 	eHT_CHANNEL_WIDTH_80P80MHZ = 4,
1000 	eHT_CHANNEL_WIDTH_320MHZ = 5,
1001 	eHT_MAX_CHANNEL_WIDTH
1002 } tSirMacHTChannelWidth;
1003 
1004 typedef enum eSirMacHTChannelType {
1005 	eHT_CHAN_NO_HT = 0,
1006 	eHT_CHAN_HT20 = 1,
1007 	eHT_CHAN_HT40MINUS = 2,
1008 	eHT_CHAN_HT40PLUS = 3
1009 } tSirMacHTChannelType;
1010 
1011 /* Packet struct for HT capability */
1012 typedef struct sHtCaps {
1013 	uint16_t advCodingCap:1;
1014 	uint16_t supportedChannelWidthSet:1;
1015 	uint16_t mimoPowerSave:2;
1016 	uint16_t greenField:1;
1017 	uint16_t shortGI20MHz:1;
1018 	uint16_t shortGI40MHz:1;
1019 	uint16_t txSTBC:1;
1020 	uint16_t rxSTBC:2;
1021 	uint16_t delayedBA:1;
1022 	uint16_t maximalAMSDUsize:1;
1023 	uint16_t dsssCckMode40MHz:1;
1024 	uint16_t psmp:1;
1025 	uint16_t stbcControlFrame:1;
1026 	uint16_t lsigTXOPProtection:1;
1027 	uint8_t maxRxAMPDUFactor:2;
1028 	uint8_t mpduDensity:3;
1029 	uint8_t reserved1:3;
1030 	uint8_t supportedMCSSet[16];
1031 	uint16_t pco:1;
1032 	uint16_t transitionTime:2;
1033 	uint16_t reserved2:5;
1034 	uint16_t mcsFeedback:2;
1035 	uint16_t reserved3:6;
1036 	uint32_t txBF:1;
1037 	uint32_t rxStaggeredSounding:1;
1038 	uint32_t txStaggeredSounding:1;
1039 	uint32_t rxZLF:1;
1040 	uint32_t txZLF:1;
1041 	uint32_t implicitTxBF:1;
1042 	uint32_t calibration:2;
1043 	uint32_t explicitCSITxBF:1;
1044 	uint32_t explicitUncompressedSteeringMatrix:1;
1045 	uint32_t explicitBFCSIFeedback:3;
1046 	uint32_t explicitUncompressedSteeringMatrixFeedback:3;
1047 	uint32_t explicitCompressedSteeringMatrixFeedback:3;
1048 	uint32_t csiNumBFAntennae:2;
1049 	uint32_t uncompressedSteeringMatrixBFAntennae:2;
1050 	uint32_t compressedSteeringMatrixBFAntennae:2;
1051 	uint32_t reserved4:7;
1052 	uint8_t antennaSelection:1;
1053 	uint8_t explicitCSIFeedbackTx:1;
1054 	uint8_t antennaIndicesFeedbackTx:1;
1055 	uint8_t explicitCSIFeedback:1;
1056 	uint8_t antennaIndicesFeedback:1;
1057 	uint8_t rxAS:1;
1058 	uint8_t txSoundingPPDUs:1;
1059 	uint8_t reserved5:1;
1060 
1061 } qdf_packed tHtCaps;
1062 
1063 /* Supported MCS set */
1064 #define SIZE_OF_SUPPORTED_MCS_SET                          16
1065 #define SIZE_OF_BASIC_MCS_SET                              16
1066 #define VALID_MCS_SIZE                                     77   /* 0-76 */
1067 #define MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET          10
1068 #define VALID_MAX_MCS_INDEX                                8
1069 
1070 /* */
1071 /* The following enums will be used to get the "current" HT Capabilities of */
1072 /* the local STA in a generic fashion. In other words, the following enums */
1073 /* identify the HT capabilities that can be queried or set. */
1074 /* */
1075 typedef enum eHTCapability {
1076 	eHT_LSIG_TXOP_PROTECTION,
1077 	eHT_STBC_CONTROL_FRAME,
1078 	eHT_PSMP,
1079 	eHT_DSSS_CCK_MODE_40MHZ,
1080 	eHT_MAX_AMSDU_LENGTH,
1081 	eHT_MAX_AMSDU_NUM,
1082 	eHT_RX_STBC,
1083 	eHT_TX_STBC,
1084 	eHT_SHORT_GI_40MHZ,
1085 	eHT_SHORT_GI_20MHZ,
1086 	eHT_GREENFIELD,
1087 	eHT_MIMO_POWER_SAVE,
1088 	eHT_SUPPORTED_CHANNEL_WIDTH_SET,
1089 	eHT_ADVANCED_CODING,
1090 	eHT_MAX_RX_AMPDU_FACTOR,
1091 	eHT_MPDU_DENSITY,
1092 	eHT_PCO,
1093 	eHT_TRANSITION_TIME,
1094 	eHT_MCS_FEEDBACK,
1095 	eHT_TX_BEAMFORMING,
1096 	eHT_ANTENNA_SELECTION,
1097 	/* The following come under Additional HT Capabilities */
1098 	eHT_SI_GRANULARITY,
1099 	eHT_CONTROLLED_ACCESS,
1100 	eHT_RIFS_MODE,
1101 	eHT_RECOMMENDED_TX_WIDTH_SET,
1102 	eHT_EXTENSION_CHANNEL_OFFSET,
1103 	eHT_OP_MODE,
1104 	eHT_BASIC_STBC_MCS,
1105 	eHT_DUAL_CTS_PROTECTION,
1106 	eHT_LSIG_TXOP_PROTECTION_FULL_SUPPORT,
1107 	eHT_PCO_ACTIVE,
1108 	eHT_PCO_PHASE
1109 } tHTCapability;
1110 
1111 /* HT Parameters Info */
1112 typedef struct sSirMacHTParametersInfo {
1113 #ifndef ANI_LITTLE_BIT_ENDIAN
1114 	uint8_t reserved:3;
1115 	uint8_t mpduDensity:3;  /* Dynamic state */
1116 	uint8_t maxRxAMPDUFactor:2;     /* Dynamic state */
1117 #else
1118 	uint8_t maxRxAMPDUFactor:2;
1119 	uint8_t mpduDensity:3;
1120 	uint8_t reserved:3;
1121 #endif
1122 } qdf_packed tSirMacHTParametersInfo;
1123 
1124 /* Extended HT Capabilities Info */
1125 typedef struct sSirMacExtendedHTCapabilityInfo {
1126 #ifndef ANI_LITTLE_BIT_ENDIAN
1127 	uint16_t reserved2:6;
1128 	uint16_t mcsFeedback:2; /* Static via CFG */
1129 	uint16_t reserved1:5;
1130 	uint16_t transitionTime:2;      /* Static via CFG */
1131 	uint16_t pco:1;         /* Static via CFG */
1132 #else
1133 	uint16_t pco:1;
1134 	uint16_t transitionTime:2;
1135 	uint16_t reserved1:5;
1136 	uint16_t mcsFeedback:2;
1137 	uint16_t reserved2:6;
1138 #endif
1139 } qdf_packed tSirMacExtendedHTCapabilityInfo;
1140 
1141 /* IEEE 802.11n/D7.0 - 7.3.2.57.4 */
1142 /* Part of the "supported MCS set field" */
1143 typedef struct sSirMacRxHighestSupportRate {
1144 #ifndef ANI_LITTLE_BIT_ENDIAN
1145 	uint16_t reserved:6;
1146 	uint16_t rate:10;
1147 #else
1148 	uint16_t rate:10;
1149 	uint16_t reserved:6;
1150 #endif
1151 } qdf_packed tSirMacRxHighestSupportRate, *tpSirMacRxHighestSupportRate;
1152 
1153 /* Transmit Beam Forming Capabilities Info */
1154 typedef struct sSirMacTxBFCapabilityInfo {
1155 #ifndef ANI_LITTLE_BIT_ENDIAN
1156 	uint32_t reserved:7;
1157 	uint32_t compressedSteeringMatrixBFAntennae:2;  /* Static via CFG */
1158 	/* Static via CFG */
1159 	uint32_t uncompressedSteeringMatrixBFAntennae:2;
1160 	uint32_t csiNumBFAntennae:2;    /* Static via CFG */
1161 	/* Static via CFG */
1162 	uint32_t explicitCompressedSteeringMatrixFeedback:3;
1163 	/* Static via CFG */
1164 	uint32_t explicitUncompressedSteeringMatrixFeedback:3;
1165 	uint32_t explicitBFCSIFeedback:3;       /* Static via CFG */
1166 	uint32_t explicitUncompressedSteeringMatrix:1;  /* Static via CFG */
1167 	uint32_t explicitCSITxBF:1;     /* Static via CFG */
1168 	uint32_t calibration:2; /* Static via CFG */
1169 	uint32_t implicitTxBF:1;        /* Static via CFG */
1170 	uint32_t txZLF:1;       /* Static via CFG */
1171 	uint32_t rxZLF:1;       /* Static via CFG */
1172 	uint32_t txStaggeredSounding:1; /* Static via CFG */
1173 	uint32_t rxStaggeredSounding:1; /* Static via CFG */
1174 	uint32_t txBF:1;        /* Static via CFG */
1175 #else
1176 	uint32_t txBF:1;
1177 	uint32_t rxStaggeredSounding:1;
1178 	uint32_t txStaggeredSounding:1;
1179 	uint32_t rxZLF:1;
1180 	uint32_t txZLF:1;
1181 	uint32_t implicitTxBF:1;
1182 	uint32_t calibration:2;
1183 	uint32_t explicitCSITxBF:1;
1184 	uint32_t explicitUncompressedSteeringMatrix:1;
1185 	uint32_t explicitBFCSIFeedback:3;
1186 	uint32_t explicitUncompressedSteeringMatrixFeedback:3;
1187 	uint32_t explicitCompressedSteeringMatrixFeedback:3;
1188 	uint32_t csiNumBFAntennae:2;
1189 	uint32_t uncompressedSteeringMatrixBFAntennae:2;
1190 	uint32_t compressedSteeringMatrixBFAntennae:2;
1191 	uint32_t reserved:7;
1192 #endif
1193 } qdf_packed tSirMacTxBFCapabilityInfo;
1194 
1195 /* Antenna Selection Capability Info */
1196 typedef struct sSirMacASCapabilityInfo {
1197 #ifndef ANI_LITTLE_BIT_ENDIAN
1198 	uint8_t reserved2:1;
1199 	uint8_t txSoundingPPDUs:1;      /* Static via CFG */
1200 	uint8_t rxAS:1;         /* Static via CFG */
1201 	uint8_t antennaIndicesFeedback:1;       /* Static via CFG */
1202 	uint8_t explicitCSIFeedback:1;  /* Static via CFG */
1203 	uint8_t antennaIndicesFeedbackTx:1;     /* Static via CFG */
1204 	uint8_t explicitCSIFeedbackTx:1;        /* Static via CFG */
1205 	uint8_t antennaSelection:1;     /* Static via CFG */
1206 #else
1207 	uint8_t antennaSelection:1;
1208 	uint8_t explicitCSIFeedbackTx:1;
1209 	uint8_t antennaIndicesFeedbackTx:1;
1210 	uint8_t explicitCSIFeedback:1;
1211 	uint8_t antennaIndicesFeedback:1;
1212 	uint8_t rxAS:1;
1213 	uint8_t txSoundingPPDUs:1;
1214 	uint8_t reserved2:1;
1215 #endif
1216 } qdf_packed tSirMacASCapabilityInfo;
1217 
1218 typedef struct sSirMacAuthFrameBody {
1219 	uint16_t authAlgoNumber;
1220 	uint16_t authTransactionSeqNumber;
1221 	uint16_t authStatusCode;
1222 	uint8_t type;           /* = WLAN_ELEMID_CHALLENGE */
1223 	uint8_t length;         /* = SIR_MAC_AUTH_CHALLENGE_LENGTH */
1224 	uint8_t challengeText[SIR_MAC_AUTH_CHALLENGE_LENGTH];
1225 #ifdef WLAN_FEATURE_FILS_SK
1226 	tSirMacRsnInfo rsn_ie;
1227 	struct mac_ft_ie ft_ie;
1228 	uint8_t assoc_delay_info;
1229 	uint8_t session[SIR_FILS_SESSION_LENGTH];
1230 	uint8_t wrapped_data_len;
1231 	uint8_t wrapped_data[SIR_FILS_WRAPPED_DATA_MAX_SIZE];
1232 	uint8_t nonce[SIR_FILS_NONCE_LENGTH];
1233 #endif
1234 	bool is_mlo_ie_present;
1235 	struct qdf_mac_addr peer_mld;
1236 } qdf_packed tSirMacAuthFrameBody, *tpSirMacAuthFrameBody;
1237 
1238 /* / Common header for all action frames */
1239 typedef struct sSirMacActionFrameHdr {
1240 	uint8_t category;
1241 	uint8_t actionID;
1242 } qdf_packed tSirMacActionFrameHdr, *tpSirMacActionFrameHdr;
1243 
1244 typedef struct sSirMacVendorSpecificFrameHdr {
1245 	uint8_t category;
1246 	uint8_t Oui[4];
1247 } qdf_packed tSirMacVendorSpecificFrameHdr,
1248 *tpSirMacVendorSpecificFrameHdr;
1249 
1250 typedef struct sSirMacVendorSpecificPublicActionFrameHdr {
1251 	uint8_t category;
1252 	uint8_t actionID;
1253 	uint8_t Oui[4];
1254 	uint8_t OuiSubType;
1255 	uint8_t dialogToken;
1256 } qdf_packed tSirMacVendorSpecificPublicActionFrameHdr,
1257 *tpSirMacVendorSpecificPublicActionFrameHdr;
1258 
1259 typedef struct sSirMacMeasActionFrameHdr {
1260 	uint8_t category;
1261 	uint8_t actionID;
1262 	uint8_t dialogToken;
1263 } tSirMacMeasActionFrameHdr, *tpSirMacMeasActionFrameHdr;
1264 
1265 #ifdef ANI_SUPPORT_11H
1266 typedef struct sSirMacTpcReqActionFrame {
1267 	tSirMacMeasActionFrameHdr actionHeader;
1268 	uint8_t type;
1269 	uint8_t length;
1270 } tSirMacTpcReqActionFrame, *tpSirMacTpcReqActionFrame;
1271 typedef struct sSirMacMeasReqActionFrame {
1272 	tSirMacMeasActionFrameHdr actionHeader;
1273 	tSirMacMeasReqIE measReqIE;
1274 } tSirMacMeasReqActionFrame, *tpSirMacMeasReqActionFrame;
1275 #endif
1276 
1277 typedef struct sSirMacNeighborReportReq {
1278 	uint8_t dialogToken;
1279 	uint8_t ssid_present;
1280 	tSirMacSSid ssid;
1281 } tSirMacNeighborReportReq, *tpSirMacNeighborReportReq;
1282 
1283 typedef struct sSirMacLinkReport {
1284 	uint8_t dialogToken;
1285 	uint8_t txPower;
1286 	uint8_t rxAntenna;
1287 	uint8_t txAntenna;
1288 	uint8_t rcpi;
1289 	uint8_t rsni;
1290 } tSirMacLinkReport, *tpSirMacLinkReport;
1291 
1292 #define BEACON_REPORT_MAX_IES 215
1293 /* Max number of beacon reports per channel supported in the driver */
1294 #define MAX_BEACON_REPORTS 32
1295 /* Offset of IEs after Fixed Fields in Beacon Frame */
1296 #define BEACON_FRAME_IES_OFFSET 12
1297 
1298 /**
1299  * struct bcn_report_frame_body_frag_id - beacon report reported frame body
1300  *					  fragment ID sub element params
1301  * @id: report ID
1302  * @frag_id: fragment ID
1303  * @more_frags: more frags present or not present
1304  */
1305 struct bcn_report_frame_body_frag_id {
1306 	uint8_t id;
1307 	uint8_t frag_id;
1308 	bool more_frags;
1309 };
1310 
1311 /**
1312  * struct sSirMacBeaconReport - Beacon Report Structure
1313  * @regClass: Regulatory Class
1314  * @channel: Channel for which the current report is being sent
1315  * @measStartTime: RRM scan start time for this report
1316  * @measDuration: Scan duration for the current channel
1317  * @phyType: Condensed Phy Type
1318  * @bcnProbeRsp: Beacon or probe response being reported
1319  * @rsni: Received signal-to-noise indication
1320  * @rcpi: Received Channel Power indication
1321  * @bssid: BSSID of the AP requesting the beacon report
1322  * @antennaId: Number of Antennas used for measurement
1323  * @parentTSF: measuring STA's TSF timer value
1324  * @numIes: Number of IEs included in the beacon frames
1325  * @last_bcn_report_ind_support: Support for Last beacon report indication
1326  * @is_last_bcn_report: Is the current report last or more reports present
1327  * @frame_body_frag_id: Reported Frame Body Frag Id sub-element params
1328  * @Ies: IEs included in the beacon report
1329  */
1330 typedef struct sSirMacBeaconReport {
1331 	uint8_t regClass;
1332 	uint8_t channel;
1333 	uint8_t measStartTime[8];
1334 	uint8_t measDuration;
1335 	uint8_t phyType;
1336 	uint8_t bcnProbeRsp;
1337 	uint8_t rsni;
1338 	uint8_t rcpi;
1339 	tSirMacAddr bssid;
1340 	uint8_t antennaId;
1341 	uint32_t parentTSF;
1342 	uint8_t numIes;
1343 	uint8_t last_bcn_report_ind_support;
1344 	uint8_t is_last_bcn_report;
1345 	struct bcn_report_frame_body_frag_id frame_body_frag_id;
1346 	uint8_t Ies[BEACON_REPORT_MAX_IES];
1347 
1348 } tSirMacBeaconReport, *tpSirMacBeaconReport;
1349 
1350 /**
1351  * struct sir_mac_bw_ind_element - Contains info for Bandwidth Indication IE
1352  * present in channel load request received from AP
1353  * @is_wide_bw_chan_switch: to check Bandwidth Indication optional IE present
1354  * @channel_width: channel width
1355  * @center_chan_freq0: center freq segment 0 for 320 MHz request
1356  * @center_chan_freq1: center freq segment 1 for 320 MHz request
1357  */
1358 struct sir_mac_bw_ind_element {
1359 	bool is_bw_ind_element;
1360 	uint8_t channel_width;
1361 	uint8_t center_freq_seg0;
1362 	uint8_t center_freq_seg1;
1363 };
1364 
1365 /**
1366  * struct sir_mac_wide_bw_chan_switch - Contains info for Wide Bandwidth Channel
1367  * Switch IE present in channel load request received from AP
1368  * @is_wide_bw_chan_switch: to check Bandwidth Indication optional IE present
1369  * @channel_width: channel width
1370  * @center_chan_freq0: center freq segment 0 for till 160 MHz request
1371  * @center_chan_freq1: center freq segment 1 for till 160 MHz request
1372  */
1373 struct sir_mac_wide_bw_chan_switch {
1374 	uint8_t is_wide_bw_chan_switch;
1375 	uint8_t channel_width;
1376 	uint8_t center_chan_freq0;
1377 	uint8_t center_chan_freq1;
1378 };
1379 
1380 /**
1381  * struct chan_load_report - channel load Report Structure
1382  * @op_class: Regulatory Class
1383  * @channel: Channel for which the current report is being sent
1384  * @rrm_scan_tsf: RRM scan start time for this report
1385  * @meas_duration: Scan duration for the current channel
1386  * @chan_load: channel utilization measurement
1387  * @bw_ind: Contains info for Bandwidth Indication IE
1388  * @wide_bw: Contains info for Wide Bandwidth Channel IE
1389  */
1390 struct chan_load_report {
1391 	uint8_t op_class;
1392 	uint8_t channel;
1393 	qdf_time_t rrm_scan_tsf;
1394 	uint8_t meas_duration;
1395 	uint8_t chan_load;
1396 	struct sir_mac_bw_ind_element bw_ind;
1397 	struct sir_mac_wide_bw_chan_switch wide_bw;
1398 };
1399 
1400 /**
1401  * sta_statistics_group_id - RRM STA STATISTICS TYPE related Refer IEEE
1402  * P802.11-REVme/D2.1, January 2023, Table 9-144
1403  * @STA_STAT_GROUP_ID_COUNTER_STATS: group id for counter stats
1404  * @STA_STAT_GROUP_ID_MAC_STATS: group id for mac stats
1405  * @STA_STAT_GROUP_ID_QOS_STATS: group id for qos stats
1406  * @STA_STAT_GROUP_ID_DELAY_STATS: group id delay stats
1407  */
1408 enum sta_statistics_group_id {
1409 	STA_STAT_GROUP_ID_COUNTER_STATS = 0,
1410 	STA_STAT_GROUP_ID_MAC_STATS = 1,
1411 	STA_STAT_GROUP_ID_QOS_STATS = 2,
1412 	STA_STAT_GROUP_ID_DELAY_STATS = 10,
1413 };
1414 
1415 /**
1416  * counter_stats - structure to hold stats of group id 0
1417  * @transmitted_fragment_count: transmitted fragment count
1418  * @group_transmitted_frame_count: group transmitted frame count
1419  * @failed_count: failed count
1420  * @group_received_frame_count: group received frame count
1421  * @fcs_error_count: face error count
1422  * @transmitted_frame_count: transmitted frame count
1423  * @received_fragment_count: received fragment count
1424  */
1425 struct counter_stats {
1426 	uint32_t transmitted_fragment_count;
1427 	uint32_t group_transmitted_frame_count;
1428 	uint32_t failed_count;
1429 	uint32_t group_received_frame_count;
1430 	uint32_t fcs_error_count;
1431 	uint32_t transmitted_frame_count;
1432 	uint32_t received_fragment_count;
1433 };
1434 
1435 /**
1436  * mac_stats - struct to hold group id 1 stats
1437  * @retry_count: retry count
1438  * @multiple_retry_count: multiple retry count
1439  * @frame_duplicate_count: frame duplicate count
1440  * @rts_success_count: rts success count
1441  * @rts_failure_count: rts failure count
1442  * @ack_failure_count: ack failure count
1443  */
1444 struct mac_stats {
1445 	uint32_t retry_count;
1446 	uint32_t multiple_retry_count;
1447 	uint32_t frame_duplicate_count;
1448 	uint32_t rts_success_count;
1449 	uint32_t rts_failure_count;
1450 	uint32_t ack_failure_count;
1451 };
1452 
1453 /**
1454  * struct access_delay_stats - struct for group id 10 stats
1455  * @ap_average_access_delay: ap average access delay
1456  * @average_access_delay_besteffort: access delay best effort
1457  * @average_access_delay_background: average access delay background
1458  * @average_access_delay_video: average access delay video
1459  * @average_access_delay_voice: average access delay voice
1460  * station_count: station count
1461  * channel_utilization: channel utilization
1462  */
1463 struct access_delay_stats {
1464 	uint8_t ap_average_access_delay;
1465 	uint8_t average_access_delay_besteffort;
1466 	uint8_t average_access_delay_background;
1467 	uint8_t average_access_delay_video;
1468 	uint8_t average_access_delay_voice;
1469 	uint16_t station_count;
1470 	uint8_t channel_utilization;
1471 };
1472 
1473 /**
1474  * union stats_group_data - stats data for provided group id
1475  * @counter stats - stats for group id 0
1476  * @mac_stats - stats for group id 1
1477  */
1478 union stats_group_data {
1479 	struct counter_stats counter_stats;
1480 	struct mac_stats mac_stats;
1481 	struct access_delay_stats access_delay_stats;
1482 };
1483 
1484 /**
1485  * struct statistics_report - To store sta statistics report
1486  * @meas_duration: measurement duration
1487  * @group id: stats group id
1488  * @group stats: stats data
1489  */
1490 struct statistics_report {
1491 	uint8_t meas_duration;
1492 	uint8_t group_id;
1493 	union stats_group_data group_stats;
1494 };
1495 
1496 typedef struct sSirMacRadioMeasureReport {
1497 	uint8_t token;
1498 	uint8_t refused;
1499 	uint8_t incapable;
1500 	uint8_t type;
1501 	union {
1502 		tSirMacBeaconReport beaconReport;
1503 		struct chan_load_report channel_load_report;
1504 		struct statistics_report statistics_report;
1505 	} report;
1506 
1507 } tSirMacRadioMeasureReport, *tpSirMacRadioMeasureReport;
1508 
1509 #ifdef WLAN_FEATURE_11AX
1510 struct he_cap_network_endian {
1511 	uint32_t htc_he:1;
1512 	uint32_t twt_request:1;
1513 	uint32_t twt_responder:1;
1514 	uint32_t fragmentation:2;
1515 	uint32_t max_num_frag_msdu_amsdu_exp:3;
1516 	uint32_t min_frag_size:2;
1517 	uint32_t trigger_frm_mac_pad:2;
1518 	uint32_t multi_tid_aggr_rx_supp:3;
1519 	uint32_t he_link_adaptation:2;
1520 	uint32_t all_ack:1;
1521 	uint32_t trigd_rsp_sched:1;
1522 	uint32_t a_bsr:1;
1523 	uint32_t broadcast_twt:1;
1524 	uint32_t ba_32bit_bitmap:1;
1525 	uint32_t mu_cascade:1;
1526 	uint32_t ack_enabled_multitid:1;
1527 	uint32_t reserved:1;
1528 	uint32_t omi_a_ctrl:1;
1529 	uint32_t ofdma_ra:1;
1530 	uint32_t max_ampdu_len_exp_ext:2;
1531 	uint32_t amsdu_frag:1;
1532 	uint32_t flex_twt_sched:1;
1533 	uint32_t rx_ctrl_frame:1;
1534 
1535 	uint16_t bsrp_ampdu_aggr:1;
1536 	uint16_t qtp:1;
1537 	uint16_t a_bqr:1;
1538 	uint16_t spatial_reuse_param_rspder:1;
1539 	uint16_t ndp_feedback_supp:1;
1540 	uint16_t ops_supp:1;
1541 	uint16_t amsdu_in_ampdu:1;
1542 	uint16_t multi_tid_aggr_tx_supp:3;
1543 	uint16_t he_sub_ch_sel_tx_supp:1;
1544 	uint16_t ul_2x996_tone_ru_supp:1;
1545 	uint16_t om_ctrl_ul_mu_data_dis_rx:1;
1546 	uint16_t he_dynamic_smps:1;
1547 	uint16_t punctured_sounding_supp:1;
1548 	uint16_t ht_vht_trg_frm_rx_supp:1;
1549 
1550 	uint32_t reserved2:1;
1551 	uint32_t chan_width:7;
1552 	uint32_t rx_pream_puncturing:4;
1553 	uint32_t device_class:1;
1554 	uint32_t ldpc_coding:1;
1555 	uint32_t he_1x_ltf_800_gi_ppdu:1;
1556 	uint32_t midamble_tx_rx_max_nsts:2;
1557 	uint32_t he_4x_ltf_3200_gi_ndp:1;
1558 	uint32_t tb_ppdu_tx_stbc_lt_80mhz:1;
1559 	uint32_t rx_stbc_lt_80mhz:1;
1560 	uint32_t doppler:2;
1561 	uint32_t ul_mu:2;
1562 	uint32_t dcm_enc_tx:3;
1563 	uint32_t dcm_enc_rx:3;
1564 	uint32_t ul_he_mu:1;
1565 	uint32_t su_beamformer:1;
1566 
1567 	uint32_t su_beamformee:1;
1568 	uint32_t mu_beamformer:1;
1569 	uint32_t bfee_sts_lt_80:3;
1570 	uint32_t bfee_sts_gt_80:3;
1571 	uint32_t num_sounding_lt_80:3;
1572 	uint32_t num_sounding_gt_80:3;
1573 	uint32_t su_feedback_tone16:1;
1574 	uint32_t mu_feedback_tone16:1;
1575 	uint32_t codebook_su:1;
1576 	uint32_t codebook_mu:1;
1577 	uint32_t beamforming_feedback:3;
1578 	uint32_t he_er_su_ppdu:1;
1579 	uint32_t dl_mu_mimo_part_bw:1;
1580 	uint32_t ppet_present:1;
1581 	uint32_t srp:1;
1582 	uint32_t power_boost:1;
1583 	uint32_t he_ltf_800_gi_4x:1;
1584 	uint32_t max_nc:3;
1585 	uint32_t tb_ppdu_tx_stbc_gt_80mhz:1;
1586 	uint32_t rx_stbc_gt_80mhz:1;
1587 
1588 	uint16_t er_he_ltf_800_gi_4x:1;
1589 	uint16_t he_ppdu_20_in_40Mhz_2G:1;
1590 	uint16_t he_ppdu_20_in_160_80p80Mhz:1;
1591 	uint16_t he_ppdu_80_in_160_80p80Mhz:1;
1592 	uint16_t er_1x_he_ltf_gi:1;
1593 	uint16_t midamble_tx_rx_1x_he_ltf:1;
1594 	uint16_t dcm_max_bw:2;
1595 	uint16_t longer_than_16_he_sigb_ofdm_sym:1;
1596 	uint16_t non_trig_cqi_feedback:1;
1597 	uint16_t tx_1024_qam_lt_242_tone_ru:1;
1598 	uint16_t rx_1024_qam_lt_242_tone_ru:1;
1599 	uint16_t rx_full_bw_su_he_mu_compress_sigb:1;
1600 	uint16_t rx_full_bw_su_he_mu_non_cmpr_sigb:1;
1601 	uint16_t reserved3:2;
1602 
1603 	uint8_t  reserved4;
1604 
1605 	uint16_t rx_he_mcs_map_lt_80;
1606 	uint16_t tx_he_mcs_map_lt_80;
1607 	uint16_t rx_he_mcs_map_160;
1608 	uint16_t tx_he_mcs_map_160;
1609 	uint16_t rx_he_mcs_map_80_80;
1610 	uint16_t tx_he_mcs_map_80_80;
1611 } qdf_packed;
1612 
1613 struct he_ops_network_endian {
1614 	uint16_t default_pe:3;
1615 	uint16_t twt_required:1;
1616 	uint16_t txop_rts_threshold:10;
1617 	uint16_t vht_oper_present:1;
1618 	uint16_t co_located_bss:1;
1619 	uint8_t  er_su_disable:1;
1620 	uint8_t  reserved1:7;
1621 	uint8_t  bss_color:6;
1622 	uint8_t  partial_bss_col:1;
1623 	uint8_t  bss_col_disabled:1;
1624 	uint8_t  basic_mcs_nss[2];
1625 	union {
1626 		struct {
1627 			uint8_t chan_width;
1628 			uint8_t center_freq_seg0;
1629 			uint8_t center_freq_seg1;
1630 		} info; /* vht_oper_present = 1 */
1631 	} vht_oper;
1632 	union {
1633 		struct {
1634 			uint8_t data;
1635 		} info; /* co_located_bss = 1 */
1636 	} maxbssid_ind;
1637 } qdf_packed;
1638 
1639 /* HE Capabilities Info */
1640 struct he_capability_info {
1641 #ifndef ANI_LITTLE_BIT_ENDIAN
1642 	uint32_t rx_ctrl_frame:1;
1643 	uint32_t flex_twt_sched:1;
1644 	uint32_t amsdu_frag:1;
1645 	uint32_t max_ampdu_len_exp_ext:2;
1646 	uint32_t ofdma_ra:1;
1647 	uint32_t omi_a_ctrl:1;
1648 	uint32_t reserved:1;
1649 	uint32_t ack_enabled_multitid:1;
1650 	uint32_t mu_cascade:1;
1651 	uint32_t ba_32bit_bitmap:1;
1652 	uint32_t broadcast_twt:1;
1653 	uint32_t a_bsr:1;
1654 	uint32_t trigd_rsp_sched:1;
1655 	uint32_t all_ack:1;
1656 	uint32_t he_link_adaptation:2;
1657 	uint32_t multi_tid_aggr_rx_supp:3;
1658 	uint32_t trigger_frm_mac_pad:2;
1659 	uint32_t min_frag_size:2;
1660 	uint32_t max_num_frag_msdu_amsdu_exp:3;
1661 	uint32_t fragmentation:2;
1662 	uint32_t twt_responder:1;
1663 	uint32_t twt_request:1;
1664 	uint32_t htc_he:1;
1665 
1666 	uint16_t ht_vht_trg_frm_rx_supp:1;
1667 	uint16_t punctured_sounding_supp:1;
1668 	uint16_t he_dynamic_smps:1;
1669 	uint16_t om_ctrl_ul_mu_data_dis_rx:1;
1670 	uint16_t ul_2x996_tone_ru_supp:1;
1671 	uint16_t he_sub_ch_sel_tx_supp:1;
1672 	uint16_t multi_tid_aggr_tx_supp:3;
1673 	uint16_t amsdu_in_ampdu:1;
1674 	uint16_t ops_supp:1;
1675 	uint16_t ndp_feedback_supp:1;
1676 	uint16_t spatial_reuse_param_rspder:1;
1677 	uint16_t a_bqr:1;
1678 	uint16_t qtp:1;
1679 	uint16_t bsrp_ampdu_aggr:1;
1680 
1681 	uint32_t su_beamformer:1;
1682 	uint32_t ul_he_mu:1;
1683 	uint32_t dcm_enc_rx:3;
1684 	uint32_t dcm_enc_tx:3;
1685 	uint32_t ul_mu:2;
1686 	uint32_t doppler:2;
1687 	uint32_t rx_stbc_lt_80mhz:1;
1688 	uint32_t tb_ppdu_tx_stbc_lt_80mhz:1;
1689 	uint32_t he_4x_ltf_3200_gi_ndp:1;
1690 	uint32_t midamble_tx_rx_max_nsts:2;
1691 	uint32_t he_1x_ltf_800_gi_ppdu:1;
1692 	uint32_t ldpc_coding:1;
1693 	uint32_t device_class:1;
1694 	uint32_t rx_pream_puncturing:4;
1695 	uint32_t chan_width:7;
1696 	uint32_t reserved2:1;
1697 
1698 	uint32_t rx_stbc_gt_80mhz:1;
1699 	uint32_t tb_ppdu_tx_stbc_gt_80mhz:1;
1700 	uint32_t max_nc:3;
1701 	uint32_t he_ltf_800_gi_4x:1;
1702 	uint32_t power_boost:1;
1703 	uint32_t srp:1;
1704 	uint32_t ppet_present:1;
1705 	uint32_t dl_mu_mimo_part_bw:1;
1706 	uint32_t he_er_su_ppdu:1;
1707 	uint32_t beamforming_feedback:3;
1708 	uint32_t codebook_mu:1;
1709 	uint32_t codebook_su:1;
1710 	uint32_t mu_feedback_tone16:1;
1711 	uint32_t su_feedback_tone16:1;
1712 	uint32_t num_sounding_gt_80:3;
1713 	uint32_t num_sounding_lt_80:3;
1714 	uint32_t bfee_sts_gt_80:3;
1715 	uint32_t bfee_sts_lt_80:3;
1716 	uint32_t mu_beamformer:1;
1717 	uint32_t su_beamformee:1;
1718 
1719 	uint16_t reserved3:2;
1720 	uint16_t rx_full_bw_su_he_mu_non_cmpr_sigb:1;
1721 	uint16_t rx_full_bw_su_he_mu_compress_sigb:1;
1722 	uint16_t rx_1024_qam_lt_242_tone_ru:1;
1723 	uint16_t tx_1024_qam_lt_242_tone_ru:1;
1724 	uint16_t non_trig_cqi_feedback:1;
1725 	uint16_t longer_than_16_he_sigb_ofdm_sym:1;
1726 	uint16_t dcm_max_bw:2;
1727 	uint16_t midamble_tx_rx_1x_he_ltf:1;
1728 	uint16_t er_1x_he_ltf_gi:1;
1729 	uint16_t he_ppdu_80_in_160_80p80Mhz:1;
1730 	uint16_t he_ppdu_20_in_160_80p80Mhz:1;
1731 	uint16_t he_ppdu_20_in_40Mhz_2G:1;
1732 	uint16_t er_he_ltf_800_gi_4x:1;
1733 
1734 	uint8_t reserved4;
1735 
1736 	uint16_t tx_he_mcs_map_80_80;
1737 	uint16_t rx_he_mcs_map_80_80;
1738 	uint16_t tx_he_mcs_map_160;
1739 	uint16_t rx_he_mcs_map_160;
1740 	uint16_t tx_he_mcs_map_lt_80;
1741 	uint16_t rx_he_mcs_map_lt_80;
1742 #else
1743 	uint32_t htc_he:1;
1744 	uint32_t twt_request:1;
1745 	uint32_t twt_responder:1;
1746 	uint32_t fragmentation:2;
1747 	uint32_t max_num_frag_msdu_amsdu_exp:3;
1748 	uint32_t min_frag_size:2;
1749 	uint32_t trigger_frm_mac_pad:2;
1750 	uint32_t multi_tid_aggr_rx_supp:3;
1751 	uint32_t he_link_adaptation:2;
1752 	uint32_t all_ack:1;
1753 	uint32_t trigd_rsp_sched:1;
1754 	uint32_t a_bsr:1;
1755 	uint32_t broadcast_twt:1;
1756 	uint32_t ba_32bit_bitmap:1;
1757 	uint32_t mu_cascade:1;
1758 	uint32_t ack_enabled_multitid:1;
1759 	uint32_t reserved:1;
1760 	uint32_t omi_a_ctrl:1;
1761 	uint32_t ofdma_ra:1;
1762 	uint32_t max_ampdu_len_exp_ext:2;
1763 	uint32_t amsdu_frag:1;
1764 	uint32_t flex_twt_sched:1;
1765 	uint32_t rx_ctrl_frame:1;
1766 
1767 	uint16_t bsrp_ampdu_aggr:1;
1768 	uint16_t qtp:1;
1769 	uint16_t a_bqr:1;
1770 	uint16_t spatial_reuse_param_rspder:1;
1771 	uint16_t ndp_feedback_supp:1;
1772 	uint16_t ops_supp:1;
1773 	uint16_t amsdu_in_ampdu:1;
1774 	uint16_t multi_tid_aggr_tx_supp:3;
1775 	uint16_t he_sub_ch_sel_tx_supp:1;
1776 	uint16_t ul_2x996_tone_ru_supp:1;
1777 	uint16_t om_ctrl_ul_mu_data_dis_rx:1;
1778 	uint16_t he_dynamic_smps:1;
1779 	uint16_t punctured_sounding_supp:1;
1780 	uint16_t ht_vht_trg_frm_rx_supp:1;
1781 
1782 	uint32_t reserved2:1;
1783 	uint32_t chan_width:7;
1784 	uint32_t rx_pream_puncturing:4;
1785 	uint32_t device_class:1;
1786 	uint32_t ldpc_coding:1;
1787 	uint32_t he_1x_ltf_800_gi_ppdu:1;
1788 	uint32_t midamble_tx_rx_max_nsts:2;
1789 	uint32_t he_4x_ltf_3200_gi_ndp:1;
1790 	uint32_t tb_ppdu_tx_stbc_lt_80mhz:1;
1791 	uint32_t rx_stbc_lt_80mhz:1;
1792 	uint32_t doppler:2;
1793 	uint32_t ul_mu:2;
1794 	uint32_t dcm_enc_tx:3;
1795 	uint32_t dcm_enc_rx:3;
1796 	uint32_t ul_he_mu:1;
1797 	uint32_t su_beamformer:1;
1798 
1799 	uint32_t su_beamformee:1;
1800 	uint32_t mu_beamformer:1;
1801 	uint32_t bfee_sts_lt_80:3;
1802 	uint32_t bfee_sts_gt_80:3;
1803 	uint32_t num_sounding_lt_80:3;
1804 	uint32_t num_sounding_gt_80:3;
1805 	uint32_t su_feedback_tone16:1;
1806 	uint32_t mu_feedback_tone16:1;
1807 	uint32_t codebook_su:1;
1808 	uint32_t codebook_mu:1;
1809 	uint32_t beamforming_feedback:3;
1810 	uint32_t he_er_su_ppdu:1;
1811 	uint32_t dl_mu_mimo_part_bw:1;
1812 	uint32_t ppet_present:1;
1813 	uint32_t srp:1;
1814 	uint32_t power_boost:1;
1815 	uint32_t he_ltf_800_gi_4x:1;
1816 	uint32_t max_nc:3;
1817 	uint32_t tb_ppdu_tx_stbc_gt_80mhz:1;
1818 	uint32_t rx_stbc_gt_80mhz:1;
1819 
1820 	uint16_t er_he_ltf_800_gi_4x:1;
1821 	uint16_t he_ppdu_20_in_40Mhz_2G:1;
1822 	uint16_t he_ppdu_20_in_160_80p80Mhz:1;
1823 	uint16_t he_ppdu_80_in_160_80p80Mhz:1;
1824 	uint16_t er_1x_he_ltf_gi:1;
1825 	uint16_t midamble_tx_rx_1x_he_ltf:1;
1826 	uint16_t dcm_max_bw:2;
1827 	uint16_t longer_than_16_he_sigb_ofdm_sym:1;
1828 	uint16_t non_trig_cqi_feedback:1;
1829 	uint16_t tx_1024_qam_lt_242_tone_ru:1;
1830 	uint16_t rx_1024_qam_lt_242_tone_ru:1;
1831 	uint16_t rx_full_bw_su_he_mu_compress_sigb:1;
1832 	uint16_t rx_full_bw_su_he_mu_non_cmpr_sigb:1;
1833 	uint16_t reserved3:2;
1834 
1835 	uint8_t  reserved4;
1836 
1837 	uint16_t rx_he_mcs_map_lt_80;
1838 	uint16_t tx_he_mcs_map_lt_80;
1839 	uint16_t rx_he_mcs_map_160;
1840 	uint16_t tx_he_mcs_map_160;
1841 	uint16_t rx_he_mcs_map_80_80;
1842 	uint16_t tx_he_mcs_map_80_80;
1843 #endif
1844 } qdf_packed;
1845 
1846 struct he_6ghz_capability_info {
1847 	uint16_t min_mpdu_start_spacing:3;
1848 	uint16_t    max_ampdu_len_exp:3;
1849 	uint16_t         max_mpdu_len:2;
1850 
1851 	uint16_t             reserved:1;
1852 	uint16_t          sm_pow_save:2;
1853 	uint16_t         rd_responder:1;
1854 	uint16_t rx_ant_pattern_consistency:1;
1855 	uint16_t tx_ant_pattern_consistency:1;
1856 	uint16_t             reserved2:2;
1857 } qdf_packed;
1858 #endif
1859 
1860 /*
1861  * frame parser does not include optional 160 and 80+80 mcs set for MIN IE len
1862  */
1863 #define SIR_MAC_HE_CAP_MIN_LEN       (DOT11F_IE_HE_CAP_MIN_LEN)
1864 #define HE_CAP_160M_MCS_MAP_LEN      4
1865 #define HE_CAP_80P80_MCS_MAP_LEN     4
1866 #define HE_CAP_OUI_LEN               3
1867 
1868 /* QOS action frame definitions */
1869 
1870 /* max number of possible tclas elements in any frame */
1871 #define SIR_MAC_TCLASIE_MAXNUM  2
1872 
1873 /* 11b rate encoding in MAC format */
1874 
1875 #define SIR_MAC_RATE_1   0x02
1876 #define SIR_MAC_RATE_2   0x04
1877 #define SIR_MAC_RATE_5_5 0x0B
1878 #define SIR_MAC_RATE_11  0x16
1879 
1880 /* 11a/g rate encoding in MAC format */
1881 
1882 #define SIR_MAC_RATE_6   0x0C
1883 #define SIR_MAC_RATE_9   0x12
1884 #define SIR_MAC_RATE_12  0x18
1885 #define SIR_MAC_RATE_18  0x24
1886 #define SIR_MAC_RATE_24  0x30
1887 #define SIR_MAC_RATE_36  0x48
1888 #define SIR_MAC_RATE_48  0x60
1889 #define SIR_MAC_RATE_54  0x6C
1890 
1891 /* ANI legacy supported rates */
1892 #define SIR_MAC_RATE_72  0x01
1893 #define SIR_MAC_RATE_96  0x03
1894 #define SIR_MAC_RATE_108 0x05
1895 
1896 /* ANI enhanced rates */
1897 #define SIR_MAC_RATE_42  1000
1898 #define SIR_MAC_RATE_84  1001
1899 #define SIR_MAC_RATE_126 1002
1900 #define SIR_MAC_RATE_144 1003
1901 #define SIR_MAC_RATE_168 1004
1902 #define SIR_MAC_RATE_192 1005
1903 #define SIR_MAC_RATE_216 1006
1904 #define SIR_MAC_RATE_240 1007
1905 
1906 #define SIR_MAC_RATE_1_BITMAP    (1<<0)
1907 #define SIR_MAC_RATE_2_BITMAP    (1<<1)
1908 #define SIR_MAC_RATE_5_5_BITMAP  (1<<2)
1909 #define SIR_MAC_RATE_11_BITMAP   (1<<3)
1910 #define SIR_MAC_RATE_6_BITMAP    (1<<4)
1911 #define SIR_MAC_RATE_9_BITMAP    (1<<5)
1912 #define SIR_MAC_RATE_12_BITMAP   (1<<6)
1913 #define SIR_MAC_RATE_18_BITMAP   (1<<7)
1914 #define SIR_MAC_RATE_24_BITMAP   (1<<8)
1915 #define SIR_MAC_RATE_36_BITMAP   (1<<9)
1916 #define SIR_MAC_RATE_48_BITMAP   (1<<10)
1917 #define SIR_MAC_RATE_54_BITMAP   (1<<11)
1918 
1919 #define sirIsArate(x) ((((uint8_t)x) == SIR_MAC_RATE_6)  || \
1920 		       (((uint8_t)x) == SIR_MAC_RATE_9)  || \
1921 		       (((uint8_t)x) == SIR_MAC_RATE_12) || \
1922 		       (((uint8_t)x) == SIR_MAC_RATE_18) || \
1923 		       (((uint8_t)x) == SIR_MAC_RATE_24) || \
1924 		       (((uint8_t)x) == SIR_MAC_RATE_36) || \
1925 		       (((uint8_t)x) == SIR_MAC_RATE_48) || \
1926 		       (((uint8_t)x) == SIR_MAC_RATE_54))
1927 
1928 #define sirIsBrate(x) ((((uint8_t)x) == SIR_MAC_RATE_1)   || \
1929 		       (((uint8_t)x) == SIR_MAC_RATE_2)   || \
1930 		       (((uint8_t)x) == SIR_MAC_RATE_5_5) || \
1931 		       (((uint8_t)x) == SIR_MAC_RATE_11))
1932 
1933 #define sirIsGrate(x) ((((uint8_t)x) == SIR_MAC_RATE_1)   || \
1934 		       (((uint8_t)x) == SIR_MAC_RATE_2)   || \
1935 		       (((uint8_t)x) == SIR_MAC_RATE_5_5) || \
1936 		       (((uint8_t)x) == SIR_MAC_RATE_11)  || \
1937 		       (((uint8_t)x) == SIR_MAC_RATE_6)   || \
1938 		       (((uint8_t)x) == SIR_MAC_RATE_9)   || \
1939 		       (((uint8_t)x) == SIR_MAC_RATE_12)  || \
1940 		       (((uint8_t)x) == SIR_MAC_RATE_18)  || \
1941 		       (((uint8_t)x) == SIR_MAC_RATE_24)  || \
1942 		       (((uint8_t)x) == SIR_MAC_RATE_36)  || \
1943 		       (((uint8_t)x) == SIR_MAC_RATE_48)  || \
1944 		       (((uint8_t)x) == SIR_MAC_RATE_54))
1945 
1946 #define SIR_MAC_MIN_IE_LEN 2    /* Minimum IE length for IE validation */
1947 
1948 #define SIR_MAC_TI_TYPE_ASSOC_COMEBACK          3
1949 
1950 #define SIR_MAC_VHT_CAP_MAX_MPDU_LEN              0
1951 #define SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET         2
1952 #define SIR_MAC_VHT_CAP_LDPC_CODING_CAP           4
1953 #define SIR_MAC_VHT_CAP_SHORTGI_80MHZ             5
1954 #define SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ      6
1955 #define SIR_MAC_VHT_CAP_TXSTBC                    7
1956 #define SIR_MAC_VHT_CAP_RXSTBC                    8
1957 #define SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP         11
1958 #define SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP         12
1959 #define SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP     13
1960 #define SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM          16
1961 #define SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP       19
1962 #define SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP       20
1963 #define SIR_MAC_VHT_CAP_TXOPPS                    21
1964 #define SIR_MAC_VHT_CAP_HTC_CAP                   22
1965 #define SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO         23
1966 #define SIR_MAC_VHT_CAP_LINK_ADAPT_CAP            26
1967 #define SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN        28
1968 #define SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN        29
1969 #define SIR_MAC_VHT_CAP_EXTD_NSS_BW               30
1970 
1971 #define SIR_MAC_HT_CAP_ADVCODING_S                 0
1972 #define SIR_MAC_HT_CAP_CHWIDTH40_S                 1
1973 #define SIR_MAC_HT_CAP_SMPOWERSAVE_DYNAMIC_S       2
1974 #define SIR_MAC_HT_CAP_SM_RESERVED_S               3
1975 #define SIR_MAC_HT_CAP_GREENFIELD_S                4
1976 #define SIR_MAC_HT_CAP_SHORTGI20MHZ_S              5
1977 #define SIR_MAC_HT_CAP_SHORTGI40MHZ_S              6
1978 #define SIR_MAC_HT_CAP_TXSTBC_S                    7
1979 #define SIR_MAC_HT_CAP_RXSTBC_S                    8
1980 #define SIR_MAC_HT_CAP_DELAYEDBLKACK_S            10
1981 #define SIR_MAC_HT_CAP_MAXAMSDUSIZE_S             11
1982 #define SIR_MAC_HT_CAP_DSSSCCK40_S                12
1983 #define SIR_MAC_HT_CAP_PSMP_S                     13
1984 #define SIR_MAC_HT_CAP_INTOLERANT40_S             14
1985 #define SIR_MAC_HT_CAP_LSIGTXOPPROT_S             15
1986 
1987 #define SIR_MAC_TXSTBC                             1
1988 #define SIR_MAC_RXSTBC                             1
1989 
1990 #define SIR_MAC_RSNX_CAP_MIN_LEN                   1
1991 #define SIR_MAC_RSNX_CAP_MAX_LEN                  16
1992 
1993 #define SIR_MAC_IE_TYPE_OFFSET                     0
1994 #define SIR_MAC_IE_LEN_OFFSET                      1
1995 #define SIR_MAC_IE_TYPE_LEN_SIZE                   2
1996 #endif /* __MAC_PROT_DEFS_H */
1997