xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: contains commnon ieee80211 definitions
21  */
22 
23 #ifndef _WLAN_CMN_IEEE80211_H_
24 #define _WLAN_CMN_IEEE80211_H_
25 #include <qdf_types.h>
26 #include <osdep.h>
27 
28 /* Length of Timestamp field */
29 #define WLAN_TIMESTAMP_LEN         8
30 
31 /* Length of Beacon Interval field */
32 #define WLAN_BEACONINTERVAL_LEN    2
33 
34 /* Length of Capability Information field */
35 #define WLAN_CAPABILITYINFO_LEN    2
36 
37 /* Length of Listen Interval field */
38 #define WLAN_LISTENINTERVAL_LEN    2
39 
40 /* Length of Status code field */
41 #define WLAN_STATUSCODE_LEN        2
42 
43 /* Length of AID field */
44 #define WLAN_AID_LEN               2
45 
46 /* Assoc resp IE offset Capability(2) + Status Code(2) + AID(2) */
47 #define WLAN_ASSOC_RSP_IES_OFFSET \
48 	(WLAN_CAPABILITYINFO_LEN  + WLAN_STATUSCODE_LEN + WLAN_AID_LEN)
49 
50 /* Assoc req IE offset - Capability(2) + LI(2) */
51 #define WLAN_ASSOC_REQ_IES_OFFSET \
52 	(WLAN_CAPABILITYINFO_LEN + WLAN_LISTENINTERVAL_LEN)
53 
54 /* Reassoc req IE offset - Capability(2) + LI(2) + current AP address(6) */
55 #define WLAN_REASSOC_REQ_IES_OFFSET \
56 	(WLAN_CAPABILITYINFO_LEN + WLAN_LISTENINTERVAL_LEN + QDF_MAC_ADDR_SIZE)
57 
58 /* Length (in bytes) of MAC header in 3 address format */
59 #define WLAN_MAC_HDR_LEN_3A 24
60 
61 #define IEEE80211_CCMP_HEADERLEN    8
62 #define IEEE80211_HT_CTRL_LEN       4
63 #define IEEE80211_CCMP_MICLEN       8
64 #define WLAN_IEEE80211_GCMP_HEADERLEN    8
65 #define WLAN_IEEE80211_GCMP_MICLEN       16
66 
67 #define IEEE80211_FC1_RETRY         0x08
68 #define IEEE80211_FC1_WEP           0x40
69 #define IEEE80211_FC1_ORDER         0x80
70 
71 #define WLAN_HDR_IV_LEN            3
72 #define WLAN_HDR_EXT_IV_BIT        0x20
73 #define WLAN_HDR_EXT_IV_LEN        4
74 
75 #define WLAN_SEQ_SEQ_SHIFT 4
76 
77 #define P2P_WFA_OUI {0x50, 0x6f, 0x9a}
78 #define P2P_WFA_VER 0x09
79 
80 #define WSC_OUI 0x0050f204
81 #define MBO_OCE_OUI 0x506f9a16
82 #define MBO_OCE_OUI_SIZE 4
83 #define REDUCED_WAN_METRICS_ATTR 103
84 #define OCE_DISALLOW_ASSOC_ATTR  0x4
85 #define AP_TX_PWR_ATTR 107
86 #define OCE_SUBNET_ID_ATTR 108
87 #define OCE_SUBNET_ID_LEN 6
88 #define OSEN_OUI 0x506f9a12
89 
90 /* WCN IE */
91 /* Microsoft OUI */
92 #define WCN_OUI 0xf25000
93 /* WCN */
94 #define WCN_OUI_TYPE 0x04
95 #define WME_OUI 0xf25000
96 #define WME_OUI_TYPE 0x02
97 #define WME_PARAM_OUI_SUBTYPE 0x01
98 #define WME_INFO_OUI_SUBTYPE 0x00
99  /* Atheros OUI */
100 #define ATH_OUI 0x7f0300
101 #define ATH_OUI_TYPE 0x01
102 /* Atheros Extended Cap Type */
103 #define ATH_OUI_EXTCAP_TYPE 0x04
104 /* QCA Bandwidth NSS Mapping Type */
105 #define ATH_OUI_BW_NSS_MAP_TYPE 0x05
106 #define SFA_OUI 0x964000
107 #define SFA_OUI_TYPE 0x14
108 /* QCA OUI (in little endian) */
109 #define QCA_OUI 0xf0fd8c
110 #define QCA_OUI_WHC_TYPE  0x00
111 #define QCA_OUI_WHC_REPT_TYPE 0x01
112 
113 /* Extender vendor specific IE */
114 #define QCA_OUI_EXTENDER_TYPE           0x03
115 
116 #define ADAPTIVE_11R_OUI      0x964000
117 #define ADAPTIVE_11R_OUI_TYPE 0x2C
118 
119 #define OUI_LENGTH              4
120 #define OUI_TYPE_BITS           24
121 #define MAX_ADAPTIVE_11R_IE_LEN 8
122 
123 /*
124  * sae single pmk vendor specific IE details
125  * Category     Data
126  * Type         0xDD
127  * Length       0x05
128  * OUI          0x00 40 96
129  * Type         0x03
130  * Data         Don’t care (EX, 0x05)
131  */
132 #define SAE_SINGLE_PMK_OUI          0x964000
133 #define SAE_SINGLE_PMK_TYPE         0x03
134 #define MAX_SAE_SINGLE_PMK_IE_LEN   8
135 
136 /* Temporary vendor specific IE for 11n pre-standard interoperability */
137 #define VENDOR_HT_OUI       0x00904c
138 #define VENDOR_HT_CAP_ID    51
139 #define VENDOR_HT_INFO_ID   52
140 
141 #define VHT_INTEROP_OUI 0x00904c
142 #define VHT_INTEROP_TYPE 0x04
143 #define VHT_INTEROP_OUI_SUBTYPE 0x08
144 #define VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC 0x18
145 
146 /* ATH HE OUI ( in little endian) */
147 #define ATH_HE_OUI                  0x741300
148 #define ATH_HE_CAP_SUBTYPE          0x01
149 #define ATH_HE_OP_SUBTYPE           0x02
150 
151 /* EPR information element flags */
152 #define ERP_NON_ERP_PRESENT   0x01
153 #define ERP_USE_PROTECTION    0x02
154 #define ERP_LONG_PREAMBLE     0x04
155 
156 #define QCA_OUI_WHC_AP_INFO_SUBTYPE 0x00
157 
158 #define WLAN_MAX_IE_LEN                255
159 #define WLAN_RSN_IE_LEN                22
160 
161 /* Individual element IEs length checks */
162 
163 /* Maximum supported basic/mandatory rates are 12 */
164 #define WLAN_SUPPORTED_RATES_IE_MAX_LEN          12
165 #define WLAN_FH_PARAM_IE_MAX_LEN                 5
166 #define WLAN_DS_PARAM_IE_MAX_LEN                 1
167 #define WLAN_CF_PARAM_IE_MAX_LEN                 6
168 #define WLAN_COUNTRY_IE_MIN_LEN                  3
169 #define WLAN_QUIET_IE_MAX_LEN                    6
170 #define WLAN_CSA_IE_MAX_LEN                      3
171 #define WLAN_XCSA_IE_MAX_LEN                     4
172 #define WLAN_SECCHANOFF_IE_MAX_LEN               1
173 #define WLAN_EXT_SUPPORTED_RATES_IE_MAX_LEN      12
174 
175 #define WLAN_EXTCAP_IE_MAX_LEN                   15
176 #define WLAN_FILS_INDICATION_IE_MIN_LEN          2
177 #define WLAN_MOBILITY_DOMAIN_IE_MAX_LEN          3
178 #define WLAN_OPMODE_IE_MAX_LEN                   1
179 #define WLAN_IBSSDFS_IE_MIN_LEN                  7
180 #define WLAN_IBSS_IE_MAX_LEN                     2
181 #define WLAN_REQUEST_IE_MAX_LEN                  255
182 #define WLAN_RM_CAPABILITY_IE_MAX_LEN            5
183 #define WLAN_RNR_IE_MIN_LEN                      5
184 #define WLAN_TPE_IE_MIN_LEN                      2
185 #define WLAN_MAX_NUM_TPE_IE                      8
186 
187 /* Wide band channel switch IE length */
188 #define WLAN_WIDE_BW_CHAN_SWITCH_IE_LEN          3
189 
190 /* Number of max TX power elements supported plus size of Transmit Power
191  * Information element.
192  */
193 #define WLAN_TPE_IE_MAX_LEN                      9
194 
195 /* Max channel switch time IE length */
196 #define WLAN_MAX_CHAN_SWITCH_TIME_IE_LEN         4
197 
198 #define WLAN_MAX_SRP_IE_LEN                      21
199 #define WLAN_MAX_MUEDCA_IE_LEN                   14
200 #define WLAN_MAX_HE_6G_CAP_IE_LEN                3
201 #define WLAN_MAX_HEOP_IE_LEN                     16
202 
203 /* HT capability flags */
204 #define WLAN_HTCAP_C_ADVCODING             0x0001
205 #define WLAN_HTCAP_C_CHWIDTH40             0x0002
206 /* Capable of SM Power Save (Static) */
207 #define WLAN_HTCAP_C_SMPOWERSAVE_STATIC    0x0000
208 /* Capable of SM Power Save (Dynamic) */
209 #define WLAN_HTCAP_C_SMPOWERSAVE_DYNAMIC   0x0004
210 /* Reserved */
211 #define WLAN_HTCAP_C_SM_RESERVED           0x0008
212 /* SM enabled, no SM Power Save */
213 #define WLAN_HTCAP_C_SMPOWERSAVE_DISABLED            0x000c
214 #define WLAN_HTCAP_C_GREENFIELD            0x0010
215 #define WLAN_HTCAP_C_SHORTGI20             0x0020
216 #define WLAN_HTCAP_C_SHORTGI40             0x0040
217 #define WLAN_HTCAP_C_TXSTBC                0x0080
218 #define WLAN_HTCAP_C_TXSTBC_S                   7
219 /* 2 bits */
220 #define WLAN_HTCAP_C_RXSTBC                0x0300
221 #define WLAN_HTCAP_C_RXSTBC_S                   8
222 #define WLAN_HTCAP_C_DELAYEDBLKACK         0x0400
223 /* 1 = 8K, 0 = 3839B */
224 #define WLAN_HTCAP_C_MAXAMSDUSIZE          0x0800
225 #define WLAN_HTCAP_C_DSSSCCK40             0x1000
226 #define WLAN_HTCAP_C_PSMP                  0x2000
227 #define WLAN_HTCAP_C_INTOLERANT40          0x4000
228 #define WLAN_HTCAP_C_LSIGTXOPPROT          0x8000
229 /* Spatial Multiplexing (SM) capabitlity bitmask */
230 #define WLAN_HTCAP_C_SM_MASK               0x000c
231 
232 /* VHT Operation  */
233 /* 20/40 MHz Operating Channel */
234 #define WLAN_VHTOP_CHWIDTH_2040          0
235 /* 80 MHz Operating Channel */
236 #define WLAN_VHTOP_CHWIDTH_80            1
237 /* 160 MHz Operating Channel */
238 #define WLAN_VHTOP_CHWIDTH_160           2
239 /* 80 + 80 MHz Operating Channel */
240 #define WLAN_VHTOP_CHWIDTH_80_80         3
241 /* 160 MHz Operating Channel  (revised signalling) */
242 #define WLAN_VHTOP_CHWIDTH_REVSIG_160    1
243 /* 80 + 80 MHz Operating Channel  (revised signalling) */
244 #define WLAN_VHTOP_CHWIDTH_REVSIG_80_80  1
245 
246 #define WLAN_HEOP_FIXED_PARAM_LENGTH       7
247 #define WLAN_HEOP_VHTOP_LENGTH             3
248 #define WLAN_HEOP_CO_LOCATED_BSS_LENGTH    1
249 
250 #define WLAN_HEOP_VHTOP_PRESENT_MASK       0x00004000  /* B14 */
251 #define WLAN_HEOP_CO_LOCATED_BSS_MASK      0x00008000  /* B15 */
252 #define WLAN_HEOP_6GHZ_INFO_PRESENT_MASK   0X00020000  /* B17 */
253 
254 #define WLAN_HE_6GHZ_CHWIDTH_20           0 /* 20MHz Oper Ch width */
255 #define WLAN_HE_6GHZ_CHWIDTH_40           1 /* 40MHz Oper Ch width */
256 #define WLAN_HE_6GHZ_CHWIDTH_80           2 /* 80MHz Oper Ch width */
257 #define WLAN_HE_6GHZ_CHWIDTH_160_80_80    3 /* 160/80+80 MHz Oper Ch width */
258 
259 #ifdef WLAN_FEATURE_11BE
260 #define WLAN_EHT_CHWIDTH_20           0 /* 20MHz Oper Ch width */
261 #define WLAN_EHT_CHWIDTH_40           1 /* 40MHz Oper Ch width */
262 #define WLAN_EHT_CHWIDTH_80           2 /* 80MHz Oper Ch width */
263 #define WLAN_EHT_CHWIDTH_160          3 /* 160MHz Oper Ch width */
264 #define WLAN_EHT_CHWIDTH_320          4 /* 320MHz Oper Ch width */
265 #endif
266 
267 #define WLAN_RATE_VAL              0x7f
268 #define WLAN_BASIC_RATE_MASK       0x80
269 
270 #define WLAN_RV(v)     ((v) & WLAN_RATE_VAL)
271 
272 #define WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY       127
273 #define WLAN_BSS_MEMBERSHIP_SELECTOR_VHT_PHY      126
274 #define WLAN_BSS_MEMBERSHIP_SELECTOR_SAE_H2E      123
275 #define WLAN_BSS_MEMBERSHIP_SELECTOR_HE_PHY       122
276 
277 #define WLAN_CHAN_IS_5GHZ(chanidx) \
278 	((chanidx > 30) ? true : false)
279 #define WLAN_CHAN_IS_2GHZ(chanidx) \
280 	(((chanidx > 0) && (chanidx < 15)) ? true : false)
281 
282 /* Check if revised signalling is being used for VHT160 in vhtop */
283 #define WLAN_IS_REVSIG_VHT160(vhtop) (((vhtop)->vht_op_chwidth == \
284 	WLAN_VHTOP_CHWIDTH_REVSIG_160) && \
285 	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
286 	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) == 8))
287 
288 /* Check if revised signalling is being used for VHT80p80 in vhtop */
289 #define WLAN_IS_REVSIG_VHT80_80(vhtop) (((vhtop)->vht_op_chwidth == \
290 	WLAN_VHTOP_CHWIDTH_REVSIG_80_80) && \
291 	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
292 	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) > 8))
293 
294 /* Check if channel width is HE160 in HE 6ghz params */
295 #define WLAN_IS_HE160(he_6g_param) (((he_6g_param)->width == \
296 	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
297 	((he_6g_param)->chan_freq_seg1 != 0) && \
298 	(abs((he_6g_param)->chan_freq_seg1 - \
299 	(he_6g_param)->chan_freq_seg0) == 8))
300 
301 /* Check if channel width is HE80p80 in HE 6ghz params */
302 #define WLAN_IS_HE80_80(he_6g_param) (((he_6g_param)->width == \
303 	WLAN_HE_6GHZ_CHWIDTH_160_80_80) && \
304 	((he_6g_param)->chan_freq_seg1 != 0) && \
305 	(abs((he_6g_param)->chan_freq_seg1 - \
306 	(he_6g_param)->chan_freq_seg0) > 8))
307 
308 #define LE_READ_2(p) \
309 	((uint16_t)\
310 	((((const uint8_t *)(p))[0]) |\
311 	(((const uint8_t *)(p))[1] <<  8)))
312 
313 #define LE_READ_4(p) \
314 	((uint32_t)\
315 	((((const uint8_t *)(p))[0]) |\
316 	(((const uint8_t *)(p))[1] <<  8) |  \
317 	(((const uint8_t *)(p))[2] << 16) |\
318 	(((const uint8_t *)(p))[3] << 24)))
319 
320 #define BE_READ_4(p) \
321 	((uint32_t)\
322 	((((const uint8_t *)(p))[0] << 24) |\
323 	(((const uint8_t *)(p))[1] << 16) |\
324 	(((const uint8_t *)(p))[2] <<  8) |\
325 	(((const uint8_t *)(p))[3])))
326 
327 /**
328  * enum ext_chan_offset: extension channel offset
329  * @WLAN_HTINFO_EXTOFFSET_NA: no extension channel is present
330  * @WLAN_HTINFO_EXTOFFSET_ABOVE: above control channel
331  * @WLAN_HTINFO_EXTOFFSET_UNDEF: undefined
332  * @WLAN_HTINFO_EXTOFFSET_BELOW: below control channel
333  */
334 enum ext_chan_offset {
335 	WLAN_HTINFO_EXTOFFSET_NA    = 0,
336 	WLAN_HTINFO_EXTOFFSET_ABOVE = 1,
337 	WLAN_HTINFO_EXTOFFSET_UNDEF = 2,
338 	WLAN_HTINFO_EXTOFFSET_BELOW = 3
339 };
340 
341 /**
342  * enum element_ie :- Management information element
343  * @WLAN_ELEMID_SSID: ssid IE
344  * @WLAN_ELEMID_RATES: Rates IE
345  * @WLAN_ELEMID_FHPARMS: FH param IE
346  * @WLAN_ELEMID_DSPARMS: DS Param IE
347  * @WLAN_ELEMID_CFPARMS : CF Param IE
348  * @WLAN_ELEMID_TIM: TIM IE
349  * @WLAN_ELEMID_IBSSPARMS: Ibss params IE
350  * @WLAN_ELEMID_COUNTRY: Country code IE
351  * @WLAN_ELEMID_REQINFO: Req Info IE
352  * @WLAN_ELEMID_QBSS_LOAD: Qbss load IE
353  * @WLAN_ELEMID_TCLAS: TCLAS IE
354  * @WLAN_ELEMID_CHALLENGE: Challenge IE
355  * @WLAN_ELEMID_PWRCNSTR: Power cn IE
356  * @WLAN_ELEMID_PWRCAP: power cap IE
357  * @WLAN_ELEMID_TPCREQ: TPC req IE
358  * @WLAN_ELEMID_TPCREP: TPC rsp IE
359  * @WLAN_ELEMID_SUPPCHAN: Supported channel IE
360  * @WLAN_ELEMID_CHANSWITCHANN: Channel switch IE
361  * @WLAN_ELEMID_MEASREQ: Measurement request IE
362  * @WLAN_ELEMID_MEASREP: Measurement Resp IE
363  * @WLAN_ELEMID_QUIET: Quiet IE
364  * @WLAN_ELEMID_IBSSDFS: IBSS DFS IE
365  * @WLAN_ELEMID_ERP: ERP IE
366  * @WLAN_ELEMID_TCLAS_PROCESS: TCLAS process IE
367  * @WLAN_ELEMID_HTCAP_ANA: HTT Capability IE
368  * @WLAN_ELEMID_RSN: RSN IE
369  * @WLAN_ELEMID_XRATES: Extended rate IE
370  * @WLAN_ELEMID_HTCAP_VENDOR: HT cap vendor IE
371  * @WLAN_ELEMID_HTINFO_VENDOR: HT info vendor IE
372  * @WLAN_ELEMID_MOBILITY_DOMAIN: MD IE
373  * @WLAN_ELEMID_FT: FT IE
374  * @WLAN_ELEMID_TIMEOUT_INTERVAL: Timeout interval IE
375  * @WLAN_ELEMID_SUPP_OP_CLASS: OP class IE
376  * @WLAN_ELEMID_EXTCHANSWITCHANN: Extended Channel switch IE
377  * @WLAN_ELEMID_HTINFO_ANA: HT info IE
378  * @WLAN_ELEMID_SECCHANOFFSET: Sec channel Offset IE
379  * @WLAN_ELEMID_WAPI: WAPI IE
380  * @WLAN_ELEMID_TIME_ADVERTISEMENT: Time IE
381  * @WLAN_ELEMID_RRM: Radio resource measurement IE
382  * @WLAN_ELEMID_MULTIPLE_BSSID: Multiple BSSID IE
383  * @WLAN_ELEMID_2040_COEXT: 20-40 COext ext IE
384  * @WLAN_ELEMID_2040_INTOL:20-40 INT OL IE
385  * @WLAN_ELEMID_OBSS_SCAN: OBSS scan IE
386  * @WLAN_ELEMID_MMIE: 802.11w Management MIC IE
387  * @WLAN_ELEMID_NONTX_BSSID_CAP: Nontransmitted BSSID Capability IE
388  * @WLAN_ELEMID_MULTI_BSSID_IDX: Multiple BSSID index
389  * @WLAN_ELEMID_FMS_DESCRIPTOR: 802.11v FMS descriptor IE
390  * @WLAN_ELEMID_FMS_REQUEST: 802.11v FMS request IE
391  * @WLAN_ELEMID_FMS_RESPONSE: 802.11v FMS response IE
392  * @WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90: BSS MAX IDLE PERIOD
393  * @WLAN_ELEMID_TFS_REQUEST: TFS req IE
394  * @WLAN_ELEMID_TFS_RESPONSE: TFS resp IE
395  * @WLAN_ELEMID_TIM_BCAST_REQUEST: TIM bcast req IE
396  * @WLAN_ELEMID_TIM_BCAST_RESPONSE: TIM bcast resp IE
397  * @WLAN_ELEMID_INTERWORKING: Interworking IE
398  * @WLAN_ELEMID_QOS_MAP: QOS MAP IE
399  * @WLAN_ELEMID_XCAPS: Extended capability IE
400  * @WLAN_ELEMID_TPC: TPC IE
401  * @WLAN_ELEMID_CCKM: CCKM IE
402  * @WLAN_ELEMID_VHTCAP: VHT Capabilities
403  * @WLAN_ELEMID_VHTOP: VHT Operation
404  * @WLAN_ELEMID_EXT_BSS_LOAD: Extended BSS Load
405  * @WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH: Wide Band Channel Switch
406  * @WLAN_ELEMID_VHT_TX_PWR_ENVLP: VHT Transmit Power Envelope
407  * @WLAN_ELEMID_CHAN_SWITCH_WRAP: Channel Switch Wrapper
408  * @WLAN_ELEMID_AID: AID
409  * @WLAN_ELEMID_QUIET_CHANNEL: Quiet Channel
410  * @WLAN_ELEMID_OP_MODE_NOTIFY: Operating Mode Notification
411  * @WLAN_ELEMID_VENDOR: vendor private
412  * @WLAN_ELEMID_FRAGMENT: Fragment
413  * @WLAN_ELEMID_EXTN_ELEM: extended IE
414  */
415 enum element_ie {
416 	WLAN_ELEMID_SSID             = 0,
417 	WLAN_ELEMID_RATES            = 1,
418 	WLAN_ELEMID_FHPARMS          = 2,
419 	WLAN_ELEMID_DSPARMS          = 3,
420 	WLAN_ELEMID_CFPARMS          = 4,
421 	WLAN_ELEMID_TIM              = 5,
422 	WLAN_ELEMID_IBSSPARMS        = 6,
423 	WLAN_ELEMID_COUNTRY          = 7,
424 	/* 8-9 reserved */
425 	WLAN_ELEMID_REQINFO          = 10,
426 	WLAN_ELEMID_QBSS_LOAD        = 11,
427 	WLAN_ELEMID_EDCAPARMS        = 12,
428 	WLAN_ELEMID_TCLAS            = 14,
429 	WLAN_ELEMID_CHALLENGE        = 16,
430 	/* 17-31 reserved for challenge text extension */
431 	WLAN_ELEMID_PWRCNSTR         = 32,
432 	WLAN_ELEMID_PWRCAP           = 33,
433 	WLAN_ELEMID_TPCREQ           = 34,
434 	WLAN_ELEMID_TPCREP           = 35,
435 	WLAN_ELEMID_SUPPCHAN         = 36,
436 	WLAN_ELEMID_CHANSWITCHANN    = 37,
437 	WLAN_ELEMID_MEASREQ          = 38,
438 	WLAN_ELEMID_MEASREP          = 39,
439 	WLAN_ELEMID_QUIET            = 40,
440 	WLAN_ELEMID_IBSSDFS          = 41,
441 	WLAN_ELEMID_ERP              = 42,
442 	WLAN_ELEMID_TCLAS_PROCESS    = 44,
443 	WLAN_ELEMID_HTCAP_ANA        = 45,
444 	WLAN_ELEMID_QOS_CAPABILITY   = 46,
445 	WLAN_ELEMID_RSN              = 48,
446 	WLAN_ELEMID_XRATES           = 50,
447 	WLAN_ELEMID_HTCAP_VENDOR     = 51,
448 	WLAN_ELEMID_HTINFO_VENDOR    = 52,
449 	WLAN_ELEMID_MOBILITY_DOMAIN  = 54,
450 	WLAN_ELEMID_FT               = 55,
451 	WLAN_ELEMID_TIMEOUT_INTERVAL = 56,
452 	WLAN_ELEMID_SUPP_OP_CLASS    = 59,
453 	WLAN_ELEMID_EXTCHANSWITCHANN = 60,
454 	WLAN_ELEMID_HTINFO_ANA       = 61,
455 	WLAN_ELEMID_SECCHANOFFSET    = 62,
456 	WLAN_ELEMID_WAPI             = 68,
457 	WLAN_ELEMID_TIME_ADVERTISEMENT = 69,
458 	WLAN_ELEMID_RRM              = 70,
459 	WLAN_ELEMID_MULTIPLE_BSSID   = 71,
460 	WLAN_ELEMID_2040_COEXT       = 72,
461 	WLAN_ELEMID_2040_INTOL       = 73,
462 	WLAN_ELEMID_OBSS_SCAN        = 74,
463 	WLAN_ELEMID_MMIE             = 76,
464 	WLAN_ELEMID_NONTX_BSSID_CAP  = 83,
465 	WLAN_ELEMID_MULTI_BSSID_IDX  = 85,
466 	WLAN_ELEMID_FMS_DESCRIPTOR   = 86,
467 	WLAN_ELEMID_FMS_REQUEST      = 87,
468 	WLAN_ELEMID_FMS_RESPONSE     = 88,
469 	WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90,
470 	WLAN_ELEMID_TFS_REQUEST      = 91,
471 	WLAN_ELEMID_TFS_RESPONSE     = 92,
472 	WLAN_ELEMID_TIM_BCAST_REQUEST  = 94,
473 	WLAN_ELEMID_TIM_BCAST_RESPONSE = 95,
474 	WLAN_ELEMID_INTERWORKING     = 107,
475 	WLAN_ELEMID_QOS_MAP          = 110,
476 	WLAN_ELEMID_XCAPS            = 127,
477 	WLAN_ELEMID_TPC              = 150,
478 	WLAN_ELEMID_CCKM             = 156,
479 	WLAN_ELEMID_VHTCAP           = 191,
480 	WLAN_ELEMID_VHTOP            = 192,
481 	WLAN_ELEMID_EXT_BSS_LOAD     = 193,
482 	WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH = 194,
483 	WLAN_ELEMID_VHT_TX_PWR_ENVLP = 195,
484 	WLAN_ELEMID_CHAN_SWITCH_WRAP = 196,
485 	WLAN_ELEMID_AID              = 197,
486 	WLAN_ELEMID_QUIET_CHANNEL    = 198,
487 	WLAN_ELEMID_OP_MODE_NOTIFY   = 199,
488 	WLAN_ELEMID_REDUCED_NEIGHBOR_REPORT = 201,
489 	WLAN_ELEMID_VENDOR           = 221,
490 	WLAN_ELEMID_FILS_INDICATION  = 240,
491 	WLAN_ELEMID_FRAGMENT         = 242,
492 	WLAN_ELEMID_RSNXE            = 244,
493 	WLAN_ELEMID_EXTN_ELEM        = 255,
494 };
495 
496 /**
497  * enum extn_element_ie :- extended management information element
498  * @WLAN_EXTN_ELEMID_MAX_CHAN_SWITCH_TIME: Maximum Channel Switch Time IE
499  * @WLAN_EXTN_ELEMID_HECAP:  HE capabilities IE
500  * @WLAN_EXTN_ELEMID_HEOP:   HE Operation IE
501  * @WLAN_EXTN_ELEMID_MUEDCA: MU-EDCA IE
502  * @WLAN_EXTN_ELEMID_HE_6G_CAP: HE 6GHz Band Capabilities IE
503  * @WLAN_EXTN_ELEMID_SRP:    spatial reuse parameter IE
504  * @WLAN_EXTN_ELEMID_NONINHERITANCE: Non inheritance IE
505  * @WLAN_EXTN_ELEMID_MULTI_LINK: Multi link IE
506  * @WLAN_EXTN_ELEMID_EHTCAP: EHT Capabilities IE
507  * @WLAN_EXTN_ELEMID_EHTOP: EHT Operation IE
508  */
509 enum extn_element_ie {
510 	WLAN_EXTN_ELEMID_MAX_CHAN_SWITCH_TIME = 34,
511 	WLAN_EXTN_ELEMID_HECAP       = 35,
512 	WLAN_EXTN_ELEMID_HEOP        = 36,
513 	WLAN_EXTN_ELEMID_MUEDCA      = 38,
514 	WLAN_EXTN_ELEMID_SRP         = 39,
515 	WLAN_EXTN_ELEMID_NONINHERITANCE = 56,
516 	WLAN_EXTN_ELEMID_HE_6G_CAP   = 59,
517 	WLAN_EXTN_ELEMID_ESP         = 11,
518 #ifdef WLAN_FEATURE_11BE_MLO
519 	WLAN_EXTN_ELEMID_MULTI_LINK  = 94,
520 #endif
521 #ifdef WLAN_FEATURE_11BE
522 	WLAN_EXTN_ELEMID_EHTCAP      = 253,
523 	WLAN_EXTN_ELEMID_EHTOP       = 254,
524 #endif
525 };
526 
527 /**
528  * enum wlan_reason_code - wlan reason codes Reason codes
529  * (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45)
530  * @REASON_UNSPEC_FAILURE: Unspecified reason
531  * @REASON_PREV_AUTH_NOT_VALID: Previous authentication no longer valid
532  * @REASON_DEAUTH_NETWORK_LEAVING: Deauthenticated because sending station
533  * is leaving (or has left) IBSS or ESS
534  * @REASON_DISASSOC_DUE_TO_INACTIVITY: Disassociated due to inactivity
535  * @REASON_DISASSOC_AP_BUSY: Disassociated because AP is unable
536  * to handle all currently associated STAs
537  * @REASON_CLASS2_FRAME_FROM_NON_AUTH_STA: Class 2 frame received from
538  * nonauthenticated station
539  * @REASON_CLASS3_FRAME_FROM_NON_ASSOC_STA: Class 3 frame received from
540  * nonassociated station
541  * @REASON_DISASSOC_NETWORK_LEAVING: Disassociated because sending station
542  * is leaving (or has left) BSS
543  * @REASON_STA_NOT_AUTHENTICATED: Station requesting (re)association
544  * is not authenticated with responding station
545  * @REASON_BAD_PWR_CAPABILITY: Disassociated because the
546  * information in the Power Capability element is unacceptable
547  * @REASON_BAD_SUPPORTED_CHANNELS: Disassociated because the
548  * information in the Supported Channels element is unacceptable
549  * @REASON_DISASSOC_BSS_TRANSITION: Disassociated due to BSS transition
550  * management
551  * @REASON_INVALID_IE: Invalid element, i.e., an element defined in this
552  * standard for which the content does not meet the specifications in Clause 9
553  * @REASON_MIC_FAILURE: Message integrity code (MIC) failure
554  * @REASON_4WAY_HANDSHAKE_TIMEOUT: 4-Way Handshake timeout
555  * @REASON_GROUP_KEY_UPDATE_TIMEOUT: Group Key Handshake timeout
556  * @REASON_IN_4WAY_DIFFERS: Information element in 4-Way Handshake
557  * different from (Re)Association Request/Probe Response/Beacon frame
558  * @REASON_INVALID_GROUP_CIPHER: Invalid group cipher
559  * @REASON_INVALID_PAIRWISE_CIPHER: Invalid pairwise cipher
560  * @REASON_INVALID_AKMP: Invalid AKMP
561  * @REASON_UNSUPPORTED_RSNE_VER: Unsupported RSNE version
562  * @REASON_INVALID_RSNE_CAPABILITIES: Invalid RSNE capabilities
563  * @REASON_1X_AUTH_FAILURE: IEEE 802.1X authentication failed
564  * @REASON_CIPHER_SUITE_REJECTED: Cipher suite rejected because of the
565  * security policy
566  * @REASON_TDLS_PEER_UNREACHABLE: TDLS direct-link teardown due to TDLS
567  * peer STA unreachable via the TDLS direct link
568  * @REASON_TDLS_UNSPEC: TDLS direct-link teardown for unspecified
569  * reason
570  * @REASON_DISASSOC_SSP_REQUESTED: Disassociated because session terminated
571  * by SSP request
572  * @REASON_NO_SSP_ROAMING_AGREEMENT: Disassociated because of lack of SSP
573  * roaming agreement
574  * REASON_BAD_CIPHER_OR_AKM: Requested service rejected because of SSP
575  * cipher suite or AKM requirement
576  * @REASON_LOCATION_NOT_AUTHORIZED: Requested service not authorized in
577  * this location
578  * @REASON_SERVICE_CHANGE_PRECLUDES_TS: TS deleted because QoS AP
579  * lacks sufficient bandwidth for this QoS STA due to a change in BSS service
580  * characteristics or operational mode (e.g., an HT BSS change from 40 MHz
581  * channel to 20 MHz channel)
582  * @REASON_QOS_UNSPECIFIED: Disassociated for unspecified, QoS-related
583  * reason
584  * @REASON_NO_BANDWIDTH: Disassociated because QoS AP lacks sufficient
585  * bandwidth for this QoS STA
586  * @REASON_XS_UNACKED_FRAMES: Disassociated because excessive number of
587  * frames need to be acknowledged, but are not acknowledged due to AP
588  * transmissions and/or poor channel conditions
589  * @REASON_EXCEEDED_TXOP: Disassociated because STA is transmitting outside
590  * the limits of its TXOPs
591  * @REASON_STA_LEAVING: Requested from peer STA as the STA is leaving the
592  * BSS (or resetting)
593  * @REASON_END_TS_BA_DLS: Requesting STA is no longer using the stream
594  * or session
595  * @REASON_UNKNOWN_TS_BA: Requesting STA received frames using a
596  * mechanism for which setup has not been completed
597  * @REASON_TIMEDOUT:  Requested from peer STA due to timeout
598  * @REASON_PEERKEY_MISMATCH: Peer STA does not support the requested
599  * cipher suite
600  * @REASON_AUTHORIZED_ACCESS_LIMIT_REACHED: Disassociated because
601  * authorized access limit reached
602  * @REASON_EXTERNAL_SERVICE_REQUIREMENTS: Disassociated due to external
603  * service requirements
604  * @REASON_INVALID_FT_ACTION_FRAME_COUNT: Invalid FT Action frame count
605  * @REASON_INVALID_PMKID: Invalid pairwise master key identifier (PMKID)
606  * @REASON_INVALID_MDE: Invalid MDE
607  * @REASON_INVALID_FTE: Invalid FTE
608  * @REASON_MESH_PEERING_CANCELLED: Mesh peering canceled for unknown
609  * reasons
610  * @REASON_MESH_MAX_PEERS: The mesh STA has reached the supported maximum
611  * number of peer mesh STAs
612  * @REASON_MESH_CONFIG_POLICY_VIOLATION: The received information violates
613  * the Mesh Configuration policy configured in the mesh STA profile
614  * @REASON_MESH_CLOSE_RCVD: The mesh STA has received a Mesh Peering Close
615  * frame requesting to close the mesh peering
616  * @REASON_MESH_MAX_RETRIES: The mesh STA has resent dot11MeshMaxRetries
617  * Mesh Peering Open frames, without receiving a Mesh Peering Confirm frame
618  * @REASON_MESH_CONFIRM_TIMEOUT: The confirmTimer for the mesh peering
619  * instance times out.
620  * @REASON_MESH_INVALID_GTK: The mesh STA fails to unwrap the GTK or
621  * the values in the wrapped contents do not match
622  * @REASON_MESH_INCONSISTENT_PARAMS: The mesh STA receives inconsistent
623  * information about the mesh parameters between mesh peering Management frames
624  * @REASON_MESH_INVALID_SECURITY_CAP: The mesh STA fails the authenticated
625  * mesh peering exchange because due to failure in selecting either the pairwise
626  * ciphersuite or group ciphersuite
627  * @REASON_MESH_PATH_ERROR_NO_PROXY_INFO: The mesh STA does not have proxy
628  * information for this external destination.
629  * @REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO: The mesh STA does not have
630  * forwarding information for this destination.
631  * @REASON_MESH_PATH_ERROR_DEST_UNREACHABLE: The mesh STA determines that
632  * the link to the next hop of an active path in its forwarding information is
633  * no longer usable.
634  * @REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS: The Deauthentication frame
635  * was sent because the MAC address of the STA already exists in the mesh BSS
636  * @REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ: The mesh STA performs
637  * channel switch to meet regulatory requirements.
638  * @REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED: The mesh STA performs channel
639  * switching with unspecified reason.
640  * @REASON_POOR_RSSI_CONDITIONS: Disassociated due to poor RSSI conditions
641  *
642  *
643  * Internal reason codes: Add any internal reason code just after
644  * REASON_PROP_START and decrease the value of REASON_PROP_START
645  * accordingly.
646  *
647  * @REASON_PROP_START: Start of prop reason code
648  * @REASON_HOST_TRIGGERED_ROAM_FAILURE: Reason host triggered roam failed
649  * @REASON_FW_TRIGGERED_ROAM_FAILURE: Firmware triggered roam failed
650  * @REASON_GATEWAY_REACHABILITY_FAILURE: Due to NUD failure
651  * @REASON_UNSUPPORTED_CHANNEL_CSA: due to unsuppoerted channel in CSA
652  * @REASON_OPER_CHANNEL_DISABLED_INDOOR: as channel is disabled in indoor
653  * @REASON_OPER_CHANNEL_USER_DISABLED: due to channel disabled by user
654  * @REASON_DEVICE_RECOVERY: due to SSR
655  * @REASON_KEY_TIMEOUT: due to key Timeout
656  * @REASON_OPER_CHANNEL_BAND_CHANGE: due to change in BAND
657  * @REASON_IFACE_DOWN: as interface is going down
658  * @REASON_PEER_XRETRY_FAIL: due to sta kickout with reason no ACK
659  * @REASON_PEER_INACTIVITY: due to sta kickout with reason inactivity
660  * @REASON_SA_QUERY_TIMEOUT: due to sta kickout due to SA query timeout
661  * @REASON_CHANNEL_SWITCH_FAILED: as channel switch failed
662  * @REASON_BEACON_MISSED: due to beacon miss
663  * @REASON_USER_TRIGGERED_ROAM_FAILURE: Reason user triggered roam failed
664  */
665 enum wlan_reason_code {
666 	REASON_UNSPEC_FAILURE = 1,
667 	REASON_PREV_AUTH_NOT_VALID = 2,
668 	REASON_DEAUTH_NETWORK_LEAVING = 3,
669 	REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
670 	REASON_DISASSOC_AP_BUSY = 5,
671 	REASON_CLASS2_FRAME_FROM_NON_AUTH_STA = 6,
672 	REASON_CLASS3_FRAME_FROM_NON_ASSOC_STA = 7,
673 	REASON_DISASSOC_NETWORK_LEAVING = 8,
674 	REASON_STA_NOT_AUTHENTICATED = 9,
675 	REASON_BAD_PWR_CAPABILITY = 10,
676 	REASON_BAD_SUPPORTED_CHANNELS = 11,
677 	REASON_DISASSOC_BSS_TRANSITION = 12,
678 	REASON_INVALID_IE = 13,
679 	REASON_MIC_FAILURE = 14,
680 	REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
681 	REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
682 	REASON_IN_4WAY_DIFFERS = 17,
683 	REASON_INVALID_GROUP_CIPHER = 18,
684 	REASON_INVALID_PAIRWISE_CIPHER = 19,
685 	REASON_INVALID_AKMP = 20,
686 	REASON_UNSUPPORTED_RSNE_VER = 21,
687 	REASON_INVALID_RSNE_CAPABILITIES = 22,
688 	REASON_1X_AUTH_FAILURE = 23,
689 	REASON_CIPHER_SUITE_REJECTED = 24,
690 	REASON_TDLS_PEER_UNREACHABLE = 25,
691 	REASON_TDLS_UNSPEC = 26,
692 	REASON_DISASSOC_SSP_REQUESTED = 27,
693 	REASON_NO_SSP_ROAMING_AGREEMENT = 28,
694 	REASON_BAD_CIPHER_OR_AKM = 29,
695 	REASON_LOCATION_NOT_AUTHORIZED = 30,
696 	REASON_SERVICE_CHANGE_PRECLUDES_TS = 31,
697 	REASON_QOS_UNSPECIFIED = 32,
698 	REASON_NO_BANDWIDTH = 33,
699 	REASON_XS_UNACKED_FRAMES = 34,
700 	REASON_EXCEEDED_TXOP = 35,
701 	REASON_STA_LEAVING = 36,
702 	REASON_END_TS_BA_DLS = 37,
703 	REASON_UNKNOWN_TS_BA = 38,
704 	REASON_TIMEDOUT = 39,
705 	REASON_PEERKEY_MISMATCH = 45,
706 	REASON_AUTHORIZED_ACCESS_LIMIT_REACHED = 46,
707 	REASON_EXTERNAL_SERVICE_REQUIREMENTS = 47,
708 	REASON_INVALID_FT_ACTION_FRAME_COUNT = 48,
709 	REASON_INVALID_PMKID = 49,
710 	REASON_INVALID_MDE = 50,
711 	REASON_INVALID_FTE = 51,
712 	REASON_MESH_PEERING_CANCELLED = 52,
713 	REASON_MESH_MAX_PEERS = 53,
714 	REASON_MESH_CONFIG_POLICY_VIOLATION = 54,
715 	REASON_MESH_CLOSE_RCVD = 55,
716 	REASON_MESH_MAX_RETRIES = 56,
717 	REASON_MESH_CONFIRM_TIMEOUT = 57,
718 	REASON_MESH_INVALID_GTK = 58,
719 	REASON_MESH_INCONSISTENT_PARAMS = 59,
720 	REASON_MESH_INVALID_SECURITY_CAP = 60,
721 	REASON_MESH_PATH_ERROR_NO_PROXY_INFO = 61,
722 	REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO = 62,
723 	REASON_MESH_PATH_ERROR_DEST_UNREACHABLE = 63,
724 	REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64,
725 	REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65,
726 	REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED = 66,
727 	REASON_POOR_RSSI_CONDITIONS = 71,
728 	/* 72–65535 reserved */
729 
730 	/* Internal reason codes */
731 	REASON_PROP_START = 65519,
732 	REASON_HOST_TRIGGERED_ROAM_FAILURE  = 65519,
733 	REASON_FW_TRIGGERED_ROAM_FAILURE = 65520,
734 	REASON_GATEWAY_REACHABILITY_FAILURE = 65521,
735 	REASON_UNSUPPORTED_CHANNEL_CSA = 65522,
736 	REASON_OPER_CHANNEL_DISABLED_INDOOR = 65523,
737 	REASON_OPER_CHANNEL_USER_DISABLED = 65524,
738 	REASON_DEVICE_RECOVERY = 65525,
739 	REASON_KEY_TIMEOUT = 65526,
740 	REASON_OPER_CHANNEL_BAND_CHANGE = 65527,
741 	REASON_IFACE_DOWN = 65528,
742 	REASON_PEER_XRETRY_FAIL = 65529,
743 	REASON_PEER_INACTIVITY = 65530,
744 	REASON_SA_QUERY_TIMEOUT = 65531,
745 	REASON_CHANNEL_SWITCH_FAILED = 65532,
746 	REASON_BEACON_MISSED = 65533,
747 	REASON_USER_TRIGGERED_ROAM_FAILURE = 65534,
748 };
749 
750 /**
751  * enum wlan_status_code - wlan status codes
752  * (IEEE Std 802.11-2016, 9.4.1.9, Table 9-46)
753  * @STATUS_SUCCESS: Success full
754  * @STATUS_UNSPECIFIED_FAILURE: Unspecified failure.
755  * @STATUS_TDLS_WAKEUP_REJECT: TDLS wakeup schedule rejected but alternative
756  * schedule provided.
757  * @STATUS_SECURITY_DISABLED: Security disabled.
758  * @STATUS_UNACCEPTABLE_LIFETIME: Unacceptable lifetime.
759  * @STATUS_NOT_IN_SAME_BSS: Not in same BSS.
760  * @STATUS_CAPS_UNSUPPORTED: Cannot support all requested capabilities in the
761  * Capability Information field.
762  * @STATUS_REASSOC_NO_ASSOC: Reassociation denied due to inability to confirm
763  * that association exists.
764  * @STATUS_ASSOC_DENIED_UNSPEC: Association denied due to reason outside the
765  * scope of this standard.
766  * @STATUS_NOT_SUPPORTED_AUTH_ALG: Responding STA does not support the specified
767  * authentication algorithm.
768  * @STATUS_UNKNOWN_AUTH_TRANSACTION: Received an Authentication frame with
769  * authentication transaction sequence number out of expected sequence.
770  * @STATUS_CHALLENGE_FAIL: Authentication rejected because of challenge failure.
771  * @STATUS_AUTH_TIMEOUT: Authentication rejected due to timeout waiting for next
772  * frame in sequence.
773  * @STATUS_AP_UNABLE_TO_HANDLE_NEW_STA: Association denied because AP is unable
774  * to handle additional associated STAs.
775  * @STATUS_ASSOC_DENIED_RATES: Association denied due to requesting STA not
776  * supporting all of the data rates in the BSSBasicRateSet parameter,
777  * the Basic HT-MCS Set field of the HT Operation parameter, or the Basic
778  * VHT-MCS and NSS Set field in the VHT Operation parameter.
779  * @STATUS_ASSOC_DENIED_NOSHORT: Association denied due to requesting
780  * STA not supporting the short preamble option.
781  * @STATUS_SPEC_MGMT_REQUIRED: Association request rejected because Spectrum
782  * Management capability is required.
783  * @STATUS_PWR_CAPABILITY_NOT_VALID: Association request rejected because the
784  * information in the Power Capability element is unacceptable.
785  * @STATUS_SUPPORTED_CHANNEL_NOT_VALID: Association request rejected because
786  * the information in the Supported Channels element is unacceptable.
787  * @STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME: Association denied due to requesting
788  * STA not supporting the Short Slot Time option.
789  * @STATUS_ASSOC_DENIED_NO_HT: Association denied because the requesting STA
790  * does not support HT features.
791  * @STATUS_R0KH_UNREACHABLE: R0KH unreachable.
792  * @STATUS_ASSOC_DENIED_NO_PCO: Association denied because the requesting STA
793  * does not support the phased coexistence operation (PCO) transition time
794  * required by the AP.
795  * @STATUS_ASSOC_REJECTED_TEMPORARILY: Association request rejected temporarily,
796  * try again later.
797  * @STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION: Robust management frame policy
798  * violation.
799  * @STATUS_UNSPECIFIED_QOS_FAILURE: Unspecified, QoS-related failure.
800  * @STATUS_DENIED_INSUFFICIENT_BANDWIDTH: Association denied because QoS AP or
801  * PCP has insufficient bandwidth to handle another QoS STA.
802  * @STATUS_DENIED_POOR_CHANNEL_CONDITIONS: Association denied due to excessive
803  * frame loss rates and/or poor conditions on current operating channel.
804  * @STATUS_DENIED_QOS_NOT_SUPPORTED: Association (with QoS BSS) denied because
805  * the requesting STA does not support the QoS facility.
806  * @STATUS_REQUEST_DECLINED: The request has been declined.
807  * @STATUS_INVALID_PARAMETERS: The request has not been successful as one
808  * or more parameters have invalid values.
809  * @STATUS_REJECTED_WITH_SUGGESTED_CHANGES: The allocation or TS has not been
810  * created because the request cannot be honored; however, a suggested TSPEC/DMG
811  * TSPEC is provided so that the initiating STA can attempt to set another
812  * allocation or TS with the suggested changes to the TSPEC/DMG TSPEC
813  * @STATUS_INVALID_IE: Invalid element, i.e., an element defined in this
814  * standard for which the content does not meet the specifications in Clause 9.
815  * @STATUS_GROUP_CIPHER_NOT_VALID: Invalid group cipher.
816  * @STATUS_PAIRWISE_CIPHER_NOT_VALID: Invalid pairwise cipher.
817  * @STATUS_AKMP_NOT_VALID: Invalid AKMP.
818  * @STATUS_UNSUPPORTED_RSN_IE_VERSION: Unsupported RSNE version.
819  * @STATUS_INVALID_RSN_IE_CAPAB: Invalid RSNE capabilities.
820  * @STATUS_CIPHER_REJECTED_PER_POLICY: Cipher suite rejected because of security
821  * policy.
822  * @STATUS_TS_NOT_CREATED: The TS or allocation has not been created; however,
823  * the HC or PCP might be capable of creating a TS or allocation, in response to
824  * a request, after the time indicated in the TS Delay element.
825  * @STATUS_DIRECT_LINK_NOT_ALLOWED: Direct link is not allowed in the BSS by
826  * policy.
827  * @STATUS_DEST_STA_NOT_PRESENT: The Destination STA is not present within this
828  * BSS.
829  * @STATUS_DEST_STA_NOT_QOS_STA: The Destination STA is not a QoS STA.
830  * @STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE: Association denied because the
831  * listen interval is too large.
832  * @STATUS_INVALID_FT_ACTION_FRAME_COUNT: Invalid FT Action frame count.
833  * @STATUS_INVALID_PMKID: Invalid pairwise master key identifier (PMKID).
834  *
835  * Internal status codes: Add any internal status code just after
836  * STATUS_PROP_START and decrease the value of STATUS_PROP_START
837  * accordingly.
838  *
839  * @STATUS_PROP_START: Start of prop status codes.
840  * @STATUS_NO_NETWORK_FOUND: No network found
841  * @STATUS_AUTH_TX_FAIL: Failed to sent AUTH on air
842  * @STATUS_AUTH_NO_ACK_RECEIVED: No ack received for Auth tx
843  * @STATUS_AUTH_NO_RESP_RECEIVED: No Auth response for Auth tx
844  * @STATUS_ASSOC_TX_FAIL: Failed to sent Assoc on air
845  * @STATUS_ASSOC_NO_ACK_RECEIVED: No ack received for Assoc tx
846  * @STATUS_ASSOC_NO_RESP_RECEIVED: No Assoc response for Assoc tx
847  */
848 enum wlan_status_code {
849 	STATUS_SUCCESS = 0,
850 	STATUS_UNSPECIFIED_FAILURE = 1,
851 	STATUS_TDLS_WAKEUP_REJECT = 3,
852 	STATUS_SECURITY_DISABLED = 5,
853 	STATUS_UNACCEPTABLE_LIFETIME = 6,
854 	STATUS_NOT_IN_SAME_BSS = 7,
855 	STATUS_CAPS_UNSUPPORTED = 10,
856 	STATUS_REASSOC_NO_ASSOC = 11,
857 	STATUS_ASSOC_DENIED_UNSPEC = 12,
858 	STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
859 	STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
860 	STATUS_CHALLENGE_FAIL = 15,
861 	STATUS_AUTH_TIMEOUT = 16,
862 	STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
863 	STATUS_ASSOC_DENIED_RATES = 18,
864 	STATUS_ASSOC_DENIED_NOSHORT = 19,
865 	STATUS_SPEC_MGMT_REQUIRED = 22,
866 	STATUS_PWR_CAPABILITY_NOT_VALID = 23,
867 	STATUS_SUPPORTED_CHANNEL_NOT_VALID = 24,
868 	STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME = 25,
869 	STATUS_ASSOC_DENIED_NO_HT = 27,
870 	STATUS_R0KH_UNREACHABLE = 28,
871 	STATUS_ASSOC_DENIED_NO_PCO = 29,
872 	STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
873 	STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
874 	STATUS_UNSPECIFIED_QOS_FAILURE = 32,
875 	STATUS_DENIED_INSUFFICIENT_BANDWIDTH = 33,
876 	STATUS_DENIED_POOR_CHANNEL_CONDITIONS = 34,
877 	STATUS_DENIED_QOS_NOT_SUPPORTED = 35,
878 	STATUS_REQUEST_DECLINED = 37,
879 	STATUS_INVALID_PARAMETERS = 38,
880 	STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
881 	STATUS_INVALID_IE = 40,
882 	STATUS_GROUP_CIPHER_NOT_VALID = 41,
883 	STATUS_PAIRWISE_CIPHER_NOT_VALID = 42,
884 	STATUS_AKMP_NOT_VALID = 43,
885 	STATUS_UNSUPPORTED_RSN_IE_VERSION = 44,
886 	STATUS_INVALID_RSN_IE_CAPAB = 45,
887 	STATUS_CIPHER_REJECTED_PER_POLICY = 46,
888 	STATUS_TS_NOT_CREATED = 47,
889 	STATUS_DIRECT_LINK_NOT_ALLOWED = 48,
890 	STATUS_DEST_STA_NOT_PRESENT = 49,
891 	STATUS_DEST_STA_NOT_QOS_STA = 50,
892 	STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE = 51,
893 	STATUS_INVALID_FT_ACTION_FRAME_COUNT = 52,
894 	STATUS_INVALID_PMKID = 53,
895 
896 	/* Error STATUS code for intenal usage*/
897 	STATUS_PROP_START = 65528,
898 	STATUS_NO_NETWORK_FOUND = 65528,
899 	STATUS_AUTH_TX_FAIL = 65529,
900 	STATUS_AUTH_NO_ACK_RECEIVED = 65530,
901 	STATUS_AUTH_NO_RESP_RECEIVED = 65531,
902 	STATUS_ASSOC_TX_FAIL = 65532,
903 	STATUS_ASSOC_NO_ACK_RECEIVED = 65533,
904 	STATUS_ASSOC_NO_RESP_RECEIVED = 65534,
905 };
906 
907 #define WLAN_OUI_SIZE 4
908 #define WLAN_MAX_CIPHER 6
909 #define WLAN_RSN_SELECTOR_LEN 4
910 #define WLAN_WPA_SELECTOR_LEN 4
911 #define PMKID_LEN 16
912 #define MAX_PMK_LEN 64
913 #define MAX_PMKID 4
914 #define MAX_KEK_LENGTH 64
915 #define MAX_KCK_LEN 32
916 #define REPLAY_CTR_LEN 8
917 #define KCK_KEY_LEN 16
918 #define KEK_KEY_LEN 16
919 #define KCK_192BIT_KEY_LEN 24
920 #define KEK_256BIT_KEY_LEN 32
921 
922 #define WLAN_WPA_OUI 0xf25000
923 #define WLAN_WPA_OUI_TYPE 0x01
924 #define WPA_VERSION 1
925 #define WLAN_WPA_SEL(x) (((x) << 24) | WLAN_WPA_OUI)
926 
927 #define WLAN_RSN_OUI 0xac0f00
928 #define WLAN_CCKM_OUI 0x964000
929 #define WLAN_CCKM_ASE_UNSPEC 0
930 #define WLAN_WPA_CCKM_AKM 0x00964000
931 #define WLAN_RSN_CCKM_AKM 0x00964000
932 #define WLAN_RSN_DPP_AKM 0x029A6F50
933 #define WLAN_RSN_OSEN_AKM 0x019A6F50
934 
935 #define RSN_VERSION 1
936 #define WLAN_RSN_SEL(x) (((x) << 24) | WLAN_RSN_OUI)
937 #define WLAN_CCKM_SEL(x) (((x) << 24) | WLAN_CCKM_OUI)
938 
939 #define WLAN_CSE_NONE                    0x00
940 #define WLAN_CSE_WEP40                   0x01
941 #define WLAN_CSE_TKIP                    0x02
942 #define WLAN_CSE_RESERVED                0x03
943 #define WLAN_CSE_CCMP                    0x04
944 #define WLAN_CSE_WEP104                  0x05
945 #define WLAN_CSE_AES_CMAC                0x06
946 #define WLAN_CSE_GCMP_128                0x08
947 #define WLAN_CSE_GCMP_256                0x09
948 #define WLAN_CSE_CCMP_256                0x0A
949 #define WLAN_CSE_BIP_GMAC_128            0x0B
950 #define WLAN_CSE_BIP_GMAC_256            0x0C
951 #define WLAN_CSE_BIP_CMAC_256            0x0D
952 
953 #define WLAN_AKM_IEEE8021X        0x01
954 #define WLAN_AKM_PSK              0x02
955 #define WLAN_AKM_FT_IEEE8021X     0x03
956 #define WLAN_AKM_FT_PSK           0x04
957 #define WLAN_AKM_SHA256_IEEE8021X 0x05
958 #define WLAN_AKM_SHA256_PSK       0x06
959 #define WLAN_AKM_SAE              0x08
960 #define WLAN_AKM_FT_SAE           0x09
961 #define WLAN_AKM_SUITEB_EAP_SHA256 0x0B
962 #define WLAN_AKM_SUITEB_EAP_SHA384 0x0C
963 #define WLAN_AKM_FT_SUITEB_EAP_SHA384 0x0D
964 #define WLAN_AKM_FILS_SHA256      0x0E
965 #define WLAN_AKM_FILS_SHA384      0x0F
966 #define WLAN_AKM_FILS_FT_SHA256   0x10
967 #define WLAN_AKM_FILS_FT_SHA384   0x11
968 #define WLAN_AKM_OWE              0x12
969 
970 #define WLAN_ASE_NONE                    0x00
971 #define WLAN_ASE_8021X_UNSPEC            0x01
972 #define WLAN_ASE_8021X_PSK               0x02
973 #define WLAN_ASE_FT_IEEE8021X            0x20
974 #define WLAN_ASE_FT_PSK                  0x40
975 #define WLAN_ASE_SHA256_IEEE8021X        0x80
976 #define WLAN_ASE_SHA256_PSK              0x100
977 #define WLAN_ASE_WPS                     0x200
978 
979 #define RSN_CAP_MFP_CAPABLE 0x80
980 #define RSN_CAP_MFP_REQUIRED 0x40
981 
982 /**
983  * struct element_info - defines length of a memory block and memory block
984  * @len: length of memory block
985  * @ptr: memory block pointer
986  */
987 struct element_info {
988 	uint32_t len;
989 	uint8_t *ptr;
990 };
991 
992 /**
993  * struct wlan_rsn_ie_hdr: rsn ie header
994  * @elem_id: RSN element id WLAN_ELEMID_RSN.
995  * @len: rsn ie length
996  * @version: RSN ver
997  */
998 struct wlan_rsn_ie_hdr {
999 	u8 elem_id;
1000 	u8 len;
1001 	u8 version[2];
1002 };
1003 
1004 #define WLAN_RSN_IE_MIN_LEN             2
1005 #define WLAN_WAPI_IE_MIN_LEN            20
1006 
1007 /**
1008  * struct wlan_wpa_ie_hdr: wpa ie header
1009  * @elem_id: Wpa element id, vender specific.
1010  * @len: wpa ie length
1011  * @oui: 24-bit OUI followed by 8-bit OUI type
1012  * @version: wpa ver
1013  */
1014 struct wlan_wpa_ie_hdr {
1015 	u8 elem_id;
1016 	u8 len;
1017 	u8 oui[4];
1018 	u8 version[2];
1019 };
1020 
1021 #define WAPI_VERSION 1
1022 #define WLAN_WAPI_OUI 0x721400
1023 
1024 #define WLAN_WAPI_SEL(x) (((x) << 24) | WLAN_WAPI_OUI)
1025 
1026 #define WLAN_WAI_CERT_OR_SMS4 0x01
1027 #define WLAN_WAI_PSK 0x02
1028 
1029 /**
1030  * struct wlan_frame_hdr: generic IEEE 802.11 frames
1031  * @i_fc: frame control
1032  * @i_dur: duration field
1033  * @i_addr1: mac address 1
1034  * @i_addr2: mac address 2
1035  * @i_addr3: mac address 3
1036  * @i_seq: seq info
1037  */
1038 struct wlan_frame_hdr {
1039 	uint8_t i_fc[2];
1040 	uint8_t i_dur[2];
1041 	union {
1042 		struct {
1043 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1044 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1045 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1046 		};
1047 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1048 	};
1049 	uint8_t i_seq[2];
1050 } qdf_packed;
1051 
1052 struct wlan_frame_hdr_qos {
1053 	uint8_t i_fc[2];
1054 	uint8_t i_dur[2];
1055 	union {
1056 		struct {
1057 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1058 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1059 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1060 		};
1061 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1062 	};
1063 	uint8_t i_seq[2];
1064 	uint8_t i_qos[2];
1065 } qdf_packed;
1066 
1067 struct wlan_frame_hdr_qos_addr4 {
1068 	uint8_t i_fc[2];
1069 	uint8_t i_dur[2];
1070 	union {
1071 		struct {
1072 			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
1073 			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
1074 			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
1075 		};
1076 		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
1077 	};
1078 	uint8_t i_seq[2];
1079 	uint8_t i_addr4[QDF_MAC_ADDR_SIZE];
1080 	uint8_t i_qos[2];
1081 } qdf_packed;
1082 
1083 /* sequence number offset base on begin of mac header */
1084 #define WLAN_SEQ_CTL_OFFSET         22
1085 #define WLAN_LOW_SEQ_NUM_MASK       0x000F
1086 #define WLAN_HIGH_SEQ_NUM_MASK      0x0FF0
1087 #define WLAN_HIGH_SEQ_NUM_OFFSET    4
1088 
1089 /**
1090  * struct wlan_seq_ctl: sequence number control
1091  * @frag_num: frag number
1092  * @seq_num_lo: sequence number low byte
1093  * @seq_num_hi: sequence number high byte
1094  */
1095 struct wlan_seq_ctl {
1096 	uint8_t frag_num:4;
1097 	uint8_t seq_num_lo:4;
1098 	uint8_t seq_num_hi:8;
1099 } qdf_packed;
1100 
1101 /**
1102  * union wlan_capability : wlan_capability info
1103  * @value: capability value
1104  */
1105 union wlan_capability {
1106 	struct caps {
1107 		uint16_t ess:1;
1108 		uint16_t ibss:1;
1109 		uint16_t cf_pollable:1;
1110 		uint16_t cf_poll_request:1;
1111 		uint16_t privacy:1;
1112 		uint16_t short_preamble:1;
1113 		uint16_t pbcc:1;
1114 		uint16_t channel_agility:1;
1115 		uint16_t spectrum_management:1;
1116 		uint16_t qos:1;
1117 		uint16_t short_slot_time:1;
1118 		uint16_t apsd:1;
1119 		uint16_t reserved2:1;
1120 		uint16_t dsss_ofdm:1;
1121 		uint16_t del_block_ack:1;
1122 		uint16_t immed_block_ack:1;
1123 	} wlan_caps;
1124 	uint16_t value;
1125 } qdf_packed;
1126 
1127 /**
1128  * struct ie_header : IE header
1129  * @ie_id: Element Id
1130  * @ie_len: IE Length
1131  */
1132 struct ie_header {
1133 	uint8_t ie_id;
1134 	uint8_t ie_len;
1135 } qdf_packed;
1136 
1137 /**
1138  * struct extn_ie_header : Extension IE header
1139  * @ie_id: Element Id
1140  * @ie_len: IE Length
1141  * @ie_extn_id: extension id
1142  */
1143 struct extn_ie_header {
1144 	uint8_t ie_id;
1145 	uint8_t ie_len;
1146 	uint8_t ie_extn_id;
1147 } qdf_packed;
1148 
1149 
1150 /**
1151  * struct ie_ssid : ssid IE
1152  * @ssid_id: SSID Element Id
1153  * @ssid_len: SSID IE Length
1154  * @ssid: ssid value
1155  */
1156 struct ie_ssid {
1157 	uint8_t ssid_id;
1158 	uint8_t ssid_len;
1159 	uint8_t ssid[WLAN_SSID_MAX_LEN];
1160 } qdf_packed;
1161 
1162 /**
1163  * struct ds_ie : ds IE
1164  * @ie: DS Element Id
1165  * @len: DS IE Length
1166  * @cur_chan: channel info
1167  */
1168 struct ds_ie {
1169 	uint8_t ie;
1170 	uint8_t len;
1171 	uint8_t cur_chan;
1172 } qdf_packed;
1173 
1174 /**
1175  * struct erp_ie: ERP IE
1176  * @ie: ERP Element Id
1177  * @len: ERP IE Length
1178  * @value: EP Info
1179  */
1180 struct erp_ie {
1181 	uint8_t ie;
1182 	uint8_t len;
1183 	uint8_t value;
1184 } qdf_packed;
1185 
1186 /**
1187  * struct htcap_cmn_ie: HT common IE info
1188  * @hc_cap: HT capabilities
1189  * @ampdu_param: ampdu params
1190  * @mcsset: supported MCS set
1191  * @extcap: extended HT capabilities
1192  * @txbf_cap: txbf capabilities
1193  * @antenna: antenna capabilities
1194  */
1195 struct htcap_cmn_ie {
1196 	uint16_t hc_cap;
1197 	uint8_t ampdu_param;
1198 	uint8_t mcsset[16];
1199 	uint16_t extcap;
1200 	uint32_t txbf_cap;
1201 	uint8_t antenna;
1202 } qdf_packed;
1203 
1204 /**
1205  * struct htcap_ie: HT Capability IE
1206  * @id: HT IE
1207  * @len: HT IE LEN
1208  * @ie: HT cap info
1209  */
1210 struct htcap_ie {
1211 	uint8_t id;
1212 	uint8_t len;
1213 	struct htcap_cmn_ie ie;
1214 } qdf_packed;
1215 
1216 /**
1217  * struct fils_indication_ie: FILS indication IE element
1218  * @id: id
1219  * @len: len
1220  * @public_key_identifiers_cnt: public key identifiers count
1221  * @realm_identifiers_cnt: realm identifiers count
1222  * @is_ip_config_supported: whether ip config is supported in AP
1223  * @is_cache_id_present: whether cache identifier is present
1224  * @is_hessid_present: whether hessid is present
1225  * @is_fils_sk_auth_supported: FILS shared key authentication is supported
1226  * @is_fils_sk_auth_pfs_supported: FILS shared key auth with PFS is supported
1227  * @is_pk_auth_supported: FILS public key authentication is supported
1228  * @reserved: reserved
1229  * @variable_data: pointer to data depends on initial variables
1230  */
1231 struct fils_indication_ie {
1232 	uint8_t id;
1233 	uint8_t len;
1234 	uint16_t public_key_identifiers_cnt:3;
1235 	uint16_t realm_identifiers_cnt:3;
1236 	uint16_t is_ip_config_supported:1;
1237 	uint16_t is_cache_id_present:1;
1238 	uint16_t is_hessid_present:1;
1239 	uint16_t is_fils_sk_auth_supported:1;
1240 	uint16_t is_fils_sk_auth_pfs_supported:1;
1241 	uint16_t is_pk_auth_supported:1;
1242 	uint16_t reserved:4;
1243 	uint8_t variable_data[253];
1244 } qdf_packed;
1245 
1246 #define WLAN_VENDOR_HT_IE_OFFSET_LEN    4
1247 
1248 /**
1249  * struct wlan_vendor_ie_htcap: vendor private HT Capability IE
1250  * @id: HT IE
1251  * @hlen: HT IE len
1252  * @oui: vendor OUI
1253  * @oui_type: Oui type
1254  * @ie: HT cap info
1255  */
1256 struct wlan_vendor_ie_htcap {
1257 	uint8_t id;
1258 	uint8_t hlen;
1259 	uint8_t oui[3];
1260 	uint8_t oui_type;
1261 	struct htcap_cmn_ie ie;
1262 } qdf_packed;
1263 
1264 /**
1265  * struct wlan_ie_htinfo_cmn: ht info comman
1266  * @hi_ctrlchannel: control channel
1267  * @hi_extchoff: B0-1 extension channel offset
1268  * @hi_txchwidth: B2 recommended xmiss width set
1269  * @hi_rifsmode: rifs mode
1270  * @hi_ctrlaccess: controlled access only
1271  * @hi_serviceinterval: B5-7 svc interval granularity
1272  * @uhi_opmode: B0-1 operating mode
1273  * @hi_nongfpresent: B2 non greenfield devices present
1274  * @hi_txburstlimit: B3 transmit burst limit
1275  * @hi_obssnonhtpresent: B4 OBSS non-HT STA present
1276  * @hi_reserved0: B5-15 reserved
1277  * @hi_reserved2: B0-5 reserved
1278  * @hi_dualbeacon: B6 dual beacon
1279  * @hi_dualctsprot: B7 dual CTS protection
1280  * @hi_stbcbeacon: B8 STBC beacon
1281  * @hi_lsigtxopprot: B9 l-sig txop protection full support
1282  * @hi_pcoactive: B10 pco active
1283  * @hi_pcophase: B11 pco phase
1284  * @hi_reserved1: B12-15 reserved
1285  * @hi_basicmcsset[16]: basic MCS set
1286  */
1287 struct wlan_ie_htinfo_cmn {
1288 	uint8_t hi_ctrlchannel;
1289 	uint8_t hi_extchoff:2,
1290 		hi_txchwidth:1,
1291 		hi_rifsmode:1,
1292 		hi_ctrlaccess:1,
1293 		hi_serviceinterval:3;
1294 	uint16_t hi_opmode:2,
1295 		hi_nongfpresent:1,
1296 		hi_txburstlimit:1,
1297 		hi_obssnonhtpresent:1,
1298 		hi_reserved0:11;
1299 	uint16_t hi_reserved2:6,
1300 		hi_dualbeacon:1,
1301 		hi_dualctsprot:1,
1302 		hi_stbcbeacon:1,
1303 		hi_lsigtxopprot:1,
1304 		hi_pcoactive:1,
1305 		hi_pcophase:1,
1306 		hi_reserved1:4;
1307 	uint8_t  hi_basicmcsset[16];
1308 } qdf_packed;
1309 
1310 /**
1311  * struct wlan_ie_htinfo: HT info IE
1312  * @hi_id: HT info IE
1313  * @hi_len: HT info IE len
1314  * @hi_ie: HT info info
1315  */
1316 struct wlan_ie_htinfo {
1317 	uint8_t hi_id;
1318 	uint8_t hi_len;
1319 	struct wlan_ie_htinfo_cmn  hi_ie;
1320 } qdf_packed;
1321 
1322 /**
1323  * struct wlan_ie_htinfo: vendor private HT info IE
1324  * @hi_id: HT info IE
1325  * @hi_len: HT info IE len
1326  * @hi_oui: vendor OUI
1327  * @hi_ouitype: Oui type
1328  * @hi_ie: HT info info
1329  */
1330 struct wlan_vendor_ie_htinfo {
1331 	uint8_t hi_id;
1332 	uint8_t hi_len;
1333 	uint8_t hi_oui[3];
1334 	uint8_t hi_ouitype;
1335 	struct wlan_ie_htinfo_cmn hi_ie;
1336 } qdf_packed;
1337 
1338 #define WLAN_VENDOR_VHTCAP_IE_OFFSET    7
1339 #define WLAN_VENDOR_VHTOP_IE_OFFSET     21
1340 
1341 /**
1342  * struct wlan_ie_vhtcaps - VHT capabilities
1343  * @elem_id: VHT caps IE
1344  * @elem_len: VHT caps IE len
1345  * @max_mpdu_len: MPDU length
1346  * @supported_channel_widthset: channel width set
1347  * @ldpc_coding: LDPC coding capability
1348  * @shortgi80: short GI 80 support
1349  * @shortgi160and80plus80: short Gi 160 & 80+80 support
1350  * @tx_stbc; Tx STBC cap
1351  * @tx_stbc: Rx STBC cap
1352  * @su_beam_former: SU beam former cap
1353  * @su_beam_formee: SU beam formee cap
1354  * @csnof_beamformer_antSup: Antenna support for beamforming
1355  * @num_soundingdim: Sound dimensions
1356  * @mu_beam_former: MU beam former cap
1357  * @mu_beam_formee: MU beam formee cap
1358  * @vht_txops: TXOP power save
1359  * @htc_vhtcap: HTC VHT capability
1360  * @max_ampdu_lenexp: AMPDU length
1361  * @vht_link_adapt: VHT link adapatation capable
1362  * @rx_antpattern: Rx Antenna pattern
1363  * @tx_antpattern: Tx Antenna pattern
1364  * @rx_mcs_map: RX MCS map
1365  * @rx_high_sup_data_rate : highest RX supported data rate
1366  * @tx_mcs_map: TX MCS map
1367  * @tx_sup_data_rate: highest TX supported data rate
1368  */
1369 struct wlan_ie_vhtcaps {
1370 	uint8_t elem_id;
1371 	uint8_t elem_len;
1372 	uint32_t max_mpdu_len:2;
1373 	uint32_t supported_channel_widthset:2;
1374 	uint32_t ldpc_coding:1;
1375 	uint32_t shortgi80:1;
1376 	uint32_t shortgi160and80plus80:1;
1377 	uint32_t tx_stbc:1;
1378 	uint32_t rx_stbc:3;
1379 	uint32_t su_beam_former:1;
1380 	uint32_t su_beam_formee:1;
1381 	uint32_t csnof_beamformer_antSup:3;
1382 	uint32_t num_soundingdim:3;
1383 	uint32_t mu_beam_former:1;
1384 	uint32_t mu_beam_formee:1;
1385 	uint32_t vht_txops:1;
1386 	uint32_t htc_vhtcap:1;
1387 	uint32_t max_ampdu_lenexp:3;
1388 	uint32_t vht_link_adapt:2;
1389 	uint32_t rx_antpattern:1;
1390 	uint32_t tx_antpattern:1;
1391 	uint32_t unused:2;
1392 	uint16_t rx_mcs_map;
1393 	uint16_t rx_high_sup_data_rate:13;
1394 	uint16_t reserved2:3;
1395 	uint16_t tx_mcs_map;
1396 	uint16_t tx_sup_data_rate:13;
1397 	uint16_t reserved3:3;
1398 } qdf_packed;
1399 
1400 /**
1401  * struct wlan_ie_vhtop: VHT op IE
1402  * @elem_id: VHT op IE
1403  * @elem_len: VHT op IE len
1404  * @vht_op_chwidth: BSS Operational Channel width
1405  * @vht_op_ch_freq_seg1: Channel Center frequency
1406  * @vht_op_ch_freq_seg2: Channel Center frequency for 80+80MHz
1407  * @vhtop_basic_mcs_set: Basic MCS set
1408  */
1409 struct wlan_ie_vhtop {
1410 	uint8_t elem_id;
1411 	uint8_t elem_len;
1412 	uint8_t vht_op_chwidth;
1413 	uint8_t vht_op_ch_freq_seg1;
1414 	uint8_t vht_op_ch_freq_seg2;
1415 	uint16_t vhtop_basic_mcs_set;
1416 } qdf_packed;
1417 
1418 #define WLAN_HE_PHYCAP_160_SUPPORT BIT(2)
1419 #define WLAN_HE_PHYCAP_80_80_SUPPORT BIT(3)
1420 #define WLAN_HE_MACCAP_LEN 6
1421 #define WLAN_HE_PHYCAP_LEN 11
1422 #define WLAN_HE_MAX_MCS_MAPS 3
1423 /**
1424  * struct wlan_ie_hecaps - HT capabilities
1425  * @elem_id: HE caps IE
1426  * @elem_len: HE caps IE len
1427  * @elem_id_extn: HE caps extension id
1428  * @he_mac_cap: HE mac capabilities
1429  * @he_phy_cap: HE phy capabilities
1430  * @phy_cap_bytes: HT phy capability bytes
1431  * @supported_ch_width_set: Supported channel width set
1432  * @mcs_bw_map: MCS NSS map per bandwidth
1433  * @rx_mcs_map: RX MCS map
1434  * @tx_mcs_map: TX MCS map
1435  */
1436 struct wlan_ie_hecaps {
1437 	uint8_t elem_id;
1438 	uint8_t elem_len;
1439 	uint8_t elem_id_extn;
1440 	uint8_t he_mac_cap[WLAN_HE_MACCAP_LEN];
1441 	union {
1442 		uint8_t phy_cap_bytes[WLAN_HE_PHYCAP_LEN];
1443 		struct {
1444 			uint32_t reserved:1;
1445 			uint32_t supported_ch_width_set:7;
1446 		} qdf_packed;
1447 	} qdf_packed he_phy_cap;
1448 	struct {
1449 		uint16_t rx_mcs_map;
1450 		uint16_t tx_mcs_map;
1451 	} qdf_packed mcs_bw_map[WLAN_HE_MAX_MCS_MAPS];
1452 } qdf_packed;
1453 
1454 #ifdef WLAN_FEATURE_11BE
1455 #define WLAN_EHT_MACCAP_LEN 2
1456 #define WLAN_EHT_PHYCAP_LEN 8
1457 
1458 #define WLAN_EHT_MAX_MCS_MAPS 3
1459 /**
1460  * struct wlan_ie_ehtcaps - EHT capabilities
1461  * @elem_id: EHT caps IE
1462  * @elem_len: EHT caps IE len
1463  * @elem_id_extn: EHT caps extension id
1464  * @eht_mac_cap: EHT mac capabilities
1465  * @eht_phy_cap: EHT phy capabilities
1466  * @phy_cap_bytes: EHT phy capability bytes
1467  * @supported_ch_width_set: Supported channel width set
1468  * @mcs_bw_map: MCS NSS map per bandwidth
1469  * @rx_mcs_map: RX MCS map
1470  * @tx_mcs_map: TX MCS map
1471  */
1472 struct wlan_ie_ehtcaps {
1473 	uint8_t elem_id;
1474 	uint8_t elem_len;
1475 	uint8_t elem_id_extn;
1476 	uint8_t eht_mac_cap[WLAN_EHT_MACCAP_LEN];
1477 	union {
1478 		uint8_t phy_cap_bytes[WLAN_EHT_PHYCAP_LEN];
1479 		struct {
1480 			uint32_t reserved:1;
1481 			uint32_t supported_ch_width_set:7;
1482 		} qdf_packed;
1483 	} qdf_packed eht_phy_cap;
1484 	struct {
1485 		uint16_t rx_mcs_map;
1486 		uint16_t tx_mcs_map;
1487 	} qdf_packed mcs_bw_map[WLAN_EHT_MAX_MCS_MAPS];
1488 } qdf_packed;
1489 
1490 /**
1491  * struct wlan_ie_ehtops - EHT operation element
1492  * @elem_id: EHT caps IE
1493  * @elem_len: EHT caps IE len
1494  * @elem_id_extn: EHT caps extension id
1495  * @basic_mcs_nss_set: Basic MCS NSS set
1496  * @primary_channel: primary channel number
1497  * @width: EHT BSS Channel Width
1498  * @reserved: Reserved bits
1499  * @chan_freq_seg0: EHT Channel Centre Frequency Segment 0
1500  * @chan_freq_seg1: EHT Channel Centre Frequency Segment 1
1501  * @minimum_rate: EHT Minimum Rate
1502  * @puncture_pattern: per 20MHz puncturing bitmap
1503  */
1504 struct wlan_ie_ehtops {
1505 	uint8_t elem_id;
1506 	uint8_t elem_len;
1507 	uint8_t elem_id_extn;
1508 	uint8_t basic_mcs_nss_set[2];
1509 	uint8_t primary_channel;
1510 	uint8_t width:3,
1511 		reserved:5;
1512 	uint8_t chan_freq_seg0;
1513 	uint8_t chan_freq_seg1;
1514 	uint8_t minimum_rate;
1515 	uint16_t puncture_pattern;
1516 } qdf_packed;
1517 
1518 #ifdef WLAN_FEATURE_11BE_MLO
1519 
1520 /**
1521  * struct wlan_ie_multilink - Fixed fields in Multi-Link IE
1522  * @elem_id: Element ID
1523  * @elem_len: Element length
1524  * @elem_id_ext: Element ID extension
1525  * @mlcontrol: Multi-Link element Control field
1526  */
1527 struct wlan_ie_multilink {
1528 	uint8_t elem_id;
1529 	uint8_t elem_len;
1530 	uint8_t elem_id_ext;
1531 	uint16_t mlcontrol;
1532 } qdf_packed;
1533 
1534 /* The above fixed fields may be followed by:
1535  * Common Info (variable size)
1536  * Link Info (variable size)
1537  */
1538 
1539 /* Definitions related to Multi-Link element Control field applicable across
1540  * variants.
1541  */
1542 
1543 /* Definitions for subfields in Multi-Link element Control field. Any unused
1544  * bits are reserved.
1545  */
1546 /* Type */
1547 #define WLAN_ML_CTRL_TYPE_IDX                                       0
1548 #define WLAN_ML_CTRL_TYPE_BITS                                      3
1549 /* Presence Bitmap */
1550 #define WLAN_ML_CTRL_PBM_IDX                                        4
1551 #define WLAN_ML_CTRL_PBM_BITS                                       12
1552 
1553 /**
1554  * enum wlan_ml_variant - Encoding for Type subfield in Multi-Link element
1555  * Control field, which provides the Multi-Link element variant.
1556  * Note: In case of holes in the enumeration, scheme for invalid value
1557  * determination should be changed.
1558  * @WLAN_ML_VARIANT_BASIC: Basic variant
1559  * @WLAN_ML_VARIANT_PROBEREQ: Probe Request variant
1560  * @WLAN_ML_VARIANT_INVALIDSTART: Start of invalid value range
1561  */
1562 enum wlan_ml_variant {
1563 	WLAN_ML_VARIANT_BASIC = 0,
1564 	WLAN_ML_VARIANT_PROBEREQ = 1,
1565 	WLAN_ML_VARIANT_INVALIDSTART,
1566 };
1567 
1568 /* End of definitions related to Multi-Link element Control field applicable
1569  * across variants.
1570  */
1571 
1572 /* Definitions related to Basic variant Multi-Link element. */
1573 
1574 /* Definitions for bits in the Presence Bitmap subfield in Basic variant
1575  * Multi-Link element Control field. Any unused bits are reserved.
1576  */
1577 /* MLD MAC Address Present */
1578 #define WLAN_ML_BV_CTRL_PBM_MLDMACADDR_P               ((uint16_t)BIT(0))
1579 /* Link ID Info Present */
1580 #define WLAN_ML_BV_CTRL_PBM_LINKIDINFO_P               ((uint16_t)BIT(1))
1581 /* BSS Parameters Change Count Present */
1582 #define WLAN_ML_BV_CTRL_PBM_BSSPARAMCHANGECNT_P        ((uint16_t)BIT(2))
1583 /* Medium Synchronization Delay Information Present */
1584 #define WLAN_ML_BV_CTRL_PBM_MEDIUMSYNCDELAYINFO_P      ((uint16_t)BIT(3))
1585 /* EML Capabilities Present */
1586 #define WLAN_ML_BV_CTRL_PBM_EMLCAP_P                   ((uint16_t)BIT(4))
1587 /* MLD Capabilities */
1588 #define WLAN_ML_BV_CTRL_PBM_MLDCAP_P                   ((uint16_t)BIT(5))
1589 
1590 /* Definitions related to Basic variant Multi-Link element Common Info field */
1591 
1592 /* Definitions for sub-sub fields in Link ID Info subfield in Basic variant
1593  * Multi-Link element Common Info field. Any unused bits are reserved.
1594  */
1595 /* Link ID */
1596 #define WLAN_ML_BV_CINFO_LINKIDINFO_LINKID_IDX                      0
1597 #define WLAN_ML_BV_CINFO_LINKIDINFO_LINKID_BITS                     4
1598 
1599 /* Size in octets of Link ID Info subfield in Basic variant Multi-Link element
1600  * Common Info field.
1601  */
1602 #define WLAN_ML_BV_CINFO_LINKIDINFO_SIZE                            1
1603 
1604 /* Definitions for sub-sub fields in Medium Synchronization Delay Information
1605  * subfield in Basic variant Multi-Link element Common Info field.
1606  */
1607 /* Medium Synchronization Duration */
1608 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_DURATION_IDX             0
1609 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_DURATION_BITS            8
1610 /* Medium Synchronization OFDM ED Threshold  */
1611 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_OFDMEDTHRESH_IDX         8
1612 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_OFDMEDTHRESH_BITS        4
1613 /* Medium Synchronization Maximum Number Of TXOPs  */
1614 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_MAXTXOPS_IDX             12
1615 #define WLAN_ML_BV_CINFO_MEDMSYNCDELAYINFO_MAXTXOPS_BITS            4
1616 
1617 /* Definitions for sub-sub fields in EML Capabilities subfield in Basic variant
1618  * Multi-Link element Common Info field. Any unused bits are reserved.
1619  */
1620 /* EMLSR Support */
1621 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRSUPPORT_IDX                    0
1622 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRSUPPORT_BITS                   1
1623 /* EMLSR Delay */
1624 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_IDX                      1
1625 #define WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_BITS                     3
1626 /* EMLMR Support */
1627 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRSUPPORT_IDX                    4
1628 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRSUPPORT_BITS                   1
1629 /* EMLMR Delay */
1630 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_IDX                      5
1631 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_BITS                     3
1632 /* Transition Timeout */
1633 #define WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_IDX                    8
1634 #define WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_BITS                   4
1635 /* EMLMR Rx NSS */
1636 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRRXNSS_IDX                      16
1637 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRRXNSS_BITS                     4
1638 /* EMLMR Tx NSS */
1639 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRTXNSS_IDX                      20
1640 #define WLAN_ML_BV_CINFO_EMLCAP_EMLMRTXNSS_BITS                     4
1641 
1642 /**
1643  * wlan_ml_bv_cinfo_emlcap_emlsrdelay - Encoding for EMLSR Delay sub-sub field
1644  * in EML Capabilities subfield in Basic variant Multi-Link element Common Info
1645  * field.
1646  * Note: In case of holes in the enumeration, scheme for invalid value
1647  * determination should be changed.
1648  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_0US: EMLSR delay of 0 us
1649  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_32US: EMLSR delay of 32 us
1650  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_64US: EMLSR delay of 64 us
1651  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_128US: EMLSR delay of 128 us
1652  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_256US: EMLSR delay of 256 us
1653  * @WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_INVALIDSTART: Start of invalid value
1654  * range
1655  */
1656 enum wlan_ml_bv_cinfo_emlcap_emlsrdelay {
1657 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_0US = 0,
1658 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_32US = 1,
1659 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_64US = 2,
1660 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_128US = 3,
1661 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_256US = 4,
1662 	WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_INVALIDSTART,
1663 };
1664 
1665 /**
1666  * wlan_ml_bv_cinfo_emlcap_emlmrdelay - Encoding for EMLMR Delay sub-sub field
1667  * in EML Capabilities subfield in Basic variant Multi-Link element Common Info
1668  * field.
1669  * Note: In case of holes in the enumeration, scheme for invalid value
1670  * determination should be changed.
1671  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_0US: EMLMR delay of 0 us
1672  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_32US: EMLMR delay of 32 us
1673  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_64US: EMLMR delay of 64 us
1674  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_128US: EMLMR delay of 128 us
1675  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_256US: EMLMR delay of 256 us
1676  * @WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_INVALIDSTART: Start of invalid
1677  * value range
1678  */
1679 enum wlan_ml_bv_cinfo_emlcap_emlmrdelay {
1680 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_0US = 0,
1681 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_32US = 1,
1682 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_64US = 2,
1683 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_128US = 3,
1684 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_256US = 4,
1685 	WLAN_ML_BV_CINFO_EMLCAP_EMLMRDELAY_INVALIDSTART,
1686 };
1687 
1688 /**
1689  * wlan_ml_bv_cinfo_emlcap_transtimeout - Encoding for Transition Timeout
1690  * sub-sub field in EML Capabilities subfield in Basic variant Multi-Link
1691  * element Common Info field.
1692  * Note: a) In case of holes in the enumeration, scheme for invalid value
1693  * determination should be changed. b) A mathematical formula could have been
1694  * used instead of an enumeration. However, the standard explicitly lists out
1695  * values instead of using a formula, and we reflect this accordingly using an
1696  * enumeration.
1697  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_0TU: Transition Timeout value of 0 TUs
1698  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_1TU: Transition Timeout value of 1 TU
1699  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_2TU: Transition Timeout value of 2 TUs
1700  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_4TU: Transition Timeout value of 4 TUs
1701  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_8TU: Transition Timeout value of 8 TUs
1702  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_16TU: Transition Timeout value of 16
1703  * TUs
1704  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_32TU: Transition Timeout value of 32
1705  * TUs
1706  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_64TU: Transition Timeout value of 64
1707  * TUs
1708  * WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128TU: Transition Timeout value of 128
1709  * TUs
1710  * @WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_INVALIDSTART: Start of invalid value
1711  * range
1712  */
1713 enum wlan_ml_bv_cinfo_emlcap_transtimeout {
1714 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_0TU = 0,
1715 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_1TU = 1,
1716 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_2TU = 2,
1717 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_4TU = 3,
1718 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_8TU = 4,
1719 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_16TU = 5,
1720 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_32TU = 6,
1721 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_64TU = 7,
1722 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_128TU = 8,
1723 	WLAN_ML_BV_CINFO_EMLCAP_TRANSTIMEOUT_INVALIDSTART,
1724 };
1725 
1726 /* Definitions for sub-sub fields in MLD Capabilities subfield in Basic variant
1727  * Multi-Link element Common Info field. Any unused bits are reserved.
1728  */
1729 /* Maximum Number Of Simultaneous Links */
1730 #define WLAN_ML_BV_CINFO_MLDCAP_MAXSIMULLINKS_IDX                   0
1731 #define WLAN_ML_BV_CINFO_MLDCAP_MAXSIMULLINKS_BITS                  4
1732 /* SRS Support */
1733 #define WLAN_ML_BV_CINFO_MLDCAP_SRSSUPPORT_IDX                      4
1734 #define WLAN_ML_BV_CINFO_MLDCAP_SRSSUPPORT_BITS                     1
1735 /* TID-To-Link Mapping Negotiation Supported */
1736 #define WLAN_ML_BV_CINFO_MLDCAP_TIDTOLINKMAPNEGSUPPORT_IDX          5
1737 #define WLAN_ML_BV_CINFO_MLDCAP_TIDTOLINKMAPNEGSUPPORT_BITS         2
1738 /* Frequency Separation For STR */
1739 #define WLAN_ML_BV_CINFO_MLDCAP_STRFREQSEPARATION_IDX               7
1740 #define WLAN_ML_BV_CINFO_MLDCAP_STRFREQSEPARATION_BITS              5
1741 
1742 /* End of definitions related to Basic variant Multi-Link element Common Info
1743  * field.
1744  */
1745 
1746 /* Definitions related to Basic variant Multi-Link element Link Info field */
1747 
1748 /* Basic variant Multi-Link element Link Info field contains zero or more
1749  * subelements.
1750  */
1751 
1752 /**
1753  *  enum wlan_ml_bv_linfo_subelementid - IDs for subelements in Basic variant
1754  *  Multi-Link element Link Info field.
1755  *  @WLAN_ML_BV_LINFO_SUBELEMID_PERSTAPROFILE: Per-STA Profile
1756  *  @WLAN_ML_BV_LINFO_SUBELEMID_VENDOR: Vendor specific
1757  */
1758 enum wlan_ml_bv_linfo_subelementid {
1759 	WLAN_ML_BV_LINFO_SUBELEMID_PERSTAPROFILE  = 0,
1760 	WLAN_ML_BV_LINFO_SUBELEMID_VENDOR = 221,
1761 };
1762 
1763 /**
1764  * struct wlan_ml_bv_linfo_perstaprof - Fixed fields of Per-STA Profile
1765  * subelement in Basic variant Multi-Link element Link Info field
1766  * @subelem_id: Subelement ID
1767  * @subelem_len: Subelement length
1768  * @stacontrol: STA Control
1769  */
1770 struct wlan_ml_bv_linfo_perstaprof {
1771 	uint8_t subelem_id;
1772 	uint8_t subelem_len;
1773 	uint16_t stacontrol;
1774 } qdf_packed;
1775 
1776 /* The above fixed fields may be followed by:
1777  * STA Info (variable size)
1778  * STA Profile (variable size)
1779  */
1780 
1781 /* Definitions for subfields in STA Control field of Per-STA Profile subelement
1782  * in Basic variant Multi-Link element Link Info field. Any unused bits are
1783  * reserved.
1784  */
1785 /* Link ID */
1786 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_LINKID_IDX              0
1787 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_LINKID_BITS             4
1788 /* Complete Profile */
1789 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_IDX           4
1790 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_CMPLTPROF_BITS          1
1791 /* MAC Address Present */
1792 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_MACADDRP_IDX            5
1793 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_MACADDRP_BITS           1
1794 /* Beacon Interval Present */
1795 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BCNINTP_IDX             6
1796 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_BCNINTP_BITS            1
1797 /* DTIM Info Present */
1798 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_DTIMINFOP_IDX           7
1799 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_DTIMINFOP_BITS          1
1800 /* NSTR Link Pair Present */
1801 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRLINKPRP_IDX         8
1802 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRLINKPRP_BITS        1
1803 /* NSTR Bitmap Size */
1804 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_IDX            9
1805 #define WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_BITS           1
1806 
1807 /**
1808  * wlan_ml_bv_linfo_perstaprof_stactrl_nstrbmsz - Encoding for NSTR Bitmap Size
1809  * in STA Control field of Per-STA Profile subelement in Basic variant
1810  * Multi-Link element Link Info field.
1811  * Note: In case of holes in the enumeration, scheme for invalid value
1812  * determination should be changed.
1813  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_1_OCTET: NSTR Indication
1814  * Bitmap size of 1 octet
1815  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_2_OCTETS: NSTR Indication
1816  * Bitmap size of 2 octets
1817  * @WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_INVALIDSTART: Start of invalid
1818  * value range
1819  */
1820 enum wlan_ml_bv_linfo_perstaprof_stactrl_nstrbmsz {
1821 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_1_OCTET = 0,
1822 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_2_OCTETS = 1,
1823 	WLAN_ML_BV_LINFO_PERSTAPROF_STACTRL_NSTRBMSZ_INVALIDSTART,
1824 };
1825 
1826 /**
1827  * struct wlan_ml_bv_linfo_perstaprof_stainfo_dtiminfo - DTIM info in STA info
1828  * in Per-STA Profile subelement in Basic variant Multi-Link element Link Info
1829  * field.
1830  * @dtimcount: DTIM Count
1831  * @dtimperiod: DTIM Period
1832  */
1833 struct wlan_ml_bv_linfo_perstaprof_stainfo_dtiminfo {
1834 	uint8_t dtimcount;
1835 	uint8_t dtimperiod;
1836 } qdf_packed;
1837 
1838 /* End of definitions related to Basic variant Multi-Link element Link Info
1839  * field.
1840  */
1841 
1842 /* End of definitions related to Basic variant Multi-Link element. */
1843 
1844 /*
1845  * Definitions related to MLO specific aspects of Reduced Neighbor Report
1846  * element.
1847  */
1848 
1849 /*
1850  * Definitions for MLD Parameters subfield in TBTT Information field present as
1851  * part of TBTT Information Set in Neighbor AP Information field of Reduced
1852  * Neighbor Report element.
1853  */
1854 /* MLD ID */
1855 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_MLDID_IDX                  0
1856 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_MLDID_BITS                 8
1857 /* Link ID */
1858 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_LINKID_IDX                 8
1859 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_LINKID_BITS                4
1860 /* BSS Parameters Change Count */
1861 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_BSSPARAMCHANGECNT_IDX      12
1862 #define WLAN_RNR_NBRAPINFO_TBTTINFO_MLDPARAMS_BSSPARAMCHANGECNT_BITS     8
1863 
1864 /*
1865  * End of definitions related to MLO specific aspects of Reduced Neighbor Report
1866  * element.
1867  */
1868 #endif /* WLAN_FEATURE_11BE_MLO */
1869 #endif /* WLAN_FEATURE_11BE */
1870 
1871 /**
1872  * struct he_oper_6g_param: 6 Ghz params for HE
1873  * @primary_channel: HE 6GHz Primary channel number
1874  * @width: HE 6GHz BSS Channel Width
1875  * @duplicate_beacon: HE 6GHz Duplicate beacon field
1876  * @reserved: Reserved bits
1877  * @chan_freq_seg0: HE 6GHz Channel Centre Frequency Segment 0
1878  * @chan_freq_seg1: HE 6GHz Channel Centre Frequency Segment 1
1879  * @minimum_rate: HE 6GHz Minimum Rate
1880  */
1881 struct he_oper_6g_param {
1882 	uint8_t primary_channel;
1883 	uint8_t width:2,
1884 		duplicate_beacon:1,
1885 		reserved:5;
1886 	uint8_t chan_freq_seg0;
1887 	uint8_t chan_freq_seg1;
1888 	uint8_t minimum_rate;
1889 } qdf_packed;
1890 
1891 /**
1892  * struct wlan_country_ie: country IE
1893  * @ie: country IE
1894  * @len: IE len
1895  * @cc: country code
1896  */
1897 struct wlan_country_ie {
1898 	uint8_t ie;
1899 	uint8_t len;
1900 	uint8_t cc[3];
1901 } qdf_packed;
1902 
1903 /**
1904  * struct wlan_country_ie: country IE
1905  * @ie: QBSS IE
1906  * @len: IE len
1907  * @station_count: number of station associated
1908  * @qbss_chan_load: qbss channel load
1909  * @qbss_load_avail: qbss_load_avail
1910  */
1911 struct qbss_load_ie {
1912 	uint8_t ie;
1913 	uint8_t len;
1914 	uint16_t station_count;
1915 	uint8_t qbss_chan_load;
1916 	uint16_t qbss_load_avail;
1917 } qdf_packed;
1918 
1919 /**
1920  * struct wlan_bcn_frame: beacon frame fixed params
1921  * @timestamp: the value of sender's TSFTIMER
1922  * @beacon_interval: beacon interval
1923  * @capability: capability
1924  * @ie: variable IE
1925  */
1926 struct wlan_bcn_frame {
1927 	uint8_t timestamp[8];
1928 	uint16_t beacon_interval;
1929 	union wlan_capability capability;
1930 	struct ie_header ie;
1931 } qdf_packed;
1932 
1933 #define WLAN_TIM_IE_MIN_LENGTH             4
1934 
1935 /**
1936  * struct wlan_tim_ie: tim IE
1937  * @tim_ie: Time IE
1938  * @tim_len: TIM IE len
1939  * @tim_count: dtim count
1940  * @tim_period: dtim period
1941  * @tim_bitctl: bitmap control
1942  * @tim_bitmap: variable length bitmap
1943  */
1944 struct wlan_tim_ie {
1945 	uint8_t tim_ie;         /* WLAN_ELEMID_TIM */
1946 	uint8_t tim_len;
1947 	uint8_t tim_count;      /* DTIM count */
1948 	uint8_t tim_period;     /* DTIM period */
1949 	uint8_t tim_bitctl;     /* bitmap control */
1950 	uint8_t tim_bitmap[251];  /* variable-length bitmap */
1951 } qdf_packed;
1952 
1953 /**
1954  * struct rsn_mdie: mobility domain IE
1955  * @rsn_id: RSN IE id
1956  * @rsn_len: RSN IE len
1957  * @mobility_domain: mobility domain info
1958  * @ft_capab: ft capability
1959  *
1960  * Reference 9.4.2.47 Mobility Domain element (MDE) of 802.11-2016
1961  */
1962 struct rsn_mdie {
1963 	uint8_t rsn_id;
1964 	uint8_t rsn_len;
1965 	uint8_t mobility_domain[2];
1966 	uint8_t ft_capab;
1967 } qdf_packed;
1968 
1969 /**
1970  * struct srp_ie: Spatial reuse parameter IE
1971  * @srp_id: SRP IE id
1972  * @srp_len: SRP IE len
1973  * @srp_id_extn: SRP Extension ID
1974  * @sr_control: sr control
1975  * @non_srg_obsspd_max_offset: non srg obsspd max offset
1976  * @srg_obss_pd_min_offset: srg obss pd min offset
1977  * @srg_obss_pd_max_offset: srg obss pd max offset
1978  * @srg_bss_color_bitmap: srg bss color bitmap
1979  * @srg_partial_bssid_bitmap: srg partial bssid bitmap
1980  */
1981 struct wlan_srp_ie {
1982 	uint8_t srp_id;
1983 	uint8_t srp_len;
1984 	uint8_t srp_id_extn;
1985 	uint8_t sr_control;
1986 	union {
1987 		struct {
1988 			uint8_t non_srg_obsspd_max_offset;
1989 			uint8_t srg_obss_pd_min_offset;
1990 			uint8_t srg_obss_pd_max_offset;
1991 			uint8_t srg_bss_color_bitmap[8];
1992 			uint8_t srg_partial_bssid_bitmap[8];
1993 		} qdf_packed nonsrg_srg_info;
1994 		struct {
1995 			uint8_t non_srg_obsspd_max_offset;
1996 		} qdf_packed nonsrg_info;
1997 		struct {
1998 			uint8_t srg_obss_pd_min_offset;
1999 			uint8_t srg_obss_pd_max_offset;
2000 			uint8_t srg_bss_color_bitmap[8];
2001 			uint8_t srg_partial_bssid_bitmap[8];
2002 		} qdf_packed srg_info;
2003 	};
2004 } qdf_packed;
2005 
2006 #define ESP_INFORMATION_LIST_LENGTH 3
2007 #define MAX_ESP_INFORMATION_FIELD 4
2008 /*
2009  * enum access_category: tells about access category in ESP paramameter
2010  * @ESP_AC_BK: ESP access category for background
2011  * @ESP_AC_BE: ESP access category for best effort
2012  * @ESP_AC_VI: ESP access category for video
2013  * @ESP_AC_VO: ESP access category for Voice
2014  */
2015 enum access_category {
2016 	ESP_AC_BK,
2017 	ESP_AC_BE,
2018 	ESP_AC_VI,
2019 	ESP_AC_VO,
2020 
2021 };
2022 /*
2023  * struct wlan_esp_info: structure for Esp information parameter
2024  * @access_category: access category info
2025  * @reserved: reserved
2026  * @data_format: two bits in length and tells about data format
2027  * i.e. 0 = No aggregation is expected to be performed for MSDUs or MPDUs with
2028  * the Type subfield equal to Data for the corresponding AC
2029  * 1 = A-MSDU aggregation is expected to be performed for MSDUs for the
2030  * corresponding AC, but A-MPDU aggregation is not expected to be performed
2031  * for MPDUs with the Type subfield equal to Data for the corresponding AC
2032  * 2 = A-MPDU aggregation is expected to be performed for MPDUs with the Type
2033  * subfield equal to Data for the corresponding AC, but A-MSDU aggregation is
2034  * not expected to be performed for MSDUs for the corresponding AC
2035  * 3 = A-MSDU aggregation is expected to be performed for MSDUs for the
2036  * corresponding AC and A-MPDU aggregation is expected to be performed for
2037  * MPDUs with the Type subfield equal to Data for the corresponding AC
2038  * @ba_window_size: BA Window Size subfield is three bits in length and
2039  * indicates the size of the Block Ack window that is
2040  * expected for the corresponding access category
2041  * @estimated_air_fraction: Estimated Air Time Fraction subfield is 8 bits in
2042  * length and contains an unsigned integer that represents
2043  * the predicted percentage of time, linearly scaled with 255 representing
2044  * 100%, that a new STA joining the
2045  * BSS will be allocated for PPDUs that contain only
2046  * MPDUs with the Type
2047  * subfield equal to Data of the
2048  * corresponding access category for that STA.
2049  * @ppdu_duration: Data PPDU Duration Target field
2050  * is 8 bits in length and is
2051  * an unsigned integer that indicates the
2052  * expected target duration of PPDUs that contain only MPDUs with the Type
2053  * subfield equal to Data for the
2054  * corresponding access category in units of 50 μs
2055  */
2056 struct wlan_esp_info {
2057 	uint8_t access_category:2;
2058 	uint8_t reserved:1;
2059 	uint8_t data_format:2;
2060 	uint8_t ba_window_size:3;
2061 	uint8_t estimated_air_fraction;
2062 	uint8_t ppdu_duration;
2063 };
2064 
2065 /**
2066  * struct wlan_esp_ie: struct for ESP information
2067  * @esp_id: ESP IE id
2068  * @esp_len: ESP IE len
2069  * @esp_id_extn: ESP Extension ID
2070  * @esp_info_AC_BK: ESP information related to BK category
2071  * @esp_info_AC_BE: ESP information related to BE category
2072  * @esp_info_AC_VI: ESP information related to VI category
2073  * @esp_info_AC_VO: ESP information related to VO category
2074  */
2075 struct wlan_esp_ie {
2076 	uint8_t esp_id;
2077 	uint8_t esp_len;
2078 	uint8_t esp_id_extn;
2079 	struct wlan_esp_info esp_info_AC_BK;
2080 	struct wlan_esp_info esp_info_AC_BE;
2081 	struct wlan_esp_info esp_info_AC_VI;
2082 	struct wlan_esp_info esp_info_AC_VO;
2083 } qdf_packed;
2084 
2085 /**
2086  * struct wlan_ext_cap_ie - struct for extended capabilities information
2087  * @ext_cap_id: Extended capabilities id
2088  * @ext_cap_len: Extended capabilities IE len
2089  * @ext_caps: Variable length extended capabilities information
2090  */
2091 struct wlan_ext_cap_ie {
2092 	uint8_t ext_cap_id;
2093 	uint8_t ext_cap_len;
2094 	uint8_t ext_caps[];
2095 } qdf_packed;
2096 
2097 /**
2098  * struct oce_reduced_wan_metrics: struct for oce wan metrics
2099  * @downlink_av_cap: Download available capacity
2100  * @uplink_av_cap: Upload available capacity
2101  */
2102 struct oce_reduced_wan_metrics {
2103 	uint8_t downlink_av_cap:4;
2104 	uint8_t uplink_av_cap:4;
2105 };
2106 
2107 #define WLAN_VENDOR_WPA_IE_LEN 28
2108 /**
2109  * is_wpa_oui() - If vendor IE is WPA type
2110  * @frm: vendor IE pointer
2111  *
2112  * API to check if vendor IE is WPA
2113  *
2114  * Return: true if its WPA IE
2115  */
2116 static inline bool
2117 is_wpa_oui(uint8_t *frm)
2118 {
2119 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
2120 		((WLAN_WPA_OUI_TYPE << 24) | WLAN_WPA_OUI));
2121 }
2122 
2123 /**
2124  * is_wps_oui() - If vendor IE is WPS type
2125  * @frm: vendor IE pointer
2126  *
2127  * API to check if vendor IE is WPS
2128  *
2129  * Return: true if its WPS IE
2130  */
2131 static inline bool
2132 is_wps_oui(const uint8_t *frm)
2133 {
2134 	return frm[1] > 3 && BE_READ_4(frm + 2) == WSC_OUI;
2135 }
2136 
2137 /**
2138  * is_mbo_oce_oui() - If vendor IE is MBO/OCE type
2139  * @frm: vendor IE pointer
2140  *
2141  * API to check if vendor IE is MBO/OCE
2142  *
2143  * Return: true if its MBO/OCE IE
2144  */
2145 static inline bool
2146 is_mbo_oce_oui(const uint8_t *frm)
2147 {
2148 	return frm[1] > 3 && BE_READ_4(frm + 2) == MBO_OCE_OUI;
2149 }
2150 
2151 /**
2152  * is_wcn_oui() - If vendor IE is WCN type
2153  * @frm: vendor IE pointer
2154  *
2155  * API to check if vendor IE is WCN
2156  *
2157  * Return: true if its WCN IE
2158  */
2159 static inline bool
2160 is_wcn_oui(uint8_t *frm)
2161 {
2162 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2163 		((WCN_OUI_TYPE << 24) | WCN_OUI));
2164 }
2165 
2166 #define WLAN_VENDOR_WME_IE_LEN 24
2167 /**
2168  * is_wme_param() - If vendor IE is WME param type
2169  * @frm: vendor IE pointer
2170  *
2171  * API to check if vendor IE is WME param
2172  *
2173  * Return: true if its WME param IE
2174  */
2175 static inline bool
2176 is_wme_param(const uint8_t *frm)
2177 {
2178 	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
2179 			((WME_OUI_TYPE << 24) | WME_OUI)) &&
2180 			(frm[6] == WME_PARAM_OUI_SUBTYPE);
2181 }
2182 
2183 /**
2184  * is_wme_info() - If vendor IE is WME info type
2185  * @frm: vendor IE pointer
2186  *
2187  * API to check if vendor IE is WME info
2188  *
2189  * Return: true if its WME info IE
2190  */
2191 static inline bool
2192 is_wme_info(const uint8_t *frm)
2193 {
2194 	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
2195 		((WME_OUI_TYPE << 24) | WME_OUI)) &&
2196 		(frm[6] == WME_INFO_OUI_SUBTYPE);
2197 }
2198 
2199 #define WLAN_VENDOR_ATHCAPS_IE_LEN 9
2200 /**
2201  * is_atheros_oui() - If vendor IE is Atheros type
2202  * @frm: vendor IE pointer
2203  *
2204  * API to check if vendor IE is Atheros
2205  *
2206  * Return: true if its Atheros IE
2207  */
2208 static inline bool
2209 is_atheros_oui(const uint8_t *frm)
2210 {
2211 	return (frm[1] > 3) && LE_READ_4(frm + 2) ==
2212 		((ATH_OUI_TYPE << 24) | ATH_OUI);
2213 }
2214 
2215 #define WLAN_VENDOR_ATH_EXTCAP_IE_LEN 10
2216 /**
2217  * is_atheros_extcap_oui() - If vendor IE is Atheros ext cap
2218  * @frm: vendor IE pointer
2219  *
2220  * API to check if vendor IE is Atheros ext cap
2221  *
2222  * Return: true if its Atheros ext cap IE
2223  */
2224 static inline int
2225 is_atheros_extcap_oui(uint8_t *frm)
2226 {
2227 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
2228 		((ATH_OUI_EXTCAP_TYPE << 24) | ATH_OUI));
2229 }
2230 
2231 #define WLAN_VENDOR_SFA_IE_LEN 5
2232 /**
2233  * is_sfa_oui() - If vendor IE is SFA type
2234  * @frm: vendor IE pointer
2235  *
2236  * API to check if vendor IE is SFA
2237  *
2238  * Return: true if its SFA IE
2239  */
2240 static inline bool
2241 is_sfa_oui(uint8_t *frm)
2242 {
2243 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2244 		((SFA_OUI_TYPE << 24) | SFA_OUI));
2245 }
2246 
2247 /**
2248  * is_p2p_oui() - If vendor IE is P2P type
2249  * @frm: vendor IE pointer
2250  *
2251  * API to check if vendor IE is P2P
2252  *
2253  * Return: true if its P2P IE
2254  */
2255 static inline bool
2256 is_p2p_oui(const uint8_t *frm)
2257 {
2258 	const uint8_t wfa_oui[3] = P2P_WFA_OUI;
2259 
2260 	return (frm[1] >= 4) &&
2261 		(frm[2] == wfa_oui[0]) &&
2262 		(frm[3] == wfa_oui[1]) &&
2263 		(frm[4] == wfa_oui[2]) &&
2264 		(frm[5] == P2P_WFA_VER);
2265 }
2266 
2267 #define WLAN_VENDOR_SON_IE_LEN 31
2268 /**
2269  * is_qca_son_oui() - If vendor IE is QCA WHC type
2270  * @frm: vendor IE pointer
2271  * @whc_subtype: subtype
2272  *
2273  * API to check if vendor IE is QCA WHC
2274  *
2275  * Return: true if its QCA WHC IE
2276  */
2277 static inline bool
2278 is_qca_son_oui(uint8_t *frm, uint8_t whc_subtype)
2279 {
2280 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2281 		((QCA_OUI_WHC_TYPE << 24) | QCA_OUI)) &&
2282 		(*(frm + 6) == whc_subtype);
2283 }
2284 
2285 /**
2286  * is_qca_son_rept_oui() - If vendor IE is QCA WHC repeater type
2287  * @frm: vendor IE pointer
2288  * @whc_subtype: subtype
2289  *
2290  * API to check if vendor IE is QCA WHC REPT
2291  *
2292  * Return: true if its QCA WHC REPT IE
2293  */
2294 static inline bool
2295 is_qca_son_rept_oui(u_int8_t *frm, u_int8_t whc_subtype)
2296 {
2297 	return ((frm[1] > 4) && (LE_READ_4(frm + 2) ==
2298 		((QCA_OUI_WHC_REPT_TYPE << 24) | QCA_OUI)) &&
2299 		(*(frm + 6) == whc_subtype));
2300 }
2301 
2302 /**
2303  * is_ht_cap() - If vendor IE is vendor HT cap type
2304  * @frm: vendor IE pointer
2305  *
2306  * API to check if vendor IE is vendor HT cap
2307  *
2308  * Return: true if its vendor HT cap IE
2309  */
2310 static inline bool
2311 is_ht_cap(uint8_t *frm)
2312 {
2313 	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
2314 		((VENDOR_HT_OUI << 8) | VENDOR_HT_CAP_ID));
2315 }
2316 
2317 /**
2318  * is_ht_info() - If vendor IE is vendor HT info type
2319  * @frm: vendor IE pointer
2320  *
2321  * API to check if vendor IE is vendor HT info
2322  *
2323  * Return: true if its vendor HT info IE
2324  */
2325 static inline bool
2326 is_ht_info(uint8_t *frm)
2327 {
2328 	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
2329 		((VENDOR_HT_OUI << 8) | VENDOR_HT_INFO_ID));
2330 }
2331 
2332 /**
2333  * is_interop_vht() - If vendor IE is VHT interop
2334  * @frm: vendor IE pointer
2335  *
2336  * API to check if vendor IE is VHT interop
2337  *
2338  * Return: true if its VHT interop IE
2339  */
2340 static inline bool
2341 is_interop_vht(uint8_t *frm)
2342 {
2343 	return (frm[1] > 12) && (BE_READ_4(frm + 2) ==
2344 		((VHT_INTEROP_OUI << 8) | VHT_INTEROP_TYPE)) &&
2345 		((*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE) ||
2346 		(*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC));
2347 }
2348 
2349 /**
2350  * is_bwnss_oui() - If vendor IE is BW NSS type
2351  * @frm: vendor IE pointer
2352  *
2353  * API to check if vendor IE is BW NSS
2354  *
2355  * Return: true if its BW NSS IE
2356  */
2357 static inline bool
2358 is_bwnss_oui(uint8_t *frm)
2359 {
2360 	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
2361 		((ATH_OUI_BW_NSS_MAP_TYPE << 24) | ATH_OUI));
2362 }
2363 
2364 #define WLAN_BWNSS_MAP_OFFSET 7
2365 
2366 /**
2367  * is_he_cap_oui() - If vendor IE is HE CAP OUI
2368  * @frm: vendor IE pointer
2369  *
2370  * API to check if vendor IE is HE CAP
2371  *
2372  * Return: true if its HE CAP IE
2373  */
2374 static inline bool
2375 is_he_cap_oui(uint8_t *frm)
2376 {
2377 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2378 		((ATH_HE_CAP_SUBTYPE << 24) | ATH_HE_OUI));
2379 }
2380 
2381 /**
2382  * is_he_op_oui() - If vendor IE is HE OP OUI
2383  * @frm: vendor IE pointer
2384  *
2385  * API to check if vendor IE is HE OP OUT
2386  *
2387  * Return: true if its HE OP OUI
2388  */
2389 static inline bool
2390 is_he_op_oui(uint8_t *frm)
2391 {
2392 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2393 		((ATH_HE_OP_SUBTYPE << 24) | ATH_HE_OUI));
2394 }
2395 
2396 /**
2397  * is_extender_oui() - If vendor IE is EXTENDER OUI
2398  * @frm: vendor IE pointer
2399  *
2400  * API to check if vendor IE is EXTENDER OUI
2401  *
2402  * Return: true if its EXTENDER OUI
2403  */
2404 static inline bool
2405 is_extender_oui(uint8_t *frm)
2406 {
2407 	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
2408 		((QCA_OUI_EXTENDER_TYPE << 24) | QCA_OUI));
2409 }
2410 
2411 /**
2412  * is_adaptive_11r_oui() - Function to check if vendor IE is ADAPTIVE 11R OUI
2413  * @frm: vendor IE pointer
2414  *
2415  * API to check if vendor IE is ADAPTIVE 11R OUI
2416  *
2417  * Return: true if its ADAPTIVE 11r OUI
2418  */
2419 static inline bool
2420 is_adaptive_11r_oui(uint8_t *frm)
2421 {
2422 	return (frm[1] > OUI_LENGTH) && (LE_READ_4(frm + 2) ==
2423 		((ADAPTIVE_11R_OUI_TYPE << OUI_TYPE_BITS) | ADAPTIVE_11R_OUI));
2424 }
2425 
2426 /**
2427  * is_sae_single_pmk_oui() - Fun to check if vendor IE is sae single pmk OUI
2428  * @frm: vendor IE pointer
2429  *
2430  * API to check if vendor IE is sae single pmk OUI
2431  *
2432  * Return: true if its sae single pmk OUI
2433  */
2434 static inline bool
2435 is_sae_single_pmk_oui(uint8_t *frm)
2436 {
2437 	return (frm[1] > OUI_LENGTH) && (LE_READ_4(frm + 2) ==
2438 		((SAE_SINGLE_PMK_TYPE << OUI_TYPE_BITS) | SAE_SINGLE_PMK_OUI));
2439 }
2440 
2441 /**
2442  * wlan_parse_oce_reduced_wan_metrics_ie() - parse oce wan metrics
2443  * @mbo_oce_ie: MBO/OCE ie ptr
2444  * @wan_metrics: out structure for the reduced wan metric
2445  *
2446  * API, function to parse reduced wan metric
2447  *
2448  * Return: true if oce wan metrics is present
2449  */
2450 static inline bool
2451 wlan_parse_oce_reduced_wan_metrics_ie(uint8_t *mbo_oce_ie,
2452 	struct oce_reduced_wan_metrics *wan_metrics)
2453 {
2454 	uint8_t len, attribute_len, attribute_id;
2455 	uint8_t *ie;
2456 
2457 	if (!mbo_oce_ie)
2458 		return false;
2459 
2460 	ie = mbo_oce_ie;
2461 	len = ie[1];
2462 	ie += 2;
2463 
2464 	if (len <= MBO_OCE_OUI_SIZE)
2465 		return false;
2466 
2467 	ie += MBO_OCE_OUI_SIZE;
2468 	len -= MBO_OCE_OUI_SIZE;
2469 
2470 	while (len > 2) {
2471 		attribute_id = ie[0];
2472 		attribute_len = ie[1];
2473 		len -= 2;
2474 		if (attribute_len > len)
2475 			return false;
2476 
2477 		if (attribute_id == REDUCED_WAN_METRICS_ATTR) {
2478 			wan_metrics->downlink_av_cap = ie[2] & 0xff;
2479 			wan_metrics->uplink_av_cap = ie[2] >> 4;
2480 			return true;
2481 		}
2482 
2483 		ie += (attribute_len + 2);
2484 		len -= attribute_len;
2485 	}
2486 
2487 	return false;
2488 }
2489 
2490 /**
2491  * wlan_parse_oce_subnet_id_ie() - parse oce subnet id IE
2492  * @mbo_oce_ie: MBO/OCE IE pointer
2493  *
2494  * While parsing vendor IE, is_mbo_oce_oui() API does sanity of
2495  * length and attribute ID for MBO_OCE_OUI and after passing the
2496  * sanity only mbo_oce IE is stored in scan cache.
2497  * It is a callers responsiblity to get the mbo_oce_ie pointer
2498  * using util_scan_entry_mbo_oce() API, which points to mbo_oce
2499  * stored in scan cache. Thus caller is responsible for ensuring
2500  * the length of the IE is consistent with the embedded length.
2501  *
2502  * Return: true if oce subnet id is present, else false
2503  */
2504 static inline bool
2505 wlan_parse_oce_subnet_id_ie(uint8_t *mbo_oce_ie)
2506 {
2507 	uint8_t len, attribute_len, attribute_id;
2508 	uint8_t *ie;
2509 
2510 	if (!mbo_oce_ie)
2511 		return false;
2512 
2513 	ie = mbo_oce_ie;
2514 	len = ie[1];
2515 	ie += 2;
2516 
2517 	if (len <= MBO_OCE_OUI_SIZE)
2518 		return false;
2519 
2520 	ie += MBO_OCE_OUI_SIZE;
2521 	len -= MBO_OCE_OUI_SIZE;
2522 
2523 	while (len > 2) {
2524 		attribute_id = ie[0];
2525 		attribute_len = ie[1];
2526 		len -= 2;
2527 		if (attribute_len > len)
2528 			return false;
2529 
2530 		if (attribute_id == OCE_SUBNET_ID_ATTR)
2531 			return true;
2532 
2533 		ie += (attribute_len + 2);
2534 		len -= attribute_len;
2535 	}
2536 
2537 	return false;
2538 }
2539 
2540 /**
2541  * wlan_parse_oce_assoc_disallowed_ie() - parse oce assoc disallowed IE
2542  * @mbo_oce_ie: MBO/OCE ie ptr
2543  * @reason: reason for disallowing assoc.
2544  *
2545  * API, function to parse OCE assoc disallowed param from the OCE MBO IE
2546  *
2547  * Return: true if assoc disallowed field is present in the IE
2548  */
2549 static inline bool
2550 wlan_parse_oce_assoc_disallowed_ie(uint8_t *mbo_oce_ie, uint8_t *reason)
2551 {
2552 	uint8_t len, attribute_len, attribute_id;
2553 	uint8_t *ie;
2554 
2555 	if (!mbo_oce_ie)
2556 		return false;
2557 
2558 	ie = mbo_oce_ie;
2559 	len = ie[1];
2560 	ie += 2;
2561 
2562 	if (len <= MBO_OCE_OUI_SIZE)
2563 		return false;
2564 
2565 	ie += MBO_OCE_OUI_SIZE;
2566 	len -= MBO_OCE_OUI_SIZE;
2567 
2568 	while (len > 2) {
2569 		attribute_id = ie[0];
2570 		attribute_len = ie[1];
2571 		len -= 2;
2572 		if (attribute_len > len)
2573 			return false;
2574 
2575 		if (attribute_id == OCE_DISALLOW_ASSOC_ATTR) {
2576 			*reason = ie[2];
2577 			return true;
2578 		}
2579 
2580 		ie += (attribute_len + 2);
2581 		len -= attribute_len;
2582 	}
2583 
2584 	return false;
2585 }
2586 
2587 /*
2588  * wlan_parse_oce_ap_tx_pwr_ie() - parse oce ap tx pwr
2589  * @mbo_oce_ie: MBO/OCE ie ptr
2590  * @ap_tx_pwr: pointer to hold value of ap_tx_pwr in dbm
2591  *
2592  * Return: true if oce ap tx pwr is present, else false
2593  */
2594 static inline bool
2595 wlan_parse_oce_ap_tx_pwr_ie(uint8_t *mbo_oce_ie, int8_t *ap_tx_pwr_dbm)
2596 {
2597 	uint8_t len, attribute_len, attribute_id;
2598 	uint8_t *ie;
2599 	int8_t ap_tx_power_in_2_complement;
2600 
2601 	if (!mbo_oce_ie)
2602 		return false;
2603 
2604 	ie = mbo_oce_ie;
2605 	len = ie[1];
2606 	ie += 2;
2607 
2608 	if (len <= MBO_OCE_OUI_SIZE)
2609 		return false;
2610 
2611 	ie += MBO_OCE_OUI_SIZE;
2612 	len -= MBO_OCE_OUI_SIZE;
2613 
2614 	while (len > 2) {
2615 		attribute_id = ie[0];
2616 		attribute_len = ie[1];
2617 		len -= 2;
2618 		if (attribute_len > len)
2619 			return false;
2620 
2621 		if (attribute_id == AP_TX_PWR_ATTR) {
2622 			ap_tx_power_in_2_complement = ie[2];
2623 			*ap_tx_pwr_dbm =
2624 				(int8_t)(256 - ap_tx_power_in_2_complement);
2625 			return true;
2626 		}
2627 
2628 		ie += (attribute_len + 2);
2629 		len -= attribute_len;
2630 	}
2631 
2632 	return false;
2633 }
2634 #endif /* _WLAN_CMN_IEEE80211_DEFS_H_ */
2635