xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h (revision 839714c413056bc9b82af766295b4ffabe28bbbf)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-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  * DOC: contains commnon ieee80211 definitions
22  */
23 
24 #ifndef _WLAN_CMN_IEEE80211_H_
25 #define _WLAN_CMN_IEEE80211_H_
26 #include <qdf_types.h>
27 #include <osdep.h>
28 
29 /* Subfields in Frame Control field (except Type and Subtype) */
30 #define WLAN_FC0_PVER      0x0003
31 #define WLAN_FC1_DIR_MASK  0x03
32 #define WLAN_FC1_TODS      0x01
33 #define WLAN_FC1_FROMDS    0x02
34 #define WLAN_FC1_DSTODS    0x03
35 #define WLAN_FC1_MOREFRAG  0x04
36 #define WLAN_FC1_RETRY     0x08
37 #define WLAN_FC1_PWRMGT    0x10
38 #define WLAN_FC1_MOREDATA  0x20
39 #define WLAN_FC1_ISWEP     0x40
40 #define WLAN_FC1_ORDER     0x80
41 
42 /* Definitions for Type subfield in Frame Control field */
43 #define WLAN_FC0_TYPE_MGMT        0
44 #define WLAN_FC0_TYPE_CTRL        1
45 #define WLAN_FC0_TYPE_DATA        2
46 
47 /* Definitions for management frame subtypes in Frame Control field */
48 #define WLAN_FC0_STYPE_ASSOC_REQ      0
49 #define WLAN_FC0_STYPE_ASSOC_RESP     1
50 #define WLAN_FC0_STYPE_REASSOC_REQ    2
51 #define WLAN_FC0_STYPE_REASSOC_RESP   3
52 #define WLAN_FC0_STYPE_PROBE_REQ      4
53 #define WLAN_FC0_STYPE_PROBE_RESP     5
54 #define WLAN_FC0_STYPE_BEACON         8
55 #define WLAN_FC0_STYPE_ATIM           9
56 #define WLAN_FC0_STYPE_DISASSOC      10
57 #define WLAN_FC0_STYPE_AUTH          11
58 #define WLAN_FC0_STYPE_DEAUTH        12
59 #define WLAN_FC0_STYPE_ACTION        13
60 
61 /* Definitions for control frame subtypes in Frame Control field */
62 #define WLAN_FC0_STYPE_PSPOLL        10
63 #define WLAN_FC0_STYPE_RTS           11
64 #define WLAN_FC0_STYPE_CTS           12
65 #define WLAN_FC0_STYPE_ACK           13
66 #define WLAN_FC0_STYPE_CFEND         14
67 #define WLAN_FC0_STYPE_CFENDACK      15
68 
69 /* Definitions for data frame subtypes in Frame Control field */
70 #define WLAN_FC0_STYPE_DATA                0
71 #define WLAN_FC0_STYPE_DATA_CFACK          1
72 #define WLAN_FC0_STYPE_DATA_CFPOLL         2
73 #define WLAN_FC0_STYPE_DATA_CFACKPOLL      3
74 #define WLAN_FC0_STYPE_NULLFUNC            4
75 #define WLAN_FC0_STYPE_CFACK               5
76 #define WLAN_FC0_STYPE_CFPOLL              6
77 #define WLAN_FC0_STYPE_CFACKPOLL           7
78 #define WLAN_FC0_STYPE_QOS_DATA            8
79 #define WLAN_FC0_STYPE_QOS_DATA_CFACK      9
80 #define WLAN_FC0_STYPE_QOS_DATA_CFPOLL    10
81 #define WLAN_FC0_STYPE_QOS_DATA_CFACKPOLL 11
82 #define WLAN_FC0_STYPE_QOS_NULL           12
83 #define WLAN_FC0_STYPE_QOS_CFPOLL         14
84 #define WLAN_FC0_STYPE_QOS_CFACKPOLL      15
85 
86 /* Get Type/Subtype subfields in Frame Control field */
87 #define WLAN_FC0_GET_TYPE(fc)    (((fc) & 0x0c) >> 2)
88 #define WLAN_FC0_GET_STYPE(fc)   (((fc) & 0xf0) >> 4)
89 
90 /* Definitions related to sequence number processing, TID, etc. */
91 #define WLAN_INVALID_MGMT_SEQ   0xffff
92 #define WLAN_SEQ_MASK           0x0fff
93 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
94 #define WLAN_GET_SEQ_SEQ(seq) \
95 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
96 #define WLAN_QOS_TID_MASK       0x0f
97 #define WLAN_TID_SIZE           17
98 #define WLAN_NONQOS_SEQ         16
99 
100 /* Length of Timestamp field */
101 #define WLAN_TIMESTAMP_LEN         8
102 
103 /* Length of Beacon Interval field */
104 #define WLAN_BEACONINTERVAL_LEN    2
105 
106 /* Length of Capability Information field */
107 #define WLAN_CAPABILITYINFO_LEN    2
108 
109 /* Length of Listen Interval field */
110 #define WLAN_LISTENINTERVAL_LEN    2
111 
112 /* Length of Status code field */
113 #define WLAN_STATUSCODE_LEN        2
114 
115 /* Length of AID field */
116 #define WLAN_AID_LEN               2
117 
118 /* Assoc resp IE offset Capability(2) + Status Code(2) + AID(2) */
119 #define WLAN_ASSOC_RSP_IES_OFFSET \
120 	(WLAN_CAPABILITYINFO_LEN  + WLAN_STATUSCODE_LEN + WLAN_AID_LEN)
121 
122 /* Assoc req IE offset - Capability(2) + LI(2) */
123 #define WLAN_ASSOC_REQ_IES_OFFSET \
124 	(WLAN_CAPABILITYINFO_LEN + WLAN_LISTENINTERVAL_LEN)
125 
126 /* Reassoc req IE offset - Capability(2) + LI(2) + current AP address(6) */
127 #define WLAN_REASSOC_REQ_IES_OFFSET \
128 	(WLAN_CAPABILITYINFO_LEN + WLAN_LISTENINTERVAL_LEN + QDF_MAC_ADDR_SIZE)
129 
130 /* Probe response IE offset - timestamp(8) + Beacon Int(2) + Cap info(2) */
131 #define WLAN_PROBE_RESP_IES_OFFSET \
132 	(WLAN_TIMESTAMP_LEN + WLAN_BEACONINTERVAL_LEN + WLAN_CAPABILITYINFO_LEN)
133 
134 /* Beacon IE offset - timestamp(8) + Beacon Int(2) + Cap info(2) */
135 #define WLAN_BEACON_IES_OFFSET \
136 	(WLAN_TIMESTAMP_LEN + WLAN_BEACONINTERVAL_LEN + WLAN_CAPABILITYINFO_LEN)
137 
138 /* Length (in bytes) of MAC header in 3 address format */
139 #define WLAN_MAC_HDR_LEN_3A 24
140 
141 #define IEEE80211_CCMP_HEADERLEN    8
142 #define IEEE80211_HT_CTRL_LEN       4
143 #define IEEE80211_CCMP_MICLEN       8
144 #define WLAN_IEEE80211_GCMP_HEADERLEN    8
145 #define WLAN_IEEE80211_GCMP_MICLEN       16
146 
147 #define IEEE80211_FC1_RETRY         0x08
148 #define IEEE80211_FC1_WEP           0x40
149 #define IEEE80211_FC1_ORDER         0x80
150 
151 #define WLAN_HDR_IV_LEN            3
152 #define WLAN_HDR_EXT_IV_BIT        0x20
153 #define WLAN_HDR_EXT_IV_LEN        4
154 
155 #define WLAN_SEQ_SEQ_SHIFT 4
156 
157 #define P2P_WFA_OUI {0x50, 0x6f, 0x9a}
158 #define P2P_WFA_VER 0x09
159 
160 #define WSC_OUI 0x0050f204
161 #define MBO_OCE_OUI 0x506f9a16
162 #define MBO_OCE_OUI_SIZE 4
163 #define REDUCED_WAN_METRICS_ATTR 103
164 #define OCE_DISALLOW_ASSOC_ATTR  0x4
165 #define AP_TX_PWR_ATTR 107
166 #define OCE_SUBNET_ID_ATTR 108
167 #define OCE_SUBNET_ID_LEN 6
168 #define OSEN_OUI 0x506f9a12
169 
170 /* WCN IE */
171 /* Microsoft OUI */
172 #define WCN_OUI 0xf25000
173 /* WCN */
174 #define WCN_OUI_TYPE 0x04
175 #define WME_OUI 0xf25000
176 #define WME_OUI_TYPE 0x02
177 #define WME_PARAM_OUI_SUBTYPE 0x01
178 #define WME_INFO_OUI_SUBTYPE 0x00
179  /* Atheros OUI */
180 #define ATH_OUI 0x7f0300
181 #define ATH_OUI_TYPE 0x01
182 /* Atheros Extended Cap Type */
183 #define ATH_OUI_EXTCAP_TYPE 0x04
184 /* QCA Bandwidth NSS Mapping Type */
185 #define ATH_OUI_BW_NSS_MAP_TYPE 0x05
186 #define SFA_OUI 0x964000
187 #define SFA_OUI_TYPE 0x14
188 /* QCA OUI (in little endian) */
189 #define QCA_OUI 0xf0fd8c
190 #define QCN_OUI_TYPE_CMN 0x01
191 #define QCA_OUI_WHC_TYPE  0x00
192 #define QCA_OUI_WHC_REPT_TYPE 0x01
193 
194 /**
195  * enum qcn_attribute_id: QCN IE attribute ID
196  * @QCN_ATTRIB_VERSION: QCN version
197  * @QCN_ATTRIB_VHT_MCS10_11_SUPP: VHT MCS 10-11 support
198  * @QCN_ATTRIB_HE_400NS_SGI_SUPP: HE 400 NS SGI support
199  * @QCN_ATTRIB_HE_2XLTF_160_80P80_SUPP: HE 2X LTF 160 80P80 support
200  * @QCN_ATTRIB_HE_DL_OFDMA_SUPP: HE DL OFDMA support
201  * @QCN_ATTRIB_TRANSITION_REASON: Transition reason
202  * @QCN_ATTRIB_TRANSITION_REJECTION: Transition rejection
203  * @QCN_ATTRIB_HE_DL_MUMIMO_SUPP: DL MUMIMO support
204  * @QCN_ATTRIB_HE_MCS12_13_SUPP: MCS 12-13 support
205  * @QCN_ATTRIB_REPEATER_INFO: Repeater information
206  * @QCN_ATTRIB_HE_240_MHZ_SUPP: HE 240 MHZ support
207  * @QCN_ATTRIB_ECSA_SUPP: ECSA support
208  * @QCN_ATTRIB_EDCA_PIFS_PARAM: EDCA PIFS param
209  * @QCN_ATTRIB_MAX: Maximum attribute
210  */
211 enum qcn_attribute_id {
212 	QCN_ATTRIB_VERSION                  = 0x01,
213 	QCN_ATTRIB_VHT_MCS10_11_SUPP        = 0X02,
214 	QCN_ATTRIB_HE_400NS_SGI_SUPP        = 0X03,
215 	QCN_ATTRIB_HE_2XLTF_160_80P80_SUPP  = 0X04,
216 	QCN_ATTRIB_HE_DL_OFDMA_SUPP         = 0X05,
217 	QCN_ATTRIB_TRANSITION_REASON        = 0x06,
218 	QCN_ATTRIB_TRANSITION_REJECTION     = 0x07,
219 	QCN_ATTRIB_HE_DL_MUMIMO_SUPP        = 0X08,
220 	QCN_ATTRIB_HE_MCS12_13_SUPP         = 0X09,
221 	QCN_ATTRIB_REPEATER_INFO            = 0X0A,
222 	QCN_ATTRIB_HE_240_MHZ_SUPP          = 0X0B,
223 	QCN_ATTRIB_ECSA_SUPP                = 0X0C,
224 	QCN_ATTRIB_EDCA_PIFS_PARAM          = 0X0D,
225 	QCN_ATTRIB_MAX                      = 0x0E
226 };
227 
228 /* Extender vendor specific IE */
229 #define QCA_OUI_EXTENDER_TYPE           0x03
230 
231 #define ADAPTIVE_11R_OUI      0x964000
232 #define ADAPTIVE_11R_OUI_TYPE 0x2C
233 
234 #define OUI_LENGTH              4
235 #define OUI_TYPE_BITS           24
236 #define MAX_ADAPTIVE_11R_IE_LEN 8
237 
238 /* Minimum length of Non-Inheritance element (inclusive of the IE header) */
239 #define MIN_NONINHERITANCEELEM_LEN 5
240 
241 /*
242  * sae single pmk vendor specific IE details
243  * Category     Data
244  * Type         0xDD
245  * Length       0x05
246  * OUI          0x00 40 96
247  * Type         0x03
248  * Data         Don’t care (EX, 0x05)
249  */
250 #define SAE_SINGLE_PMK_OUI          0x964000
251 #define SAE_SINGLE_PMK_TYPE         0x03
252 #define MAX_SAE_SINGLE_PMK_IE_LEN   8
253 
254 /* Temporary vendor specific IE for 11n pre-standard interoperability */
255 #define VENDOR_HT_OUI       0x00904c
256 #define VENDOR_HT_CAP_ID    51
257 #define VENDOR_HT_INFO_ID   52
258 
259 #define VHT_INTEROP_OUI 0x00904c
260 #define VHT_INTEROP_TYPE 0x04
261 #define VHT_INTEROP_OUI_SUBTYPE 0x08
262 #define VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC 0x18
263 
264 /* ATH HE OUI ( in little endian) */
265 #define ATH_HE_OUI                  0x741300
266 #define ATH_HE_CAP_SUBTYPE          0x01
267 #define ATH_HE_OP_SUBTYPE           0x02
268 
269 /* EPR information element flags */
270 #define ERP_NON_ERP_PRESENT   0x01
271 #define ERP_USE_PROTECTION    0x02
272 #define ERP_LONG_PREAMBLE     0x04
273 
274 #define QCA_OUI_WHC_AP_INFO_SUBTYPE 0x00
275 
276 #define WLAN_MAX_IE_LEN                255
277 #define WLAN_RSN_IE_LEN                22
278 
279 /* Individual element IEs length checks */
280 
281 /* Maximum supported basic/mandatory rates are 12 */
282 #define WLAN_SUPPORTED_RATES_IE_MAX_LEN          12
283 #define WLAN_FH_PARAM_IE_MAX_LEN                 5
284 #define WLAN_DS_PARAM_IE_MAX_LEN                 1
285 #define WLAN_CF_PARAM_IE_MAX_LEN                 6
286 #define WLAN_COUNTRY_IE_MIN_LEN                  3
287 #define WLAN_QUIET_IE_MAX_LEN                    6
288 #define WLAN_CSA_IE_MAX_LEN                      3
289 #define WLAN_XCSA_IE_MAX_LEN                     4
290 #define WLAN_SECCHANOFF_IE_MAX_LEN               1
291 #define WLAN_EXT_SUPPORTED_RATES_IE_MAX_LEN      12
292 
293 #define WLAN_EXTCAP_IE_MAX_LEN                   15
294 #define WLAN_FILS_INDICATION_IE_MIN_LEN          2
295 #define WLAN_MOBILITY_DOMAIN_IE_MAX_LEN          3
296 #define WLAN_OPMODE_IE_MAX_LEN                   1
297 #define WLAN_IBSSDFS_IE_MIN_LEN                  7
298 #define WLAN_IBSS_IE_MAX_LEN                     2
299 #define WLAN_REQUEST_IE_MAX_LEN                  255
300 #define WLAN_RM_CAPABILITY_IE_MAX_LEN            5
301 #define WLAN_RNR_IE_MIN_LEN                      5
302 #define WLAN_RNR_TBTT_OFFSET_INVALID             255
303 #define WLAN_TPE_IE_MIN_LEN                      2
304 #define WLAN_MAX_NUM_TPE_IE                      8
305 
306 /* Wide band channel switch IE length */
307 #define WLAN_WIDE_BW_CHAN_SWITCH_IE_LEN          3
308 
309 /* Number of max TX power elements supported plus size of Transmit Power
310  * Information element.
311  */
312 #define WLAN_TPE_IE_MAX_LEN                      9
313 
314 /* Max channel switch time IE length */
315 #define WLAN_MAX_CHAN_SWITCH_TIME_IE_LEN         4
316 
317 #define WLAN_MAX_SRP_IE_LEN                      21
318 #define WLAN_MAX_MUEDCA_IE_LEN                   14
319 #define WLAN_MAX_HE_6G_CAP_IE_LEN                3
320 #define WLAN_MAX_HEOP_IE_LEN                     16
321 #define WLAN_HEOP_OUI_TYPE                       "\x24"
322 #define WLAN_HEOP_OUI_SIZE                       1
323 
324 /* HT capability flags */
325 #define WLAN_HTCAP_C_ADVCODING             0x0001
326 #define WLAN_HTCAP_C_CHWIDTH40             0x0002
327 /* Capable of SM Power Save (Static) */
328 #define WLAN_HTCAP_C_SMPOWERSAVE_STATIC    0x0000
329 /* Capable of SM Power Save (Dynamic) */
330 #define WLAN_HTCAP_C_SMPOWERSAVE_DYNAMIC   0x0004
331 /* Reserved */
332 #define WLAN_HTCAP_C_SM_RESERVED           0x0008
333 /* SM enabled, no SM Power Save */
334 #define WLAN_HTCAP_C_SMPOWERSAVE_DISABLED            0x000c
335 #define WLAN_HTCAP_C_GREENFIELD            0x0010
336 #define WLAN_HTCAP_C_SHORTGI20             0x0020
337 #define WLAN_HTCAP_C_SHORTGI40             0x0040
338 #define WLAN_HTCAP_C_TXSTBC                0x0080
339 #define WLAN_HTCAP_C_TXSTBC_S                   7
340 /* 2 bits */
341 #define WLAN_HTCAP_C_RXSTBC                0x0300
342 #define WLAN_HTCAP_C_RXSTBC_S                   8
343 #define WLAN_HTCAP_C_DELAYEDBLKACK         0x0400
344 /* 1 = 8K, 0 = 3839B */
345 #define WLAN_HTCAP_C_MAXAMSDUSIZE          0x0800
346 #define WLAN_HTCAP_C_DSSSCCK40             0x1000
347 #define WLAN_HTCAP_C_PSMP                  0x2000
348 #define WLAN_HTCAP_C_INTOLERANT40          0x4000
349 #define WLAN_HTCAP_C_LSIGTXOPPROT          0x8000
350 /* Spatial Multiplexing (SM) capabitlity bitmask */
351 #define WLAN_HTCAP_C_SM_MASK               0x000c
352 
353 /* VHT Operation  */
354 /* 20/40 MHz Operating Channel */
355 #define WLAN_VHTOP_CHWIDTH_2040          0
356 /* 80 MHz Operating Channel */
357 #define WLAN_VHTOP_CHWIDTH_80            1
358 /* 160 MHz Operating Channel */
359 #define WLAN_VHTOP_CHWIDTH_160           2
360 /* 80 + 80 MHz Operating Channel */
361 #define WLAN_VHTOP_CHWIDTH_80_80         3
362 /* 160 MHz Operating Channel  (revised signalling) */
363 #define WLAN_VHTOP_CHWIDTH_REVSIG_160    1
364 /* 80 + 80 MHz Operating Channel  (revised signalling) */
365 #define WLAN_VHTOP_CHWIDTH_REVSIG_80_80  1
366 
367 #define WLAN_HEOP_FIXED_PARAM_LENGTH       7
368 #define WLAN_HEOP_VHTOP_LENGTH             3
369 #define WLAN_HEOP_CO_LOCATED_BSS_LENGTH    1
370 
371 #define WLAN_HEOP_VHTOP_PRESENT_MASK       0x00004000  /* B14 */
372 #define WLAN_HEOP_CO_LOCATED_BSS_MASK      0x00008000  /* B15 */
373 #define WLAN_HEOP_6GHZ_INFO_PRESENT_MASK   0X00020000  /* B17 */
374 
375 #define WLAN_HE_6GHZ_CHWIDTH_20           0 /* 20MHz Oper Ch width */
376 #define WLAN_HE_6GHZ_CHWIDTH_40           1 /* 40MHz Oper Ch width */
377 #define WLAN_HE_6GHZ_CHWIDTH_80           2 /* 80MHz Oper Ch width */
378 #define WLAN_HE_6GHZ_CHWIDTH_160_80_80    3 /* 160/80+80 MHz Oper Ch width */
379 
380 #define WLAN_HE_NON_SRG_PD_SR_DISALLOWED 0x02
381 #define WLAN_HE_NON_SRG_OFFSET_PRESENT 0x04
382 #define WLAN_HE_SIGA_SR_VAL15_ALLOWED  0x10
383 
384 #ifdef WLAN_FEATURE_11BE
385 #define WLAN_EHT_CHWIDTH_20           0 /* 20MHz Oper Ch width */
386 #define WLAN_EHT_CHWIDTH_40           1 /* 40MHz Oper Ch width */
387 #define WLAN_EHT_CHWIDTH_80           2 /* 80MHz Oper Ch width */
388 #define WLAN_EHT_CHWIDTH_160          3 /* 160MHz Oper Ch width */
389 #define WLAN_EHT_CHWIDTH_320          4 /* 320MHz Oper Ch width */
390 #endif
391 
392 /* Max length of 802.11 subelement */
393 #define WLAN_MAX_SUBELEM_LEN          255
394 
395 #define WLAN_RATE_VAL              0x7f
396 #define WLAN_BASIC_RATE_MASK       0x80
397 
398 #define WLAN_RV(v)     ((v) & WLAN_RATE_VAL)
399 
400 #define WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY       127
401 #define WLAN_BSS_MEMBERSHIP_SELECTOR_VHT_PHY      126
402 #define WLAN_BSS_MEMBERSHIP_SELECTOR_GLK          125
403 #define WLAN_BSS_MEMBERSHIP_SELECTOR_EPD          124
404 #define WLAN_BSS_MEMBERSHIP_SELECTOR_SAE_H2E      123
405 #define WLAN_BSS_MEMBERSHIP_SELECTOR_HE_PHY       122
406 
407 /* EXT cap bit definitions based on IEEE 802.11az D4.0 - 9.4.2.26 */
408 #define WLAN_EXT_CAPA11_NTB_RANGING_RESPONDER          BIT(2)
409 #define WLAN_EXT_CAPA11_TB_RANGING_RESPONDER           BIT(3)
410 #define WLAN_EXT_CAPA11_PASSIVE_TB_RANGING_RESPONDER   BIT(4)
411 #define WLAN_EXT_CAPA11_PASSIVE_TB_RANGING_INITIATOR   BIT(5)
412 
413 #define WLAN_CHAN_IS_5GHZ(chanidx) \
414 	((chanidx > 30) ? true : false)
415 #define WLAN_CHAN_IS_2GHZ(chanidx) \
416 	(((chanidx > 0) && (chanidx < 15)) ? true : false)
417 
418 /* Check if revised signalling is being used for VHT160 in vhtop */
419 #define WLAN_IS_REVSIG_VHT160(vhtop) (((vhtop)->vht_op_chwidth == \
420 	WLAN_VHTOP_CHWIDTH_REVSIG_160) && \
421 	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
422 	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) == 8))
423 
424 /* Check if revised signalling is being used for VHT80p80 in vhtop */
425 #define WLAN_IS_REVSIG_VHT80_80(vhtop) (((vhtop)->vht_op_chwidth == \
426 	WLAN_VHTOP_CHWIDTH_REVSIG_80_80) && \
427 	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
428 	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) > 8))
429 
430 /* Check if channel width is HE160 in HE 6ghz params */
431 #define WLAN_IS_HE160(he_6g_param) (((he_6g_param)->width == \
432 	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
433 	((he_6g_param)->chan_freq_seg1 != 0) && \
434 	(abs((he_6g_param)->chan_freq_seg1 - \
435 	(he_6g_param)->chan_freq_seg0) == 8))
436 
437 /* Check if channel width is HE80p80 in HE 6ghz params */
438 #define WLAN_IS_HE80_80(he_6g_param) (((he_6g_param)->width == \
439 	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
440 	((he_6g_param)->chan_freq_seg1 != 0) && \
441 	(abs((he_6g_param)->chan_freq_seg1 - \
442 	(he_6g_param)->chan_freq_seg0) > 8))
443 
444 #define LE_READ_2(p) \
445 	((uint16_t)\
446 	((((const uint8_t *)(p))[0]) |\
447 	(((const uint8_t *)(p))[1] <<  8)))
448 
449 #define LE_READ_4(p) \
450 	((uint32_t)\
451 	((((const uint8_t *)(p))[0]) |\
452 	(((const uint8_t *)(p))[1] <<  8) |  \
453 	(((const uint8_t *)(p))[2] << 16) |\
454 	(((const uint8_t *)(p))[3] << 24)))
455 
456 #define BE_READ_4(p) \
457 	((uint32_t)\
458 	((((const uint8_t *)(p))[0] << 24) |\
459 	(((const uint8_t *)(p))[1] << 16) |\
460 	(((const uint8_t *)(p))[2] <<  8) |\
461 	(((const uint8_t *)(p))[3])))
462 
463 /**
464  * enum ext_chan_offset: extension channel offset
465  * @WLAN_HTINFO_EXTOFFSET_NA: no extension channel is present
466  * @WLAN_HTINFO_EXTOFFSET_ABOVE: above control channel
467  * @WLAN_HTINFO_EXTOFFSET_UNDEF: undefined
468  * @WLAN_HTINFO_EXTOFFSET_BELOW: below control channel
469  */
470 enum ext_chan_offset {
471 	WLAN_HTINFO_EXTOFFSET_NA    = 0,
472 	WLAN_HTINFO_EXTOFFSET_ABOVE = 1,
473 	WLAN_HTINFO_EXTOFFSET_UNDEF = 2,
474 	WLAN_HTINFO_EXTOFFSET_BELOW = 3
475 };
476 
477 /**
478  * enum element_ie - Management information element
479  * @WLAN_ELEMID_SSID: ssid IE
480  * @WLAN_ELEMID_RATES: Rates IE
481  * @WLAN_ELEMID_FHPARMS: FH param IE
482  * @WLAN_ELEMID_DSPARMS: DS Param IE
483  * @WLAN_ELEMID_CFPARMS : CF Param IE
484  * @WLAN_ELEMID_TIM: TIM IE
485  * @WLAN_ELEMID_IBSSPARMS: Ibss params IE
486  * @WLAN_ELEMID_COUNTRY: Country code IE
487  * @WLAN_ELEMID_REQINFO: Req Info IE
488  * @WLAN_ELEMID_QBSS_LOAD: Qbss load IE
489  * @WLAN_ELEMID_EDCAPARMS: EDCA Parameter Set element
490  * @WLAN_ELEMID_TCLAS: TCLAS IE
491  * @WLAN_ELEMID_CHALLENGE: Challenge IE
492  * @WLAN_ELEMID_PWRCNSTR: Power cn IE
493  * @WLAN_ELEMID_PWRCAP: power cap IE
494  * @WLAN_ELEMID_TPCREQ: TPC req IE
495  * @WLAN_ELEMID_TPCREP: TPC rsp IE
496  * @WLAN_ELEMID_SUPPCHAN: Supported channel IE
497  * @WLAN_ELEMID_CHANSWITCHANN: Channel switch IE
498  * @WLAN_ELEMID_MEASREQ: Measurement request IE
499  * @WLAN_ELEMID_MEASREP: Measurement Resp IE
500  * @WLAN_ELEMID_QUIET: Quiet IE
501  * @WLAN_ELEMID_IBSSDFS: IBSS DFS IE
502  * @WLAN_ELEMID_ERP: ERP IE
503  * @WLAN_ELEMID_TCLAS_PROCESS: TCLAS process IE
504  * @WLAN_ELEMID_HTCAP_ANA: HTT Capability IE
505  * @WLAN_ELEMID_QOS_CAPABILITY: QoS Capability element
506  * @WLAN_ELEMID_RSN: RSN IE
507  * @WLAN_ELEMID_XRATES: Extended rate IE
508  * @WLAN_ELEMID_HTCAP_VENDOR: HT cap vendor IE
509  * @WLAN_ELEMID_HTINFO_VENDOR: HT info vendor IE
510  * @WLAN_ELEMID_MOBILITY_DOMAIN: MD IE
511  * @WLAN_ELEMID_FT: FT IE
512  * @WLAN_ELEMID_TIMEOUT_INTERVAL: Timeout interval IE
513  * @WLAN_ELEMID_SUPP_OP_CLASS: OP class IE
514  * @WLAN_ELEMID_EXTCHANSWITCHANN: Extended Channel switch IE
515  * @WLAN_ELEMID_HTINFO_ANA: HT info IE
516  * @WLAN_ELEMID_SECCHANOFFSET: Sec channel Offset IE
517  * @WLAN_ELEMID_WAPI: WAPI IE
518  * @WLAN_ELEMID_TIME_ADVERTISEMENT: Time IE
519  * @WLAN_ELEMID_RRM: Radio resource measurement IE
520  * @WLAN_ELEMID_MULTIPLE_BSSID: Multiple BSSID IE
521  * @WLAN_ELEMID_2040_COEXT: 20-40 COext ext IE
522  * @WLAN_ELEMID_2040_INTOL:20-40 INT OL IE
523  * @WLAN_ELEMID_OBSS_SCAN: OBSS scan IE
524  * @WLAN_ELEMID_MMIE: 802.11w Management MIC IE
525  * @WLAN_ELEMID_NONTX_BSSID_CAP: Nontransmitted BSSID Capability IE
526  * @WLAN_ELEMID_MULTI_BSSID_IDX: Multiple BSSID index
527  * @WLAN_ELEMID_FMS_DESCRIPTOR: 802.11v FMS descriptor IE
528  * @WLAN_ELEMID_FMS_REQUEST: 802.11v FMS request IE
529  * @WLAN_ELEMID_FMS_RESPONSE: 802.11v FMS response IE
530  * @WLAN_ELEMID_BSSMAX_IDLE_PERIOD: BSS Max Idle Period element
531  * @WLAN_ELEMID_TFS_REQUEST: TFS req IE
532  * @WLAN_ELEMID_TFS_RESPONSE: TFS resp IE
533  * @WLAN_ELEMID_TIM_BCAST_REQUEST: TIM bcast req IE
534  * @WLAN_ELEMID_TIM_BCAST_RESPONSE: TIM bcast resp IE
535  * @WLAN_ELEMID_INTERWORKING: Interworking IE
536  * @WLAN_ELEMID_QOS_MAP: QOS MAP IE
537  * @WLAN_ELEMID_XCAPS: Extended capability IE
538  * @WLAN_ELEMID_TPC: TPC IE
539  * @WLAN_ELEMID_CCKM: CCKM IE
540  * @WLAN_ELEMID_VHTCAP: VHT Capabilities
541  * @WLAN_ELEMID_VHTOP: VHT Operation
542  * @WLAN_ELEMID_EXT_BSS_LOAD: Extended BSS Load
543  * @WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH: Wide Band Channel Switch
544  * @WLAN_ELEMID_VHT_TX_PWR_ENVLP: VHT Transmit Power Envelope
545  * @WLAN_ELEMID_CHAN_SWITCH_WRAP: Channel Switch Wrapper
546  * @WLAN_ELEMID_AID: AID
547  * @WLAN_ELEMID_QUIET_CHANNEL: Quiet Channel
548  * @WLAN_ELEMID_OP_MODE_NOTIFY: Operating Mode Notification
549  * @WLAN_ELEMID_REDUCED_NEIGHBOR_REPORT: Reduced Neighbor Report element
550  * @WLAN_ELEMID_TWT: Target wake time IE
551  * @WLAN_ELEMID_VENDOR: vendor private
552  * @WLAN_ELEMID_FILS_INDICATION: FILS Indication element
553  * @WLAN_ELEMID_FRAGMENT: Fragment
554  * @WLAN_ELEMID_RSNXE: RSN Extension element (RSNXE)
555  * @WLAN_ELEMID_EXTN_ELEM: extended IE
556  *
557  * Reference IEEE Std 802.11-2020 Table 9-92—Element IDs
558  */
559 enum element_ie {
560 	WLAN_ELEMID_SSID             = 0,
561 	WLAN_ELEMID_RATES            = 1,
562 	WLAN_ELEMID_FHPARMS          = 2,
563 	WLAN_ELEMID_DSPARMS          = 3,
564 	WLAN_ELEMID_CFPARMS          = 4,
565 	WLAN_ELEMID_TIM              = 5,
566 	WLAN_ELEMID_IBSSPARMS        = 6,
567 	WLAN_ELEMID_COUNTRY          = 7,
568 	/* 8-9 reserved */
569 	WLAN_ELEMID_REQINFO          = 10,
570 	WLAN_ELEMID_QBSS_LOAD        = 11,
571 	WLAN_ELEMID_EDCAPARMS        = 12,
572 	WLAN_ELEMID_TCLAS            = 14,
573 	WLAN_ELEMID_CHALLENGE        = 16,
574 	/* 17-31 reserved for challenge text extension */
575 	WLAN_ELEMID_PWRCNSTR         = 32,
576 	WLAN_ELEMID_PWRCAP           = 33,
577 	WLAN_ELEMID_TPCREQ           = 34,
578 	WLAN_ELEMID_TPCREP           = 35,
579 	WLAN_ELEMID_SUPPCHAN         = 36,
580 	WLAN_ELEMID_CHANSWITCHANN    = 37,
581 	WLAN_ELEMID_MEASREQ          = 38,
582 	WLAN_ELEMID_MEASREP          = 39,
583 	WLAN_ELEMID_QUIET            = 40,
584 	WLAN_ELEMID_IBSSDFS          = 41,
585 	WLAN_ELEMID_ERP              = 42,
586 	WLAN_ELEMID_TCLAS_PROCESS    = 44,
587 	WLAN_ELEMID_HTCAP_ANA        = 45,
588 	WLAN_ELEMID_QOS_CAPABILITY   = 46,
589 	WLAN_ELEMID_RSN              = 48,
590 	WLAN_ELEMID_XRATES           = 50,
591 	WLAN_ELEMID_HTCAP_VENDOR     = 51,
592 	WLAN_ELEMID_HTINFO_VENDOR    = 52,
593 	WLAN_ELEMID_MOBILITY_DOMAIN  = 54,
594 	WLAN_ELEMID_FT               = 55,
595 	WLAN_ELEMID_TIMEOUT_INTERVAL = 56,
596 	WLAN_ELEMID_SUPP_OP_CLASS    = 59,
597 	WLAN_ELEMID_EXTCHANSWITCHANN = 60,
598 	WLAN_ELEMID_HTINFO_ANA       = 61,
599 	WLAN_ELEMID_SECCHANOFFSET    = 62,
600 	WLAN_ELEMID_WAPI             = 68,
601 	WLAN_ELEMID_TIME_ADVERTISEMENT = 69,
602 	WLAN_ELEMID_RRM              = 70,
603 	WLAN_ELEMID_MULTIPLE_BSSID   = 71,
604 	WLAN_ELEMID_2040_COEXT       = 72,
605 	WLAN_ELEMID_2040_INTOL       = 73,
606 	WLAN_ELEMID_OBSS_SCAN        = 74,
607 	WLAN_ELEMID_MMIE             = 76,
608 	WLAN_ELEMID_NONTX_BSSID_CAP  = 83,
609 	WLAN_ELEMID_MULTI_BSSID_IDX  = 85,
610 	WLAN_ELEMID_FMS_DESCRIPTOR   = 86,
611 	WLAN_ELEMID_FMS_REQUEST      = 87,
612 	WLAN_ELEMID_FMS_RESPONSE     = 88,
613 	WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90,
614 	WLAN_ELEMID_TFS_REQUEST      = 91,
615 	WLAN_ELEMID_TFS_RESPONSE     = 92,
616 	WLAN_ELEMID_TIM_BCAST_REQUEST  = 94,
617 	WLAN_ELEMID_TIM_BCAST_RESPONSE = 95,
618 	WLAN_ELEMID_INTERWORKING     = 107,
619 	WLAN_ELEMID_QOS_MAP          = 110,
620 	WLAN_ELEMID_XCAPS            = 127,
621 	WLAN_ELEMID_TPC              = 150,
622 	WLAN_ELEMID_CCKM             = 156,
623 	WLAN_ELEMID_VHTCAP           = 191,
624 	WLAN_ELEMID_VHTOP            = 192,
625 	WLAN_ELEMID_EXT_BSS_LOAD     = 193,
626 	WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH = 194,
627 	WLAN_ELEMID_VHT_TX_PWR_ENVLP = 195,
628 	WLAN_ELEMID_CHAN_SWITCH_WRAP = 196,
629 	WLAN_ELEMID_AID              = 197,
630 	WLAN_ELEMID_QUIET_CHANNEL    = 198,
631 	WLAN_ELEMID_OP_MODE_NOTIFY   = 199,
632 	WLAN_ELEMID_REDUCED_NEIGHBOR_REPORT = 201,
633 	WLAN_ELEMID_TWT              = 216,
634 	WLAN_ELEMID_VENDOR           = 221,
635 	WLAN_ELEMID_FILS_INDICATION  = 240,
636 	WLAN_ELEMID_FRAGMENT         = 242,
637 	WLAN_ELEMID_RSNXE            = 244,
638 	WLAN_ELEMID_EXTN_ELEM        = 255,
639 };
640 
641 /**
642  * enum extn_element_ie :- extended management information element
643  * @WLAN_EXTN_ELEMID_HECAP:  HE capabilities IE
644  * @WLAN_EXTN_ELEMID_HEOP:   HE Operation IE
645  * @WLAN_EXTN_ELEMID_UORA: UL OFDMA-based random access Parameter Set element
646  * @WLAN_EXTN_ELEMID_MUEDCA: MU-EDCA IE
647  * @WLAN_EXTN_ELEMID_HE_6G_CAP: HE 6GHz Band Capabilities IE
648  * @WLAN_EXTN_ELEMID_SRP:    spatial reuse parameter IE
649  * @WLAN_EXTN_ELEMID_BSS_COLOR_CHANGE_ANNOUNCE: BSS Color Change Announcement IE
650  * @WLAN_EXTN_ELEMID_MAX_CHAN_SWITCH_TIME: Maximum Channel Switch Time IE
651  * @WLAN_EXTN_ELEMID_NONINHERITANCE: Non inheritance IE
652  * @WLAN_EXTN_ELEMID_EHTOP: EHT Operation IE
653  * @WLAN_EXTN_ELEMID_ESP: Estimated Service Parameters Inbound element
654  * @WLAN_EXTN_ELEMID_MULTI_LINK: Multi-Link IE
655  * @WLAN_EXTN_ELEMID_EHTCAP: EHT Capabilities IE
656  * @WLAN_EXTN_ELEMID_T2LM: TID-to-link mapping IE
657  * @WLAN_EXTN_ELEMID_MULTI_LINK_TRAFFIC_IND: Multi-link Traffic Indication IE
658  */
659 enum extn_element_ie {
660 	WLAN_EXTN_ELEMID_ESP         = 11,
661 	WLAN_EXTN_ELEMID_HECAP       = 35,
662 	WLAN_EXTN_ELEMID_HEOP        = 36,
663 	WLAN_EXTN_ELEMID_UORA        = 37,
664 	WLAN_EXTN_ELEMID_MUEDCA      = 38,
665 	WLAN_EXTN_ELEMID_SRP         = 39,
666 	WLAN_EXTN_ELEMID_BSS_COLOR_CHANGE_ANNOUNCE = 42,
667 	WLAN_EXTN_ELEMID_MAX_CHAN_SWITCH_TIME = 52,
668 	WLAN_EXTN_ELEMID_NONINHERITANCE = 56,
669 	WLAN_EXTN_ELEMID_HE_6G_CAP   = 59,
670 #ifdef WLAN_FEATURE_11BE
671 	WLAN_EXTN_ELEMID_EHTOP       = 106,
672 #endif
673 #ifdef WLAN_FEATURE_11BE_MLO
674 	WLAN_EXTN_ELEMID_MULTI_LINK  = 107,
675 #endif
676 #ifdef WLAN_FEATURE_11BE
677 	WLAN_EXTN_ELEMID_EHTCAP      = 108,
678 #endif
679 	WLAN_EXTN_ELEMID_T2LM        = 109,
680 	WLAN_EXTN_ELEMID_MULTI_LINK_TRAFFIC_IND = 110,
681 };
682 
683 /**
684  * enum wlan_reason_code - wlan reason codes Reason codes
685  * (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45)
686  * @REASON_UNSPEC_FAILURE: Unspecified reason
687  * @REASON_PREV_AUTH_NOT_VALID: Previous authentication no longer valid
688  * @REASON_DEAUTH_NETWORK_LEAVING: Deauthenticated because sending station
689  * is leaving (or has left) IBSS or ESS
690  * @REASON_DISASSOC_DUE_TO_INACTIVITY: Disassociated due to inactivity
691  * @REASON_DISASSOC_AP_BUSY: Disassociated because AP is unable
692  * to handle all currently associated STAs
693  * @REASON_CLASS2_FRAME_FROM_NON_AUTH_STA: Class 2 frame received from
694  * nonauthenticated station
695  * @REASON_CLASS3_FRAME_FROM_NON_ASSOC_STA: Class 3 frame received from
696  * nonassociated station
697  * @REASON_DISASSOC_NETWORK_LEAVING: Disassociated because sending station
698  * is leaving (or has left) BSS
699  * @REASON_STA_NOT_AUTHENTICATED: Station requesting (re)association
700  * is not authenticated with responding station
701  * @REASON_BAD_PWR_CAPABILITY: Disassociated because the
702  * information in the Power Capability element is unacceptable
703  * @REASON_BAD_SUPPORTED_CHANNELS: Disassociated because the
704  * information in the Supported Channels element is unacceptable
705  * @REASON_DISASSOC_BSS_TRANSITION: Disassociated due to BSS transition
706  * management
707  * @REASON_INVALID_IE: Invalid element, i.e., an element defined in this
708  * standard for which the content does not meet the specifications in Clause 9
709  * @REASON_MIC_FAILURE: Message integrity code (MIC) failure
710  * @REASON_4WAY_HANDSHAKE_TIMEOUT: 4-Way Handshake timeout
711  * @REASON_GROUP_KEY_UPDATE_TIMEOUT: Group Key Handshake timeout
712  * @REASON_IN_4WAY_DIFFERS: Information element in 4-Way Handshake
713  * different from (Re)Association Request/Probe Response/Beacon frame
714  * @REASON_INVALID_GROUP_CIPHER: Invalid group cipher
715  * @REASON_INVALID_PAIRWISE_CIPHER: Invalid pairwise cipher
716  * @REASON_INVALID_AKMP: Invalid AKMP
717  * @REASON_UNSUPPORTED_RSNE_VER: Unsupported RSNE version
718  * @REASON_INVALID_RSNE_CAPABILITIES: Invalid RSNE capabilities
719  * @REASON_1X_AUTH_FAILURE: IEEE 802.1X authentication failed
720  * @REASON_CIPHER_SUITE_REJECTED: Cipher suite rejected because of the
721  * security policy
722  * @REASON_TDLS_PEER_UNREACHABLE: TDLS direct-link teardown due to TDLS
723  * peer STA unreachable via the TDLS direct link
724  * @REASON_TDLS_UNSPEC: TDLS direct-link teardown for unspecified
725  * reason
726  * @REASON_DISASSOC_SSP_REQUESTED: Disassociated because session terminated
727  * by SSP request
728  * @REASON_NO_SSP_ROAMING_AGREEMENT: Disassociated because of lack of SSP
729  * roaming agreement
730  * @REASON_BAD_CIPHER_OR_AKM: Requested service rejected because of SSP
731  * cipher suite or AKM requirement
732  * @REASON_LOCATION_NOT_AUTHORIZED: Requested service not authorized in
733  * this location
734  * @REASON_SERVICE_CHANGE_PRECLUDES_TS: TS deleted because QoS AP
735  * lacks sufficient bandwidth for this QoS STA due to a change in BSS service
736  * characteristics or operational mode (e.g., an HT BSS change from 40 MHz
737  * channel to 20 MHz channel)
738  * @REASON_QOS_UNSPECIFIED: Disassociated for unspecified, QoS-related
739  * reason
740  * @REASON_NO_BANDWIDTH: Disassociated because QoS AP lacks sufficient
741  * bandwidth for this QoS STA
742  * @REASON_XS_UNACKED_FRAMES: Disassociated because excessive number of
743  * frames need to be acknowledged, but are not acknowledged due to AP
744  * transmissions and/or poor channel conditions
745  * @REASON_EXCEEDED_TXOP: Disassociated because STA is transmitting outside
746  * the limits of its TXOPs
747  * @REASON_STA_LEAVING: Requested from peer STA as the STA is leaving the
748  * BSS (or resetting)
749  * @REASON_END_TS_BA_DLS: Requesting STA is no longer using the stream
750  * or session
751  * @REASON_UNKNOWN_TS_BA: Requesting STA received frames using a
752  * mechanism for which setup has not been completed
753  * @REASON_TIMEDOUT:  Requested from peer STA due to timeout
754  * @REASON_PEERKEY_MISMATCH: Peer STA does not support the requested
755  * cipher suite
756  * @REASON_AUTHORIZED_ACCESS_LIMIT_REACHED: Disassociated because
757  * authorized access limit reached
758  * @REASON_EXTERNAL_SERVICE_REQUIREMENTS: Disassociated due to external
759  * service requirements
760  * @REASON_INVALID_FT_ACTION_FRAME_COUNT: Invalid FT Action frame count
761  * @REASON_INVALID_PMKID: Invalid pairwise master key identifier (PMKID)
762  * @REASON_INVALID_MDE: Invalid MDE
763  * @REASON_INVALID_FTE: Invalid FTE
764  * @REASON_MESH_PEERING_CANCELLED: Mesh peering canceled for unknown
765  * reasons
766  * @REASON_MESH_MAX_PEERS: The mesh STA has reached the supported maximum
767  * number of peer mesh STAs
768  * @REASON_MESH_CONFIG_POLICY_VIOLATION: The received information violates
769  * the Mesh Configuration policy configured in the mesh STA profile
770  * @REASON_MESH_CLOSE_RCVD: The mesh STA has received a Mesh Peering Close
771  * frame requesting to close the mesh peering
772  * @REASON_MESH_MAX_RETRIES: The mesh STA has resent dot11MeshMaxRetries
773  * Mesh Peering Open frames, without receiving a Mesh Peering Confirm frame
774  * @REASON_MESH_CONFIRM_TIMEOUT: The confirmTimer for the mesh peering
775  * instance times out.
776  * @REASON_MESH_INVALID_GTK: The mesh STA fails to unwrap the GTK or
777  * the values in the wrapped contents do not match
778  * @REASON_MESH_INCONSISTENT_PARAMS: The mesh STA receives inconsistent
779  * information about the mesh parameters between mesh peering Management frames
780  * @REASON_MESH_INVALID_SECURITY_CAP: The mesh STA fails the authenticated
781  * mesh peering exchange because due to failure in selecting either the pairwise
782  * ciphersuite or group ciphersuite
783  * @REASON_MESH_PATH_ERROR_NO_PROXY_INFO: The mesh STA does not have proxy
784  * information for this external destination.
785  * @REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO: The mesh STA does not have
786  * forwarding information for this destination.
787  * @REASON_MESH_PATH_ERROR_DEST_UNREACHABLE: The mesh STA determines that
788  * the link to the next hop of an active path in its forwarding information is
789  * no longer usable.
790  * @REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS: The Deauthentication frame
791  * was sent because the MAC address of the STA already exists in the mesh BSS
792  * @REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ: The mesh STA performs
793  * channel switch to meet regulatory requirements.
794  * @REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED: The mesh STA performs channel
795  * switching with unspecified reason.
796  * @REASON_POOR_RSSI_CONDITIONS: Disassociated due to poor RSSI conditions
797  *
798  *
799  * Internal reason codes: Add any internal reason code just after
800  * REASON_PROP_START and decrease the value of REASON_PROP_START
801  * accordingly.
802  *
803  * @REASON_PROP_START: Start of prop reason code
804  * @REASON_HOST_TRIGGERED_LINK_DELETE: Dynamic link removal
805  * @REASON_OCI_MISMATCH: Reason OCI Mismatch happens
806  * @REASON_HOST_TRIGGERED_ROAM_FAILURE: Reason host triggered roam failed
807  * @REASON_FW_TRIGGERED_ROAM_FAILURE: Firmware triggered roam failed
808  * @REASON_GATEWAY_REACHABILITY_FAILURE: Due to NUD failure
809  * @REASON_UNSUPPORTED_CHANNEL_CSA: due to unsuppoerted channel in CSA
810  * @REASON_OPER_CHANNEL_DISABLED_INDOOR: as channel is disabled in indoor
811  * @REASON_OPER_CHANNEL_USER_DISABLED: due to channel disabled by user
812  * @REASON_DEVICE_RECOVERY: due to SSR
813  * @REASON_KEY_TIMEOUT: due to key Timeout
814  * @REASON_OPER_CHANNEL_BAND_CHANGE: due to change in BAND
815  * @REASON_IFACE_DOWN: as interface is going down
816  * @REASON_PEER_XRETRY_FAIL: due to sta kickout with reason no ACK
817  * @REASON_PEER_INACTIVITY: due to sta kickout with reason inactivity
818  * @REASON_SA_QUERY_TIMEOUT: due to sta kickout due to SA query timeout
819  * @REASON_CHANNEL_SWITCH_FAILED: as channel switch failed
820  * @REASON_BEACON_MISSED: due to beacon miss
821  * @REASON_USER_TRIGGERED_ROAM_FAILURE: Reason user triggered roam failed
822  * @REASON_HOST_TRIGGERED_SILENT_DEAUTH: deauth without sending deauth frame
823  */
824 enum wlan_reason_code {
825 	REASON_UNSPEC_FAILURE = 1,
826 	REASON_PREV_AUTH_NOT_VALID = 2,
827 	REASON_DEAUTH_NETWORK_LEAVING = 3,
828 	REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
829 	REASON_DISASSOC_AP_BUSY = 5,
830 	REASON_CLASS2_FRAME_FROM_NON_AUTH_STA = 6,
831 	REASON_CLASS3_FRAME_FROM_NON_ASSOC_STA = 7,
832 	REASON_DISASSOC_NETWORK_LEAVING = 8,
833 	REASON_STA_NOT_AUTHENTICATED = 9,
834 	REASON_BAD_PWR_CAPABILITY = 10,
835 	REASON_BAD_SUPPORTED_CHANNELS = 11,
836 	REASON_DISASSOC_BSS_TRANSITION = 12,
837 	REASON_INVALID_IE = 13,
838 	REASON_MIC_FAILURE = 14,
839 	REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
840 	REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
841 	REASON_IN_4WAY_DIFFERS = 17,
842 	REASON_INVALID_GROUP_CIPHER = 18,
843 	REASON_INVALID_PAIRWISE_CIPHER = 19,
844 	REASON_INVALID_AKMP = 20,
845 	REASON_UNSUPPORTED_RSNE_VER = 21,
846 	REASON_INVALID_RSNE_CAPABILITIES = 22,
847 	REASON_1X_AUTH_FAILURE = 23,
848 	REASON_CIPHER_SUITE_REJECTED = 24,
849 	REASON_TDLS_PEER_UNREACHABLE = 25,
850 	REASON_TDLS_UNSPEC = 26,
851 	REASON_DISASSOC_SSP_REQUESTED = 27,
852 	REASON_NO_SSP_ROAMING_AGREEMENT = 28,
853 	REASON_BAD_CIPHER_OR_AKM = 29,
854 	REASON_LOCATION_NOT_AUTHORIZED = 30,
855 	REASON_SERVICE_CHANGE_PRECLUDES_TS = 31,
856 	REASON_QOS_UNSPECIFIED = 32,
857 	REASON_NO_BANDWIDTH = 33,
858 	REASON_XS_UNACKED_FRAMES = 34,
859 	REASON_EXCEEDED_TXOP = 35,
860 	REASON_STA_LEAVING = 36,
861 	REASON_END_TS_BA_DLS = 37,
862 	REASON_UNKNOWN_TS_BA = 38,
863 	REASON_TIMEDOUT = 39,
864 	REASON_PEERKEY_MISMATCH = 45,
865 	REASON_AUTHORIZED_ACCESS_LIMIT_REACHED = 46,
866 	REASON_EXTERNAL_SERVICE_REQUIREMENTS = 47,
867 	REASON_INVALID_FT_ACTION_FRAME_COUNT = 48,
868 	REASON_INVALID_PMKID = 49,
869 	REASON_INVALID_MDE = 50,
870 	REASON_INVALID_FTE = 51,
871 	REASON_MESH_PEERING_CANCELLED = 52,
872 	REASON_MESH_MAX_PEERS = 53,
873 	REASON_MESH_CONFIG_POLICY_VIOLATION = 54,
874 	REASON_MESH_CLOSE_RCVD = 55,
875 	REASON_MESH_MAX_RETRIES = 56,
876 	REASON_MESH_CONFIRM_TIMEOUT = 57,
877 	REASON_MESH_INVALID_GTK = 58,
878 	REASON_MESH_INCONSISTENT_PARAMS = 59,
879 	REASON_MESH_INVALID_SECURITY_CAP = 60,
880 	REASON_MESH_PATH_ERROR_NO_PROXY_INFO = 61,
881 	REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO = 62,
882 	REASON_MESH_PATH_ERROR_DEST_UNREACHABLE = 63,
883 	REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64,
884 	REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65,
885 	REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED = 66,
886 	REASON_POOR_RSSI_CONDITIONS = 71,
887 	/* 72–65535 reserved */
888 
889 	/* Internal reason codes */
890 
891 	/*
892 	 * Internal reason codes: Add any internal reason code just after
893 	 * REASON_PROP_START and decrease the value of REASON_PROP_START
894 	 * accordingly.
895 	 */
896 	REASON_PROP_START = 65516,
897 	REASON_HOST_TRIGGERED_LINK_DELETE = 65517,
898 	REASON_OCI_MISMATCH = 65518,
899 	REASON_HOST_TRIGGERED_ROAM_FAILURE  = 65519,
900 	REASON_FW_TRIGGERED_ROAM_FAILURE = 65520,
901 	REASON_GATEWAY_REACHABILITY_FAILURE = 65521,
902 	REASON_UNSUPPORTED_CHANNEL_CSA = 65522,
903 	REASON_OPER_CHANNEL_DISABLED_INDOOR = 65523,
904 	REASON_OPER_CHANNEL_USER_DISABLED = 65524,
905 	REASON_DEVICE_RECOVERY = 65525,
906 	REASON_KEY_TIMEOUT = 65526,
907 	REASON_OPER_CHANNEL_BAND_CHANGE = 65527,
908 	REASON_IFACE_DOWN = 65528,
909 	REASON_PEER_XRETRY_FAIL = 65529,
910 	REASON_PEER_INACTIVITY = 65530,
911 	REASON_SA_QUERY_TIMEOUT = 65531,
912 	REASON_CHANNEL_SWITCH_FAILED = 65532,
913 	REASON_BEACON_MISSED = 65533,
914 	REASON_USER_TRIGGERED_ROAM_FAILURE = 65534,
915 	REASON_HOST_TRIGGERED_SILENT_DEAUTH = 65535,
916 };
917 
918 /**
919  * enum wlan_status_code - wlan status codes
920  * (IEEE Std 802.11-2016, 9.4.1.9, Table 9-46)
921  * @STATUS_SUCCESS: Success full
922  * @STATUS_UNSPECIFIED_FAILURE: Unspecified failure.
923  * @STATUS_TDLS_WAKEUP_REJECT: TDLS wakeup schedule rejected but alternative
924  * schedule provided.
925  * @STATUS_SECURITY_DISABLED: Security disabled.
926  * @STATUS_UNACCEPTABLE_LIFETIME: Unacceptable lifetime.
927  * @STATUS_NOT_IN_SAME_BSS: Not in same BSS.
928  * @STATUS_CAPS_UNSUPPORTED: Cannot support all requested capabilities in the
929  * Capability Information field.
930  * @STATUS_REASSOC_NO_ASSOC: Reassociation denied due to inability to confirm
931  * that association exists.
932  * @STATUS_ASSOC_DENIED_UNSPEC: Association denied due to reason outside the
933  * scope of this standard.
934  * @STATUS_NOT_SUPPORTED_AUTH_ALG: Responding STA does not support the specified
935  * authentication algorithm.
936  * @STATUS_UNKNOWN_AUTH_TRANSACTION: Received an Authentication frame with
937  * authentication transaction sequence number out of expected sequence.
938  * @STATUS_CHALLENGE_FAIL: Authentication rejected because of challenge failure.
939  * @STATUS_AUTH_TIMEOUT: Authentication rejected due to timeout waiting for next
940  * frame in sequence.
941  * @STATUS_AP_UNABLE_TO_HANDLE_NEW_STA: Association denied because AP is unable
942  * to handle additional associated STAs.
943  * @STATUS_ASSOC_DENIED_RATES: Association denied due to requesting STA not
944  * supporting all of the data rates in the BSSBasicRateSet parameter,
945  * the Basic HT-MCS Set field of the HT Operation parameter, or the Basic
946  * VHT-MCS and NSS Set field in the VHT Operation parameter.
947  * @STATUS_ASSOC_DENIED_NOSHORT: Association denied due to requesting
948  * STA not supporting the short preamble option.
949  * @STATUS_SPEC_MGMT_REQUIRED: Association request rejected because Spectrum
950  * Management capability is required.
951  * @STATUS_PWR_CAPABILITY_NOT_VALID: Association request rejected because the
952  * information in the Power Capability element is unacceptable.
953  * @STATUS_SUPPORTED_CHANNEL_NOT_VALID: Association request rejected because
954  * the information in the Supported Channels element is unacceptable.
955  * @STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME: Association denied due to requesting
956  * STA not supporting the Short Slot Time option.
957  * @STATUS_ASSOC_DENIED_NO_HT: Association denied because the requesting STA
958  * does not support HT features.
959  * @STATUS_R0KH_UNREACHABLE: R0KH unreachable.
960  * @STATUS_ASSOC_DENIED_NO_PCO: Association denied because the requesting STA
961  * does not support the phased coexistence operation (PCO) transition time
962  * required by the AP.
963  * @STATUS_ASSOC_REJECTED_TEMPORARILY: Association request rejected temporarily,
964  * try again later.
965  * @STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION: Robust management frame policy
966  * violation.
967  * @STATUS_UNSPECIFIED_QOS_FAILURE: Unspecified, QoS-related failure.
968  * @STATUS_DENIED_INSUFFICIENT_BANDWIDTH: Association denied because QoS AP or
969  * PCP has insufficient bandwidth to handle another QoS STA.
970  * @STATUS_DENIED_POOR_CHANNEL_CONDITIONS: Association denied due to excessive
971  * frame loss rates and/or poor conditions on current operating channel.
972  * @STATUS_DENIED_QOS_NOT_SUPPORTED: Association (with QoS BSS) denied because
973  * the requesting STA does not support the QoS facility.
974  * @STATUS_REQUEST_DECLINED: The request has been declined.
975  * @STATUS_INVALID_PARAMETERS: The request has not been successful as one
976  * or more parameters have invalid values.
977  * @STATUS_REJECTED_WITH_SUGGESTED_CHANGES: The allocation or TS has not been
978  * created because the request cannot be honored; however, a suggested TSPEC/DMG
979  * TSPEC is provided so that the initiating STA can attempt to set another
980  * allocation or TS with the suggested changes to the TSPEC/DMG TSPEC
981  * @STATUS_INVALID_IE: Invalid element, i.e., an element defined in this
982  * standard for which the content does not meet the specifications in Clause 9.
983  * @STATUS_GROUP_CIPHER_NOT_VALID: Invalid group cipher.
984  * @STATUS_PAIRWISE_CIPHER_NOT_VALID: Invalid pairwise cipher.
985  * @STATUS_AKMP_NOT_VALID: Invalid AKMP.
986  * @STATUS_UNSUPPORTED_RSN_IE_VERSION: Unsupported RSNE version.
987  * @STATUS_INVALID_RSN_IE_CAPAB: Invalid RSNE capabilities.
988  * @STATUS_CIPHER_REJECTED_PER_POLICY: Cipher suite rejected because of security
989  * policy.
990  * @STATUS_TS_NOT_CREATED: The TS or allocation has not been created; however,
991  * the HC or PCP might be capable of creating a TS or allocation, in response to
992  * a request, after the time indicated in the TS Delay element.
993  * @STATUS_DIRECT_LINK_NOT_ALLOWED: Direct link is not allowed in the BSS by
994  * policy.
995  * @STATUS_DEST_STA_NOT_PRESENT: The Destination STA is not present within this
996  * BSS.
997  * @STATUS_DEST_STA_NOT_QOS_STA: The Destination STA is not a QoS STA.
998  * @STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE: Association denied because the
999  * listen interval is too large.
1000  * @STATUS_INVALID_FT_ACTION_FRAME_COUNT: Invalid FT Action frame count.
1001  * @STATUS_INVALID_PMKID: Invalid pairwise master key identifier (PMKID).
1002  *
1003  * Internal status codes: Add any internal status code just after
1004  * STATUS_PROP_START and decrease the value of STATUS_PROP_START
1005  * accordingly.
1006  *
1007  * @STATUS_PROP_START: Start of prop status codes.
1008  * @STATUS_NO_NETWORK_FOUND: No network found
1009  * @STATUS_AUTH_TX_FAIL: Failed to sent AUTH on air
1010  * @STATUS_AUTH_NO_ACK_RECEIVED: No ack received for Auth tx
1011  * @STATUS_AUTH_NO_RESP_RECEIVED: No Auth response for Auth tx
1012  * @STATUS_ASSOC_TX_FAIL: Failed to sent Assoc on air
1013  * @STATUS_ASSOC_NO_ACK_RECEIVED: No ack received for Assoc tx
1014  * @STATUS_ASSOC_NO_RESP_RECEIVED: No Assoc response for Assoc tx
1015  */
1016 enum wlan_status_code {
1017 	STATUS_SUCCESS = 0,
1018 	STATUS_UNSPECIFIED_FAILURE = 1,
1019 	STATUS_TDLS_WAKEUP_REJECT = 3,
1020 	STATUS_SECURITY_DISABLED = 5,
1021 	STATUS_UNACCEPTABLE_LIFETIME = 6,
1022 	STATUS_NOT_IN_SAME_BSS = 7,
1023 	STATUS_CAPS_UNSUPPORTED = 10,
1024 	STATUS_REASSOC_NO_ASSOC = 11,
1025 	STATUS_ASSOC_DENIED_UNSPEC = 12,
1026 	STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
1027 	STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
1028 	STATUS_CHALLENGE_FAIL = 15,
1029 	STATUS_AUTH_TIMEOUT = 16,
1030 	STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
1031 	STATUS_ASSOC_DENIED_RATES = 18,
1032 	STATUS_ASSOC_DENIED_NOSHORT = 19,
1033 	STATUS_SPEC_MGMT_REQUIRED = 22,
1034 	STATUS_PWR_CAPABILITY_NOT_VALID = 23,
1035 	STATUS_SUPPORTED_CHANNEL_NOT_VALID = 24,
1036 	STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME = 25,
1037 	STATUS_ASSOC_DENIED_NO_HT = 27,
1038 	STATUS_R0KH_UNREACHABLE = 28,
1039 	STATUS_ASSOC_DENIED_NO_PCO = 29,
1040 	STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
1041 	STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
1042 	STATUS_UNSPECIFIED_QOS_FAILURE = 32,
1043 	STATUS_DENIED_INSUFFICIENT_BANDWIDTH = 33,
1044 	STATUS_DENIED_POOR_CHANNEL_CONDITIONS = 34,
1045 	STATUS_DENIED_QOS_NOT_SUPPORTED = 35,
1046 	STATUS_REQUEST_DECLINED = 37,
1047 	STATUS_INVALID_PARAMETERS = 38,
1048 	STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
1049 	STATUS_INVALID_IE = 40,
1050 	STATUS_GROUP_CIPHER_NOT_VALID = 41,
1051 	STATUS_PAIRWISE_CIPHER_NOT_VALID = 42,
1052 	STATUS_AKMP_NOT_VALID = 43,
1053 	STATUS_UNSUPPORTED_RSN_IE_VERSION = 44,
1054 	STATUS_INVALID_RSN_IE_CAPAB = 45,
1055 	STATUS_CIPHER_REJECTED_PER_POLICY = 46,
1056 	STATUS_TS_NOT_CREATED = 47,
1057 	STATUS_DIRECT_LINK_NOT_ALLOWED = 48,
1058 	STATUS_DEST_STA_NOT_PRESENT = 49,
1059 	STATUS_DEST_STA_NOT_QOS_STA = 50,
1060 	STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE = 51,
1061 	STATUS_INVALID_FT_ACTION_FRAME_COUNT = 52,
1062 	STATUS_INVALID_PMKID = 53,
1063 
1064 	/* Error STATUS code for intenal usage*/
1065 	STATUS_PROP_START = 65528,
1066 	STATUS_NO_NETWORK_FOUND = 65528,
1067 	STATUS_AUTH_TX_FAIL = 65529,
1068 	STATUS_AUTH_NO_ACK_RECEIVED = 65530,
1069 	STATUS_AUTH_NO_RESP_RECEIVED = 65531,
1070 	STATUS_ASSOC_TX_FAIL = 65532,
1071 	STATUS_ASSOC_NO_ACK_RECEIVED = 65533,
1072 	STATUS_ASSOC_NO_RESP_RECEIVED = 65534,
1073 };
1074 
1075 #define WLAN_OUI_SIZE 4
1076 #define WLAN_MAX_CIPHER 6
1077 #define WLAN_RSN_SELECTOR_LEN 4
1078 #define WLAN_WPA_SELECTOR_LEN 4
1079 #define PMKID_LEN 16
1080 #define MAX_PMK_LEN 64
1081 #define MAX_PMKID 4
1082 #define MAX_KEK_LENGTH 64
1083 #define MAX_KCK_LEN 32
1084 #define REPLAY_CTR_LEN 8
1085 #define KCK_KEY_LEN 16
1086 #define KEK_KEY_LEN 16
1087 #define KCK_192BIT_KEY_LEN 24
1088 #define KEK_256BIT_KEY_LEN 32
1089 
1090 #define WLAN_MAX_SECURE_LTF_KEYSEED_LEN 48
1091 #define WLAN_MIN_SECURE_LTF_KEYSEED_LEN 32
1092 
1093 #define WLAN_WPA_OUI 0xf25000
1094 #define WLAN_WPA_OUI_TYPE 0x01
1095 #define WPA_VERSION 1
1096 #define WLAN_WPA_SEL(x) (((x) << 24) | WLAN_WPA_OUI)
1097 
1098 #define WLAN_RSN_OUI 0xac0f00
1099 #define WLAN_CCKM_OUI 0x964000
1100 #define WLAN_CCKM_ASE_UNSPEC 0
1101 #define WLAN_WPA_CCKM_AKM 0x00964000
1102 #define WLAN_RSN_CCKM_AKM 0x00964000
1103 #define WLAN_RSN_DPP_AKM 0x029A6F50
1104 #define WLAN_RSN_OSEN_AKM 0x019A6F50
1105 
1106 #define RSN_VERSION 1
1107 #define WLAN_RSN_SEL(x) (((x) << 24) | WLAN_RSN_OUI)
1108 #define WLAN_CCKM_SEL(x) (((x) << 24) | WLAN_CCKM_OUI)
1109 
1110 #define WLAN_CSE_NONE                    0x00
1111 #define WLAN_CSE_WEP40                   0x01
1112 #define WLAN_CSE_TKIP                    0x02
1113 #define WLAN_CSE_RESERVED                0x03
1114 #define WLAN_CSE_CCMP                    0x04
1115 #define WLAN_CSE_WEP104                  0x05
1116 #define WLAN_CSE_AES_CMAC                0x06
1117 #define WLAN_CSE_GCMP_128                0x08
1118 #define WLAN_CSE_GCMP_256                0x09
1119 #define WLAN_CSE_CCMP_256                0x0A
1120 #define WLAN_CSE_BIP_GMAC_128            0x0B
1121 #define WLAN_CSE_BIP_GMAC_256            0x0C
1122 #define WLAN_CSE_BIP_CMAC_256            0x0D
1123 
1124 #define WLAN_AKM_IEEE8021X        0x01
1125 #define WLAN_AKM_PSK              0x02
1126 #define WLAN_AKM_FT_IEEE8021X     0x03
1127 #define WLAN_AKM_FT_PSK           0x04
1128 #define WLAN_AKM_SHA256_IEEE8021X 0x05
1129 #define WLAN_AKM_SHA256_PSK       0x06
1130 #define WLAN_AKM_SAE              0x08
1131 #define WLAN_AKM_FT_SAE           0x09
1132 #define WLAN_AKM_SUITEB_EAP_SHA256 0x0B
1133 #define WLAN_AKM_SUITEB_EAP_SHA384 0x0C
1134 #define WLAN_AKM_FT_SUITEB_EAP_SHA384 0x0D
1135 #define WLAN_AKM_FILS_SHA256      0x0E
1136 #define WLAN_AKM_FILS_SHA384      0x0F
1137 #define WLAN_AKM_FILS_FT_SHA256   0x10
1138 #define WLAN_AKM_FILS_FT_SHA384   0x11
1139 #define WLAN_AKM_OWE              0x12
1140 #define WLAN_AKM_SAE_EXT_KEY      0x18
1141 
1142 #define WLAN_ASE_NONE                    0x00
1143 #define WLAN_ASE_8021X_UNSPEC            0x01
1144 #define WLAN_ASE_8021X_PSK               0x02
1145 #define WLAN_ASE_FT_IEEE8021X            0x20
1146 #define WLAN_ASE_FT_PSK                  0x40
1147 #define WLAN_ASE_SHA256_IEEE8021X        0x80
1148 #define WLAN_ASE_SHA256_PSK              0x100
1149 #define WLAN_ASE_WPS                     0x200
1150 
1151 #define RSN_CAP_MFP_CAPABLE 0x80
1152 #define RSN_CAP_MFP_REQUIRED 0x40
1153 
1154 /* FILS Discovery */
1155 #define WLAN_ACTION_FILS_DISCOVERY         34
1156 #define WLAN_FD_FRAMECNTL_CAP              0x0020
1157 #define WLAN_FD_FRAMECNTL_SHORTSSID        0x0040
1158 #define WLAN_FD_FRAMECNTL_CH_CENTERFREQ    0x0200
1159 #define WLAN_FD_FRAMECNTL_LEN_PRES         0x1000
1160 #define WLAN_FD_FRAMECNTL_SHORTSSID_LEN    0x0003
1161 
1162 #define WLAN_FD_SSID_LEN_PRES(_v)          ((_v) & 0x1F)
1163 #define WLAN_FD_IS_CAP_PRESENT(_v)         ((_v) & WLAN_FD_FRAMECNTL_CAP)
1164 #define WLAN_FD_IS_LEN_PRESENT(_v)         ((_v) & WLAN_FD_FRAMECNTL_LEN_PRES)
1165 #define WLAN_FD_IS_FRAMECNTL_CH_CENTERFREQ(_v)\
1166 					((_v) & WLAN_FD_FRAMECNTL_CH_CENTERFREQ)
1167 
1168 #define WLAN_FD_CAP_LEN                    2
1169 #define WLAN_FD_CAP_ESS_S                  0
1170 #define WLAN_FD_CAP_PRIVACY_S              1
1171 #define WLAN_FD_CAP_BSS_CHWIDTH_S          2
1172 #define WLAN_FD_CAP_NSS_S                  5
1173 #define WLAN_FD_CAP_PHY_INDEX_S            2
1174 #define WLAN_FD_CAP_MIN_RATE_S             5
1175 
1176 #define WLAN_FD_CHWIDTH_20                 0
1177 #define WLAN_FD_CHWIDTH_40                 1
1178 #define WLAN_FD_CHWIDTH_80                 2
1179 #define WLAN_FD_CHWIDTH_160_80_80          3
1180 #define WLAN_FD_CHWIDTH_320                4
1181 
1182 #define WLAN_FD_CAP_NSS_GTE_5              4
1183 #define WLAN_FD_CAP_NSS_MODE_1             1
1184 #define WLAN_FD_CAP_NSS_MODE_2             2
1185 #define WLAN_FD_CAP_NSS_MODE_3             3
1186 #define WLAN_FD_CAP_NSS_MODE_4             4
1187 #define WLAN_FD_CAP_NSS_MODE_5             5
1188 #define WLAN_FD_CAP_NSS_MODE_6             6
1189 #define WLAN_FD_CAP_NSS_MODE_7             7
1190 #define WLAN_FD_CAP_NSS_MODE_8             8
1191 
1192 #define WLAN_FD_CAP_ESS_ENABLE             1
1193 
1194 #define WLAN_FD_CAP_PHY_INDEX_NON_HT_OFDM  1
1195 #define WLAN_FD_CAP_PHY_INDEX_HT           2
1196 #define WLAN_FD_CAP_PHY_INDEX_VHT          3
1197 #define WLAN_FD_CAP_PHY_INDEX_HE           4
1198 #ifdef WLAN_FEATURE_11BE
1199 #define WLAN_FD_CAP_PHY_INDEX_EHT          5
1200 #endif /* WLAN_FEATURE_11BE */
1201 
1202 #define WLAN_FD_CAP_MIN_RATE               0
1203 
1204 /**
1205  * struct element_info - defines length of a memory block and memory block
1206  * @len: length of memory block
1207  * @ptr: memory block pointer
1208  */
1209 struct element_info {
1210 	uint32_t len;
1211 	uint8_t *ptr;
1212 };
1213 
1214 /**
1215  * struct wlan_rsn_ie_hdr: rsn ie header
1216  * @elem_id: RSN element id WLAN_ELEMID_RSN.
1217  * @len: rsn ie length
1218  * @version: RSN ver
1219  */
1220 struct wlan_rsn_ie_hdr {
1221 	u8 elem_id;
1222 	u8 len;
1223 	u8 version[2];
1224 };
1225 
1226 #define WLAN_RSN_IE_MIN_LEN             2
1227 #define WLAN_WAPI_IE_MIN_LEN            20
1228 
1229 /**
1230  * struct wlan_wpa_ie_hdr: wpa ie header
1231  * @elem_id: Wpa element id, vendor specific.
1232  * @len: wpa ie length
1233  * @oui: 24-bit OUI followed by 8-bit OUI type
1234  * @version: wpa ver
1235  */
1236 struct wlan_wpa_ie_hdr {
1237 	u8 elem_id;
1238 	u8 len;
1239 	u8 oui[4];
1240 	u8 version[2];
1241 };
1242 
1243 #define WAPI_VERSION 1
1244 #define WLAN_WAPI_OUI 0x721400
1245 
1246 #define WLAN_WAPI_SEL(x) (((x) << 24) | WLAN_WAPI_OUI)
1247 
1248 #define WLAN_WAI_CERT_OR_SMS4 0x01
1249 #define WLAN_WAI_PSK 0x02
1250 
1251 /**
1252  * struct wlan_frame_hdr: generic IEEE 802.11 frames
1253  * @i_fc: frame control
1254  * @i_dur: duration field
1255  * @i_addr1: mac address 1
1256  * @i_addr2: mac address 2
1257  * @i_addr3: mac address 3
1258  * @i_addr_all: all 3 of the above in a single array
1259  * @i_seq: seq info
1260  */
1261 struct wlan_frame_hdr {
1262 	uint8_t i_fc[2];
1263 	uint8_t i_dur[2];
1264 	union {
1265 		struct {
1266 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1267 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1268 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1269 		};
1270 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1271 	};
1272 	uint8_t i_seq[2];
1273 } qdf_packed;
1274 
1275 struct wlan_frame_hdr_qos {
1276 	uint8_t i_fc[2];
1277 	uint8_t i_dur[2];
1278 	union {
1279 		struct {
1280 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1281 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1282 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1283 		};
1284 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1285 	};
1286 	uint8_t i_seq[2];
1287 	uint8_t i_qos[2];
1288 } qdf_packed;
1289 
1290 struct wlan_frame_hdr_qos_addr4 {
1291 	uint8_t i_fc[2];
1292 	uint8_t i_dur[2];
1293 	union {
1294 		struct {
1295 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1296 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1297 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1298 		};
1299 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1300 	};
1301 	uint8_t i_seq[2];
1302 	uint8_t i_addr4[QDF_MAC_ADDR_SIZE];
1303 	uint8_t i_qos[2];
1304 } qdf_packed;
1305 
1306 /* sequence number offset base on begin of mac header */
1307 #define WLAN_SEQ_CTL_OFFSET         22
1308 #define WLAN_LOW_SEQ_NUM_MASK       0x000F
1309 #define WLAN_HIGH_SEQ_NUM_MASK      0x0FF0
1310 #define WLAN_HIGH_SEQ_NUM_OFFSET    4
1311 
1312 /**
1313  * struct wlan_seq_ctl: sequence number control
1314  * @frag_num: frag number
1315  * @seq_num_lo: sequence number low byte
1316  * @seq_num_hi: sequence number high byte
1317  */
1318 struct wlan_seq_ctl {
1319 	uint8_t frag_num:4;
1320 	uint8_t seq_num_lo:4;
1321 	uint8_t seq_num_hi:8;
1322 } qdf_packed;
1323 
1324 /**
1325  * union wlan_capability : wlan_capability info
1326  * @wlan_caps: individual capability bits
1327  * @value: capability value
1328  */
1329 union wlan_capability {
1330 	struct caps {
1331 		uint16_t ess:1;
1332 		uint16_t ibss:1;
1333 		uint16_t cf_pollable:1;
1334 		uint16_t cf_poll_request:1;
1335 		uint16_t privacy:1;
1336 		uint16_t short_preamble:1;
1337 		uint16_t pbcc:1;
1338 		uint16_t channel_agility:1;
1339 		uint16_t spectrum_management:1;
1340 		uint16_t qos:1;
1341 		uint16_t short_slot_time:1;
1342 		uint16_t apsd:1;
1343 		uint16_t reserved2:1;
1344 		uint16_t dsss_ofdm:1;
1345 		uint16_t del_block_ack:1;
1346 		uint16_t immed_block_ack:1;
1347 	} wlan_caps;
1348 	uint16_t value;
1349 } qdf_packed;
1350 
1351 /**
1352  * struct ie_header : IE header
1353  * @ie_id: Element Id
1354  * @ie_len: IE Length
1355  */
1356 struct ie_header {
1357 	uint8_t ie_id;
1358 	uint8_t ie_len;
1359 } qdf_packed;
1360 
1361 /**
1362  * struct extn_ie_header : Extension IE header
1363  * @ie_id: Element Id
1364  * @ie_len: IE Length
1365  * @ie_extn_id: extension id
1366  */
1367 struct extn_ie_header {
1368 	uint8_t ie_id;
1369 	uint8_t ie_len;
1370 	uint8_t ie_extn_id;
1371 } qdf_packed;
1372 
1373 
1374 /**
1375  * struct ie_ssid : ssid IE
1376  * @ssid_id: SSID Element Id
1377  * @ssid_len: SSID IE Length
1378  * @ssid: ssid value
1379  */
1380 struct ie_ssid {
1381 	uint8_t ssid_id;
1382 	uint8_t ssid_len;
1383 	uint8_t ssid[WLAN_SSID_MAX_LEN];
1384 } qdf_packed;
1385 
1386 /**
1387  * struct ds_ie : ds IE
1388  * @ie: DS Element Id
1389  * @len: DS IE Length
1390  * @cur_chan: channel info
1391  */
1392 struct ds_ie {
1393 	uint8_t ie;
1394 	uint8_t len;
1395 	uint8_t cur_chan;
1396 } qdf_packed;
1397 
1398 /**
1399  * struct erp_ie: ERP IE
1400  * @ie: ERP Element Id
1401  * @len: ERP IE Length
1402  * @value: EP Info
1403  */
1404 struct erp_ie {
1405 	uint8_t ie;
1406 	uint8_t len;
1407 	uint8_t value;
1408 } qdf_packed;
1409 
1410 /**
1411  * struct htcap_cmn_ie: HT common IE info
1412  * @hc_cap: HT capabilities
1413  * @ampdu_param: ampdu params
1414  * @mcsset: supported MCS set
1415  * @extcap: extended HT capabilities
1416  * @txbf_cap: txbf capabilities
1417  * @antenna: antenna capabilities
1418  */
1419 struct htcap_cmn_ie {
1420 	uint16_t hc_cap;
1421 	uint8_t ampdu_param;
1422 	uint8_t mcsset[16];
1423 	uint16_t extcap;
1424 	uint32_t txbf_cap;
1425 	uint8_t antenna;
1426 } qdf_packed;
1427 
1428 /**
1429  * struct htcap_ie: HT Capability IE
1430  * @id: HT IE
1431  * @len: HT IE LEN
1432  * @ie: HT cap info
1433  */
1434 struct htcap_ie {
1435 	uint8_t id;
1436 	uint8_t len;
1437 	struct htcap_cmn_ie ie;
1438 } qdf_packed;
1439 
1440 /**
1441  * struct tbtt_information_header - TBTT information header
1442  * @tbbt_info_fieldtype: TBTT information field type
1443  * @filtered_neighbor_ap: filtered neighbor ap
1444  * @reserved: reserved bit
1445  * @tbtt_info_count: TBTT information count
1446  * @tbtt_info_length: TBTT information length
1447  */
1448 struct tbtt_information_header {
1449 	uint16_t tbbt_info_fieldtype:2,
1450 		 filtered_neighbor_ap:1,
1451 		 reserved:1,
1452 		 tbtt_info_count:4,
1453 		 tbtt_info_length:8;
1454 } qdf_packed;
1455 
1456 /**
1457  * struct fils_indication_ie: FILS indication IE element
1458  * @id: id
1459  * @len: len
1460  * @public_key_identifiers_cnt: public key identifiers count
1461  * @realm_identifiers_cnt: realm identifiers count
1462  * @is_ip_config_supported: whether ip config is supported in AP
1463  * @is_cache_id_present: whether cache identifier is present
1464  * @is_hessid_present: whether hessid is present
1465  * @is_fils_sk_auth_supported: FILS shared key authentication is supported
1466  * @is_fils_sk_auth_pfs_supported: FILS shared key auth with PFS is supported
1467  * @is_pk_auth_supported: FILS public key authentication is supported
1468  * @reserved: reserved
1469  * @variable_data: pointer to data depends on initial variables
1470  */
1471 struct fils_indication_ie {
1472 	uint8_t id;
1473 	uint8_t len;
1474 	uint16_t public_key_identifiers_cnt:3;
1475 	uint16_t realm_identifiers_cnt:3;
1476 	uint16_t is_ip_config_supported:1;
1477 	uint16_t is_cache_id_present:1;
1478 	uint16_t is_hessid_present:1;
1479 	uint16_t is_fils_sk_auth_supported:1;
1480 	uint16_t is_fils_sk_auth_pfs_supported:1;
1481 	uint16_t is_pk_auth_supported:1;
1482 	uint16_t reserved:4;
1483 	uint8_t variable_data[253];
1484 } qdf_packed;
1485 
1486 #define WLAN_VENDOR_HT_IE_OFFSET_LEN    4
1487 
1488 /**
1489  * struct wlan_vendor_ie_htcap: vendor private HT Capability IE
1490  * @id: HT IE
1491  * @hlen: HT IE len
1492  * @oui: vendor OUI
1493  * @oui_type: Oui type
1494  * @ie: HT cap info
1495  */
1496 struct wlan_vendor_ie_htcap {
1497 	uint8_t id;
1498 	uint8_t hlen;
1499 	uint8_t oui[3];
1500 	uint8_t oui_type;
1501 	struct htcap_cmn_ie ie;
1502 } qdf_packed;
1503 
1504 /**
1505  * struct wlan_ie_htinfo_cmn: ht info command
1506  * @hi_ctrlchannel: control channel
1507  * @hi_extchoff: B0-1 extension channel offset
1508  * @hi_txchwidth: B2 recommended xmiss width set
1509  * @hi_rifsmode: rifs mode
1510  * @hi_ctrlaccess: controlled access only
1511  * @hi_serviceinterval: B5-7 svc interval granularity
1512  * @hi_opmode: B0-1 operating mode
1513  * @hi_nongfpresent: B2 non greenfield devices present
1514  * @hi_txburstlimit: B3 transmit burst limit
1515  * @hi_obssnonhtpresent: B4 OBSS non-HT STA present
1516  * @hi_reserved0: B5-15 reserved
1517  * @hi_reserved2: B0-5 reserved
1518  * @hi_dualbeacon: B6 dual beacon
1519  * @hi_dualctsprot: B7 dual CTS protection
1520  * @hi_stbcbeacon: B8 STBC beacon
1521  * @hi_lsigtxopprot: B9 l-sig txop protection full support
1522  * @hi_pcoactive: B10 pco active
1523  * @hi_pcophase: B11 pco phase
1524  * @hi_reserved1: B12-15 reserved
1525  * @hi_basicmcsset: basic MCS set
1526  */
1527 struct wlan_ie_htinfo_cmn {
1528 	uint8_t hi_ctrlchannel;
1529 	uint8_t hi_extchoff:2,
1530 		hi_txchwidth:1,
1531 		hi_rifsmode:1,
1532 		hi_ctrlaccess:1,
1533 		hi_serviceinterval:3;
1534 	uint16_t hi_opmode:2,
1535 		hi_nongfpresent:1,
1536 		hi_txburstlimit:1,
1537 		hi_obssnonhtpresent:1,
1538 		hi_reserved0:11;
1539 	uint16_t hi_reserved2:6,
1540 		hi_dualbeacon:1,
1541 		hi_dualctsprot:1,
1542 		hi_stbcbeacon:1,
1543 		hi_lsigtxopprot:1,
1544 		hi_pcoactive:1,
1545 		hi_pcophase:1,
1546 		hi_reserved1:4;
1547 	uint8_t  hi_basicmcsset[16];
1548 } qdf_packed;
1549 
1550 /**
1551  * struct wlan_ie_htinfo: HT info IE
1552  * @hi_id: HT info IE
1553  * @hi_len: HT info IE len
1554  * @hi_ie: HT info info
1555  */
1556 struct wlan_ie_htinfo {
1557 	uint8_t hi_id;
1558 	uint8_t hi_len;
1559 	struct wlan_ie_htinfo_cmn  hi_ie;
1560 } qdf_packed;
1561 
1562 /**
1563  * struct wlan_vendor_ie_htinfo: vendor private HT info IE
1564  * @hi_id: HT info IE
1565  * @hi_len: HT info IE len
1566  * @hi_oui: vendor OUI
1567  * @hi_ouitype: Oui type
1568  * @hi_ie: HT info info
1569  */
1570 struct wlan_vendor_ie_htinfo {
1571 	uint8_t hi_id;
1572 	uint8_t hi_len;
1573 	uint8_t hi_oui[3];
1574 	uint8_t hi_ouitype;
1575 	struct wlan_ie_htinfo_cmn hi_ie;
1576 } qdf_packed;
1577 
1578 #define WLAN_VENDOR_VHTCAP_IE_OFFSET    7
1579 #define WLAN_VENDOR_VHTOP_IE_OFFSET     21
1580 
1581 /**
1582  * struct wlan_ie_vhtcaps - VHT capabilities
1583  * @elem_id: VHT caps IE
1584  * @elem_len: VHT caps IE len
1585  * @max_mpdu_len: MPDU length
1586  * @supported_channel_widthset: channel width set
1587  * @ldpc_coding: LDPC coding capability
1588  * @shortgi80: short GI 80 support
1589  * @shortgi160and80plus80: short Gi 160 & 80+80 support
1590  * @tx_stbc: Tx STBC cap
1591  * @rx_stbc: Rx STBC cap
1592  * @su_beam_former: SU beam former cap
1593  * @su_beam_formee: SU beam formee cap
1594  * @csnof_beamformer_antSup: Antenna support for beamforming
1595  * @num_soundingdim: Sound dimensions
1596  * @mu_beam_former: MU beam former cap
1597  * @mu_beam_formee: MU beam formee cap
1598  * @vht_txops: TXOP power save
1599  * @htc_vhtcap: HTC VHT capability
1600  * @max_ampdu_lenexp: AMPDU length
1601  * @vht_link_adapt: VHT link adapatation capable
1602  * @rx_antpattern: Rx Antenna pattern
1603  * @tx_antpattern: Tx Antenna pattern
1604  * @unused: reserved bits
1605  * @rx_mcs_map: RX MCS map
1606  * @rx_high_sup_data_rate : highest RX supported data rate
1607  * @reserved2: reserved bits
1608  * @tx_mcs_map: TX MCS map
1609  * @tx_sup_data_rate: highest TX supported data rate
1610  * @reserved3: reserved bits
1611  */
1612 struct wlan_ie_vhtcaps {
1613 	uint8_t elem_id;
1614 	uint8_t elem_len;
1615 	uint32_t max_mpdu_len:2;
1616 	uint32_t supported_channel_widthset:2;
1617 	uint32_t ldpc_coding:1;
1618 	uint32_t shortgi80:1;
1619 	uint32_t shortgi160and80plus80:1;
1620 	uint32_t tx_stbc:1;
1621 	uint32_t rx_stbc:3;
1622 	uint32_t su_beam_former:1;
1623 	uint32_t su_beam_formee:1;
1624 	uint32_t csnof_beamformer_antSup:3;
1625 	uint32_t num_soundingdim:3;
1626 	uint32_t mu_beam_former:1;
1627 	uint32_t mu_beam_formee:1;
1628 	uint32_t vht_txops:1;
1629 	uint32_t htc_vhtcap:1;
1630 	uint32_t max_ampdu_lenexp:3;
1631 	uint32_t vht_link_adapt:2;
1632 	uint32_t rx_antpattern:1;
1633 	uint32_t tx_antpattern:1;
1634 	uint32_t unused:2;
1635 	uint16_t rx_mcs_map;
1636 	uint16_t rx_high_sup_data_rate:13;
1637 	uint16_t reserved2:3;
1638 	uint16_t tx_mcs_map;
1639 	uint16_t tx_sup_data_rate:13;
1640 	uint16_t reserved3:3;
1641 } qdf_packed;
1642 
1643 /**
1644  * struct wlan_ie_vhtop: VHT op IE
1645  * @elem_id: VHT op IE
1646  * @elem_len: VHT op IE len
1647  * @vht_op_chwidth: BSS Operational Channel width
1648  * @vht_op_ch_freq_seg1: Channel Center frequency
1649  * @vht_op_ch_freq_seg2: Channel Center frequency for 80+80MHz
1650  * @vhtop_basic_mcs_set: Basic MCS set
1651  */
1652 struct wlan_ie_vhtop {
1653 	uint8_t elem_id;
1654 	uint8_t elem_len;
1655 	uint8_t vht_op_chwidth;
1656 	uint8_t vht_op_ch_freq_seg1;
1657 	uint8_t vht_op_ch_freq_seg2;
1658 	uint16_t vhtop_basic_mcs_set;
1659 } qdf_packed;
1660 
1661 #define WLAN_HE_PHYCAP_SU_BFER_OFFSET 3
1662 #define WLAN_HE_PHYCAP_SU_BFER_IDX 7
1663 #define WLAN_HE_PHYCAP_SU_BFER_BITS 1
1664 
1665 #define WLAN_HE_PHYCAP_160_SUPPORT BIT(2)
1666 #define WLAN_HE_PHYCAP_80_80_SUPPORT BIT(3)
1667 #define WLAN_HE_MACCAP_LEN 6
1668 #define WLAN_HE_PHYCAP_LEN 11
1669 #define WLAN_HE_MAX_MCS_MAPS 3
1670 /**
1671  * struct wlan_ie_hecaps - HT capabilities
1672  * @elem_id: HE caps IE
1673  * @elem_len: HE caps IE len
1674  * @elem_id_extn: HE caps extension id
1675  * @he_mac_cap: HE mac capabilities
1676  * @he_phy_cap: HE phy capabilities
1677  * @phy_cap_bytes: HT phy capability bytes
1678  * @supported_ch_width_set: Supported channel width set
1679  * @mcs_bw_map: MCS NSS map per bandwidth
1680  * @rx_mcs_map: RX MCS map
1681  * @tx_mcs_map: TX MCS map
1682  */
1683 struct wlan_ie_hecaps {
1684 	uint8_t elem_id;
1685 	uint8_t elem_len;
1686 	uint8_t elem_id_extn;
1687 	uint8_t he_mac_cap[WLAN_HE_MACCAP_LEN];
1688 	union {
1689 		uint8_t phy_cap_bytes[WLAN_HE_PHYCAP_LEN];
1690 		struct {
1691 			uint32_t reserved:1;
1692 			uint32_t supported_ch_width_set:7;
1693 		} qdf_packed;
1694 	} qdf_packed he_phy_cap;
1695 	struct {
1696 		uint16_t rx_mcs_map;
1697 		uint16_t tx_mcs_map;
1698 	} qdf_packed mcs_bw_map[WLAN_HE_MAX_MCS_MAPS];
1699 } qdf_packed;
1700 
1701 /**
1702  * struct subelem_header: Subelement header
1703  * @subelem_id: Subelement ID
1704  * @subelem_len: Subelement length
1705  */
1706 struct subelem_header {
1707 	uint8_t subelem_id;
1708 	uint8_t subelem_len;
1709 } qdf_packed;
1710 
1711 #ifdef WLAN_FEATURE_11BE
1712 #define WLAN_EHT_MACCAP_LEN 2
1713 #define WLAN_EHT_PHYCAP_LEN 9
1714 
1715 #define WLAN_EHT_MAX_MCS_MAPS 3
1716 
1717 #define EHTCAP_MAC_EPCSPRIACCESS_IDX                    0
1718 #define EHTCAP_MAC_EPCSPRIACCESS_BITS                   1
1719 #define EHTCAP_MAC_EHTOMCTRL_IDX                        1
1720 #define EHTCAP_MAC_EHTOMCTRL_BITS                       1
1721 #define EHTCAP_MAC_TRIGGERED_TXOP_MODE1_IDX             2
1722 #define EHTCAP_MAC_TRIGGERED_TXOP_MODE1_BITS            1
1723 #define EHTCAP_MAC_TRIGGERED_TXOP_MODE2_IDX             3
1724 #define EHTCAP_MAC_TRIGGERED_TXOP_MODE2_BITS            1
1725 #define EHTCAP_MAC_RESTRICTED_TWT_IDX                   4
1726 #define EHTCAP_MAC_RESTRICTED_TWT_BITS                  1
1727 #define EHTCAP_MAC_SCS_TRAFFIC_DESC_IDX                 5
1728 #define EHTCAP_MAC_SCS_TRAFFIC_DESC_BITS                1
1729 #define EHTCAP_MAC_MAX_MPDU_LEN_IDX                     6
1730 #define EHTCAP_MAC_MAX_MPDU_LEN_BITS                    2
1731 #define EHTCAP_MAC_MAX_A_MPDU_LEN_IDX                   8
1732 #define EHTCAP_MAC_MAX_A_MPDU_LEN_BITS                  1
1733 #define EHTCAP_MAC_TRS_SUPPORT_IDX                      9
1734 #define EHTCAP_MAC_TRS_SUPPORT_BITS                     1
1735 #define EHTCAP_MAC_TXOP_RET_SUPPP_IN_SHARING_MODE2_IDX  10
1736 #define EHTCAP_MAC_TXOP_RET_SUPPP_IN_SHARING_MODE2_BITS 1
1737 
1738 #define EHTCAP_PHY_320MHZIN6GHZ_IDX                     1
1739 #define EHTCAP_PHY_320MHZIN6GHZ_BITS                    1
1740 #define EHTCAP_PHY_242TONERUBWLT20MHZ_IDX               2
1741 #define EHTCAP_PHY_242TONERUBWLT20MHZ_BITS              1
1742 #define EHTCAP_PHY_NDP4XEHTLTFAND320NSGI_IDX            3
1743 #define EHTCAP_PHY_NDP4XEHTLTFAND320NSGI_BITS           1
1744 #define EHTCAP_PHY_PARTIALBWULMU_IDX                    4
1745 #define EHTCAP_PHY_PARTIALBWULMU_BITS                   1
1746 #define EHTCAP_PHY_SUBFMR_IDX                           5
1747 #define EHTCAP_PHY_SUBFMR_BITS                          1
1748 #define EHTCAP_PHY_SUBFME_IDX                           6
1749 #define EHTCAP_PHY_SUBFME_BITS                          1
1750 #define EHTCAP_PHY_BFMESSLT80MHZ_IDX                    7
1751 #define EHTCAP_PHY_BFMESSLT80MHZ_BITS                   3
1752 #define EHTCAP_PHY_BFMESS160MHZ_IDX                     10
1753 #define EHTCAP_PHY_BFMESS160MHZ_BITS                    3
1754 #define EHTCAP_PHY_BFMESS320MHZ_IDX                     13
1755 #define EHTCAP_PHY_BFMESS320MHZ_BITS                    3
1756 #define EHTCAP_PHY_NUMSOUNDLT80MHZ_IDX                  16
1757 #define EHTCAP_PHY_NUMSOUNDLT80MHZ_BITS                 3
1758 #define EHTCAP_PHY_NUMSOUND160MHZ_IDX                   19
1759 #define EHTCAP_PHY_NUMSOUND160MHZ_BITS                  3
1760 #define EHTCAP_PHY_NUMSOUND320MHZ_IDX                   22
1761 #define EHTCAP_PHY_NUMSOUND320MHZ_BITS                  3
1762 #define EHTCAP_PHY_NG16SUFB_IDX                         25
1763 #define EHTCAP_PHY_NG16SUFB_BITS                        1
1764 #define EHTCAP_PHY_NG16MUFB_IDX                         26
1765 #define EHTCAP_PHY_NG16MUFB_BITS                        1
1766 #define EHTCAP_PHY_CODBK42SUFB_IDX                      27
1767 #define EHTCAP_PHY_CODBK42SUFB_BITS                     1
1768 #define EHTCAP_PHY_CODBK75MUFB_IDX                      28
1769 #define EHTCAP_PHY_CODBK75MUFB_BITS                     1
1770 #define EHTCAP_PHY_TRIGSUBFFB_IDX                       29
1771 #define EHTCAP_PHY_TRIGSUBFFB_BITS                      1
1772 #define EHTCAP_PHY_TRIGMUBFPARTBWFB_IDX                 30
1773 #define EHTCAP_PHY_TRIGMUBFPARTBWFB_BITS                1
1774 #define EHTCAP_PHY_TRIGCQIFB_IDX                        31
1775 #define EHTCAP_PHY_TRIGCQIFB_BITS                       1
1776 
1777 #define EHTCAP_PHY_PARTBWDLMUMIMO_IDX                   32
1778 #define EHTCAP_PHY_PARTBWDLMUMIMO_BITS                  1
1779 #define EHTCAP_PHY_PSRSR_IDX                            33
1780 #define EHTCAP_PHY_PSRSR_BITS                           1
1781 #define EHTCAP_PHY_PWRBSTFACTOR_IDX                     34
1782 #define EHTCAP_PHY_PWRBSTFACTOR_BITS                    1
1783 #define EHTCAP_PHY_4XEHTLTFAND800NSGI_IDX               35
1784 #define EHTCAP_PHY_4XEHTLTFAND800NSGI_BITS              1
1785 #define EHTCAP_PHY_MAXNC_IDX                            36
1786 #define EHTCAP_PHY_MAXNC_BITS                           4
1787 #define EHTCAP_PHY_NONTRIGCQIFB_IDX                     40
1788 #define EHTCAP_PHY_NONTRIGCQIFB_BITS                    1
1789 #define EHTCAP_PHY_TX1024AND4096QAMLS242TONERU_IDX      41
1790 #define EHTCAP_PHY_TX1024AND4096QAMLS242TONERU_BITS     1
1791 #define EHTCAP_PHY_RX1024AND4096QAMLS242TONERU_IDX      42
1792 #define EHTCAP_PHY_RX1024AND4096QAMLS242TONERU_BITS     1
1793 #define EHTCAP_PHY_PPETHRESPRESENT_IDX                  43
1794 #define EHTCAP_PHY_PPETHRESPRESENT_BITS                 1
1795 #define EHTCAP_PHY_CMNNOMPKTPAD_IDX                     44
1796 #define EHTCAP_PHY_CMNNOMPKTPAD_BITS                    2
1797 #define EHTCAP_PHY_MAXNUMEHTLTF_IDX                     46
1798 #define EHTCAP_PHY_MAXNUMEHTLTF_BITS                    5
1799 #define EHTCAP_PHY_SUPMCS15_IDX                         51
1800 #define EHTCAP_PHY_SUPMCS15_BITS                        4
1801 #define EHTCAP_PHY_EHTDUPIN6GHZ_IDX                     55
1802 #define EHTCAP_PHY_EHTDUPIN6GHZ_BITS                    1
1803 #define EHTCAP_PHY_20MHZOPSTARXNDPWIDERBW_IDX           56
1804 #define EHTCAP_PHY_20MHZOPSTARXNDPWIDERBW_BITS          1
1805 #define EHTCAP_PHY_NONOFDMAULMUMIMOLT80MHZ_IDX          57
1806 #define EHTCAP_PHY_NONOFDMAULMUMIMOLT80MHZ_BITS         1
1807 #define EHTCAP_PHY_NONOFDMAULMUMIMO160MHZ_IDX           58
1808 #define EHTCAP_PHY_NONOFDMAULMUMIMO160MHZ_BITS          1
1809 #define EHTCAP_PHY_NONOFDMAULMUMIMO320MHZ_IDX           59
1810 #define EHTCAP_PHY_NONOFDMAULMUMIMO320MHZ_BITS          1
1811 #define EHTCAP_PHY_MUBFMRLT80MHZ_IDX                    60
1812 #define EHTCAP_PHY_MUBFMRLT80MHZ_BITS                   1
1813 #define EHTCAP_PHY_MUBFMR160MHZ_IDX                     61
1814 #define EHTCAP_PHY_MUBFMR160MHZ_BITS                    1
1815 #define EHTCAP_PHY_MUBFMR320MHZ_IDX                     62
1816 #define EHTCAP_PHY_MUBFMR320MHZ_BITS                    1
1817 #define EHTCAP_PHY_TB_SOUNDING_FEEDBACK_RL_IDX          63
1818 #define EHTCAP_PHY_TB_SOUNDING_FEEDBACK_RL_BITS         1
1819 #define EHTCAP_PHY_RX_1K_QAM_IN_WIDER_BW_DL_OFDMA_IDX   64
1820 #define EHTCAP_PHY_RX_1K_QAM_IN_WIDER_BW_DL_OFDMA_BITS  1
1821 #define EHTCAP_PHY_RX_4K_QAM_IN_WIDER_BW_DL_OFDMA_IDX   65
1822 #define EHTCAP_PHY_RX_4K_QAM_IN_WIDER_BW_DL_OFDMA_BITS  1
1823 
1824 #define EHTCAP_RX_MCS_NSS_MAP_IDX                       0
1825 #define EHTCAP_RX_MCS_NSS_MAP_BITS                      4
1826 #define EHTCAP_TX_MCS_NSS_MAP_IDX                       4
1827 #define EHTCAP_TX_MCS_NSS_MAP_BITS                      4
1828 
1829 #define EHTCAP_PPET_NSS_IDX               0
1830 #define EHTCAP_PPET_NSS_BITS              4
1831 #define EHTCAP_PPET_RU_INDEX_BITMASK_IDX  4
1832 #define EHTCAP_PPET_RU_INDEX_BITMASK_BITS 5
1833 
1834 #define EHTOP_INFO_PRESENT_IDX                           0
1835 #define EHTOP_INFO_PRESENT_BITS                          1
1836 #define EHTOP_PARAM_DISABLED_SC_BITMAP_PRESENT_IDX       1
1837 #define EHTOP_PARAM_DISABLED_SC_BITMAP_PRESENT_BITS      1
1838 #define EHTOP_DEFAULT_PE_DURATION_IDX                    2
1839 #define EHTOP_DEFAULT_PE_DURATION_BITS                   1
1840 #define EHTOP_GRP_ADDRESSED_BU_IND_LIMIT_IDX             3
1841 #define EHTOP_GRP_ADDRESSED_BU_IND_LIMIT_BITS            1
1842 #define EHTOP_GRP_ADDRESSED_BU_IND_EXPONENT_IDX          4
1843 #define EHTOP_GRP_ADDRESSED_BU_IND_EXPONENT_BITS         2
1844 
1845 #define EHTOP_INFO_CHAN_WIDTH_IDX          0
1846 #define EHTOP_INFO_CHAN_WIDTH_BITS         3
1847 
1848 #define EHTOP_RX_MCS_NSS_MAP_IDX                       0
1849 #define EHTOP_RX_MCS_NSS_MAP_BITS                      4
1850 #define EHTOP_TX_MCS_NSS_MAP_IDX                       4
1851 #define EHTOP_TX_MCS_NSS_MAP_BITS                      4
1852 
1853 #define MAX_EHT_MCS_NSS_MAP_LEN 9
1854 
1855 /**
1856  * struct eht_basic_mcs_nss_set - EHT Basic mcs nss set
1857  * @max_nss_mcs_0_7: Rx, Tx Max Nss That Supports EHT-MCS 0-7
1858  * @max_nss_mcs_8_9: Rx, Tx Max Nss That Supports EHT-MCS 8-9
1859  * @max_nss_mcs_10_11: Rx, Tx Max Nss That Supports EHT-MCS 10-11
1860  * @max_nss_mcs_12_13: Rx, Tx Max Nss That Supports EHT-MCS 12-13
1861  */
1862 struct eht_basic_mcs_nss_set {
1863 	uint8_t max_nss_mcs_0_7;
1864 	uint8_t max_nss_mcs_8_9;
1865 	uint8_t max_nss_mcs_10_11;
1866 	uint8_t max_nss_mcs_12_13;
1867 } qdf_packed;
1868 
1869 /**
1870  * struct wlan_ie_ehtcaps - EHT capabilities
1871  * @elem_id: EHT caps IE
1872  * @elem_len: EHT caps IE len
1873  * @elem_id_extn: EHT caps extension id
1874  * @eht_mac_cap: EHT mac capabilities
1875  * @eht_phy_cap: EHT phy capabilities
1876  * @phy_cap_bytes: EHT phy capability bytes
1877  * @supported_ch_width_set: Supported channel width set
1878  * @mcs_bw_map: MCS NSS map per bandwidth
1879  * @rx_mcs_map: RX MCS map
1880  * @tx_mcs_map: TX MCS map
1881  * @qdf_packed: silence kernel-doc warning
1882  */
1883 struct wlan_ie_ehtcaps {
1884 	uint8_t elem_id;
1885 	uint8_t elem_len;
1886 	uint8_t elem_id_extn;
1887 	uint8_t eht_mac_cap[WLAN_EHT_MACCAP_LEN];
1888 	union {
1889 		uint8_t phy_cap_bytes[WLAN_EHT_PHYCAP_LEN];
1890 		struct {
1891 			uint32_t reserved:1;
1892 			uint32_t supported_ch_width_set:7;
1893 		} qdf_packed;
1894 	} qdf_packed eht_phy_cap;
1895 	union {
1896 		struct {
1897 			uint8_t max_nss_mcs_0_9;
1898 			uint8_t max_nss_mcs_10_11;
1899 			uint8_t max_nss_mcs_12_13;
1900 		} qdf_packed mcs_bw_map[WLAN_EHT_MAX_MCS_MAPS];
1901 		struct eht_basic_mcs_nss_set mcs_bw_map_20_sta;
1902 		uint8_t mcs_nss_map_bytes[MAX_EHT_MCS_NSS_MAP_LEN];
1903 	} qdf_packed;
1904 } qdf_packed;
1905 
1906 /**
1907  * struct wlan_ie_ehtops - EHT operation element
1908  * @elem_id: EHT caps IE
1909  * @elem_len: EHT caps IE len
1910  * @elem_id_extn: EHT caps extension id
1911  * @ehtop_param: EHT Operation Parameters
1912  * @basic_mcs_nss_set: EHT basic mcs nss set
1913  * @control: Control field in EHT Operation Information
1914  * @ccfs0: EHT Channel Centre Frequency Segment0 information
1915  * @ccfs1: EHT Channel Centre Frequency Segment1 information
1916  * @disabled_sub_chan_bitmap: Bitmap to indicate 20MHz subchannel is punctured
1917  *                            or not
1918  */
1919 struct wlan_ie_ehtops {
1920 	uint8_t elem_id;
1921 	uint8_t elem_len;
1922 	uint8_t elem_id_extn;
1923 	uint8_t ehtop_param;
1924 	struct eht_basic_mcs_nss_set basic_mcs_nss_set;
1925 	uint8_t control;
1926 	uint8_t ccfs0;
1927 	uint8_t ccfs1;
1928 	uint8_t disabled_sub_chan_bitmap[2];
1929 } qdf_packed;
1930 
1931 #ifdef WLAN_FEATURE_11BE_MLO
1932 #define WLAN_MLO_MAX_VDEVS 2
1933 
1934 /* Size in octets of the BSS Parameters Change Count (sub)field */
1935 #define WLAN_ML_BSSPARAMCHNGCNT_SIZE                    1
1936 
1937 /**
1938  * struct rnr_mld_info - Reduced Neighbor Report MLD information
1939  * @mld_id: MLD ID
1940  * @link_id: Link ID
1941  * @bss_param_change_cnt: BSS parameters change count
1942  * @all_updates_included: All Updates Included
1943  * @reserved: Reserved/Spare bits
1944  */
1945 struct rnr_mld_info {
1946 	uint8_t mld_id;
1947 	uint16_t link_id: 4,
1948 		 bss_param_change_cnt: 8,
1949 		 all_updates_included: 1,
1950 		 reserved: 3;
1951 } qdf_packed;
1952 
1953 /**
1954  * struct wlan_ie_multilink - Fixed fields in Multi-Link IE
1955  * @elem_id: Element ID
1956  * @elem_len: Element length
1957  * @elem_id_ext: Element ID extension
1958  * @mlcontrol: Multi-Link element Control field
1959  */
1960 struct wlan_ie_multilink {
1961 	uint8_t elem_id;
1962 	uint8_t elem_len;
1963 	uint8_t elem_id_ext;
1964 	uint16_t mlcontrol;
1965 } qdf_packed;
1966 
1967 /**
1968  * struct wlan_sta_profile - Per STA profile IE
1969  * @sub_elem_id: Sub element ID
1970  * @per_sta_len: Per STA profile length
1971  * @sta_control: STA control field
1972  * @num_data: Number of valid data bytes
1973  * @data: Per STA profile IE elements
1974  */
1975 struct wlan_sta_profile {
1976 	uint8_t sub_elem_id;
1977 	uint8_t per_sta_len;
1978 	uint16_t sta_control;
1979 	uint8_t num_data;
1980 	uint8_t *data;
1981 } qdf_packed;
1982 
1983 /**
1984  * struct wlan_ml_probe_req - Multi-Link Probe req IE
1985  * @ml_ie_ff: Multi Link IE fixed field
1986  * @common_info_len: Common info length
1987  * @mld_id: MLD ID
1988  * @sta_profile: STA profile IE
1989  */
1990 struct wlan_ml_probe_req {
1991 	struct wlan_ie_multilink ml_ie_ff;
1992 	uint8_t common_info_len;
1993 	uint8_t mld_id;
1994 	struct wlan_sta_profile sta_profile[WLAN_MLO_MAX_VDEVS];
1995 } qdf_packed;
1996 /* The above fixed fields may be followed by:
1997  * Common Info (variable size)
1998  * Link Info (variable size)
1999  */
2000 
2001 /* Definitions related to Multi-Link element Control field applicable across
2002  * variants.
2003  */
2004 
2005 /* The below fields and subfields have been transitioned to D1.5, and the rest
2006  * will be checked and transitioned to D1.5 separately:
2007  * 1. Presence bitmap subfield in the Multi-Link Control field.
2008  * 2. Common Info Length subfield of Common Info field.
2009  * 3. STA Control field in Per-STA Profile subelement in Basic variant
2010  *    Multi-Link element Link Info field.
2011  * 4. STA Info Length subfield in STA Info field in Per-STA Profile subelement
2012  *    in Basic variant Multi-Link element Link Info field.
2013  * 5. EML Capabilities subfield of Common Info field.
2014  * 6. MLD Capabilities subfield of Common Info field.
2015  */
2016 
2017 /* Size in octets of Multi-Link element Control field */
2018 #define WLAN_ML_CTRL_SIZE                                          2
2019 
2020 /* Definitions for subfields in Multi-Link element Control field. Any unused
2021  * bits are reserved.
2022  */
2023 /* Type */
2024 #define WLAN_ML_CTRL_TYPE_IDX                                       0
2025 #define WLAN_ML_CTRL_TYPE_BITS                                      3
2026 /* Presence Bitmap */
2027 #define WLAN_ML_CTRL_PBM_IDX                                        4
2028 #define WLAN_ML_CTRL_PBM_BITS                                       12
2029 
2030 /**
2031  * enum wlan_ml_variant - Encoding for Type subfield in Multi-Link element
2032  * Control field, which provides the Multi-Link element variant.
2033  * Note: In case of holes in the enumeration, scheme for invalid value
2034  * determination should be changed.
2035  * @WLAN_ML_VARIANT_BASIC: Basic variant
2036  * @WLAN_ML_VARIANT_PROBEREQ: Probe Request variant
2037  * @WLAN_ML_VARIANT_RECONFIG: Reconfiguration variant
2038  * @WLAN_ML_VARIANT_TDLS: TDLS variant
2039  * @WLAN_ML_VARIANT_PRIORITYACCESS: Priority Access variant
2040  * @WLAN_ML_VARIANT_INVALIDSTART: Start of invalid value range
2041  */
2042 enum wlan_ml_variant {
2043 	WLAN_ML_VARIANT_BASIC = 0,
2044 	WLAN_ML_VARIANT_PROBEREQ = 1,
2045 	WLAN_ML_VARIANT_RECONFIG = 2,
2046 	WLAN_ML_VARIANT_TDLS = 3,
2047 	WLAN_ML_VARIANT_PRIORITYACCESS = 4,
2048 	WLAN_ML_VARIANT_INVALIDSTART,
2049 };
2050 
2051 /**
2052  *  enum wlan_ml_linfo_subelementid - IDs for subelements in Multi-Link element
2053  *  Link Info field.
2054  *  @WLAN_ML_LINFO_SUBELEMID_PERSTAPROFILE: Per-STA Profile
2055  *  @WLAN_ML_LINFO_SUBELEMID_VENDOR: Vendor specific
2056  *  @WLAN_ML_LINFO_SUBELEMID_FRAGMENT: Fragment
2057  */
2058 enum wlan_ml_linfo_subelementid {
2059 	WLAN_ML_LINFO_SUBELEMID_PERSTAPROFILE  = 0,
2060 	WLAN_ML_LINFO_SUBELEMID_VENDOR = 221,
2061 	WLAN_ML_LINFO_SUBELEMID_FRAGMENT = 254,
2062 };
2063 
2064 /* End of definitions related to Multi-Link element Control field applicable
2065  * across variants.
2066  */
2067 
2068 /* Definitions related to Basic variant Multi-Link element. */
2069 
2070 /* Definitions for bits in the Presence Bitmap subfield in Basic variant
2071  * Multi-Link element Control field. Any unused bits are reserved.
2072  */
2073 /* Link ID Info Present */
2074 #define WLAN_ML_BV_CTRL_PBM_LINKIDINFO_P               ((uint16_t)BIT(0))
2075 /* BSS Parameters Change Count Present */
2076 #define WLAN_ML_BV_CTRL_PBM_BSSPARAMCHANGECNT_P        ((uint16_t)BIT(1))
2077 /* Medium Synchronization Delay Information Present */
2078 #define WLAN_ML_BV_CTRL_PBM_MEDIUMSYNCDELAYINFO_P      ((uint16_t)BIT(2))
2079 /* EML Capabilities Present */
2080 #define WLAN_ML_BV_CTRL_PBM_EMLCAP_P                   ((uint16_t)BIT(3))
2081 /* MLD Capabilities and operation Present */
2082 #define WLAN_ML_BV_CTRL_PBM_MLDCAPANDOP_P              ((uint16_t)BIT(4))
2083 /* MLD ID Present */
2084 #define WLAN_ML_BV_CTRL_PBM_MLDID_P                    ((uint16_t)BIT(5))
2085 
2086 /* Definitions related to Basic variant Multi-Link element Common Info field */
2087 
2088 /* Size in octets of Common Info Length subfield of Common Info field in
2089  * Basic variant Multi-Link element.
2090  */
2091 /* Common Info Length  */
2092 #define WLAN_ML_BV_CINFO_LENGTH_SIZE                               1
2093 
2094 /* Size in octets of Link ID Info subfield in Basic variant Multi-Link element
2095  * Common Info field.
2096  */
2097 #define WLAN_ML_BV_CINFO_LINKIDINFO_SIZE                            1
2098 
2099 /* Definitions for sub-sub fields in Link ID Info subfield in Basic variant
2100  * Multi-Link element Common Info field. Any unused bits are reserved.
2101  */
2102 /* Link ID */
2103 #define WLAN_ML_BV_CINFO_LINKIDINFO_LINKID_IDX                      0
2104 #define WLAN_ML_BV_CINFO_LINKIDINFO_LINKID_BITS                     4
2105 
2106 /* Size in octets of Medium Synchronization Delay Information subfield in Basic
2107  * variant Multi-Link element Common Info field.
2108  */
2109 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_SIZE                      2
2110 
2111 /* Definitions for sub-sub fields in Medium Synchronization Delay Information
2112  * subfield in Basic variant Multi-Link element Common Info field.
2113  */
2114 /* Medium Synchronization Duration */
2115 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_DURATION_IDX             0
2116 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_DURATION_BITS            8
2117 /* Medium Synchronization OFDM ED Threshold  */
2118 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_OFDMEDTHRESH_IDX         8
2119 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_OFDMEDTHRESH_BITS        4
2120 /* Medium Synchronization Maximum Number Of TXOPs  */
2121 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_MAXTXOPS_IDX             12
2122 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_MAXTXOPS_BITS            4
2123 
2124 /* Size in octets of EML Capabilities subfield in Basic variant Multi-Link
2125  * element Common Info field.
2126  */
2127 #define WLAN_ML_BV_CINFO_EMLCAP_SIZE                                2
2128 
2129 /* Definitions for sub-sub fields in EML Capabilities subfield in Basic variant
2130  * Multi-Link element Common Info field as per IEEE P802.11be/D1.5.
2131  * Any unused bits are reserved.
2132  */
2133 /* EMLSR Support */
2134 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRSUPPORT_IDX                    0
2135 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRSUPPORT_BITS                   1
2136 /* EMLSR Delay */
2137 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSR_PADDINGDELAY_IDX              1
2138 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSR_PADDINGDELAY_BITS             3
2139 /* EMLSR Transition Delay */
2140 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_IDX                 4
2141 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_BITS                3
2142 /* EMLMR Support */
2143 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRSUPPORT_IDX                    7
2144 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRSUPPORT_BITS                   1
2145 /* EMLMR Delay */
2146 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_IDX                      8
2147 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_BITS                     3
2148 /* Transition Timeout */
2149 #define WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_IDX                    11
2150 #define WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_BITS                   4
2151 
2152 /**
2153  * enum wlan_ml_bv_cinfo_emlcap_emlsr_padding_delay - Encoding for EMLSR Padding
2154  * Delay sub field in EML Capabilities subfield in Basic variant Multi-Link
2155  * element Common Info field.
2156  * Note: In case of holes in the enumeration, scheme for invalid value
2157  * determination should be changed.
2158  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_0US: EMLSR delay of 0 us
2159  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_32US: EMLSR delay of 32 us
2160  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_64US: EMLSR delay of 64 us
2161  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_128US: EMLSR delay of 128 us
2162  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_256US: EMLSR delay of 256 us
2163  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_INVALIDSTART: Start of invalid value
2164  * range
2165  */
2166 enum wlan_ml_bv_cinfo_emlcap_emlsr_padding_delay {
2167 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_0US = 0,
2168 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_32US = 1,
2169 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_64US = 2,
2170 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_128US = 3,
2171 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_256US = 4,
2172 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_INVALIDSTART,
2173 };
2174 
2175 /**
2176  * enum wlan_ml_bv_cinfo_emlsr_transition_delay - Encoding for EMLSR
2177  * Transition delay in EML Capabilities subfield in Basic variant
2178  * Multi-Link element Common Info field.
2179  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_0US: EMLSR transition delay of 0 us
2180  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_16US: EMLSR transition delay of
2181  * 16 us
2182  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_32US: EMLSR transition delay of
2183  * 32 us
2184  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_64US: EMLSR transition delay of
2185  * 64 us
2186  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_128US: EMLSR transition delay of
2187  * 128 us
2188  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_256US: EMLSR transition delay of
2189  * 256 us
2190  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_INVALIDSTART: Start of invalid
2191  * value range
2192  */
2193 enum wlan_ml_bv_cinfo_emlsr_transition_delay {
2194 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_0US = 0,
2195 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_16US = 1,
2196 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_32US = 2,
2197 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_64US = 3,
2198 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_128US = 4,
2199 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_256US = 5,
2200 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRTRANSDELAY_INVALIDSTART,
2201 };
2202 
2203 /**
2204  * enum wlan_ml_bv_cinfo_emlcap_emlmrdelay - Encoding for EMLMR Delay
2205  * sub-sub field in EML Capabilities subfield in Basic variant
2206  * Multi-Link element Common Info field
2207  * Note: In case of holes in the enumeration, scheme for invalid value
2208  * determination should be changed.
2209  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_0US: EMLMR delay of 0 us
2210  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_32US: EMLMR delay of 32 us
2211  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_64US: EMLMR delay of 64 us
2212  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_128US: EMLMR delay of 128 us
2213  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_256US: EMLMR delay of 256 us
2214  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_INVALIDSTART: Start of invalid
2215  *                                                   value range
2216  */
2217 enum wlan_ml_bv_cinfo_emlcap_emlmrdelay {
2218 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_0US = 0,
2219 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_32US = 1,
2220 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_64US = 2,
2221 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_128US = 3,
2222 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_256US = 4,
2223 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_INVALIDSTART,
2224 };
2225 
2226 /**
2227  * enum wlan_ml_bv_cinfo_emlcap_transtimeout - Encoding for Transition Timeout
2228  * sub-sub field in EML Capabilities subfield in Basic variant Multi-Link
2229  * element Common Info field.
2230  * Note: a) In case of holes in the enumeration, scheme for invalid value
2231  * determination should be changed. b) A mathematical formula could have been
2232  * used instead of an enumeration. However, the standard explicitly lists out
2233  * values instead of using a formula, and we reflect this accordingly using an
2234  * enumeration.
2235  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_0TU: Transition Timeout value of 0 TUs
2236  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128MU: Transition Timeout value of
2237  *                                              128μs
2238  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_256MU: Transition Timeout value of
2239  *                                              256μs
2240  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_512MU: Transition Timeout value of
2241  *                                              512μs
2242  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_1TU: Transition Timeout value of 1 TU
2243  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_2TU: Transition Timeout value of 2 TUs
2244  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_4TU: Transition Timeout value of 4 TUs
2245  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_8TU: Transition Timeout value of 8 TUs
2246  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_16TU: Transition Timeout value of 16
2247  *                                             TUs
2248  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_32TU: Transition Timeout value of 32
2249  *                                             TUs
2250  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_64TU: Transition Timeout value of 64
2251  *                                             TUs
2252  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128TU: Transition Timeout value of 128
2253  *                                              TUs
2254  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_INVALIDSTART: Start of invalid value
2255  *                                                     range
2256  */
2257 enum wlan_ml_bv_cinfo_emlcap_transtimeout {
2258 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_0TU = 0,
2259 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128MU = 1,
2260 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_256MU = 2,
2261 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_512MU = 3,
2262 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_1TU = 4,
2263 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_2TU = 5,
2264 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_4TU = 6,
2265 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_8TU = 7,
2266 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_16TU = 8,
2267 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_32TU = 9,
2268 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_64TU = 10,
2269 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128TU = 11,
2270 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_INVALIDSTART,
2271 };
2272 
2273 /* Size in octets of MLD Capabilities and operation subfield in Basic variant
2274  * Multi-Link element Common Info field as per IEEE P802.11be/D1.5.
2275  */
2276 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_SIZE                                2
2277 
2278 /* Definitions for sub-sub fields in MLD Capabilities subfield in Basic variant
2279  * Multi-Link element Common Info field. Any unused bits are reserved.
2280  */
2281 /* Maximum Number Of Simultaneous Links */
2282 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_MAXSIMULLINKS_IDX                   0
2283 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_MAXSIMULLINKS_BITS                  4
2284 /* SRS Support */
2285 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_SRSSUPPORT_IDX                      4
2286 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_SRSSUPPORT_BITS                     1
2287 /* TID-To-Link Mapping Negotiation Supported */
2288 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_TIDTOLINKMAPNEGSUPPORT_IDX          5
2289 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_TIDTOLINKMAPNEGSUPPORT_BITS         2
2290 /* Frequency Separation For STR */
2291 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_STRFREQSEPARATION_IDX               7
2292 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_STRFREQSEPARATION_BITS              5
2293 /* AAR Support */
2294 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_AARSUPPORT_IDX                      12
2295 #define WLAN_ML_BV_CINFO_MLDCAPANDOP_AARSUPPORT_BITS                     1
2296 
2297 /* Size in octets of MLD ID subfield in Basic variant Multi-Link
2298  * element Common Info field.
2299  */
2300 #define WLAN_ML_BV_CINFO_MLDID_SIZE                                      1
2301 
2302 /* Max value in octets of Common Info Length subfield of Common Info field in
2303  * Basic variant Multi-Link element
2304  */
2305 #define WLAN_ML_BV_CINFO_LENGTH_MAX \
2306 	(WLAN_ML_BV_CINFO_LENGTH_SIZE + \
2307 	 QDF_MAC_ADDR_SIZE + \
2308 	 WLAN_ML_BV_CINFO_LINKIDINFO_SIZE + \
2309 	 WLAN_ML_BSSPARAMCHNGCNT_SIZE + \
2310 	 WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_SIZE + \
2311 	 WLAN_ML_BV_CINFO_EMLCAP_SIZE + \
2312 	 WLAN_ML_BV_CINFO_MLDCAPANDOP_SIZE + \
2313 	 WLAN_ML_BV_CINFO_MLDID_SIZE)
2314 
2315 /* End of definitions related to Basic variant Multi-Link element Common Info
2316  * field.
2317  */
2318 
2319 /* Definitions related to Basic variant Multi-Link element Link Info field */
2320 
2321 /* Basic variant Multi-Link element Link Info field contains zero or more
2322  * subelements.
2323  */
2324 
2325 /**
2326  * struct wlan_ml_bv_linfo_perstaprof - Fixed fields of Per-STA Profile
2327  * subelement in Basic variant Multi-Link element Link Info field
2328  * @subelem_id: Subelement ID
2329  * @subelem_len: Subelement length
2330  * @stacontrol: STA Control
2331  */
2332 struct wlan_ml_bv_linfo_perstaprof {
2333 	uint8_t subelem_id;
2334 	uint8_t subelem_len;
2335 	uint16_t stacontrol;
2336 } qdf_packed;
2337 
2338 /* The above fixed fields may be followed by:
2339  * STA Info (variable size)
2340  * STA Profile (variable size)
2341  */
2342 
2343 /* Size in octets of STA Control field of Per-STA Profile subelement in Basic
2344  * variant Multi-Link element Link Info field.
2345  */
2346 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_SIZE                   2
2347 
2348 /* Definitions for subfields in STA Control field of Per-STA Profile subelement
2349  * in Basic variant Multi-Link element Link Info field. Any unused bits are
2350  * reserved.
2351  */
2352 /* Link ID */
2353 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_LINKID_IDX              0
2354 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_LINKID_BITS             4
2355 /* Complete Profile */
2356 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_IDX           4
2357 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_BITS          1
2358 /* MAC Address Present */
2359 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_MACADDRP_IDX            5
2360 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_MACADDRP_BITS           1
2361 /* Beacon Interval Present */
2362 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BCNINTP_IDX             6
2363 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BCNINTP_BITS            1
2364 /* TSF Offset Present */
2365 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_TSFOFFSETP_IDX          7
2366 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_TSFOFFSETP_BITS         1
2367 /* DTIM Info Present */
2368 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_DTIMINFOP_IDX           8
2369 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_DTIMINFOP_BITS          1
2370 /* NSTR Link Pair Present */
2371 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRLINKPRP_IDX         9
2372 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRLINKPRP_BITS        1
2373 /* NSTR Bitmap Size */
2374 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_IDX            10
2375 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_BITS           1
2376 /* BSS Parameters Change Count Present */
2377 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BSSPARAMCHNGCNTP_IDX    11
2378 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BSSPARAMCHNGCNTP_BITS   1
2379 
2380 /* Definitions for subfields in STA Info field of Per-STA Profile subelement
2381  * in Basic variant Multi-Link element Link Info field.
2382  */
2383 /* STA Info Length */
2384 #define WLAN_ML_BV_LINFO_PERSTAPROF_STAINFO_LENGTH_SIZE             1
2385 
2386 /* Size in octets of the TSF Offset in STA info field of Per-STA Profile
2387  * subelement in Basic variant Multi-Link element Link Info field.
2388  */
2389 #define WLAN_ML_TSF_OFFSET_SIZE             8
2390 
2391 /**
2392  * enum wlan_ml_bv_linfo_perstaprof_stactrl_nstrbmsz - Encoding for
2393  * NSTR Bitmap Size in STA Control field of Per-STA Profile subelement
2394  * in Basic variant Multi-Link element Link Info field.
2395  * Note: In case of holes in the enumeration, scheme for invalid value
2396  * determination should be changed.
2397  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_1_OCTET: NSTR Indication
2398  * Bitmap size of 1 octet
2399  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_2_OCTETS: NSTR Indication
2400  * Bitmap size of 2 octets
2401  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_INVALIDSTART: Start of invalid
2402  * value range
2403  */
2404 enum wlan_ml_bv_linfo_perstaprof_stactrl_nstrbmsz {
2405 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_1_OCTET = 0,
2406 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_2_OCTETS = 1,
2407 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_INVALIDSTART,
2408 };
2409 
2410 /* Max size in octets of the NSTR Bitmap in STA Control field of Per-STA Profile
2411  * subelement in Basic variant Multi-Link element Link Info field.
2412  */
2413 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_MAX 2
2414 
2415 /**
2416  * struct wlan_ml_bv_linfo_perstaprof_stainfo_dtiminfo - DTIM info in STA info
2417  * in Per-STA Profile subelement in Basic variant Multi-Link element Link Info
2418  * field.
2419  * @dtimcount: DTIM Count
2420  * @dtimperiod: DTIM Period
2421  */
2422 struct wlan_ml_bv_linfo_perstaprof_stainfo_dtiminfo {
2423 	uint8_t dtimcount;
2424 	uint8_t dtimperiod;
2425 } qdf_packed;
2426 
2427 /* Max value in octets of STA Info Length in STA Info field of Per-STA Profile
2428  * subelement in Basic variant Multi-Link element Link Info field.
2429  */
2430 #define WLAN_ML_BV_LINFO_PERSTAPROF_STAINFO_LENGTH_MAX \
2431 	(WLAN_ML_BV_LINFO_PERSTAPROF_STAINFO_LENGTH_SIZE + \
2432 	 QDF_MAC_ADDR_SIZE + \
2433 	 WLAN_BEACONINTERVAL_LEN + \
2434 	 WLAN_ML_TSF_OFFSET_SIZE + \
2435 	 sizeof(struct wlan_ml_bv_linfo_perstaprof_stainfo_dtiminfo) + \
2436 	 WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_MAX + \
2437 	 WLAN_ML_BSSPARAMCHNGCNT_SIZE)
2438 
2439 /* End of definitions related to Basic variant Multi-Link element Link Info
2440  * field.
2441  */
2442 
2443 /* End of definitions related to Basic variant Multi-Link element. */
2444 
2445 /* Definitions related to Probe Req Multi-Link element Link Info field */
2446 
2447 /* Probe Req variant Multi-Link element Link Info field contains zero or more
2448  * subelements.
2449  */
2450 
2451 /**
2452  * struct wlan_ml_prv_linfo_perstaprof - Fixed fields of Per-STA Profile
2453  * subelement in Probe Request variant Multi-Link element Link Info field
2454  * @subelem_id: Subelement ID
2455  * @subelem_len: Subelement length
2456  * @stacontrol: STA Control
2457  */
2458 struct wlan_ml_prv_linfo_perstaprof {
2459 	uint8_t subelem_id;
2460 	uint8_t subelem_len;
2461 	uint16_t stacontrol;
2462 } qdf_packed;
2463 
2464 /* The above fixed fields may be followed by:
2465  * STA Profile (variable size)
2466  */
2467 
2468 /* Size in octets of STA Control field of Per-STA Profile subelement in Basic
2469  * variant Multi-Link element Link Info field.
2470  */
2471 #define WLAN_ML_PRV_LINFO_PERSTAPROF_STACTRL_SIZE                   2
2472 
2473 /* Definitions for subfields in STA Control field of Per-STA Profile subelement
2474  * in Probe Req variant Multi-Link element Link Info field. Any unused bits are
2475  * reserved.
2476  */
2477 /* Link ID */
2478 #define WLAN_ML_PRV_LINFO_PERSTAPROF_STACTRL_LINKID_IDX              0
2479 #define WLAN_ML_PRV_LINFO_PERSTAPROF_STACTRL_LINKID_BITS             4
2480 /* Complete Profile */
2481 #define WLAN_ML_PRV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_IDX           4
2482 #define WLAN_ML_PRV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_BITS          1
2483 
2484 /* Definitions for bits in the Presence Bitmap subfield in Probe Req variant
2485  * Multi-Link element Control field. Any unused bits are reserved.
2486  */
2487 /* MLD ID Present */
2488 #define WLAN_ML_PRV_CTRL_PBM_MLDID_P               ((uint16_t)BIT(0))
2489 /* Size in octets of Common Info Length subfield of Common Info field in
2490  * Probe Req variant Multi-Link element.
2491  */
2492 /* Common Info Length  */
2493 #define WLAN_ML_PRV_CINFO_LENGTH_SIZE                               1
2494 
2495 /* Size in octets of MLD ID subfield in Probe Req variant Multi-Link
2496  * element Common Info field.
2497  */
2498 #define WLAN_ML_PRV_CINFO_MLDID_SIZE                                1
2499 
2500 /* Max value in octets of Common Info Length subfield of Common Info field in
2501  * Probe Req variant Multi-Link element
2502  */
2503 #define WLAN_ML_PRV_CINFO_LENGTH_MAX \
2504 	(WLAN_ML_PRV_CINFO_LENGTH_SIZE + \
2505 	 WLAN_ML_PRV_CINFO_MLDID_SIZE)
2506 
2507 /* End of definitions related to Probe Request variant Multi-Link element. */
2508 
2509 /* Definitions related to Reconfiguration variant Multi-Link element (per
2510  * IEEE802.11be D2.1.1)
2511  */
2512 
2513 /* Definitions for bits in the Presence Bitmap subfield in Reconfiguration
2514  * variant Multi-Link element Control field. Any unused bits are reserved.
2515  */
2516 /* MLD MAC Address Present */
2517 #define WLAN_ML_RV_CTRL_PBM_MLDMACADDR_P               ((uint16_t)BIT(0))
2518 
2519 /* Definitions related to Reconfiguration variant Multi-Link element Common Info
2520  * field.
2521  */
2522 
2523 /* Size in octets of Common Info Length subfield of Common Info field in
2524  * Reconfiguration variant Multi-Link element.
2525  */
2526 #define WLAN_ML_RV_CINFO_LENGTH_SIZE                               1
2527 
2528 /* End of definitions related to Reconfiguration variant Multi-Link element
2529  * Common Info field.
2530  */
2531 
2532 /* Definitions related to Reconfiguration variant Multi-Link element Link Info
2533  * field
2534  */
2535 
2536 /**
2537  * struct wlan_ml_rv_linfo_perstaprof - Fixed fields of Per-STA Profile
2538  * subelement in Reconfiguration variant Multi-Link element Link Info field
2539  * @subelem_id: Subelement ID
2540  * @subelem_len: Subelement length
2541  * @stacontrol: STA Control
2542  */
2543 struct wlan_ml_rv_linfo_perstaprof {
2544 	uint8_t subelem_id;
2545 	uint8_t subelem_len;
2546 	uint16_t stacontrol;
2547 } qdf_packed;
2548 
2549 /* The above fixed fields may be followed by:
2550  * STA Info (variable size)
2551  */
2552 
2553 /* Size in octets of STA Control field of Per-STA Profile subelement in
2554  * Reconfiguration variant Multi-Link element Link Info field.
2555  */
2556 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_SIZE                   2
2557 
2558 /* Definitions for subfields in STA Control field of Per-STA Profile subelement
2559  * in Reconfiguration variant Multi-Link element Link Info field. Any unused
2560  * bits are reserved.
2561  */
2562 /* Link ID */
2563 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_LINKID_IDX              0
2564 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_LINKID_BITS             4
2565 /* Complete Profile */
2566 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_IDX           4
2567 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_BITS          1
2568 /* MAC Address Present */
2569 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_MACADDRP_IDX            5
2570 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_MACADDRP_BITS           1
2571 /* Delete Timer Present */
2572 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_DELTIMERP_IDX           6
2573 #define WLAN_ML_RV_LINFO_PERSTAPROF_STACTRL_DELTIMERP_BITS          1
2574 
2575 /* Definitions for subfields in STA Info field of Per-STA Profile subelement
2576  * in Reconfiguration variant Multi-Link element Link Info field.
2577  */
2578 
2579 /* STA Info Length */
2580 #define WLAN_ML_RV_LINFO_PERSTAPROF_STAINFO_LENGTH_SIZE             1
2581 
2582 /* Size in octets of the Delete Timer subfield in STA info field of Per-STA
2583  * Profile subelement in Reconfiguration variant Multi-Link element Link Info
2584  * field.
2585  */
2586 #define WLAN_ML_RV_LINFO_PERSTAPROF_STAINFO_DELTIMER_SIZE           2
2587 
2588 /* Max value in octets of STA Info Length in STA Info field of Per-STA Profile
2589  * subelement in Reconfiguration variant Multi-Link element Link Info field.
2590  */
2591 #define WLAN_ML_RV_LINFO_PERSTAPROF_STAINFO_LENGTH_MAX \
2592 	(WLAN_ML_RV_LINFO_PERSTAPROF_STAINFO_LENGTH_SIZE + \
2593 	 QDF_MAC_ADDR_SIZE + \
2594 	 WLAN_ML_RV_LINFO_PERSTAPROF_STAINFO_DELTIMER_SIZE)
2595 
2596 /* End of definitions related to Reconfiguration variant Multi-Link element Link
2597  * Info field.
2598  */
2599 
2600 /* End of definitions related to Reconfiguration variant Multi-Link element. */
2601 
2602 /*
2603  * Definitions related to MLO specific aspects of Reduced Neighbor Report
2604  * element.
2605  */
2606 
2607 /*
2608  * Definitions for MLD Parameters subfield in TBTT Information field present as
2609  * part of TBTT Information Set in Neighbor AP Information field of Reduced
2610  * Neighbor Report element.
2611  */
2612 /* MLD ID */
2613 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_MLDID_IDX                  0
2614 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_MLDID_BITS                 8
2615 /* Link ID */
2616 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_LINKID_IDX                 8
2617 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_LINKID_BITS                4
2618 /* BSS Parameters Change Count */
2619 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_BSSPARAMCHANGECNT_IDX      12
2620 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_BSSPARAMCHANGECNT_BITS     8
2621 /* All Updates Included */
2622 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_ALLUPDATESINC_IDX          20
2623 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_ALLUPDATESINC_BITS         1
2624 /* Disabled link indication */
2625 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_DISABLEDLINKIND_IDX        21
2626 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_DISABLEDLINKIND_BITS       1
2627 
2628 /*
2629  * End of definitions related to MLO specific aspects of Reduced Neighbor Report
2630  * element.
2631  */
2632 #endif /* WLAN_FEATURE_11BE_MLO */
2633 #endif /* WLAN_FEATURE_11BE */
2634 
2635 /**
2636  * struct wlan_ie_tid_to_link_mapping - TID-to-link mapping IE
2637  * @elem_id: T2LM IE
2638  * @elem_len: T2LM IE len
2639  * @elem_id_extn: T2LM extension id
2640  * @data: Variable length data described below
2641  */
2642 struct wlan_ie_tid_to_link_mapping {
2643 	uint8_t elem_id;
2644 	uint8_t elem_len;
2645 	uint8_t elem_id_extn;
2646 	uint8_t data[];
2647 } qdf_packed;
2648 
2649 /* Size in octets of Tid to Link mapping control */
2650 #define WLAN_T2LM_CTRL_SIZE                                     2
2651 /* Size in octets of Mapping switch time size */
2652 #define WLAN_T2LM_MAPPING_SWITCH_TIME_SIZE                      2
2653 /* Size in octets of Expected duration size */
2654 #define WLAN_T2LM_EXPECTED_DURATION_SIZE                        3
2655 /* Size in octets of Link mapping of TID 0-7 size */
2656 #define WLAN_T2LM_LINK_MAPPING_SIZE                             2
2657 
2658 /* The variable length data in wlan_ie_tid_to_link_mapping structure has the
2659  * following fields.
2660  * - TID-to-link mapping control (2 octet)
2661  * - Mapping switch time (0 or 2 octet)
2662  * - Expected duration (0 or 3 octet)
2663  * - Link mapping presence indicator (0 or 1 octet)
2664  * - Link mapping of TID 0(optional) to TID 7(optional). Each field has 0 or 2
2665  *   octets.
2666  */
2667 
2668 /* Definitions related TID-to-link mapping control*/
2669 /* Direction */
2670 #define WLAN_T2LM_CONTROL_DIRECTION_IDX                         0
2671 #define WLAN_T2LM_CONTROL_DIRECTION_BITS                        2
2672 /* Default link mapping */
2673 #define WLAN_T2LM_CONTROL_DEFAULT_LINK_MAPPING_IDX              2
2674 #define WLAN_T2LM_CONTROL_DEFAULT_LINK_MAPPING_BITS             1
2675 /* Mapping switch time present bit */
2676 #define WLAN_T2LM_CONTROL_MAPPING_SWITCH_TIME_PRESENT_IDX       3
2677 #define WLAN_T2LM_CONTROL_MAPPING_SWITCH_TIME_PRESENT_BITS      1
2678 /* Expected duration present bit */
2679 #define WLAN_T2LM_CONTROL_EXPECTED_DURATION_PRESENT_IDX         4
2680 #define WLAN_T2LM_CONTROL_EXPECTED_DURATION_PRESENT_BITS        1
2681 /* Bits 5-7 are reserved */
2682 /* Link mapping presence indicator */
2683 #define WLAN_T2LM_CONTROL_LINK_MAPPING_PRESENCE_INDICATOR_IDX   8
2684 #define WLAN_T2LM_CONTROL_LINK_MAPPING_PRESENCE_INDICATOR_BITS  8
2685 
2686 /**
2687  * struct wlan_ie_multi_link_traffic_indication - Multi-link traffic indication
2688  * element
2689  * @elem_id: Multi-link traffic indication IE
2690  * @elem_len: Multi-link traffic indication IE length
2691  * @elem_id_extn: Multi-link traffic indication extension ID
2692  * @ml_traffic_ind_control: Multi-link traffic indication control
2693  * @per_link_traffic_ind_list: Indicates the per-link traffic indication. Each
2694  *                             bit in the per_link_traffic_ind_list corresponds
2695  *                             to a link of the MLD.
2696  */
2697 struct wlan_ie_multi_link_traffic_indication {
2698 	uint8_t elem_id;
2699 	uint8_t elem_len;
2700 	uint8_t elem_id_extn;
2701 	uint16_t ml_traffic_ind_control;
2702 	uint16_t per_link_traffic_ind_list[];
2703 } qdf_packed;
2704 
2705 /**
2706  * struct wlan_action_frame - Generic action frame format
2707  * @category: Action frame category
2708  * @action: action
2709  *
2710  * Reference IEEE Std 802.11-2020 9.4.1.11 Action field
2711  */
2712 struct wlan_action_frame {
2713 	int8_t category;
2714 	int8_t action;
2715 } __packed;
2716 
2717 /**
2718  * struct wlan_action_frame_args - Generic action frame arguments
2719  * @category: Action frame category
2720  * @action: action
2721  * @arg1: argument1
2722  * @arg2: argument2
2723  * @arg3: argument3
2724  * @arg4: Pointer to argument4
2725  */
2726 struct wlan_action_frame_args {
2727 	uint8_t category;
2728 	uint8_t action;
2729 	uint32_t arg1;
2730 	uint32_t arg2;
2731 	uint32_t arg3;
2732 	uint8_t *arg4;
2733 };
2734 
2735 /**
2736  * struct he_oper_6g_param: 6 Ghz params for HE
2737  * @primary_channel: HE 6GHz Primary channel number
2738  * @width: HE 6GHz BSS Channel Width
2739  * @duplicate_beacon: HE 6GHz Duplicate beacon field
2740  * @reserved: Reserved bits
2741  * @chan_freq_seg0: HE 6GHz Channel Centre Frequency Segment 0
2742  * @chan_freq_seg1: HE 6GHz Channel Centre Frequency Segment 1
2743  * @minimum_rate: HE 6GHz Minimum Rate
2744  */
2745 struct he_oper_6g_param {
2746 	uint8_t primary_channel;
2747 	uint8_t width:2,
2748 		duplicate_beacon:1,
2749 		reserved:5;
2750 	uint8_t chan_freq_seg0;
2751 	uint8_t chan_freq_seg1;
2752 	uint8_t minimum_rate;
2753 } qdf_packed;
2754 
2755 /**
2756  * struct wlan_country_ie: country IE
2757  * @ie: country IE
2758  * @len: IE len
2759  * @cc: country code
2760  */
2761 struct wlan_country_ie {
2762 	uint8_t ie;
2763 	uint8_t len;
2764 	uint8_t cc[3];
2765 } qdf_packed;
2766 
2767 /**
2768  * struct qbss_load_ie - QBSS load IE
2769  * @ie: QBSS IE
2770  * @len: IE len
2771  * @station_count: number of station associated
2772  * @qbss_chan_load: qbss channel load
2773  * @qbss_load_avail: qbss_load_avail
2774  *
2775  * Reference IEEE Std 802.11-2020 9.4.2.27 BSS Load element
2776  */
2777 struct qbss_load_ie {
2778 	uint8_t ie;
2779 	uint8_t len;
2780 	uint16_t station_count;
2781 	uint8_t qbss_chan_load;
2782 	uint16_t qbss_load_avail;
2783 } qdf_packed;
2784 
2785 /**
2786  * struct wlan_bcn_frame: beacon frame fixed params
2787  * @timestamp: the value of sender's TSFTIMER
2788  * @beacon_interval: beacon interval
2789  * @capability: capability
2790  * @ie: variable IE
2791  */
2792 struct wlan_bcn_frame {
2793 	uint8_t timestamp[8];
2794 	uint16_t beacon_interval;
2795 	union wlan_capability capability;
2796 	struct ie_header ie;
2797 } qdf_packed;
2798 
2799 #define WLAN_TIM_IE_MIN_LENGTH             4
2800 
2801 /**
2802  * struct wlan_tim_ie: tim IE
2803  * @tim_ie: Time IE
2804  * @tim_len: TIM IE len
2805  * @tim_count: dtim count
2806  * @tim_period: dtim period
2807  * @tim_bitctl: bitmap control
2808  * @tim_bitmap: variable length bitmap
2809  */
2810 struct wlan_tim_ie {
2811 	uint8_t tim_ie;         /* WLAN_ELEMID_TIM */
2812 	uint8_t tim_len;
2813 	uint8_t tim_count;      /* DTIM count */
2814 	uint8_t tim_period;     /* DTIM period */
2815 	uint8_t tim_bitctl;     /* bitmap control */
2816 	uint8_t tim_bitmap[251];  /* variable-length bitmap */
2817 } qdf_packed;
2818 
2819 /**
2820  * struct rsn_mdie: mobility domain IE
2821  * @rsn_id: RSN IE id
2822  * @rsn_len: RSN IE len
2823  * @mobility_domain: mobility domain info
2824  * @ft_capab: ft capability
2825  *
2826  * Reference 9.4.2.47 Mobility Domain element (MDE) of 802.11-2016
2827  */
2828 struct rsn_mdie {
2829 	uint8_t rsn_id;
2830 	uint8_t rsn_len;
2831 	uint8_t mobility_domain[2];
2832 	uint8_t ft_capab;
2833 } qdf_packed;
2834 
2835 /**
2836  * struct wlan_srp_ie - Spatial reuse parameter IE
2837  * @srp_id: SRP IE id
2838  * @srp_len: SRP IE len
2839  * @srp_id_extn: SRP Extension ID
2840  * @sr_control: sr control
2841  * @nonsrg_srg_info:
2842  * @nonsrg_srg_info.non_srg_obsspd_max_offset: non srg obsspd max offset
2843  * @nonsrg_srg_info.srg_obss_pd_min_offset: srg obss pd min offset
2844  * @nonsrg_srg_info.srg_obss_pd_max_offset: srg obss pd max offset
2845  * @nonsrg_srg_info.srg_bss_color_bitmap: srg bss color bitmap
2846  * @nonsrg_srg_info.srg_partial_bssid_bitmap: srg partial bssid bitmap
2847  * @nonsrg_info:
2848  * @nonsrg_info.non_srg_obsspd_max_offset: non srg obsspd max offset
2849  * @srg_info:
2850  * @srg_info.srg_obss_pd_min_offset: srg obss pd min offset
2851  * @srg_info.srg_obss_pd_max_offset: srg obss pd max offset
2852  * @srg_info.srg_bss_color_bitmap: srg bss color bitmap
2853  * @srg_info.srg_partial_bssid_bitmap: srg partial bssid bitmap
2854  */
2855 struct wlan_srp_ie {
2856 	uint8_t srp_id;
2857 	uint8_t srp_len;
2858 	uint8_t srp_id_extn;
2859 	uint8_t sr_control;
2860 	union {
2861 		struct {
2862 			uint8_t non_srg_obsspd_max_offset;
2863 			uint8_t srg_obss_pd_min_offset;
2864 			uint8_t srg_obss_pd_max_offset;
2865 			uint8_t srg_bss_color_bitmap[8];
2866 			uint8_t srg_partial_bssid_bitmap[8];
2867 		} qdf_packed nonsrg_srg_info;
2868 		struct {
2869 			uint8_t non_srg_obsspd_max_offset;
2870 		} qdf_packed nonsrg_info;
2871 		struct {
2872 			uint8_t srg_obss_pd_min_offset;
2873 			uint8_t srg_obss_pd_max_offset;
2874 			uint8_t srg_bss_color_bitmap[8];
2875 			uint8_t srg_partial_bssid_bitmap[8];
2876 		} qdf_packed srg_info;
2877 	};
2878 } qdf_packed;
2879 
2880 #define ESP_INFORMATION_LIST_LENGTH 3
2881 #define MAX_ESP_INFORMATION_FIELD 4
2882 /*
2883  * enum access_category: tells about access category in ESP paramameter
2884  * @ESP_AC_BK: ESP access category for background
2885  * @ESP_AC_BE: ESP access category for best effort
2886  * @ESP_AC_VI: ESP access category for video
2887  * @ESP_AC_VO: ESP access category for Voice
2888  */
2889 enum access_category {
2890 	ESP_AC_BK,
2891 	ESP_AC_BE,
2892 	ESP_AC_VI,
2893 	ESP_AC_VO,
2894 
2895 };
2896 /*
2897  * struct wlan_esp_info: structure for Esp information parameter
2898  * @access_category: access category info
2899  * @reserved: reserved
2900  * @data_format: two bits in length and tells about data format
2901  * i.e. 0 = No aggregation is expected to be performed for MSDUs or MPDUs with
2902  * the Type subfield equal to Data for the corresponding AC
2903  * 1 = A-MSDU aggregation is expected to be performed for MSDUs for the
2904  * corresponding AC, but A-MPDU aggregation is not expected to be performed
2905  * for MPDUs with the Type subfield equal to Data for the corresponding AC
2906  * 2 = A-MPDU aggregation is expected to be performed for MPDUs with the Type
2907  * subfield equal to Data for the corresponding AC, but A-MSDU aggregation is
2908  * not expected to be performed for MSDUs for the corresponding AC
2909  * 3 = A-MSDU aggregation is expected to be performed for MSDUs for the
2910  * corresponding AC and A-MPDU aggregation is expected to be performed for
2911  * MPDUs with the Type subfield equal to Data for the corresponding AC
2912  * @ba_window_size: BA Window Size subfield is three bits in length and
2913  * indicates the size of the Block Ack window that is
2914  * expected for the corresponding access category
2915  * @estimated_air_fraction: Estimated Air Time Fraction subfield is 8 bits in
2916  * length and contains an unsigned integer that represents
2917  * the predicted percentage of time, linearly scaled with 255 representing
2918  * 100%, that a new STA joining the
2919  * BSS will be allocated for PPDUs that contain only
2920  * MPDUs with the Type
2921  * subfield equal to Data of the
2922  * corresponding access category for that STA.
2923  * @ppdu_duration: Data PPDU Duration Target field
2924  * is 8 bits in length and is
2925  * an unsigned integer that indicates the
2926  * expected target duration of PPDUs that contain only MPDUs with the Type
2927  * subfield equal to Data for the
2928  * corresponding access category in units of 50 μs
2929  */
2930 struct wlan_esp_info {
2931 	uint8_t access_category:2;
2932 	uint8_t reserved:1;
2933 	uint8_t data_format:2;
2934 	uint8_t ba_window_size:3;
2935 	uint8_t estimated_air_fraction;
2936 	uint8_t ppdu_duration;
2937 };
2938 
2939 /**
2940  * struct wlan_esp_ie: struct for ESP information
2941  * @esp_id: ESP IE id
2942  * @esp_len: ESP IE len
2943  * @esp_id_extn: ESP Extension ID
2944  * @esp_info_AC_BK: ESP information related to BK category
2945  * @esp_info_AC_BE: ESP information related to BE category
2946  * @esp_info_AC_VI: ESP information related to VI category
2947  * @esp_info_AC_VO: ESP information related to VO category
2948  */
2949 struct wlan_esp_ie {
2950 	uint8_t esp_id;
2951 	uint8_t esp_len;
2952 	uint8_t esp_id_extn;
2953 	struct wlan_esp_info esp_info_AC_BK;
2954 	struct wlan_esp_info esp_info_AC_BE;
2955 	struct wlan_esp_info esp_info_AC_VI;
2956 	struct wlan_esp_info esp_info_AC_VO;
2957 } qdf_packed;
2958 
2959 /**
2960  * struct wlan_ext_cap_ie - struct for extended capabilities information
2961  * @ext_cap_id: Extended capabilities id
2962  * @ext_cap_len: Extended capabilities IE len
2963  * @ext_caps: Variable length extended capabilities information
2964  */
2965 struct wlan_ext_cap_ie {
2966 	uint8_t ext_cap_id;
2967 	uint8_t ext_cap_len;
2968 	uint8_t ext_caps[];
2969 } qdf_packed;
2970 
2971 /* EHT caps fixed field = 2 bytes (EHT mac caps) + 9 bytes (EHT phy caps) */
2972 #define EHT_CAP_FIXED_FIELDS         11
2973 #define EHT_CAP_320M_MCS_MAP_LEN      3
2974 #define EHT_CAP_160M_MCS_MAP_LEN      3
2975 #define EHT_CAP_80M_MCS_MAP_LEN       3
2976 #define EHT_CAP_20M_MCS_MAP_LEN       4
2977 #define EHT_CAP_OUI_LEN               3
2978 
2979 /**
2980  * struct wlan_eht_cap_info - struct for eht capabilities information
2981  * @epcs_pri_access: EPCS priority access support
2982  * @eht_om_ctl: EHT OM control support
2983  * @triggered_txop_sharing_mode1: Triggered TXOP sharing support mode 1 support
2984  * @triggered_txop_sharing_mode2: Triggered TXOP sharing mode 2 support
2985  * @restricted_twt: Restricted TWT support
2986  * @scs_traffic_desc: SCS traffic description support
2987  * @max_mpdu_len: Maximum MPDU length
2988  * @max_a_mpdu_len_exponent_ext: Maximum A-MPDU Length Exponent Extension
2989  * @eht_trs_support: EHT TRS SUPPORT
2990  * @txop_return_support_txop_share_m2: TXOP Return Support in TXOP Share Mode 2
2991  * @reserved: reserved bits
2992  * @reserved2: reserved bits
2993  * @support_320mhz_6ghz: support 320mhz in 6gz
2994  * @ru_242tone_wt_20mhz: Support For 242-tone RU In BW Wider Than 20 MHz
2995  * @ndp_4x_eht_ltf_3dot2_us_gi: NDP With 4 EHT-LTF And 3.2 μs GI
2996  * @partial_bw_mu_mimo: Partial Bandwidth UL MU-MIMO
2997  * @su_beamformer: SU Beamformer
2998  * @su_beamformee: SU Beamformer
2999  * @bfee_ss_le_80mhz: Beamformee SS (≤ 80 MHz)
3000  * @bfee_ss_160mhz: Beamformee SS (= 160 MHz)
3001  * @bfee_ss_320mhz: Beamformee SS (= 320 MHz)
3002  * @num_sounding_dim_le_80mhz: Number Of Sounding Dimensions (≤ 80 MHz)
3003  * @num_sounding_dim_160mhz: Number Of Sounding Dimensions (= 160 MHz)
3004  * @num_sounding_dim_320mhz: Number Of Sounding Dimensions (= 320 MHz)
3005  * @ng_16_su_feedback: Ng = 16 SU Feedback
3006  * @ng_16_mu_feedback: Ng = 16 MU Feedback
3007  * @cb_sz_4_2_su_feedback: Codebook Size SU Feedback
3008  * @cb_sz_7_5_su_feedback: Codebook Size SU Feedback
3009  * @trig_su_bforming_feedback: Triggered SU Beamforming Feedback
3010  * @trig_mu_bforming_partial_bw_feedback: Triggered MU Partial
3011  *                                        Beamforming Feedback
3012  * @triggered_cqi_feedback: Triggered SU Beamforming Feedback
3013  * @partial_bw_dl_mu_mimo: Partial Bandwidth DL MU-MIMO
3014  * @psr_based_sr: PSR-based SR Support
3015  * @power_boost_factor: Power Boost Factor Support
3016  * @eht_mu_ppdu_4x_ltf_0_8_us_gi: EHT MU PPDU With 4 EHT-LTF And 0.8 μs GI
3017  * @max_nc: Max Nc
3018  * @non_trig_cqi_feedback: Non-Triggered CQI Feedback
3019  * @tx_1024_4096_qam_lt_242_tone_ru: Tx 1024-QAM And 4096-QAM < 242-tone
3020  *                                   RU Support
3021  * @rx_1024_4096_qam_lt_242_tone_ru: Rx 1024-QAM And 4096-QAM < 242-tone
3022  *                                   RU Support
3023  * @ppet_present: PPE Thresholds Present
3024  * @common_nominal_pkt_padding: Common Nominal Packet Padding
3025  * @max_num_eht_ltf: Maximum Number Of Supported EHT-LTFs
3026  * @mcs_15: Support Of MCS 15
3027  * @eht_dup_6ghz: Support Of EHT DUP In 6 GHz
3028  * @op_sta_rx_ndp_wider_bw_20mhz: Support For 20 MHz Operating STA
3029  *                                Receiving NDP With Wider Bandwidth
3030  * @non_ofdma_ul_mu_mimo_le_80mhz: Non-OFDMA UL MU-MIMO (BW ≤ 80 MHz)
3031  * @non_ofdma_ul_mu_mimo_160mhz: Non-OFDMA UL MU-MIMO (BW ≤ 160 MHz)
3032  * @non_ofdma_ul_mu_mimo_320mhz: Non-OFDMA UL MU-MIMO (BW ≤ 320 MHz)
3033  * @mu_bformer_le_80mhz: MU Beamformer (BW ≤ 80 MHz)
3034  * @mu_bformer_160mhz: MU Beamformer (BW ≤ 160 MHz)
3035  * @mu_bformer_320mhz: MU Beamformer (BW ≤ 320 MHz)
3036  * @tb_sounding_feedback_rl: TB sounding feedback rate limit
3037  * @rx_1k_qam_in_wider_bw_dl_ofdma: Rx 1024-QAM in wider bandwidth DL
3038  *                                 OFDMA support
3039  * @rx_4k_qam_in_wider_bw_dl_ofdma: Rx 4096-QAM in wider bandwidth DL
3040  *                                 OFDMA support
3041  * @reserved3: reserved bits
3042  * @bw_20_rx_max_nss_for_mcs_0_to_7: Max Rx NSS for MCS 0 to 7 (BW = 20MHz)
3043  * @bw_20_tx_max_nss_for_mcs_0_to_7: Max Tx NSS for MCS 0 to 7 (BW = 20MHz)
3044  * @bw_20_rx_max_nss_for_mcs_8_and_9: Max Rx NSS for MCS 8 and 9 (BW = 20MHz)
3045  * @bw_20_tx_max_nss_for_mcs_8_and_9: Max Tx NSS for MCS 8 and 9 (BW = 20MHz)
3046  * @bw_20_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3047  *                                      (BW = 20MHz)
3048  * @bw_20_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3049  *                                      (BW = 20MHz)
3050  * @bw_20_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3051  *                                      (BW = 20MHz)
3052  * @bw_20_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3053  *                                      (BW = 20MHz)
3054  * @bw_le_80_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW <= 80MHz)
3055  * @bw_le_80_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW <= 80MHz)
3056  * @bw_le_80_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3057  *                                        (BW <= 80MHz)
3058  * @bw_le_80_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3059  *                                        (BW <= 80MHz)
3060  * @bw_le_80_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3061  *                                        (BW <= 80MHz)
3062  * @bw_le_80_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3063  *                                        (BW <= 80MHz)
3064  * @bw_160_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW = 160MHz)
3065  * @bw_160_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW = 160MHz)
3066  * @bw_160_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3067  *                                      (BW = 160MHz)
3068  * @bw_160_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3069  *                                      (BW = 160MHz)
3070  * @bw_160_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3071  *                                      (BW = 160MHz)
3072  * @bw_160_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3073  *                                      (BW = 160MHz)
3074  * @bw_320_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW = 320MHz)
3075  * @bw_320_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW = 320MHz)
3076  * @bw_320_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3077  *                                      (BW = 320MHz)
3078  * @bw_320_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3079  *                                      (BW = 320MHz)
3080  * @bw_320_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3081  *                                      (BW = 320MHz)
3082  * @bw_320_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3083  *                                      (BW = 320MHz)
3084  */
3085 struct wlan_eht_cap_info {
3086 #ifndef ANI_LITTLE_BIT_ENDIAN
3087 	uint16_t reserved:5;
3088 	uint16_t txop_return_support_txop_share_m2:1;
3089 	uint16_t eht_trs_support:1;
3090 	uint16_t max_a_mpdu_len_exponent_ext:1;
3091 	uint16_t max_mpdu_len:2;
3092 	uint16_t scs_traffic_desc:1;
3093 	uint16_t restricted_twt:1;
3094 	uint16_t triggered_txop_sharing_mode2:1;
3095 	uint16_t triggered_txop_sharing_mode1:1;
3096 	uint16_t eht_om_ctl:1;
3097 	uint16_t epcs_pri_access:1;
3098 
3099 	uint32_t triggered_cqi_feedback:1;
3100 	uint32_t trig_mu_bforming_partial_bw_feedback:1;
3101 	uint32_t trig_su_bforming_feedback:1;
3102 	uint32_t cb_sz_7_5_su_feedback:1;
3103 	uint32_t cb_sz_4_2_su_feedback:1;
3104 	uint32_t ng_16_mu_feedback:1;
3105 	uint32_t ng_16_su_feedback:1;
3106 	uint32_t num_sounding_dim_320mhz:3;
3107 	uint32_t num_sounding_dim_160mhz:3;
3108 	uint32_t num_sounding_dim_le_80mhz:3;
3109 	uint32_t bfee_ss_320mhz:3;
3110 	uint32_t bfee_ss_160mhz:3;
3111 	uint32_t bfee_ss_le_80mhz:3;
3112 	uint32_t su_beamformee:1;
3113 	uint32_t su_beamformer:1;
3114 	uint32_t partial_bw_mu_mimo:1;
3115 	uint32_t ndp_4x_eht_ltf_3dot2_us_gi:1;
3116 	uint32_t ru_242tone_wt_20mhz:1;
3117 	uint32_t support_320mhz_6ghz:1;
3118 	uint32_t reserved2:1;
3119 
3120 	uint32_t tb_sounding_feedback_rl:1;
3121 	uint32_t mu_bformer_320mhz:1;
3122 	uint32_t mu_bformer_160mhz:1;
3123 	uint32_t mu_bformer_le_80mhz:1;
3124 	uint32_t non_ofdma_ul_mu_mimo_320mhz:1;
3125 	uint32_t non_ofdma_ul_mu_mimo_160mhz:1;
3126 	uint32_t non_ofdma_ul_mu_mimo_le_80mhz:1;
3127 	uint32_t op_sta_rx_ndp_wider_bw_20mhz:1;
3128 	uint32_t eht_dup_6ghz:1;
3129 	uint32_t mcs_15:4;
3130 	uint32_t max_num_eht_ltf:5;
3131 	uint32_t common_nominal_pkt_padding:2;
3132 	uint32_t ppet_present:1;
3133 	uint32_t rx_1024_4096_qam_lt_242_tone_ru:1;
3134 	uint32_t tx_1024_4096_qam_lt_242_tone_ru:1;
3135 	uint32_t non_trig_cqi_feedback:1;
3136 	uint32_t max_nc:4;
3137 	uint32_t eht_mu_ppdu_4x_ltf_0_8_us_gi:1;
3138 	uint32_t power_boost_factor:1;
3139 	uint32_t psr_based_sr:1;
3140 	uint32_t partial_bw_dl_mu_mimo:1;
3141 
3142 	uint8_t reserved3:6;
3143 	uint8_t rx_4k_qam_in_wider_bw_dl_ofdma:1;
3144 	uint8_t rx_1k_qam_in_wider_bw_dl_ofdma:1;
3145 
3146 	uint32_t bw_20_rx_max_nss_for_mcs_12_and_13:4;
3147 	uint32_t bw_20_tx_max_nss_for_mcs_12_and_13:4;
3148 	uint32_t bw_20_rx_max_nss_for_mcs_10_and_11:4;
3149 	uint32_t bw_20_tx_max_nss_for_mcs_10_and_11:4;
3150 	uint32_t bw_20_rx_max_nss_for_mcs_8_and_9:4;
3151 	uint32_t bw_20_tx_max_nss_for_mcs_8_and_9:4;
3152 	uint32_t bw_20_rx_max_nss_for_mcs_0_to_7:4;
3153 	uint32_t bw_20_tx_max_nss_for_mcs_0_to_7:4;
3154 
3155 	uint32_t bw_le_80_rx_max_nss_for_mcs_12_and_13:4;
3156 	uint32_t bw_le_80_tx_max_nss_for_mcs_12_and_13:4;
3157 	uint32_t bw_le_80_rx_max_nss_for_mcs_10_and_11:4;
3158 	uint32_t bw_le_80_tx_max_nss_for_mcs_10_and_11:4;
3159 	uint32_t bw_le_80_rx_max_nss_for_mcs_0_to_9:4;
3160 	uint32_t bw_le_80_tx_max_nss_for_mcs_0_to_9:4;
3161 	uint32_t bw_160_rx_max_nss_for_mcs_12_and_13:4;
3162 	uint32_t bw_160_tx_max_nss_for_mcs_12_and_13:4;
3163 
3164 	uint32_t bw_160_rx_max_nss_for_mcs_10_and_11:4;
3165 	uint32_t bw_160_tx_max_nss_for_mcs_10_and_11:4;
3166 	uint32_t bw_160_rx_max_nss_for_mcs_0_to_9:4;
3167 	uint32_t bw_160_tx_max_nss_for_mcs_0_to_9:4;
3168 	uint32_t bw_320_rx_max_nss_for_mcs_12_and_13:4;
3169 	uint32_t bw_320_tx_max_nss_for_mcs_12_and_13:4;
3170 	uint32_t bw_320_rx_max_nss_for_mcs_10_and_11:4;
3171 	uint32_t bw_320_tx_max_nss_for_mcs_10_and_11:4;
3172 
3173 	uint8_t bw_320_rx_max_nss_for_mcs_0_to_9:4;
3174 	uint8_t bw_320_tx_max_nss_for_mcs_0_to_9:4;
3175 
3176 #else
3177 	uint16_t epcs_pri_access:1;
3178 	uint16_t eht_om_ctl:1;
3179 	uint16_t triggered_txop_sharing_mode1:1;
3180 	uint16_t triggered_txop_sharing_mode2:1;
3181 	uint16_t restricted_twt:1;
3182 	uint16_t scs_traffic_desc:1;
3183 	uint16_t max_mpdu_len:2;
3184 	uint16_t max_a_mpdu_len_exponent_ext:1;
3185 	uint16_t eht_trs_support:1;
3186 	uint16_t txop_return_support_txop_share_m2:1;
3187 	uint16_t reserved:5;
3188 
3189 	uint32_t reserved2:1;
3190 	uint32_t support_320mhz_6ghz:1;
3191 	uint32_t ru_242tone_wt_20mhz:1;
3192 	uint32_t ndp_4x_eht_ltf_3dot2_us_gi:1;
3193 	uint32_t partial_bw_mu_mimo:1;
3194 	uint32_t su_beamformer:1;
3195 	uint32_t su_beamformee:1;
3196 	uint32_t bfee_ss_le_80mhz:3;
3197 	uint32_t bfee_ss_160mhz:3;
3198 	uint32_t bfee_ss_320mhz:3;
3199 	uint32_t num_sounding_dim_le_80mhz:3;
3200 	uint32_t num_sounding_dim_160mhz:3;
3201 	uint32_t num_sounding_dim_320mhz:3;
3202 	uint32_t ng_16_su_feedback:1;
3203 	uint32_t ng_16_mu_feedback:1;
3204 	uint32_t cb_sz_4_2_su_feedback:1;
3205 	uint32_t cb_sz_7_5_su_feedback:1;
3206 	uint32_t trig_su_bforming_feedback:1;
3207 	uint32_t trig_mu_bforming_partial_bw_feedback:1;
3208 	uint32_t triggered_cqi_feedback:1;
3209 
3210 	uint32_t partial_bw_dl_mu_mimo:1;
3211 	uint32_t psr_based_sr:1;
3212 	uint32_t power_boost_factor:1;
3213 	uint32_t eht_mu_ppdu_4x_ltf_0_8_us_gi:1;
3214 	uint32_t max_nc:4;
3215 	uint32_t non_trig_cqi_feedback:1;
3216 	uint32_t tx_1024_4096_qam_lt_242_tone_ru:1;
3217 	uint32_t rx_1024_4096_qam_lt_242_tone_ru:1;
3218 	uint32_t ppet_present:1;
3219 	uint32_t common_nominal_pkt_padding:2;
3220 	uint32_t max_num_eht_ltf:5;
3221 	uint32_t mcs_15:4;
3222 	uint32_t eht_dup_6ghz:1;
3223 	uint32_t op_sta_rx_ndp_wider_bw_20mhz:1;
3224 	uint32_t non_ofdma_ul_mu_mimo_le_80mhz:1;
3225 	uint32_t non_ofdma_ul_mu_mimo_160mhz:1;
3226 	uint32_t non_ofdma_ul_mu_mimo_320mhz:1;
3227 	uint32_t mu_bformer_le_80mhz:1;
3228 	uint32_t mu_bformer_160mhz:1;
3229 	uint32_t mu_bformer_320mhz:1;
3230 	uint32_t tb_sounding_feedback_rl:1;
3231 
3232 	uint8_t rx_1k_qam_in_wider_bw_dl_ofdma:1;
3233 	uint8_t rx_4k_qam_in_wider_bw_dl_ofdma:1;
3234 	uint8_t reserved3:6;
3235 
3236 	uint32_t bw_20_rx_max_nss_for_mcs_0_to_7:4;
3237 	uint32_t bw_20_tx_max_nss_for_mcs_0_to_7:4;
3238 	uint32_t bw_20_rx_max_nss_for_mcs_8_and_9:4;
3239 	uint32_t bw_20_tx_max_nss_for_mcs_8_and_9:4;
3240 	uint32_t bw_20_rx_max_nss_for_mcs_10_and_11:4;
3241 	uint32_t bw_20_tx_max_nss_for_mcs_10_and_11:4;
3242 	uint32_t bw_20_rx_max_nss_for_mcs_12_and_13:4;
3243 	uint32_t bw_20_tx_max_nss_for_mcs_12_and_13:4;
3244 
3245 	uint32_t bw_le_80_rx_max_nss_for_mcs_0_to_9:4;
3246 	uint32_t bw_le_80_tx_max_nss_for_mcs_0_to_9:4;
3247 	uint32_t bw_le_80_rx_max_nss_for_mcs_10_and_11:4;
3248 	uint32_t bw_le_80_tx_max_nss_for_mcs_10_and_11:4;
3249 	uint32_t bw_le_80_rx_max_nss_for_mcs_12_and_13:4;
3250 	uint32_t bw_le_80_tx_max_nss_for_mcs_12_and_13:4;
3251 
3252 	uint32_t bw_160_rx_max_nss_for_mcs_0_to_9:4;
3253 	uint32_t bw_160_tx_max_nss_for_mcs_0_to_9:4;
3254 	uint32_t bw_160_rx_max_nss_for_mcs_10_and_11:4;
3255 	uint32_t bw_160_tx_max_nss_for_mcs_10_and_11:4;
3256 	uint32_t bw_160_rx_max_nss_for_mcs_12_and_13:4;
3257 	uint32_t bw_160_tx_max_nss_for_mcs_12_and_13:4;
3258 
3259 	uint32_t bw_320_rx_max_nss_for_mcs_0_to_9:4;
3260 	uint32_t bw_320_tx_max_nss_for_mcs_0_to_9:4;
3261 	uint32_t bw_320_rx_max_nss_for_mcs_10_and_11:4;
3262 	uint32_t bw_320_tx_max_nss_for_mcs_10_and_11:4;
3263 	uint8_t bw_320_rx_max_nss_for_mcs_12_and_13:4;
3264 	uint8_t bw_320_tx_max_nss_for_mcs_12_and_13:4;
3265 #endif
3266 } qdf_packed;
3267 
3268 /**
3269  * struct wlan_eht_cap_info_network_endian - struct for eht capabilities
3270  *                                           information
3271  * @epcs_pri_access: EPCS priority access support
3272  * @eht_om_ctl: EHT OM control support
3273  * @triggered_txop_sharing_mode1: Triggered TXOP sharing mode 1 support
3274  * @triggered_txop_sharing_mode2: Triggered TXOP sharing mode 2 support
3275  * @restricted_twt: Restricted TWT support
3276  * @scs_traffic_desc: SCS traffic description support
3277  * @max_mpdu_len: Maximum MPDU length
3278  * @max_a_mpdu_len_exponent_ext: Maximum A-MPDU Length Exponent Extension
3279  * @eht_trs_support: EHT TRS SUPPORT
3280  * @txop_return_support_txop_share_m2: TXOP Return Support in TXOP Share Mode 2
3281  * @reserved: reserved bits
3282  * @reserved2: reserved bits
3283  * @support_320mhz_6ghz: support 320mhz in 6gz
3284  * @ru_242tone_wt_20mhz: Support For 242-tone RU In BW Wider Than 20 MHz
3285  * @ndp_4x_eht_ltf_3dot2_us_gi: NDP With 4 EHT-LTF And 3.2 μs GI
3286  * @partial_bw_mu_mimo: Partial Bandwidth UL MU-MIMO
3287  * @su_beamformer: SU Beamformer
3288  * @su_beamformee: SU Beamformer
3289  * @bfee_ss_le_80mhz: Beamformee SS (≤ 80 MHz)
3290  * @bfee_ss_160mhz: Beamformee SS (= 160 MHz)
3291  * @bfee_ss_320mhz: Beamformee SS (= 320 MHz)
3292  * @num_sounding_dim_le_80mhz: Number Of Sounding Dimensions (≤ 80 MHz)
3293  * @num_sounding_dim_160mhz: Number Of Sounding Dimensions (= 160 MHz)
3294  * @num_sounding_dim_320mhz: Number Of Sounding Dimensions (= 320 MHz)
3295  * @ng_16_su_feedback: Ng = 16 SU Feedback
3296  * @ng_16_mu_feedback: Ng = 16 MU Feedback
3297  * @cb_sz_4_2_su_feedback: Codebook Size SU Feedback
3298  * @cb_sz_7_5_su_feedback: Codebook Size SU Feedback
3299  * @trig_su_bforming_feedback: Triggered SU Beamforming Feedback
3300  * @trig_mu_bforming_partial_bw_feedback: Triggered MU Partial
3301  *                                        Beamforming Feedback
3302  * @triggered_cqi_feedback: Triggered SU Beamforming Feedback
3303  * @partial_bw_dl_mu_mimo: Partial Bandwidth DL MU-MIMO
3304  * @psr_based_sr: PSR-based SR Support
3305  * @power_boost_factor: Power Boost Factor Support
3306  * @eht_mu_ppdu_4x_ltf_0_8_us_gi: EHT MU PPDU With 4 EHT-LTF And 0.8 μs GI
3307  * @max_nc: Max Nc
3308  * @non_trig_cqi_feedback: Non-Triggered CQI Feedback
3309  * @tx_1024_4096_qam_lt_242_tone_ru: Tx 1024-QAM And 4096-QAM < 242-tone
3310  *                                   RU Support
3311  * @rx_1024_4096_qam_lt_242_tone_ru: Rx 1024-QAM And 4096-QAM < 242-tone
3312  *                                   RU Support
3313  * @ppet_present: PPE Thresholds Present
3314  * @common_nominal_pkt_padding: Common Nominal Packet Padding
3315  * @max_num_eht_ltf: Maximum Number Of Supported EHT-LTFs
3316  * @mcs_15: Support Of MCS 15
3317  * @eht_dup_6ghz: Support Of EHT DUP In 6 GHz
3318  * @op_sta_rx_ndp_wider_bw_20mhz: Support For 20 MHz Operating STA
3319  *                                Receiving NDP With Wider Bandwidth
3320  * @non_ofdma_ul_mu_mimo_le_80mhz: Non-OFDMA UL MU-MIMO (BW ≤ 80 MHz)
3321  * @non_ofdma_ul_mu_mimo_160mhz: Non-OFDMA UL MU-MIMO (BW ≤ 160 MHz)
3322  * @non_ofdma_ul_mu_mimo_320mhz: Non-OFDMA UL MU-MIMO (BW ≤ 320 MHz)
3323  * @mu_bformer_le_80mhz: MU Beamformer (BW ≤ 80 MHz)
3324  * @mu_bformer_160mhz: MU Beamformer (BW ≤ 160 MHz)
3325  * @mu_bformer_320mhz: MU Beamformer (BW ≤ 320 MHz)
3326  * @tb_sounding_feedback_rl: TB sounding feedback rate limit
3327  * @rx_1k_qam_in_wider_bw_dl_ofdma: Rx 1024-QAM in wider bandwidth DL
3328  *                                 OFDMA support
3329  * @rx_4k_qam_in_wider_bw_dl_ofdma: Rx 4096-QAM in wider bandwidth DL
3330  *                                 OFDMA support
3331  * @reserved3: reserved bits
3332  * @bw_20_rx_max_nss_for_mcs_0_to_7: Max Rx NSS for MCS 0 to 7 (BW = 20MHz)
3333  * @bw_20_tx_max_nss_for_mcs_0_to_7: Max Tx NSS for MCS 0 to 7 (BW = 20MHz)
3334  * @bw_20_rx_max_nss_for_mcs_8_and_9: Max Rx NSS for MCS 8 and 9 (BW = 20MHz)
3335  * @bw_20_tx_max_nss_for_mcs_8_and_9: Max Tx NSS for MCS 8 and 9 (BW = 20MHz
3336  * @bw_20_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3337  *                                      (BW = 20MHz)
3338  * @bw_20_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3339  *                                      (BW = 20MHz)
3340  * @bw_20_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3341  *                                      (BW = 20MHz)
3342  * @bw_20_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3343  *                                      (BW = 20MHz)
3344  * @bw_le_80_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW <= 80MHz)
3345  * @bw_le_80_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW <= 80MHz)
3346  * @bw_le_80_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3347  *                                        (BW <= 80MHz)
3348  * @bw_le_80_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3349  *                                        (BW <= 80MHz)
3350  * @bw_le_80_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3351  *                                        (BW <= 80MHz)
3352  * @bw_le_80_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3353  *                                        (BW <= 80MHz)
3354  * @bw_160_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW = 160MHz)
3355  * @bw_160_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW = 160MHz)
3356  * @bw_160_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3357  *                                      (BW = 160MHz)
3358  * @bw_160_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3359  *                                      (BW = 160MHz)
3360  * @bw_160_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3361  *                                      (BW = 160MHz)
3362  * @bw_160_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3363  *                                      (BW = 160MHz)
3364  * @bw_320_rx_max_nss_for_mcs_0_to_9: Max Rx NSS for MCS 0 to 9 (BW = 320MHz)
3365  * @bw_320_tx_max_nss_for_mcs_0_to_9: Max Tx NSS for MCS 0 to 9 (BW = 320MHz)
3366  * @bw_320_rx_max_nss_for_mcs_10_and_11: Max Rx NSS for MCS 10 and 11
3367  *                                      (BW = 320MHz)
3368  * @bw_320_tx_max_nss_for_mcs_10_and_11: Max Tx NSS for MCS 10 and 11
3369  *                                      (BW = 320MHz)
3370  * @bw_320_rx_max_nss_for_mcs_12_and_13: Max Rx NSS for MCS 12 and 13
3371  *                                      (BW = 320MHz)
3372  * @bw_320_tx_max_nss_for_mcs_12_and_13: Max Tx NSS for MCS 12 and 13
3373  *                                      (BW = 320MHz)
3374  */
3375 struct wlan_eht_cap_info_network_endian {
3376 	uint16_t epcs_pri_access:1;
3377 	uint16_t eht_om_ctl:1;
3378 	uint16_t triggered_txop_sharing_mode1:1;
3379 	uint16_t triggered_txop_sharing_mode2:1;
3380 	uint16_t restricted_twt:1;
3381 	uint16_t scs_traffic_desc:1;
3382 	uint16_t max_mpdu_len:2;
3383 	uint16_t max_a_mpdu_len_exponent_ext:1;
3384 	uint16_t eht_trs_support:1;
3385 	uint16_t txop_return_support_txop_share_m2:1;
3386 	uint16_t reserved:5;
3387 
3388 	uint32_t reserved2:1;
3389 	uint32_t support_320mhz_6ghz:1;
3390 	uint32_t ru_242tone_wt_20mhz:1;
3391 	uint32_t ndp_4x_eht_ltf_3dot2_us_gi:1;
3392 	uint32_t partial_bw_mu_mimo:1;
3393 	uint32_t su_beamformer:1;
3394 	uint32_t su_beamformee:1;
3395 	uint32_t bfee_ss_le_80mhz:3;
3396 	uint32_t bfee_ss_160mhz:3;
3397 	uint32_t bfee_ss_320mhz:3;
3398 	uint32_t num_sounding_dim_le_80mhz:3;
3399 	uint32_t num_sounding_dim_160mhz:3;
3400 	uint32_t num_sounding_dim_320mhz:3;
3401 	uint32_t ng_16_su_feedback:1;
3402 	uint32_t ng_16_mu_feedback:1;
3403 	uint32_t cb_sz_4_2_su_feedback:1;
3404 	uint32_t cb_sz_7_5_su_feedback:1;
3405 	uint32_t trig_su_bforming_feedback:1;
3406 	uint32_t trig_mu_bforming_partial_bw_feedback:1;
3407 	uint32_t triggered_cqi_feedback:1;
3408 
3409 	uint32_t partial_bw_dl_mu_mimo:1;
3410 	uint32_t psr_based_sr:1;
3411 	uint32_t power_boost_factor:1;
3412 	uint32_t eht_mu_ppdu_4x_ltf_0_8_us_gi:1;
3413 	uint32_t max_nc:4;
3414 	uint32_t non_trig_cqi_feedback:1;
3415 	uint32_t tx_1024_4096_qam_lt_242_tone_ru:1;
3416 	uint32_t rx_1024_4096_qam_lt_242_tone_ru:1;
3417 	uint32_t ppet_present:1;
3418 	uint32_t common_nominal_pkt_padding:2;
3419 	uint32_t max_num_eht_ltf:5;
3420 	uint32_t mcs_15:4;
3421 	uint32_t eht_dup_6ghz:1;
3422 	uint32_t op_sta_rx_ndp_wider_bw_20mhz:1;
3423 	uint32_t non_ofdma_ul_mu_mimo_le_80mhz:1;
3424 	uint32_t non_ofdma_ul_mu_mimo_160mhz:1;
3425 	uint32_t non_ofdma_ul_mu_mimo_320mhz:1;
3426 	uint32_t mu_bformer_le_80mhz:1;
3427 	uint32_t mu_bformer_160mhz:1;
3428 	uint32_t mu_bformer_320mhz:1;
3429 	uint32_t tb_sounding_feedback_rl:1;
3430 
3431 	uint8_t rx_1k_qam_in_wider_bw_dl_ofdma:1;
3432 	uint8_t rx_4k_qam_in_wider_bw_dl_ofdma:1;
3433 	uint8_t reserved3:6;
3434 
3435 	uint32_t bw_20_rx_max_nss_for_mcs_0_to_7:4;
3436 	uint32_t bw_20_tx_max_nss_for_mcs_0_to_7:4;
3437 	uint32_t bw_20_rx_max_nss_for_mcs_8_and_9:4;
3438 	uint32_t bw_20_tx_max_nss_for_mcs_8_and_9:4;
3439 	uint32_t bw_20_rx_max_nss_for_mcs_10_and_11:4;
3440 	uint32_t bw_20_tx_max_nss_for_mcs_10_and_11:4;
3441 	uint32_t bw_20_rx_max_nss_for_mcs_12_and_13:4;
3442 	uint32_t bw_20_tx_max_nss_for_mcs_12_and_13:4;
3443 
3444 	uint32_t bw_le_80_rx_max_nss_for_mcs_0_to_9:4;
3445 	uint32_t bw_le_80_tx_max_nss_for_mcs_0_to_9:4;
3446 	uint32_t bw_le_80_rx_max_nss_for_mcs_10_and_11:4;
3447 	uint32_t bw_le_80_tx_max_nss_for_mcs_10_and_11:4;
3448 	uint32_t bw_le_80_rx_max_nss_for_mcs_12_and_13:4;
3449 	uint32_t bw_le_80_tx_max_nss_for_mcs_12_and_13:4;
3450 
3451 	uint32_t bw_160_rx_max_nss_for_mcs_0_to_9:4;
3452 	uint32_t bw_160_tx_max_nss_for_mcs_0_to_9:4;
3453 	uint32_t bw_160_rx_max_nss_for_mcs_10_and_11:4;
3454 	uint32_t bw_160_tx_max_nss_for_mcs_10_and_11:4;
3455 	uint32_t bw_160_rx_max_nss_for_mcs_12_and_13:4;
3456 	uint32_t bw_160_tx_max_nss_for_mcs_12_and_13:4;
3457 
3458 	uint32_t bw_320_rx_max_nss_for_mcs_0_to_9:4;
3459 	uint32_t bw_320_tx_max_nss_for_mcs_0_to_9:4;
3460 	uint32_t bw_320_rx_max_nss_for_mcs_10_and_11:4;
3461 	uint32_t bw_320_tx_max_nss_for_mcs_10_and_11:4;
3462 	uint8_t bw_320_rx_max_nss_for_mcs_12_and_13:4;
3463 } qdf_packed;
3464 
3465 /**
3466  * struct edca_param: struct for edca_param
3467  * @acvo_aifsn: ac vo aifsn
3468  * @acvo_acm: ac vo acm
3469  * @acvo_aci: ac vo aci
3470  * @unused: unused bit
3471  * @acvo_cwmin: ac vo cwmin
3472  * @acvo_cwmax: ac vo cwmax
3473  * @acvo_txoplimit: ac vo txoplimit
3474  */
3475 struct edca_param {
3476 	uint8_t acvo_aifsn:4;
3477 	uint8_t acvo_acm:1;
3478 	uint8_t acvo_aci:2;
3479 	uint8_t unused:1;
3480 	uint8_t acvo_cwmin:4;
3481 	uint8_t acvo_cwmax:4;
3482 	uint16_t acvo_txoplimit;
3483 };
3484 
3485 /**
3486  * struct pifs_param: struct for pifs_param
3487  * @sap_pifs_offset: sap pifs offset
3488  * @leb_pifs_offset: left earbud offset
3489  * @reb_pifs_offset: right earbud offset
3490  */
3491 struct pifs_param {
3492 	uint8_t sap_pifs_offset;
3493 	uint8_t leb_pifs_offset;
3494 	uint8_t reb_pifs_offset;
3495 };
3496 
3497 /**
3498  * struct wlan_edca_pifs_param_ie: struct for QCN_ATTRIB_EDCA_PIFS_PARAM
3499  * @edca_param_type: edca param type
3500  * @edca_pifs_param: union of param types
3501  * @edca_pifs_param.eparam: structure for edca_param
3502  * @edca_pifs_param.pparam: structure for pifs_param
3503  */
3504 struct wlan_edca_pifs_param_ie {
3505 	uint8_t edca_param_type;
3506 	union {
3507 		struct edca_param eparam; /* edca_param_type = 0 */
3508 		struct pifs_param pparam; /* edca_param_type = 1 */
3509 	} qdf_packed edca_pifs_param;
3510 } qdf_packed;
3511 
3512 /**
3513  * struct oce_reduced_wan_metrics: struct for oce wan metrics
3514  * @downlink_av_cap: Download available capacity
3515  * @uplink_av_cap: Upload available capacity
3516  */
3517 struct oce_reduced_wan_metrics {
3518 	uint8_t downlink_av_cap:4;
3519 	uint8_t uplink_av_cap:4;
3520 };
3521 
3522 /**
3523  * is_wpa_oui() - If vendor IE is WPA type
3524  * @frm: vendor IE pointer
3525  *
3526  * API to check if vendor IE is WPA
3527  *
3528  * Return: true if its WPA IE
3529  */
3530 static inline bool
3531 is_wpa_oui(uint8_t *frm)
3532 {
3533 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
3534 		((WLAN_WPA_OUI_TYPE << 24) | WLAN_WPA_OUI));
3535 }
3536 
3537 /**
3538  * is_wps_oui() - If vendor IE is WPS type
3539  * @frm: vendor IE pointer
3540  *
3541  * API to check if vendor IE is WPS
3542  *
3543  * Return: true if its WPS IE
3544  */
3545 static inline bool
3546 is_wps_oui(const uint8_t *frm)
3547 {
3548 	return frm[1] > 3 && BE_READ_4(frm + 2) == WSC_OUI;
3549 }
3550 
3551 /**
3552  * is_mbo_oce_oui() - If vendor IE is MBO/OCE type
3553  * @frm: vendor IE pointer
3554  *
3555  * API to check if vendor IE is MBO/OCE
3556  *
3557  * Return: true if its MBO/OCE IE
3558  */
3559 static inline bool
3560 is_mbo_oce_oui(const uint8_t *frm)
3561 {
3562 	return frm[1] > 3 && BE_READ_4(frm + 2) == MBO_OCE_OUI;
3563 }
3564 
3565 /**
3566  * is_wcn_oui() - If vendor IE is WCN type
3567  * @frm: vendor IE pointer
3568  *
3569  * API to check if vendor IE is WCN
3570  *
3571  * Return: true if its WCN IE
3572  */
3573 static inline bool
3574 is_wcn_oui(uint8_t *frm)
3575 {
3576 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3577 		((WCN_OUI_TYPE << 24) | WCN_OUI));
3578 }
3579 
3580 static inline bool
3581 is_qcn_oui(uint8_t *frm)
3582 {
3583 	return ((frm[1] > 4) && (LE_READ_4(frm + 2) ==
3584 		((QCN_OUI_TYPE_CMN << 24) | QCA_OUI)));
3585 }
3586 
3587 #define WLAN_VENDOR_WME_IE_LEN 24
3588 /**
3589  * is_wme_param() - If vendor IE is WME param type
3590  * @frm: vendor IE pointer
3591  *
3592  * API to check if vendor IE is WME param
3593  *
3594  * Return: true if its WME param IE
3595  */
3596 static inline bool
3597 is_wme_param(const uint8_t *frm)
3598 {
3599 	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
3600 			((WME_OUI_TYPE << 24) | WME_OUI)) &&
3601 			(frm[6] == WME_PARAM_OUI_SUBTYPE);
3602 }
3603 
3604 /**
3605  * is_wme_info() - If vendor IE is WME info type
3606  * @frm: vendor IE pointer
3607  *
3608  * API to check if vendor IE is WME info
3609  *
3610  * Return: true if its WME info IE
3611  */
3612 static inline bool
3613 is_wme_info(const uint8_t *frm)
3614 {
3615 	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
3616 		((WME_OUI_TYPE << 24) | WME_OUI)) &&
3617 		(frm[6] == WME_INFO_OUI_SUBTYPE);
3618 }
3619 
3620 #define WLAN_VENDOR_ATHCAPS_IE_LEN 9
3621 /**
3622  * is_atheros_oui() - If vendor IE is Atheros type
3623  * @frm: vendor IE pointer
3624  *
3625  * API to check if vendor IE is Atheros
3626  *
3627  * Return: true if its Atheros IE
3628  */
3629 static inline bool
3630 is_atheros_oui(const uint8_t *frm)
3631 {
3632 	return (frm[1] > 3) && LE_READ_4(frm + 2) ==
3633 		((ATH_OUI_TYPE << 24) | ATH_OUI);
3634 }
3635 
3636 #define WLAN_VENDOR_ATH_EXTCAP_IE_LEN 10
3637 /**
3638  * is_atheros_extcap_oui() - If vendor IE is Atheros ext cap
3639  * @frm: vendor IE pointer
3640  *
3641  * API to check if vendor IE is Atheros ext cap
3642  *
3643  * Return: true if its Atheros ext cap IE
3644  */
3645 static inline int
3646 is_atheros_extcap_oui(uint8_t *frm)
3647 {
3648 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
3649 		((ATH_OUI_EXTCAP_TYPE << 24) | ATH_OUI));
3650 }
3651 
3652 #define WLAN_VENDOR_SFA_IE_LEN 5
3653 /**
3654  * is_sfa_oui() - If vendor IE is SFA type
3655  * @frm: vendor IE pointer
3656  *
3657  * API to check if vendor IE is SFA
3658  *
3659  * Return: true if its SFA IE
3660  */
3661 static inline bool
3662 is_sfa_oui(uint8_t *frm)
3663 {
3664 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3665 		((SFA_OUI_TYPE << 24) | SFA_OUI));
3666 }
3667 
3668 /**
3669  * is_p2p_oui() - If vendor IE is P2P type
3670  * @frm: vendor IE pointer
3671  *
3672  * API to check if vendor IE is P2P
3673  *
3674  * Return: true if its P2P IE
3675  */
3676 static inline bool
3677 is_p2p_oui(const uint8_t *frm)
3678 {
3679 	const uint8_t wfa_oui[3] = P2P_WFA_OUI;
3680 
3681 	return (frm[1] >= 4) &&
3682 		(frm[2] == wfa_oui[0]) &&
3683 		(frm[3] == wfa_oui[1]) &&
3684 		(frm[4] == wfa_oui[2]) &&
3685 		(frm[5] == P2P_WFA_VER);
3686 }
3687 
3688 #define WLAN_VENDOR_SON_IE_LEN 31
3689 /**
3690  * is_qca_son_oui() - If vendor IE is QCA WHC type
3691  * @frm: vendor IE pointer
3692  * @whc_subtype: subtype
3693  *
3694  * API to check if vendor IE is QCA WHC
3695  *
3696  * Return: true if its QCA WHC IE
3697  */
3698 static inline bool
3699 is_qca_son_oui(uint8_t *frm, uint8_t whc_subtype)
3700 {
3701 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3702 		((QCA_OUI_WHC_TYPE << 24) | QCA_OUI)) &&
3703 		(*(frm + 6) == whc_subtype);
3704 }
3705 
3706 /**
3707  * is_qca_son_rept_oui() - If vendor IE is QCA WHC repeater type
3708  * @frm: vendor IE pointer
3709  * @whc_subtype: subtype
3710  *
3711  * API to check if vendor IE is QCA WHC REPT
3712  *
3713  * Return: true if its QCA WHC REPT IE
3714  */
3715 static inline bool
3716 is_qca_son_rept_oui(u_int8_t *frm, u_int8_t whc_subtype)
3717 {
3718 	return ((frm[1] > 4) && (LE_READ_4(frm + 2) ==
3719 		((QCA_OUI_WHC_REPT_TYPE << 24) | QCA_OUI)) &&
3720 		(*(frm + 6) == whc_subtype));
3721 }
3722 
3723 /**
3724  * is_ht_cap() - If vendor IE is vendor HT cap type
3725  * @frm: vendor IE pointer
3726  *
3727  * API to check if vendor IE is vendor HT cap
3728  *
3729  * Return: true if its vendor HT cap IE
3730  */
3731 static inline bool
3732 is_ht_cap(uint8_t *frm)
3733 {
3734 	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
3735 		((VENDOR_HT_OUI << 8) | VENDOR_HT_CAP_ID));
3736 }
3737 
3738 /**
3739  * is_ht_info() - If vendor IE is vendor HT info type
3740  * @frm: vendor IE pointer
3741  *
3742  * API to check if vendor IE is vendor HT info
3743  *
3744  * Return: true if its vendor HT info IE
3745  */
3746 static inline bool
3747 is_ht_info(uint8_t *frm)
3748 {
3749 	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
3750 		((VENDOR_HT_OUI << 8) | VENDOR_HT_INFO_ID));
3751 }
3752 
3753 /**
3754  * is_interop_vht() - If vendor IE is VHT interop
3755  * @frm: vendor IE pointer
3756  *
3757  * API to check if vendor IE is VHT interop
3758  *
3759  * Return: true if its VHT interop IE
3760  */
3761 static inline bool
3762 is_interop_vht(uint8_t *frm)
3763 {
3764 	return (frm[1] > 12) && (BE_READ_4(frm + 2) ==
3765 		((VHT_INTEROP_OUI << 8) | VHT_INTEROP_TYPE)) &&
3766 		((*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE) ||
3767 		(*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC));
3768 }
3769 
3770 /**
3771  * is_bwnss_oui() - If vendor IE is BW NSS type
3772  * @frm: vendor IE pointer
3773  *
3774  * API to check if vendor IE is BW NSS
3775  *
3776  * Return: true if its BW NSS IE
3777  */
3778 static inline bool
3779 is_bwnss_oui(uint8_t *frm)
3780 {
3781 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
3782 		((ATH_OUI_BW_NSS_MAP_TYPE << 24) | ATH_OUI));
3783 }
3784 
3785 #define WLAN_BWNSS_MAP_OFFSET 7
3786 
3787 /**
3788  * is_he_cap_oui() - If vendor IE is HE CAP OUI
3789  * @frm: vendor IE pointer
3790  *
3791  * API to check if vendor IE is HE CAP
3792  *
3793  * Return: true if its HE CAP IE
3794  */
3795 static inline bool
3796 is_he_cap_oui(uint8_t *frm)
3797 {
3798 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3799 		((ATH_HE_CAP_SUBTYPE << 24) | ATH_HE_OUI));
3800 }
3801 
3802 /**
3803  * is_he_op_oui() - If vendor IE is HE OP OUI
3804  * @frm: vendor IE pointer
3805  *
3806  * API to check if vendor IE is HE OP OUT
3807  *
3808  * Return: true if its HE OP OUI
3809  */
3810 static inline bool
3811 is_he_op_oui(uint8_t *frm)
3812 {
3813 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3814 		((ATH_HE_OP_SUBTYPE << 24) | ATH_HE_OUI));
3815 }
3816 
3817 /**
3818  * is_extender_oui() - If vendor IE is EXTENDER OUI
3819  * @frm: vendor IE pointer
3820  *
3821  * API to check if vendor IE is EXTENDER OUI
3822  *
3823  * Return: true if its EXTENDER OUI
3824  */
3825 static inline bool
3826 is_extender_oui(uint8_t *frm)
3827 {
3828 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
3829 		((QCA_OUI_EXTENDER_TYPE << 24) | QCA_OUI));
3830 }
3831 
3832 /**
3833  * is_adaptive_11r_oui() - Function to check if vendor IE is ADAPTIVE 11R OUI
3834  * @frm: vendor IE pointer
3835  *
3836  * API to check if vendor IE is ADAPTIVE 11R OUI
3837  *
3838  * Return: true if its ADAPTIVE 11r OUI
3839  */
3840 static inline bool
3841 is_adaptive_11r_oui(uint8_t *frm)
3842 {
3843 	return (frm[1] > OUI_LENGTH) && (LE_READ_4(frm + 2) ==
3844 		((ADAPTIVE_11R_OUI_TYPE << OUI_TYPE_BITS) | ADAPTIVE_11R_OUI));
3845 }
3846 
3847 /**
3848  * is_sae_single_pmk_oui() - Fun to check if vendor IE is sae single pmk OUI
3849  * @frm: vendor IE pointer
3850  *
3851  * API to check if vendor IE is sae single pmk OUI
3852  *
3853  * Return: true if its sae single pmk OUI
3854  */
3855 static inline bool
3856 is_sae_single_pmk_oui(uint8_t *frm)
3857 {
3858 	return (frm[1] > OUI_LENGTH) && (LE_READ_4(frm + 2) ==
3859 		((SAE_SINGLE_PMK_TYPE << OUI_TYPE_BITS) | SAE_SINGLE_PMK_OUI));
3860 }
3861 
3862 /**
3863  * wlan_parse_oce_reduced_wan_metrics_ie() - parse oce wan metrics
3864  * @mbo_oce_ie: MBO/OCE ie ptr
3865  * @wan_metrics: out structure for the reduced wan metric
3866  *
3867  * API, function to parse reduced wan metric
3868  *
3869  * Return: true if oce wan metrics is present
3870  */
3871 static inline bool
3872 wlan_parse_oce_reduced_wan_metrics_ie(uint8_t *mbo_oce_ie,
3873 	struct oce_reduced_wan_metrics *wan_metrics)
3874 {
3875 	uint8_t len, attribute_len, attribute_id;
3876 	uint8_t *ie;
3877 
3878 	if (!mbo_oce_ie)
3879 		return false;
3880 
3881 	ie = mbo_oce_ie;
3882 	len = ie[1];
3883 	ie += 2;
3884 
3885 	if (len <= MBO_OCE_OUI_SIZE)
3886 		return false;
3887 
3888 	ie += MBO_OCE_OUI_SIZE;
3889 	len -= MBO_OCE_OUI_SIZE;
3890 
3891 	while (len > 2) {
3892 		attribute_id = ie[0];
3893 		attribute_len = ie[1];
3894 		len -= 2;
3895 		if (attribute_len > len)
3896 			return false;
3897 
3898 		if (attribute_id == REDUCED_WAN_METRICS_ATTR) {
3899 			wan_metrics->downlink_av_cap = ie[2] & 0xff;
3900 			wan_metrics->uplink_av_cap = ie[2] >> 4;
3901 			return true;
3902 		}
3903 
3904 		ie += (attribute_len + 2);
3905 		len -= attribute_len;
3906 	}
3907 
3908 	return false;
3909 }
3910 
3911 /**
3912  * wlan_parse_oce_subnet_id_ie() - parse oce subnet id IE
3913  * @mbo_oce_ie: MBO/OCE IE pointer
3914  *
3915  * While parsing vendor IE, is_mbo_oce_oui() API does sanity of
3916  * length and attribute ID for MBO_OCE_OUI and after passing the
3917  * sanity only mbo_oce IE is stored in scan cache.
3918  * It is a callers responsibility to get the mbo_oce_ie pointer
3919  * using util_scan_entry_mbo_oce() API, which points to mbo_oce
3920  * stored in scan cache. Thus caller is responsible for ensuring
3921  * the length of the IE is consistent with the embedded length.
3922  *
3923  * Return: true if oce subnet id is present, else false
3924  */
3925 static inline bool
3926 wlan_parse_oce_subnet_id_ie(uint8_t *mbo_oce_ie)
3927 {
3928 	uint8_t len, attribute_len, attribute_id;
3929 	uint8_t *ie;
3930 
3931 	if (!mbo_oce_ie)
3932 		return false;
3933 
3934 	ie = mbo_oce_ie;
3935 	len = ie[1];
3936 	ie += 2;
3937 
3938 	if (len <= MBO_OCE_OUI_SIZE)
3939 		return false;
3940 
3941 	ie += MBO_OCE_OUI_SIZE;
3942 	len -= MBO_OCE_OUI_SIZE;
3943 
3944 	while (len > 2) {
3945 		attribute_id = ie[0];
3946 		attribute_len = ie[1];
3947 		len -= 2;
3948 		if (attribute_len > len)
3949 			return false;
3950 
3951 		if (attribute_id == OCE_SUBNET_ID_ATTR)
3952 			return true;
3953 
3954 		ie += (attribute_len + 2);
3955 		len -= attribute_len;
3956 	}
3957 
3958 	return false;
3959 }
3960 
3961 /**
3962  * wlan_parse_oce_assoc_disallowed_ie() - parse oce assoc disallowed IE
3963  * @mbo_oce_ie: MBO/OCE ie ptr
3964  * @reason: reason for disallowing assoc.
3965  *
3966  * API, function to parse OCE assoc disallowed param from the OCE MBO IE
3967  *
3968  * Return: true if assoc disallowed field is present in the IE
3969  */
3970 static inline bool
3971 wlan_parse_oce_assoc_disallowed_ie(uint8_t *mbo_oce_ie, uint8_t *reason)
3972 {
3973 	uint8_t len, attribute_len, attribute_id;
3974 	uint8_t *ie;
3975 
3976 	if (!mbo_oce_ie)
3977 		return false;
3978 
3979 	ie = mbo_oce_ie;
3980 	len = ie[1];
3981 	ie += 2;
3982 
3983 	if (len <= MBO_OCE_OUI_SIZE)
3984 		return false;
3985 
3986 	ie += MBO_OCE_OUI_SIZE;
3987 	len -= MBO_OCE_OUI_SIZE;
3988 
3989 	while (len > 2) {
3990 		attribute_id = ie[0];
3991 		attribute_len = ie[1];
3992 		len -= 2;
3993 		if (attribute_len > len)
3994 			return false;
3995 
3996 		if (attribute_id == OCE_DISALLOW_ASSOC_ATTR) {
3997 			*reason = ie[2];
3998 			return true;
3999 		}
4000 
4001 		ie += (attribute_len + 2);
4002 		len -= attribute_len;
4003 	}
4004 
4005 	return false;
4006 }
4007 
4008 /*
4009  * wlan_parse_oce_ap_tx_pwr_ie() - parse oce ap tx pwr
4010  * @mbo_oce_ie: MBO/OCE ie ptr
4011  * @ap_tx_pwr: pointer to hold value of ap_tx_pwr in dbm
4012  *
4013  * Return: true if oce ap tx pwr is present, else false
4014  */
4015 static inline bool
4016 wlan_parse_oce_ap_tx_pwr_ie(uint8_t *mbo_oce_ie, int8_t *ap_tx_pwr_dbm)
4017 {
4018 	uint8_t len, attribute_len, attribute_id;
4019 	uint8_t *ie;
4020 	int8_t ap_tx_power_in_2_complement;
4021 
4022 	if (!mbo_oce_ie)
4023 		return false;
4024 
4025 	ie = mbo_oce_ie;
4026 	len = ie[1];
4027 	ie += 2;
4028 
4029 	if (len <= MBO_OCE_OUI_SIZE)
4030 		return false;
4031 
4032 	ie += MBO_OCE_OUI_SIZE;
4033 	len -= MBO_OCE_OUI_SIZE;
4034 
4035 	while (len > 2) {
4036 		attribute_id = ie[0];
4037 		attribute_len = ie[1];
4038 		len -= 2;
4039 		if (attribute_len > len)
4040 			return false;
4041 
4042 		if (attribute_id == AP_TX_PWR_ATTR) {
4043 			ap_tx_power_in_2_complement = ie[2];
4044 			*ap_tx_pwr_dbm =
4045 				(int8_t)(256 - ap_tx_power_in_2_complement);
4046 			return true;
4047 		}
4048 
4049 		ie += (attribute_len + 2);
4050 		len -= attribute_len;
4051 	}
4052 
4053 	return false;
4054 }
4055 
4056 /**
4057  * enum mlme_csa_event_ies_present_flag - IE present flag in CSA event
4058  * @MLME_CSA_IE_PRESENT: CSA IE is present
4059  * @MLME_XCSA_IE_PRESENT: extend CSA IE is present
4060  * @MLME_WBW_IE_PRESENT: wide bandwidth channel switch IE is present
4061  * @MLME_CSWRAP_IE_EXTENDED_PRESENT: channel switch wrapper IE is present
4062  */
4063 enum mlme_csa_event_ies_present_flag {
4064 	MLME_CSA_IE_PRESENT    = 0x00000001,
4065 	MLME_XCSA_IE_PRESENT   = 0x00000002,
4066 	MLME_WBW_IE_PRESENT    = 0x00000004,
4067 	MLME_CSWRAP_IE_EXTENDED_PRESENT = 0x00000008,
4068 };
4069 
4070 /**
4071  * struct csa_offload_params - STA CSA offload request parameters
4072  * @channel: channel
4073  * @csa_chan_freq: channel frequency (MHz)
4074  * @switch_mode: switch mode
4075  * @sec_chan_offset: secondary channel offset
4076  * @new_ch_width: new channel width
4077  * @new_punct_bitmap: new puncture bitmap based on new channel width
4078  * @new_op_class: new operating class
4079  * @new_ch_freq_seg1: channel center freq 1
4080  * @new_ch_freq_seg2: channel center freq 2
4081  * @ies_present_flag: BIT MAP of MLME_CSA_EVENT_IES_PRESENT_FLAG
4082  * @bssid: BSSID which triggers CSA
4083  */
4084 struct csa_offload_params {
4085 	uint8_t channel;
4086 	uint32_t csa_chan_freq;
4087 	uint8_t switch_mode;
4088 	uint8_t sec_chan_offset;
4089 	enum phy_ch_width new_ch_width;
4090 #ifdef WLAN_FEATURE_11BE
4091 	uint16_t new_punct_bitmap;
4092 #endif
4093 	uint8_t new_op_class;
4094 	uint8_t new_ch_freq_seg1;
4095 	uint8_t new_ch_freq_seg2;
4096 	uint32_t ies_present_flag;
4097 	struct qdf_mac_addr bssid;
4098 };
4099 #endif /* _WLAN_CMN_IEEE80211_DEFS_H_ */
4100