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