1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /*
21  * This file parser_api.h contains the definitions used
22  * for parsing received 802.11 frames
23  * Author:        Chandra Modumudi
24  * Date:          02/11/02
25  * History:-
26  * Date           Modified by    Modification Information
27  * --------------------------------------------------------------------
28  *
29  */
30 #ifndef __PARSE_H__
31 #define __PARSE_H__
32 
33 #include "qdf_types.h"
34 #include "sir_mac_prop_exts.h"
35 #include "dot11f.h"
36 #include "lim_ft_defs.h"
37 #include "lim_session.h"
38 #include "wlan_mlme_main.h"
39 #include <wlan_mlo_mgr_public_structs.h>
40 
41 #define COUNTRY_STRING_LENGTH    (3)
42 #define COUNTRY_INFO_MAX_CHANNEL (84)
43 #define MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE (COUNTRY_STRING_LENGTH * \
44 						COUNTRY_INFO_MAX_CHANNEL)
45 #define HIGHEST_24GHZ_CHANNEL_NUM  (14)
46 
47 #define IS_24G_CH(__chNum) ((__chNum > 0) && (__chNum < 15))
48 #define IS_5G_CH(__chNum) ((__chNum >= 36) && (__chNum <= 165))
49 #define IS_2X2_CHAIN(__chain) ((__chain & 0x3) == 0x3)
50 #define DISABLE_NSS2_MCS 0xC
51 #define VHT_1x1_MCS9_MAP 0x2
52 #define VHT_2x2_MCS9_MAP 0xA
53 #define VHT_1x1_MCS8_VAL 0xFFFD
54 #define VHT_2x2_MCS8_VAL 0xFFF5
55 #define VHT_1x1_MCS_MASK 0x3
56 #define VHT_2x2_MCS_MASK 0xF
57 #define DISABLE_VHT_MCS_9(mcs, nss) \
58 	(mcs = (nss > 1) ? VHT_2x2_MCS8_VAL : VHT_1x1_MCS8_VAL)
59 
60 #define NSS_1x1_MODE 1
61 #define NSS_2x2_MODE 2
62 #define NSS_3x3_MODE 3
63 #define NSS_4x4_MODE 4
64 #define MBO_IE_ASSOC_DISALLOWED_SUBATTR_ID 0x04
65 
66 #define SIZE_OF_FIXED_PARAM 12
67 #define SIZE_OF_TAG_PARAM_NUM 1
68 #define SIZE_OF_TAG_PARAM_LEN 1
69 #define RSNIEID 0x30
70 #define RSNIE_CAPABILITY_LEN 2
71 #define DEFAULT_RSNIE_CAP_VAL 0x00
72 
73 #define SIZE_MASK 0x7FFF
74 #define FIXED_MASK 0x8000
75 
76 #define MAX_TPE_IES 8
77 
78 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
79 #define QCOM_VENDOR_IE_MCC_AVOID_CH 0x01
80 
81 struct sAvoidChannelIE {
82 	/* following must be 0xDD (221) */
83 	uint8_t tag_number;
84 	uint8_t length;
85 	/* following must be 00-A0-C6 */
86 	uint8_t oui[3];
87 	/* following must be 0x01 */
88 	uint8_t type;
89 	uint8_t channel;
90 };
91 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
92 
93 /*
94  * Host driver uses TBTT info of length 13
95  * in the RNR IE for legacy SAPs.
96  */
97 #define CURRENT_RNR_TBTT_INFO_LEN 13
98 
99 typedef struct sSirCountryInformation {
100 	uint8_t countryString[COUNTRY_STRING_LENGTH];
101 	uint8_t numIntervals;   /* number of channel intervals */
102 	struct channelPowerLim {
103 		uint8_t channelNumber;
104 		uint8_t numChannel;
105 		uint8_t maxTransmitPower;
106 	} channelTransmitPower[COUNTRY_INFO_MAX_CHANNEL];
107 } tSirCountryInformation, *tpSirCountryInformation;
108 
109 #ifdef WLAN_FEATURE_FILS_SK
110 #define SIR_MAX_IDENTIFIER_CNT 7
111 #define SIR_CACHE_IDENTIFIER_LEN 2
112 #define SIR_HESSID_LEN 6
113 #define SIR_MAX_KEY_CNT 7
114 #define SIR_MAX_KEY_LEN 48
115 #define SIR_FILS_IND_ELEM_OFFSET 2
116 /*
117  * struct public_key_identifier: structure for public key identifier
118  * present in fils indication element
119  * @is_present: if Key info is present
120  * @key_cnt:  number of keys present
121  * @key_type: type of key used
122  * @length: length of key
123  * @key: key data
124  */
125 struct public_key_identifier {
126 	bool is_present;
127 	uint8_t key_cnt;
128 	uint8_t key_type;
129 	uint8_t length;
130 	uint8_t key[SIR_MAX_KEY_CNT][SIR_MAX_KEY_LEN];
131 };
132 
133 /*
134  * struct fils_cache_identifier: structure for fils cache identifier
135  * present in fils indication element
136  * @is_present: if cache identifier is present
137  * @identifier: cache identifier
138  */
139 struct fils_cache_identifier {
140 	bool is_present;
141 	uint8_t identifier[SIR_CACHE_IDENTIFIER_LEN];
142 };
143 
144 /*
145  * struct fils_hessid: structure for fils hessid
146  * present in fils indication element
147  * @is_present: if hessid info is present
148  * @hessid: hessid data
149  */
150 struct fils_hessid {
151 	bool is_present;
152 	uint8_t hessid[SIR_HESSID_LEN];
153 };
154 
155 /*
156  * struct fils_realm_identifier: structure for fils_realm_identifier
157  * present in fils indication element
158  * @is_present: if realm info is present
159  * @realm_cnt: realm count
160  * @realm: realm data
161  */
162 struct fils_realm_identifier {
163 	bool is_present;
164 	uint8_t realm_cnt;
165 	uint8_t realm[SIR_MAX_REALM_COUNT][SIR_REALM_LEN];
166 };
167 
168 /*
169  * struct sir_fils_indication: structure for fils indication element
170  * @is_present: if indication element is present
171  * @is_ip_config_supported: if IP config is supported
172  * @is_fils_sk_auth_supported: if fils sk suppprted
173  * @is_fils_sk_auth_pfs_supported: if fils sk with pfs supported
174  * @is_pk_auth_supported: if fils public key supported
175  * @cache_identifier: fils cache idenfier info
176  * @hessid: fils hessid info
177  * @realm_identifier: fils realm info
178  * @key_identifier: fils key identifier info
179  */
180 struct sir_fils_indication {
181 	bool is_present;
182 	uint8_t is_ip_config_supported;
183 	uint8_t is_fils_sk_auth_supported;
184 	uint8_t is_fils_sk_auth_pfs_supported;
185 	uint8_t is_pk_auth_supported;
186 	struct fils_cache_identifier cache_identifier;
187 	struct fils_hessid hessid;
188 	struct fils_realm_identifier realm_identifier;
189 	struct public_key_identifier key_identifier;
190 };
191 #endif
192 
193 enum operating_class_num {
194 	OP_CLASS_131 = 131,
195 	OP_CLASS_132,
196 	OP_CLASS_133,
197 	OP_CLASS_134,
198 	OP_CLASS_135,
199 	OP_CLASS_136,
200 };
201 
202 enum operating_extension_identifier {
203 	OP_CLASS_ID_200 = 200,
204 	OP_CLASS_ID_201,
205 };
206 
207 #ifdef WLAN_FEATURE_11BE_MLO
208 struct sir_multi_link_ie {
209 	uint8_t num_of_mlo_ie;
210 	bool mlo_ie_present;
211 	struct wlan_mlo_ie mlo_ie;
212 };
213 #endif
214 
215 /* Structure common to Beacons & Probe Responses */
216 typedef struct sSirProbeRespBeacon {
217 	tSirMacTimeStamp timeStamp;
218 	uint16_t beaconInterval;
219 	tSirMacCapabilityInfo capabilityInfo;
220 
221 	tSirMacSSid ssId;
222 	tSirMacRateSet supportedRates;
223 	tSirMacRateSet extendedRates;
224 	uint32_t chan_freq;
225 	tSirMacCfParamSet cfParamSet;
226 	tSirMacTim tim;
227 	tSirMacEdcaParamSetIE edcaParams;
228 	tSirMacQosCapabilityIE qosCapability;
229 
230 	tSirCountryInformation countryInfoParam;
231 	tSirMacWpaInfo wpa;
232 	tSirMacRsnInfo rsn;
233 
234 	tSirMacErpInfo erpIEInfo;
235 
236 	tDot11fIEPowerConstraints localPowerConstraint;
237 	tDot11fIETPCReport tpcReport;
238 	tDot11fIEChanSwitchAnn channelSwitchIE;
239 	tDot11fIEsec_chan_offset_ele sec_chan_offset;
240 	tDot11fIEext_chan_switch_ann ext_chan_switch;
241 	tDot11fIESuppOperatingClasses supp_operating_classes;
242 	tSirMacAddr bssid;
243 	tDot11fIEQuiet quietIE;
244 	tDot11fIEHTCaps HTCaps;
245 	tDot11fIEHTInfo HTInfo;
246 	tDot11fIEP2PProbeRes P2PProbeRes;
247 	uint8_t mdie[SIR_MDIE_SIZE];
248 #ifdef FEATURE_WLAN_ESE
249 	tDot11fIEESETxmitPower eseTxPwr;
250 	tDot11fIEQBSSLoad QBSSLoad;
251 #endif
252 	uint8_t ssidPresent;
253 	uint8_t suppRatesPresent;
254 	uint8_t extendedRatesPresent;
255 	uint8_t supp_operating_class_present;
256 	uint8_t cfPresent;
257 	uint8_t dsParamsPresent;
258 	uint8_t timPresent;
259 
260 	uint8_t edcaPresent;
261 	uint8_t qosCapabilityPresent;
262 	uint8_t wmeEdcaPresent;
263 	uint8_t wmeInfoPresent;
264 	uint8_t wsmCapablePresent;
265 
266 	uint8_t countryInfoPresent;
267 	uint8_t wpaPresent;
268 	uint8_t rsnPresent;
269 	uint8_t erpPresent;
270 	uint8_t channelSwitchPresent;
271 	uint8_t sec_chan_offset_present;
272 	uint8_t ext_chan_switch_present;
273 	uint8_t quietIEPresent;
274 	uint8_t tpcReportPresent;
275 	uint8_t powerConstraintPresent;
276 
277 	uint8_t mdiePresent;
278 
279 	tDot11fIEVHTCaps VHTCaps;
280 	tDot11fIEVHTOperation VHTOperation;
281 	tDot11fIEVHTExtBssLoad VHTExtBssLoad;
282 	tDot11fIEExtCap ext_cap;
283 	tDot11fIEOperatingMode OperatingMode;
284 	uint8_t WiderBWChanSwitchAnnPresent;
285 	tDot11fIEWiderBWChanSwitchAnn WiderBWChanSwitchAnn;
286 	uint8_t Vendor1IEPresent;
287 	tDot11fIEvendor_vht_ie vendor_vht_ie;
288 	uint8_t Vendor3IEPresent;
289 	tDot11fIEhs20vendor_ie hs20vendor_ie;
290 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
291 	tDot11fIEQComVendorIE   AvoidChannelIE;
292 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
293 #ifdef FEATURE_WLAN_ESE
294 	uint8_t    is_ese_ver_ie_present;
295 #endif
296 	tDot11fIEOBSSScanParameters obss_scanparams;
297 	bool MBO_IE_present;
298 	uint8_t MBO_capability;
299 	bool assoc_disallowed;
300 	uint8_t assoc_disallowed_reason;
301 	tDot11fIEqcn_ie qcn_ie;
302 	tDot11fIEhe_cap he_cap;
303 	tDot11fIEhe_op he_op;
304 #ifdef WLAN_FEATURE_SR
305 	tDot11fIEspatial_reuse srp_ie;
306 #endif
307 	tDot11fIEeht_cap eht_cap;
308 	tDot11fIEeht_op eht_op;
309 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
310 	tDot11fIEbss_color_change vendor_he_bss_color_change;
311 #endif
312 #ifdef WLAN_FEATURE_FILS_SK
313 	struct sir_fils_indication fils_ind;
314 #endif
315 	uint8_t num_transmit_power_env;
316 	tDot11fIEtransmit_power_env transmit_power_env[MAX_TPE_IES];
317 	uint8_t ap_power_type;
318 #ifdef WLAN_FEATURE_11BE_MLO
319 	struct sir_multi_link_ie mlo_ie;
320 	struct wlan_t2lm_context t2lm_ctx;
321 #endif
322 	tDot11fIEWMMParams wmm_params;
323 } tSirProbeRespBeacon, *tpSirProbeRespBeacon;
324 
325 /* probe Request structure */
326 typedef struct sSirProbeReq {
327 	tSirMacSSid ssId;
328 	tSirMacRateSet supportedRates;
329 	tSirMacRateSet extendedRates;
330 	tDot11fIEWscProbeReq probeReqWscIeInfo;
331 	tDot11fIEHTCaps HTCaps;
332 	uint8_t ssidPresent;
333 	uint8_t suppRatesPresent;
334 	uint8_t extendedRatesPresent;
335 	uint8_t wscIePresent;
336 	uint8_t p2pIePresent;
337 	tDot11fIEVHTCaps VHTCaps;
338 	tDot11fIEhe_cap he_cap;
339 } tSirProbeReq, *tpSirProbeReq;
340 
341 /* / Association Request structure (one day to be replaced by */
342 /* / tDot11fAssocRequest) */
343 typedef struct sSirAssocReq {
344 
345 	tSirMacCapabilityInfo capabilityInfo;
346 	uint16_t listenInterval;
347 	tSirMacAddr currentApAddr;      /* only in reassoc frames */
348 	tSirMacSSid ssId;
349 	tSirMacRateSet supportedRates;
350 	tSirMacRateSet extendedRates;
351 
352 	tSirAddtsReqInfo addtsReq;
353 	tSirMacQosCapabilityStaIE qosCapability;
354 
355 	tSirMacWapiInfo wapi;
356 	tSirMacWpaInfo wpa;
357 	tSirMacRsnInfo rsn;
358 	tSirAddie addIE;
359 
360 	tSirMacPowerCapabilityIE powerCapability;
361 	tSirMacSupportedChannelIE supportedChannels;
362 	tDot11fIEHTCaps HTCaps;
363 	tDot11fIEWMMInfoStation WMMInfoStation;
364 	tDot11fIESuppOperatingClasses supp_operating_classes;
365 	/* / This is set if the frame is a reassoc request: */
366 	uint8_t reassocRequest;
367 	uint8_t ssidPresent;
368 	uint8_t suppRatesPresent;
369 	uint8_t extendedRatesPresent;
370 
371 	uint8_t wmeInfoPresent;
372 	uint8_t qosCapabilityPresent;
373 	uint8_t addtsPresent;
374 	uint8_t wsmCapablePresent;
375 
376 	uint8_t wapiPresent;
377 	uint8_t wpaPresent;
378 	uint8_t rsnPresent;
379 	uint8_t addIEPresent;
380 
381 	uint8_t powerCapabilityPresent;
382 	uint8_t supportedChannelsPresent;
383 	/* keeping copy of association request received, this is
384 	   required for indicating the frame to upper layers */
385 	qdf_nbuf_t assoc_req_buf;
386 	uint32_t assocReqFrameLength;
387 	uint8_t *assocReqFrame;
388 	tDot11fIEVHTCaps VHTCaps;
389 	tDot11fIEOperatingMode operMode;
390 	tDot11fIEExtCap ExtCap;
391 	tDot11fIEbss_max_idle_period bss_max_idle_period;
392 	tDot11fIEvendor_vht_ie vendor_vht_ie;
393 	tDot11fIEhs20vendor_ie hs20vendor_ie;
394 	tDot11fIEhe_cap he_cap;
395 	tDot11fIEhe_6ghz_band_cap he_6ghz_band_cap;
396 	tDot11fIEqcn_ie qcn_ie;
397 	tDot11fIEeht_cap eht_cap;
398 	bool is_sae_authenticated;
399 	struct mlo_partner_info mlo_info;
400 	uint8_t mld_mac[QDF_MAC_ADDR_SIZE];
401 } tSirAssocReq, *tpSirAssocReq;
402 
403 #define FTIE_SUBELEM_R1KH_ID 1
404 #define FTIE_SUBELEM_GTK     2
405 #define FTIE_SUBELEM_R0KH_ID 3
406 #define FTIE_SUBELEM_IGTK    4
407 #define FTIE_SUBELEM_OCI     5
408 
409 #define FTIE_R1KH_LEN 6
410 #define FTIE_R0KH_MAX_LEN 48
411 
412 /**
413  * struct wlan_sha384_ftinfo_subelem - subelements of FTIE
414  * @r1kh_id: FT R1 Key holder ID
415  * @gtk: Ft group temporal key
416  * @gtk_len: GTK length
417  * @r0kh_id: FT R0 Key Holder ID
418  * @igtk: FT IGTK used for 11w
419  * @igtk_len: IGTK length
420  */
421 struct wlan_sha384_ftinfo_subelem {
422 	tDot11fIER1KH_ID r1kh_id;
423 	uint8_t *gtk;
424 	uint8_t gtk_len;
425 	tDot11fIER0KH_ID r0kh_id;
426 	uint8_t *igtk;
427 	uint8_t igtk_len;
428 };
429 
430 #define MIC_CONTROL_BYTES 2
431 #define MIC_SHA384_BYTES  24
432 #define NONCE_BYTES       32
433 
434 /**
435  * struct wlan_sha384_ftinfo - FTE for sha384 based AKMs
436  * @mic_control: FTIE mic control field of 2 bytes
437  * @mic: MIC present in the FTIE assoc Response
438  * @anonce: Anonce sent by the AP
439  * @snonce: Snonce field in the FTIE
440  */
441 struct wlan_sha384_ftinfo {
442 	uint8_t mic_control[MIC_CONTROL_BYTES];
443 	uint8_t mic[MIC_SHA384_BYTES];
444 	uint8_t anonce[NONCE_BYTES];
445 	uint8_t snonce[NONCE_BYTES];
446 };
447 
448 /* / Association Response structure (one day to be replaced by */
449 /* / tDot11fAssocRequest) */
450 typedef struct sSirAssocRsp {
451 
452 	tSirMacCapabilityInfo capabilityInfo;
453 	uint16_t aid;
454 	uint16_t status_code;
455 	tSirMacRateSet supportedRates;
456 	tSirMacRateSet extendedRates;
457 	tSirMacEdcaParamSetIE edca;
458 	tSirAddtsRspInfo addtsRsp;
459 	tDot11fIEHTCaps HTCaps;
460 	tDot11fIEHTInfo HTInfo;
461 	tDot11fIEFTInfo FTInfo;
462 	struct wlan_sha384_ftinfo sha384_ft_info;
463 	struct wlan_sha384_ftinfo_subelem sha384_ft_subelem;
464 	uint8_t mdie[SIR_MDIE_SIZE];
465 	uint8_t num_RICData;
466 	tDot11fIERICDataDesc RICData[2];
467 
468 #ifdef FEATURE_WLAN_ESE
469 	uint8_t num_tspecs;
470 	tDot11fIEWMMTSPEC TSPECInfo[ESE_MAX_TSPEC_IES];
471 	struct ese_tsm_ie tsmIE;
472 #endif
473 
474 	uint8_t suppRatesPresent;
475 	uint8_t extendedRatesPresent;
476 
477 	uint8_t edcaPresent;
478 	uint8_t wmeEdcaPresent;
479 	uint8_t addtsPresent;
480 	uint8_t wsmCapablePresent;
481 	uint8_t ftinfoPresent;
482 	uint8_t mdiePresent;
483 	uint8_t ricPresent;
484 #ifdef FEATURE_WLAN_ESE
485 	uint8_t tspecPresent;
486 	uint8_t tsmPresent;
487 #endif
488 	tDot11fIEVHTCaps VHTCaps;
489 	tDot11fIEVHTOperation VHTOperation;
490 	tDot11fIEExtCap ExtCap;
491 	tDot11fIEOperatingMode oper_mode_ntf;
492 	struct qos_map_set QosMapSet;
493 	tDot11fIETimeoutInterval TimeoutInterval;
494 	tDot11fIERRMEnabledCap rrm_caps;
495 	tDot11fIEvendor_vht_ie vendor_vht_ie;
496 	tDot11fIEOBSSScanParameters obss_scanparams;
497 	tDot11fTLVrssi_assoc_rej rssi_assoc_rej;
498 	tDot11fIEqcn_ie qcn_ie;
499 	tDot11fIEhe_cap he_cap;
500 	tDot11fIEhe_op he_op;
501 #ifdef WLAN_FEATURE_SR
502 	tDot11fIEspatial_reuse srp_ie;
503 #endif
504 	tDot11fIEhe_6ghz_band_cap he_6ghz_band_cap;
505 	tDot11fIEeht_cap eht_cap;
506 	tDot11fIEeht_op eht_op;
507 	bool mu_edca_present;
508 	tSirMacEdcaParamSetIE mu_edca;
509 	tDot11fIEbss_max_idle_period bss_max_idle_period;
510 #ifdef WLAN_FEATURE_FILS_SK
511 	tDot11fIEfils_session fils_session;
512 	tDot11fIEfils_key_confirmation fils_key_auth;
513 	tDot11fIEfils_kde fils_kde;
514 	struct qdf_mac_addr dst_mac;
515 	struct qdf_mac_addr src_mac;
516 	uint16_t hlp_data_len;
517 	uint8_t hlp_data[FILS_MAX_HLP_DATA_LEN];
518 #endif
519 #ifdef WLAN_FEATURE_11BE_MLO
520 	struct sir_multi_link_ie mlo_ie;
521 	struct wlan_t2lm_context t2lm_ctx;
522 #endif
523 } tSirAssocRsp, *tpSirAssocRsp;
524 
525 #ifdef FEATURE_WLAN_ESE
526 /* Structure to hold ESE Beacon report mandatory IEs */
527 typedef struct sSirEseBcnReportMandatoryIe {
528 	tSirMacSSid ssId;
529 	tSirMacRateSet supportedRates;
530 	tSirMacFHParamSet fhParamSet;
531 	tSirMacDsParamSetIE dsParamSet;
532 	tSirMacCfParamSet cfParamSet;
533 	tSirMacTim tim;
534 	tSirMacRRMEnabledCap rmEnabledCapabilities;
535 
536 	uint8_t ssidPresent;
537 	uint8_t suppRatesPresent;
538 	uint8_t fhParamPresent;
539 	uint8_t dsParamsPresent;
540 	uint8_t cfPresent;
541 	uint8_t timPresent;
542 	uint8_t rrmPresent;
543 } tSirEseBcnReportMandatoryIe, *tpSirEseBcnReportMandatoryIe;
544 #endif /* FEATURE_WLAN_ESE */
545 
546 /**
547  * struct s_ext_cap - holds bitfields of extended capability IE
548  *
549  * s_ext_cap holds bitfields of extended capability IE. In dot11f files
550  * extended capability IE information is stored as an array of bytes.
551  * This structure is used to encode/decode the byte array present in
552  * dot11f IE structure.
553  */
554 
555 struct s_ext_cap {
556 	uint8_t bss_coexist_mgmt_support:1;
557 	uint8_t reserved1:1;
558 	uint8_t ext_chan_switch:1;
559 	uint8_t reserved2:1;
560 	uint8_t psmp_cap:1;
561 	uint8_t reserved3:1;
562 	uint8_t spsmp_cap:1;
563 	uint8_t event:1;
564 	uint8_t diagnostics:1;
565 	uint8_t multi_diagnostics:1;
566 	uint8_t loc_tracking:1;
567 	uint8_t fms:1;
568 	uint8_t proxy_arp_service:1;
569 	uint8_t co_loc_intf_reporting:1;
570 	uint8_t civic_loc:1;
571 	uint8_t geospatial_loc:1;
572 	uint8_t tfs:1;
573 	uint8_t wnm_sleep_mode:1;
574 	uint8_t tim_broadcast:1;
575 	uint8_t bss_transition:1;
576 	uint8_t qos_traffic_cap:1;
577 	uint8_t ac_sta_cnt:1;
578 	uint8_t multi_bssid:1;
579 	uint8_t timing_meas:1;
580 	uint8_t chan_usage:1;
581 	uint8_t ssid_list:1;
582 	uint8_t dms:1;
583 	uint8_t utctsf_offset:1;
584 	uint8_t tdls_peer_uapsd_buffer_sta:1;
585 	uint8_t tdls_peer_psm_supp:1;
586 	uint8_t tdls_channel_switching:1;
587 	uint8_t interworking_service:1;
588 	uint8_t qos_map:1;
589 	uint8_t ebr:1;
590 	uint8_t sspn_interface:1;
591 	uint8_t reserved4:1;
592 	uint8_t msg_cf_cap:1;
593 	uint8_t tdls_support:1;
594 	uint8_t tdls_prohibited:1;
595 	uint8_t tdls_chan_swit_prohibited:1;
596 	uint8_t reject_unadmitted_traffic:1;
597 	uint8_t service_interval_granularity:3;
598 	uint8_t identifier_loc:1;
599 	uint8_t uapsd_coexistence:1;
600 	uint8_t wnm_notification:1;
601 	uint8_t qa_bcapbility:1;
602 	uint8_t utf8_ssid:1;
603 	uint8_t qmf_activated:1;
604 	uint8_t qm_frecon_act:1;
605 	uint8_t robust_av_streaming:1;
606 	uint8_t advanced_gcr:1;
607 	uint8_t mesh_gcr:1;
608 	uint8_t scs:1;
609 	uint8_t q_load_report:1;
610 	uint8_t alternate_edca:1;
611 	uint8_t unprot_txo_pneg:1;
612 	uint8_t prot_txo_pneg:1;
613 	uint8_t reserved6:1;
614 	uint8_t prot_q_load_report:1;
615 	uint8_t tdls_wider_bw:1;
616 	uint8_t oper_mode_notification:1;
617 	uint8_t max_num_of_msdu_bit1:1;
618 	uint8_t max_num_of_msdu_bit2:1;
619 	uint8_t chan_sch_mgmt:1;
620 	uint8_t geo_db_inband_en_signal:1;
621 	uint8_t nw_chan_control:1;
622 	uint8_t white_space_map:1;
623 	uint8_t chan_avail_query:1;
624 	uint8_t fine_time_meas_responder:1;
625 	uint8_t fine_time_meas_initiator:1;
626 	uint8_t fils_capability:1;
627 	uint8_t ext_spectrum_management:1;
628 	uint8_t future_channel_guidance:1;
629 	uint8_t reserved7:2;
630 	uint8_t twt_requestor_support:1;
631 	uint8_t twt_responder_support:1;
632 	uint8_t reserved8: 1;
633 	uint8_t reserved9: 4;
634 	uint8_t beacon_protection_enable: 1;
635 };
636 
637 void swap_bit_field16(uint16_t in, uint16_t *out);
638 
639 /* Currently implemented as "shims" between callers & the new framesc- */
640 /* generated code: */
641 
642 QDF_STATUS
643 sir_convert_probe_req_frame2_struct(struct mac_context *mac,
644 				uint8_t *frame, uint32_t len,
645 				tpSirProbeReq probe);
646 
647 QDF_STATUS
648 sir_convert_probe_frame2_struct(struct mac_context *mac, uint8_t *frame,
649 				uint32_t len, tpSirProbeRespBeacon probe);
650 
651 enum wlan_status_code
652 sir_convert_assoc_req_frame2_struct(struct mac_context *mac,
653 				    uint8_t *frame, uint32_t len,
654 				    tpSirAssocReq assoc);
655 /**
656  * wlan_parse_ftie_sha384() - Parse the FT IE if akm uses sha384 KDF
657  * @frame: Pointer to the association response frame
658  * @frame_len: Length of the assoc response frame
659  * @assoc_rsp: Destination assoc response structure in PE to which the FTIE
660  * needs to be parsed and copied
661  *
662  * Return: QDF_STATUS
663  */
664 QDF_STATUS
665 wlan_parse_ftie_sha384(uint8_t *frame, uint32_t frame_len,
666 		       struct sSirAssocRsp *assoc_rsp);
667 
668 QDF_STATUS
669 sir_convert_assoc_resp_frame2_struct(struct mac_context *mac,
670 				struct pe_session *session_entry,
671 				uint8_t *frame, uint32_t len,
672 				tpSirAssocRsp assoc);
673 
674 enum wlan_status_code
675 sir_convert_reassoc_req_frame2_struct(struct mac_context *mac,
676 				uint8_t *frame, uint32_t len,
677 				tpSirAssocReq assoc);
678 
679 QDF_STATUS
680 sir_parse_beacon_ie(struct mac_context *mac,
681 		tpSirProbeRespBeacon pBeaconStruct,
682 		uint8_t *pPayload, uint32_t payloadLength);
683 
684 QDF_STATUS
685 sir_convert_beacon_frame2_struct(struct mac_context *mac,
686 				uint8_t *pBeaconFrame,
687 				tpSirProbeRespBeacon pBeaconStruct);
688 
689 QDF_STATUS
690 sir_convert_auth_frame2_struct(struct mac_context *mac,
691 			uint8_t *frame, uint32_t len,
692 			tpSirMacAuthFrameBody auth);
693 
694 QDF_STATUS
695 sir_convert_addts_rsp2_struct(struct mac_context *mac,
696 			uint8_t *frame, uint32_t len,
697 			tSirAddtsRspInfo *addts);
698 
699 QDF_STATUS
700 sir_convert_delts_req2_struct(struct mac_context *mac,
701 			uint8_t *frame, uint32_t len,
702 			struct delts_req_info *delTs);
703 QDF_STATUS
704 sir_convert_qos_map_configure_frame2_struct(struct mac_context *mac,
705 					uint8_t *pFrame, uint32_t nFrame,
706 					struct qos_map_set *pQosMapSet);
707 
708 #ifdef WLAN_FEATURE_11BE_MLO
709 QDF_STATUS
710 sir_convert_mlo_probe_rsp_frame2_struct(uint8_t *ml_ie,
711 					uint32_t ml_ie_total_len,
712 					struct sir_multi_link_ie *mlo_ie_ptr);
713 
714 QDF_STATUS
715 populate_dot11f_mlo_caps(struct mac_context *mac_ctx,
716 			 struct pe_session *session,
717 			 struct wlan_mlo_ie *mlo_ie);
718 #endif
719 
720 #ifdef ANI_SUPPORT_11H
721 QDF_STATUS
722 sir_convert_tpc_req_frame2_struct(struct mac_context *, uint8_t *,
723 				tpSirMacTpcReqActionFrame, uint32_t);
724 
725 QDF_STATUS
726 sir_convert_meas_req_frame2_struct(struct mac_context *, uint8_t *,
727 				tpSirMacMeasReqActionFrame, uint32_t);
728 #endif
729 
730 /**
731  * \brief Populated a tDot11fFfCapabilities
732  *
733  * \param mac Pointer to the global MAC data structure
734  *
735  * \param pDot11f Address of a tDot11fFfCapabilities to be filled in
736  *
737  *
738  * \note If SIR_MAC_PROP_CAPABILITY_11EQOS is enabled, we'll clear the QOS
739  * bit in pDot11f
740  *
741  *
742  */
743 
744 QDF_STATUS
745 populate_dot11f_capabilities(struct mac_context *mac,
746 			tDot11fFfCapabilities *pDot11f,
747 			struct pe_session *pe_session);
748 /**
749  * populate_dot11f_max_chan_switch_time() - populate max chan switch time
750  * @mac: pointer to mac
751  * @pDot11f: pointer to tDot11fIEmax_chan_switch_time
752  * @pe_session: pe session
753  *
754  * Return: Void
755  */
756 void
757 populate_dot11f_max_chan_switch_time(struct mac_context *mac,
758 				     tDot11fIEmax_chan_switch_time *pDot11f,
759 				     struct pe_session *pe_session);
760 
761 /**
762  * populate_dot11f_non_inheritance() - populate non inheritance
763  * @mac_ctx: pointer to mac
764  * @non_inheritance: pointer to tDot11fIEnon_inheritance
765  * @non_inher_ie_lists: non inheritance IE list
766  * @non_inher_ext_ie_lists: non inheritance extend IE list
767  * @non_inher_len: non inheritance IE list length
768  * @non_inher_ext_len: non inheritance Extend IE list length
769  */
770 void populate_dot11f_non_inheritance(
771 			struct mac_context *mac_ctx,
772 			tDot11fIEnon_inheritance *non_inheritance,
773 			uint8_t *non_inher_ie_lists,
774 			uint8_t *non_inher_ext_ie_lists,
775 			uint8_t non_inher_len, uint8_t non_inher_ext_len);
776 
777 /* / Populate a tDot11fIEChanSwitchAnn */
778 void
779 populate_dot11f_chan_switch_ann(struct mac_context *mac,
780 				tDot11fIEChanSwitchAnn *pDot11f,
781 				struct pe_session *pe_session);
782 
783 void
784 populate_dot_11_f_ext_chann_switch_ann(struct mac_context *mac_ptr,
785 				tDot11fIEext_chan_switch_ann *dot_11_ptr,
786 				struct pe_session *session_entry);
787 
788 void
789 populate_dot11f_tx_power_env(struct mac_context *mac,
790 			     tDot11fIEtransmit_power_env *pDot11f,
791 			     enum phy_ch_width ch_width, uint32_t chan_freq,
792 			     uint16_t *num_tpe, bool is_ch_switch);
793 
794 /* / Populate a tDot11fIEChannelSwitchWrapper */
795 void
796 populate_dot11f_chan_switch_wrapper(struct mac_context *mac,
797 				tDot11fIEChannelSwitchWrapper *pDot11f,
798 				struct pe_session *pe_session);
799 
800 /* / Populate a tDot11fIECountry */
801 QDF_STATUS
802 populate_dot11f_country(struct mac_context *mac,
803 			tDot11fIECountry *pDot11f, struct pe_session *pe_session);
804 
805 /* Populated a populate_dot11f_ds_params */
806 QDF_STATUS
807 populate_dot11f_ds_params(struct mac_context *mac,
808 			tDot11fIEDSParams *pDot11f, qdf_freq_t freq);
809 
810 /* / Populated a tDot11fIEEDCAParamSet */
811 void
812 populate_dot11f_edca_param_set(struct mac_context *mac,
813 			tDot11fIEEDCAParamSet *pDot11f,
814 			struct pe_session *pe_session);
815 
816 QDF_STATUS
817 populate_dot11f_erp_info(struct mac_context *mac,
818 			tDot11fIEERPInfo *pDot11f, struct pe_session *pe_session);
819 
820 QDF_STATUS
821 populate_dot11f_ext_supp_rates(struct mac_context *mac,
822 			uint8_t nChannelNum, tDot11fIEExtSuppRates *pDot11f,
823 			struct pe_session *pe_session);
824 
825 /**
826  * populate_dot11f_beacon_report() - Populate the Beacon Report IE
827  * @mac: Pointer to the global MAC context
828  * @pDot11f: Pointer to the measurement report structure
829  * @pBeaconReport: Pointer to the Beacon Report structure
830  * @is_last_frame: is the current report last or more reports to follow
831  *
832  * Return: QDF Status
833  */
834 QDF_STATUS
835 populate_dot11f_beacon_report(struct mac_context *mac,
836 			tDot11fIEMeasurementReport *pDot11f,
837 			tSirMacBeaconReport *pBeaconReport,
838 			bool is_last_frame);
839 
840 /**
841  * populate_dot11f_chan_load_report() - populate the chan load Report IE
842  * @mac: pointer to the global MAC context
843  * @dot11f: pointer to the measurement report structure
844  * @channel_load_report: pointer to the chan load Report structure
845  *
846  * Return: none
847  */
848 void
849 populate_dot11f_chan_load_report(struct mac_context *mac,
850 				 tDot11fIEMeasurementReport *dot11f,
851 				 struct chan_load_report *channel_load_report);
852 
853 /**
854  * populate_dot11f_rrm_sta_stats_report() - Populate RRM STA STATS Report IE
855  * @mac: Pointer to the global MAC context
856  * @pdot11f: Pointer to the measurement report structure
857  * @statistics_report: Pointer to the RRM STA STATS Report structure
858  *
859  * Return: QDF Status
860  */
861 QDF_STATUS
862 populate_dot11f_rrm_sta_stats_report(
863 		struct mac_context *mac, tDot11fIEMeasurementReport *pdot11f,
864 		struct statistics_report *statistics_report);
865 
866 /**
867  * \brief Populate a tDot11fIEExtSuppRates
868  *
869  *
870  * \param mac Pointer to the global MAC data structure
871  *
872  * \param nChannelNum Channel on which the enclosing frame will be going out
873  *
874  * \param pDot11f Address of a tDot11fIEExtSuppRates struct to be filled in.
875  *
876  *
877  * This method is a NOP if the channel is greater than 14.
878  *
879  *
880  */
881 
882 QDF_STATUS
883 populate_dot11f_ext_supp_rates1(struct mac_context *mac,
884 				uint8_t nChannelNum,
885 				tDot11fIEExtSuppRates *pDot11f);
886 
887 QDF_STATUS
888 populate_dot11f_ht_caps(struct mac_context *mac,
889 			struct pe_session *pe_session, tDot11fIEHTCaps *pDot11f);
890 
891 QDF_STATUS
892 populate_dot11f_ht_info(struct mac_context *mac,
893 			tDot11fIEHTInfo *pDot11f, struct pe_session *pe_session);
894 
895 
896 #ifdef ANI_SUPPORT_11H
897 QDF_STATUS
898 populate_dot11f_measurement_report0(struct mac_context *mac,
899 				tpSirMacMeasReqActionFrame pReq,
900 				tDot11fIEMeasurementReport *pDot11f);
901 
902 /* / Populate a tDot11fIEMeasurementReport when the report type is CCA */
903 QDF_STATUS
904 populate_dot11f_measurement_report1(struct mac_context *mac,
905 				tpSirMacMeasReqActionFrame pReq,
906 				tDot11fIEMeasurementReport *pDot11f);
907 
908 /* / Populate a tDot11fIEMeasurementReport when the report type is RPI Hist */
909 QDF_STATUS
910 populate_dot11f_measurement_report2(struct mac_context *mac,
911 				tpSirMacMeasReqActionFrame pReq,
912 				tDot11fIEMeasurementReport *pDot11f);
913 #endif /* ANI_SUPPORT_11H */
914 
915 /* / Populate a tDot11fIEPowerCaps */
916 void
917 populate_dot11f_power_caps(struct mac_context *mac,
918 			tDot11fIEPowerCaps *pCaps,
919 			uint8_t nAssocType, struct pe_session *pe_session);
920 
921 /* / Populate a tDot11fIEPowerConstraints */
922 QDF_STATUS
923 populate_dot11f_power_constraints(struct mac_context *mac,
924 				tDot11fIEPowerConstraints *pDot11f);
925 
926 void
927 populate_dot11f_qos_caps_station(struct mac_context *mac, struct pe_session *session,
928 				tDot11fIEQOSCapsStation *pDot11f);
929 
930 QDF_STATUS
931 populate_dot11f_rsn(struct mac_context *mac,
932 		tpSirRSNie pRsnIe, tDot11fIERSN *pDot11f);
933 
934 QDF_STATUS
935 populate_dot11f_rsn_opaque(struct mac_context *mac,
936 		tpSirRSNie pRsnIe, tDot11fIERSNOpaque *pDot11f);
937 
938 #if defined(FEATURE_WLAN_WAPI)
939 QDF_STATUS
940 populate_dot11f_wapi(struct mac_context *mac,
941 		     tpSirRSNie pRsnIe, tDot11fIEWAPI *pDot11f);
942 
943 QDF_STATUS populate_dot11f_wapi_opaque(struct mac_context *mac,
944 				       tpSirRSNie pRsnIe,
945 				       tDot11fIEWAPIOpaque *pDot11f);
946 #else
947 static inline QDF_STATUS
populate_dot11f_wapi(struct mac_context * mac,tpSirRSNie pRsnIe,tDot11fIEWAPI * pDot11f)948 populate_dot11f_wapi(struct mac_context *mac,
949 		     tpSirRSNie pRsnIe, tDot11fIEWAPI *pDot11f)
950 {
951 	return QDF_STATUS_SUCCESS;
952 }
953 
954 static inline QDF_STATUS
populate_dot11f_wapi_opaque(struct mac_context * mac,tpSirRSNie pRsnIe,tDot11fIEWAPIOpaque * pDot11f)955 populate_dot11f_wapi_opaque(struct mac_context *mac,
956 			    tpSirRSNie pRsnIe,
957 			    tDot11fIEWAPIOpaque *pDot11f)
958 {
959 	return QDF_STATUS_SUCCESS;
960 }
961 #endif /* defined(FEATURE_WLAN_WAPI) */
962 
963 /* / Populate a tDot11fIESSID given a tSirMacSSid */
964 void
965 populate_dot11f_ssid(struct mac_context *mac,
966 		tSirMacSSid *pInternal, tDot11fIESSID *pDot11f);
967 
968 /* / Populate a tDot11fIESSID from CFG */
969 QDF_STATUS populate_dot11f_ssid2(struct pe_session *pe_session,
970 				tDot11fIESSID *pDot11f);
971 
972 /**
973  * \brief Populate a tDot11fIESchedule
974  *
975  * \sa populate_dot11f_wmm_schedule
976  *
977  *
978  * \param pSchedule Address of a tSirMacScheduleIE struct
979  *
980  * \param pDot11f Address of a tDot11fIESchedule to be filled in
981  *
982  *
983  */
984 
985 void
986 populate_dot11f_schedule(tSirMacScheduleIE *pSchedule,
987 			tDot11fIESchedule *pDot11f);
988 
989 void
990 populate_dot11f_supp_channels(struct mac_context *mac,
991 			tDot11fIESuppChannels *pDot11f,
992 			uint8_t nAssocType, struct pe_session *pe_session);
993 
994 /**
995  * \brief Populated a tDot11fIESuppRates
996  *
997  *
998  * \param mac Pointer to the global MAC data structure
999  *
1000  * \param nChannelNum Channel the enclosing frame will be going out on; see
1001  * below
1002  *
1003  * \param pDot11f Address of a tDot11fIESuppRates struct to be filled in.
1004  *
1005  *
1006  * If nChannelNum is greater than 13, the supported rates will be
1007  * WNI_CFG_SUPPORTED_RATES_11B.  If it is less than or equal to 13, the
1008  * supported rates will be WNI_CFG_SUPPORTED_RATES_11A.  If nChannelNum is
1009  * set to the sentinel value POPULATE_DOT11F_RATES_OPERATIONAL, the struct
1010  * will be populated with WNI_CFG_OPERATIONAL_RATE_SET.
1011  *
1012  *
1013  */
1014 
1015 #define POPULATE_DOT11F_RATES_OPERATIONAL (0xff)
1016 
1017 QDF_STATUS
1018 populate_dot11f_supp_rates(struct mac_context *mac,
1019 			uint8_t nChannelNum,
1020 			tDot11fIESuppRates *pDot11f, struct pe_session *);
1021 
1022 QDF_STATUS
1023 populate_dot11f_rates_tdls(struct mac_context *p_mac,
1024 			tDot11fIESuppRates *p_supp_rates,
1025 			tDot11fIEExtSuppRates *p_ext_supp_rates,
1026 			uint8_t curr_oper_channel);
1027 
1028 QDF_STATUS populate_dot11f_tpc_report(struct mac_context *mac,
1029 					tDot11fIETPCReport *pDot11f,
1030 					struct pe_session *pe_session);
1031 
1032 /* / Populate a tDot11FfTSInfo */
1033 void populate_dot11f_ts_info(struct mac_ts_info *pInfo,
1034 			     tDot11fFfTSInfo *pDot11f);
1035 
1036 void populate_dot11f_wmm(struct mac_context *mac,
1037 			tDot11fIEWMMInfoAp *pInfo,
1038 			tDot11fIEWMMParams *pParams,
1039 			tDot11fIEWMMCaps *pCaps, struct pe_session *pe_session);
1040 
1041 void populate_dot11f_wmm_caps(tDot11fIEWMMCaps *pCaps);
1042 
1043 #if defined(FEATURE_WLAN_ESE)
1044 /* Fill the ESE version IE */
1045 void populate_dot11f_ese_version(tDot11fIEESEVersion *pESEVersion);
1046 /* Fill the Radio Management Capability */
1047 void populate_dot11f_ese_rad_mgmt_cap(tDot11fIEESERadMgmtCap *pESERadMgmtCap);
1048 /* Fill the CCKM IE */
1049 QDF_STATUS populate_dot11f_ese_cckm_opaque(struct mac_context *mac,
1050 					struct mlme_connect_info *connect_info,
1051 					tDot11fIEESECckmOpaque *pDot11f);
1052 
1053 void populate_dot11_tsrsie(struct mac_context *mac,
1054 			struct ese_tsrs_ie *pOld,
1055 			tDot11fIEESETrafStrmRateSet *pDot11f,
1056 			uint8_t rate_length);
1057 #ifdef WLAN_FEATURE_HOST_ROAM
1058 void populate_dot11f_re_assoc_tspec(struct mac_context *mac,
1059 				tDot11fReAssocRequest *pReassoc,
1060 				struct pe_session *pe_session);
1061 #endif
1062 QDF_STATUS
1063 sir_beacon_ie_ese_bcn_report(struct mac_context *mac,
1064 		uint8_t *pPayload, const uint32_t payloadLength,
1065 		uint8_t **outIeBuf, uint32_t *pOutIeLen);
1066 
1067 /**
1068  * ese_populate_wmm_tspec() - Populates TSPEC info for
1069  * reassoc
1070  * @source: source structure
1071  * @dest: destination structure
1072  *
1073  * This function copies TSPEC parameters from source
1074  * structure to destination structure.
1075  *
1076  * Return: None
1077  */
1078 void ese_populate_wmm_tspec(struct mac_tspec_ie *source,
1079 			    ese_wmm_tspec_ie *dest);
1080 
1081 #endif
1082 
1083 void populate_dot11f_wmm_info_ap(struct mac_context *mac,
1084 				tDot11fIEWMMInfoAp *pInfo,
1085 				struct pe_session *pe_session);
1086 
1087 void populate_dot11f_wmm_info_station_per_session(struct mac_context *mac,
1088 					struct pe_session *pe_session,
1089 					tDot11fIEWMMInfoStation *pInfo);
1090 
1091 void populate_dot11f_wmm_params(struct mac_context *mac,
1092 				tDot11fIEWMMParams *pParams,
1093 				struct pe_session *pe_session);
1094 
1095 QDF_STATUS
1096 populate_dot11f_wpa(struct mac_context *mac,
1097 		tpSirRSNie pRsnIe, tDot11fIEWPA *pDot11f);
1098 
1099 QDF_STATUS
1100 populate_dot11f_wpa_opaque(struct mac_context *mac,
1101 			tpSirRSNie pRsnIe, tDot11fIEWPAOpaque *pDot11f);
1102 
1103 void populate_dot11f_tspec(struct mac_tspec_ie *pOld, tDot11fIETSPEC *pDot11f);
1104 
1105 void populate_dot11f_wmmtspec(struct mac_tspec_ie *pOld,
1106 			      tDot11fIEWMMTSPEC *pDot11f);
1107 
1108 #ifdef WLAN_FEATURE_MSCS
1109 void
1110 populate_dot11f_mscs_dec_element(struct mscs_req_info *mscs_req,
1111 				 tDot11fmscs_request_action_frame *dot11f);
1112 #endif
1113 
1114 QDF_STATUS
1115 populate_dot11f_tclas(struct mac_context *mac,
1116 		tSirTclasInfo *pOld, tDot11fIETCLAS *pDot11f);
1117 
1118 QDF_STATUS
1119 populate_dot11f_wmmtclas(struct mac_context *mac,
1120 			tSirTclasInfo *pOld, tDot11fIEWMMTCLAS *pDot11f);
1121 
1122 QDF_STATUS populate_dot11f_wsc(struct mac_context *mac,
1123 			tDot11fIEWscBeacon *pDot11f);
1124 
1125 QDF_STATUS populate_dot11f_wsc_registrar_info(struct mac_context *mac,
1126 						tDot11fIEWscBeacon *pDot11f);
1127 
1128 QDF_STATUS de_populate_dot11f_wsc_registrar_info(struct mac_context *mac,
1129 						tDot11fIEWscBeacon *pDot11f);
1130 
1131 QDF_STATUS populate_dot11f_probe_res_wpsi_es(struct mac_context *mac,
1132 						tDot11fIEWscProbeRes *pDot11f,
1133 						struct pe_session *pe_session);
1134 QDF_STATUS populate_dot11f_beacon_wpsi_es(struct mac_context *mac,
1135 					tDot11fIEWscBeacon *pDot11f,
1136 					struct pe_session *pe_session);
1137 
1138 QDF_STATUS populate_dot11f_wsc_in_probe_res(struct mac_context *mac,
1139 					tDot11fIEWscProbeRes *pDot11f);
1140 
1141 QDF_STATUS
1142 populate_dot11f_wsc_registrar_info_in_probe_res(struct mac_context *mac,
1143 					tDot11fIEWscProbeRes *pDot11f);
1144 
1145 QDF_STATUS
1146 de_populate_dot11f_wsc_registrar_info_in_probe_res(struct mac_context *mac,
1147 						tDot11fIEWscProbeRes *pDot11f);
1148 
1149 QDF_STATUS populate_dot11_assoc_res_p2p_ie(struct mac_context *mac,
1150 					tDot11fIEP2PAssocRes *pDot11f,
1151 					tpSirAssocReq pRcvdAssocReq);
1152 
1153 QDF_STATUS populate_dot11f_wfatpc(struct mac_context *mac,
1154 				tDot11fIEWFATPC *pDot11f, uint8_t txPower,
1155 				uint8_t linkMargin);
1156 
1157 QDF_STATUS populate_dot11f_rrm_ie(struct mac_context *mac,
1158 				tDot11fIERRMEnabledCap *pDot11f,
1159 				struct pe_session *pe_session);
1160 
1161 void populate_mdie(struct mac_context *mac, tDot11fIEMobilityDomain *pDot11f,
1162 		   uint8_t mdie[]);
1163 
1164 #ifdef WLAN_FEATURE_FILS_SK
1165 /**
1166  * populate_fils_ft_info() - Populate FTIE into assoc request frame
1167  * @mac: Global mac context
1168  * @ft_info: pointer to assoc request frame FT IE buffer
1169  * @pe_session: pointer to PE session
1170  *
1171  * Return: None
1172  */
1173 void populate_fils_ft_info(struct mac_context *mac, tDot11fIEFTInfo *ft_info,
1174 			   struct pe_session *pe_session);
1175 #else
1176 static inline
populate_fils_ft_info(struct mac_context * mac,tDot11fIEFTInfo * ft_info,struct pe_session * pe_session)1177 void populate_fils_ft_info(struct mac_context *mac, tDot11fIEFTInfo *ft_info,
1178 			   struct pe_session *pe_session)
1179 {}
1180 #endif
1181 
1182 void populate_dot11f_assoc_rsp_rates(struct mac_context *mac,
1183 				tDot11fIESuppRates *pSupp,
1184 				tDot11fIEExtSuppRates *pExt,
1185 				uint16_t *_11bRates, uint16_t *_11aRates);
1186 
1187 int find_ie_location(struct mac_context *mac, tpSirRSNie pRsnIe, uint8_t EID);
1188 
1189 /**
1190  * wlan_get_cb_mode() - Get channel bonding mode from beacon
1191  * @mac: Global mac context
1192  * @ch_freq: channel frequency
1193  * @ie_struct: beacon ie struct
1194  * @pe_session: pointer to PE session
1195  *
1196  * Return: ePhyChanBondState
1197  */
1198 ePhyChanBondState wlan_get_cb_mode(struct mac_context *mac,
1199 				   qdf_freq_t ch_freq,
1200 				   tDot11fBeaconIEs *ie_struct,
1201 				   struct pe_session *pe_session);
1202 
1203 void lim_log_vht_cap(struct mac_context *mac, tDot11fIEVHTCaps *pDot11f);
1204 
1205 QDF_STATUS
1206 populate_dot11f_vht_caps(struct mac_context *mac, struct pe_session *pe_session,
1207 			tDot11fIEVHTCaps *pDot11f);
1208 
1209 QDF_STATUS
1210 populate_dot11f_vht_operation(struct mac_context *mac,
1211 			struct pe_session *pe_session,
1212 			tDot11fIEVHTOperation *pDot11f);
1213 
1214 QDF_STATUS
1215 populate_dot11f_ext_cap(struct mac_context *mac, bool isVHTEnabled,
1216 			tDot11fIEExtCap *pDot11f, struct pe_session *pe_session);
1217 
1218 void populate_dot11f_qcn_ie(struct mac_context *mac,
1219 			    struct pe_session *pe_session,
1220 			    tDot11fIEqcn_ie *qcn_ie,
1221 			    uint8_t attr_id);
1222 
1223 void populate_dot11f_bss_max_idle(struct mac_context *mac,
1224 				  struct pe_session *session,
1225 				  tDot11fIEbss_max_idle_period *max_idle_ie);
1226 
1227 #ifdef WLAN_FEATURE_FILS_SK
1228 /**
1229  * populate_dot11f_fils_params() - Populate FILS IE to frame
1230  * @mac_ctx: global mac context
1231  * @frm: Assoc request frame
1232  * @pe_session: PE session
1233  *
1234  * This API is used to populate FILS IE to Association request
1235  *
1236  * Return: None
1237  */
1238 void populate_dot11f_fils_params(struct mac_context *mac_ctx,
1239 				 tDot11fAssocRequest * frm,
1240 				 struct pe_session *pe_session);
1241 #else
populate_dot11f_fils_params(struct mac_context * mac_ctx,tDot11fAssocRequest * frm,struct pe_session * pe_session)1242 static inline void populate_dot11f_fils_params(struct mac_context *mac_ctx,
1243 				 tDot11fAssocRequest *frm,
1244 				 struct pe_session *pe_session)
1245 { }
1246 #endif
1247 
1248 QDF_STATUS
1249 populate_dot11f_operating_mode(struct mac_context *mac,
1250 			tDot11fIEOperatingMode *pDot11f,
1251 			struct pe_session *pe_session);
1252 
1253 void populate_dot11f_timeout_interval(struct mac_context *mac,
1254 				tDot11fIETimeoutInterval *pDot11f,
1255 				uint8_t type, uint32_t value);
1256 
1257 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
1258 /* Populate a tDot11fIEQComVendorIE */
1259 void
1260 populate_dot11f_avoid_channel_ie(struct mac_context *mac_ctx,
1261 				tDot11fIEQComVendorIE *dot11f,
1262 				struct pe_session *session_entry);
1263 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
1264 
1265 QDF_STATUS populate_dot11f_timing_advert_frame(struct mac_context *mac,
1266 	tDot11fTimingAdvertisementFrame *frame);
1267 void populate_dot11_supp_operating_classes(struct mac_context *mac_ptr,
1268 	tDot11fIESuppOperatingClasses *dot_11_ptr, struct pe_session *session_entry);
1269 
1270 QDF_STATUS
1271 sir_validate_and_rectify_ies(struct mac_context *mac_ctx,
1272 				uint8_t *mgmt_frame,
1273 				uint32_t frame_bytes,
1274 				uint32_t *missing_rsn_bytes);
1275 /**
1276  * sir_copy_caps_info() - Copy Caps info from tDot11fFfCapabilities to
1277  *                        beacon/probe response structure.
1278  * @mac_ctx: MAC Context
1279  * @caps: tDot11fFfCapabilities structure
1280  * @pProbeResp: beacon/probe response structure
1281  *
1282  * Copy the caps info to beacon/probe response structure
1283  *
1284  * Return: None
1285  */
1286 void sir_copy_caps_info(struct mac_context *mac_ctx, tDot11fFfCapabilities caps,
1287 			tpSirProbeRespBeacon pProbeResp);
1288 
1289 #ifdef WLAN_FEATURE_FILS_SK
1290 /**
1291  * update_fils_data: update fils params from beacon/probe response
1292  * @fils_ind: pointer to sir_fils_indication
1293  * @fils_indication: pointer to tDot11fIEfils_indication
1294  *
1295  * Return: None
1296  */
1297 void update_fils_data(struct sir_fils_indication *fils_ind,
1298 				 tDot11fIEfils_indication * fils_indication);
1299 #endif
1300 #ifdef WLAN_FEATURE_11AX
1301 /**
1302  * populate_dot11f_he_caps() - populate he capabilities IE
1303  *                             in beacon/probe response structure
1304  * @mac_context: pointer to mac context
1305  * @pe_session: pointer to pe session
1306  * @he_cap: he capability IE
1307  *
1308  * Return: QDF_STATUS
1309  */
1310 QDF_STATUS populate_dot11f_he_caps(struct mac_context *, struct pe_session *,
1311 				   tDot11fIEhe_cap *);
1312 
1313 /**
1314  * populate_dot11f_he_caps_by_band() - pouldate HE Capability IE by band
1315  * @mac_ctx: Global MAC context
1316  * @is_2g: is 2G band
1317  * @eht_cap: pointer to HE capability IE
1318  * @session: pointer to pe session
1319  *
1320  * Populate the HE capability IE based on band.
1321  */
1322 QDF_STATUS
1323 populate_dot11f_he_caps_by_band(struct mac_context *mac_ctx,
1324 				bool is_2g,
1325 				tDot11fIEhe_cap *he_cap,
1326 				struct pe_session *session);
1327 
1328 /**
1329  * populate_dot11f_he_operation() - populate he operation IE
1330  *                                  in beacon/probe response structure
1331  * @mac_context: pointer to mac context
1332  * @pe_session: pointer to pe session
1333  * @he_op: he operation IE
1334  *
1335  * Return: QDF_STATUS
1336  */
1337 QDF_STATUS populate_dot11f_he_operation(struct mac_context *, struct pe_session *,
1338 					tDot11fIEhe_op *);
1339 
1340 /**
1341  * populate_dot11f_sr_info() - populate tDot11fIEspatial_reuse to
1342  *                             beacon/probe response structure.
1343  * @mac_context: pointer to mac context
1344  * @pe_session: pointer to pe session
1345  * @sr_info: spatial reuse IE
1346  *
1347  * Return: QDF_STATUS
1348  */
1349 QDF_STATUS populate_dot11f_sr_info(struct mac_context *mac_ctx,
1350 				   struct pe_session *session,
1351 				   tDot11fIEspatial_reuse *sr_info);
1352 
1353 /**
1354  * populate_dot11f_he_6ghz_cap() - populdate HE 6GHz caps IE
1355  * @mac_ctx: Global MAC context
1356  * @session: PE session
1357  * @he_6g_cap: pointer to HE 6GHz IE
1358  *
1359  * Populdate the HE 6GHz IE based on the session.
1360  */
1361 QDF_STATUS
1362 populate_dot11f_he_6ghz_cap(struct mac_context *mac_ctx,
1363 			    struct pe_session *session,
1364 			    tDot11fIEhe_6ghz_band_cap *he_6g_cap);
1365 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
1366 QDF_STATUS populate_dot11f_he_bss_color_change(struct mac_context *mac_ctx,
1367 				struct pe_session *session,
1368 				tDot11fIEbss_color_change *bss_color);
1369 #else
populate_dot11f_he_bss_color_change(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEbss_color_change * bss_color)1370 static inline QDF_STATUS populate_dot11f_he_bss_color_change(
1371 				struct mac_context *mac_ctx,
1372 				struct pe_session *session,
1373 				tDot11fIEbss_color_change *bss_color)
1374 {
1375 	return QDF_STATUS_SUCCESS;
1376 }
1377 #endif
1378 #else
populate_dot11f_he_caps(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEhe_cap * he_cap)1379 static inline QDF_STATUS populate_dot11f_he_caps(struct mac_context *mac_ctx,
1380 			struct pe_session *session, tDot11fIEhe_cap *he_cap)
1381 {
1382 	return QDF_STATUS_SUCCESS;
1383 }
1384 
1385 static inline QDF_STATUS
populate_dot11f_he_caps_by_band(struct mac_context * mac_ctx,bool is_2g,tDot11fIEhe_cap * he_cap)1386 populate_dot11f_he_caps_by_band(struct mac_context *mac_ctx,
1387 				bool is_2g,
1388 				tDot11fIEhe_cap *he_cap)
1389 {
1390 	return QDF_STATUS_SUCCESS;
1391 }
1392 
populate_dot11f_he_operation(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEhe_op * he_op)1393 static inline QDF_STATUS populate_dot11f_he_operation(struct mac_context *mac_ctx,
1394 			struct pe_session *session, tDot11fIEhe_op *he_op)
1395 {
1396 	return QDF_STATUS_SUCCESS;
1397 }
1398 
1399 static inline QDF_STATUS
populate_dot11f_he_6ghz_cap(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEhe_6ghz_band_cap * he_6g_cap)1400 populate_dot11f_he_6ghz_cap(struct mac_context *mac_ctx,
1401 			    struct pe_session *session,
1402 			    tDot11fIEhe_6ghz_band_cap *he_6g_cap)
1403 {
1404 	return QDF_STATUS_SUCCESS;
1405 }
1406 
populate_dot11f_he_bss_color_change(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEbss_color_change * bss_color)1407 static inline QDF_STATUS populate_dot11f_he_bss_color_change(
1408 				struct mac_context *mac_ctx,
1409 				struct pe_session *session,
1410 				tDot11fIEbss_color_change *bss_color)
1411 {
1412 	return QDF_STATUS_SUCCESS;
1413 }
1414 
populate_dot11f_sr_info(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEspatial_reuse * sr_info)1415 static inline QDF_STATUS populate_dot11f_sr_info(
1416 					struct mac_context *mac_ctx,
1417 					struct pe_session *session,
1418 					tDot11fIEspatial_reuse *sr_info)
1419 {
1420 	return QDF_STATUS_SUCCESS;
1421 }
1422 #endif
1423 
1424 #if defined(WLAN_FEATURE_11AX) && defined(WLAN_SUPPORT_TWT)
1425 /**
1426  * populate_dot11f_twt_extended_caps() - populate TWT extended capabilities
1427  * @mac_ctx: Global MAC context.
1428  * @pe_session: Pointer to the PE session.
1429  * @dot11f: Pointer to the extended capabilities of the session.
1430  *
1431  * Populate the TWT extended capabilities based on the target and INI support.
1432  *
1433  * Return: QDF_STATUS Success or Failure
1434  */
1435 QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx,
1436 					     struct pe_session *pe_session,
1437 					     tDot11fIEExtCap *dot11f);
1438 #else
1439 static inline
populate_dot11f_twt_extended_caps(struct mac_context * mac_ctx,struct pe_session * pe_session,tDot11fIEExtCap * dot11f)1440 QDF_STATUS populate_dot11f_twt_extended_caps(struct mac_context *mac_ctx,
1441 					     struct pe_session *pe_session,
1442 					     tDot11fIEExtCap *dot11f)
1443 {
1444 	return QDF_STATUS_SUCCESS;
1445 }
1446 #endif
1447 
1448 #ifdef WLAN_FEATURE_11BE_MLO
1449 /**
1450  * populate_dot11f_assoc_rsp_mlo_ie() - populate mlo ie for assoc response
1451  * @mac_ctx: Global MAC context
1452  * @session: PE session
1453  * @sta: Pointer to tpDphHashNode
1454  * @frm: Assoc response frame
1455  *
1456  * Return: QDF_STATUS_SUCCESS of no error
1457  */
1458 QDF_STATUS populate_dot11f_assoc_rsp_mlo_ie(struct mac_context *mac_ctx,
1459 					    struct pe_session *session,
1460 					    tpDphHashNode sta,
1461 					    tDot11fAssocResponse *frm);
1462 
1463 /**
1464  * populate_dot11f_bcn_mlo_ie() - populate mlo ie for beacon
1465  * @mac_ctx: Global MAC context
1466  * @session: PE session
1467  *
1468  * Return: QDF_STATUS_SUCCESS of no error
1469  */
1470 QDF_STATUS populate_dot11f_bcn_mlo_ie(struct mac_context *mac_ctx,
1471 				      struct pe_session *session);
1472 
1473 /**
1474  * populate_dot11f_probe_req_mlo_ie() - populate mlo ie for probe req
1475  * @mac_ctx: Global MAC context
1476  * @session: PE session
1477  *
1478  * Return: QDF_STATUS_SUCCESS of no error
1479  */
1480 QDF_STATUS populate_dot11f_probe_req_mlo_ie(struct mac_context *mac_ctx,
1481 					    struct pe_session *session);
1482 
1483 /**
1484  * populate_dot11f_tdls_mgmt_mlo_ie() - populate mlo ie for tdls mgmt frame
1485  * @mac_ctx: Global MAC context
1486  * @session: PE session
1487  *
1488  * Return: QDF_STATUS_SUCCESS of no error
1489  */
1490 QDF_STATUS populate_dot11f_tdls_mgmt_mlo_ie(struct mac_context *mac_ctx,
1491 					    struct pe_session *session);
1492 
1493 /**
1494  * populate_dot11f_mlo_rnr() - populate rnr for mlo
1495  * @mac_ctx: Global MAC context
1496  * @session: PE session
1497  * @dot11f: tDot11fIEreduced_neighbor_report to be filled
1498  *
1499  * Return: void
1500  */
1501 void populate_dot11f_mlo_rnr(struct mac_context *mac_ctx,
1502 			     struct pe_session *pe_session,
1503 			     tDot11fIEreduced_neighbor_report *dot11f);
1504 
1505 /**
1506  * populate_dot11f_rnr_tbtt_info_16() - populate rnr with tbtt_info length 16
1507  * @mac_ctx: pointer to mac_context
1508  * @pe_session: pe session
1509  * @rnr_session: session to populate in rnr ie
1510  * @dot11f: tDot11fIEreduced_neighbor_report to be filled
1511  *
1512  * Return: void
1513  */
1514 void populate_dot11f_rnr_tbtt_info_16(struct mac_context *mac_ctx,
1515 				      struct pe_session *pe_session,
1516 				      struct pe_session *rnr_session,
1517 				      tDot11fIEreduced_neighbor_report *dot11f);
1518 
1519 #else
populate_dot11f_mlo_rnr(struct mac_context * mac_ctx,struct pe_session * pe_session,tDot11fIEreduced_neighbor_report * dot11f)1520 static inline void populate_dot11f_mlo_rnr(
1521 				struct mac_context *mac_ctx,
1522 				struct pe_session *pe_session,
1523 				tDot11fIEreduced_neighbor_report *dot11f)
1524 {
1525 }
1526 
populate_dot11f_rnr_tbtt_info_16(struct mac_context * mac_ctx,struct pe_session * pe_session,struct pe_session * rnr_session,tDot11fIEreduced_neighbor_report * dot11f)1527 static inline void populate_dot11f_rnr_tbtt_info_16(
1528 			struct mac_context *mac_ctx,
1529 			struct pe_session *pe_session,
1530 			struct pe_session *rnr_session,
1531 			tDot11fIEreduced_neighbor_report *dot11f)
1532 {
1533 }
1534 #endif /* WLAN_FEATURE_11BE_MLO */
1535 
1536 #ifdef WLAN_FEATURE_11BE
1537 /**
1538  * populate_dot11f_eht_caps() - pouldate EHT Capability IE
1539  * @mac_ctx: Global MAC context
1540  * @session: PE session
1541  * @eht_cap: pointer to EHT capability IE
1542  *
1543  * Populate the EHT capability IE based on the session.
1544  */
1545 QDF_STATUS populate_dot11f_eht_caps(struct mac_context *mac_ctx,
1546 				    struct pe_session *session,
1547 				    tDot11fIEeht_cap *eht_cap);
1548 
1549 /**
1550  * populate_dot11f_eht_caps_by_band() - pouldate EHT Capability IE by band
1551  * @mac_ctx: Global MAC context
1552  * @is_2g: is 2G band
1553  * @eht_cap: pointer to EHT capability IE
1554  * @session: pe session
1555  *
1556  * Populate the EHT capability IE based on band.
1557  */
1558 QDF_STATUS
1559 populate_dot11f_eht_caps_by_band(struct mac_context *mac_ctx,
1560 				 bool is_2g, tDot11fIEeht_cap *eht_cap,
1561 				 struct pe_session *session);
1562 
1563 /**
1564  * populate_dot11f_eht_operation() - pouldate EHT Operation IE
1565  * @mac_ctx: Global MAC context
1566  * @session: PE session
1567  * @eht_op: pointer to EHT Operation IE
1568  *
1569  * Populdate the EHT Operation IE based on the session.
1570  */
1571 QDF_STATUS populate_dot11f_eht_operation(struct mac_context *mac_ctx,
1572 					 struct pe_session *session,
1573 					 tDot11fIEeht_op *eht_op);
1574 
1575 /**
1576  * populate_dot11f_bw_ind_element() - pouldate bandwidth ind element
1577  * @mac_ctx: Global MAC context
1578  * @session: PE session
1579  * @bw_ind: pointer to bw ind element IE
1580  *
1581  * QDF_STATUS
1582  */
1583 QDF_STATUS populate_dot11f_bw_ind_element(struct mac_context *mac_ctx,
1584 					  struct pe_session *session,
1585 					  tDot11fIEbw_ind_element *bw_ind);
1586 
1587 /**
1588  * lim_ieee80211_pack_ehtcap() - Pack EHT capabilities IE
1589  * @ie: output pointer for eht capabilities IE
1590  * @dot11f_eht_cap: dot11f EHT capabilities IE structure
1591  * @dot11f_he_cap: dot11f HE capabilities IE structure
1592  * @is_band_2g: Flag to indicate whether operating band is 2g or not
1593  *
1594  * This API is used to encode EHT capabilities IE which is of variable in
1595  * length depending on the HE capabilities IE content.
1596  *
1597  * Return: Void
1598  */
1599 void lim_ieee80211_pack_ehtcap(uint8_t *ie, tDot11fIEeht_cap dot11f_eht_cap,
1600 			       tDot11fIEhe_cap dot11f_he_cap, bool is_band_2g);
1601 
1602 /**
1603  * lim_strip_and_decode_eht_cap() - API to decode EHT capabilities IE
1604  * @ie: source ie address
1605  * @ie_len: source ie length
1606  * @dot11f_eht_cap: output pointer to dot11f EHT capabilities IE structure
1607  * @dot11f_he_cap: dot11f HE capabilities IE structure
1608  * @freq: frequency
1609  *
1610  * This API is used to strip and decode EHT caps IE which is of variable in
1611  * length depending on the HE capabilities IE content.
1612  *
1613  * Return: QDF_STATUS
1614  */
1615 QDF_STATUS lim_strip_and_decode_eht_cap(uint8_t *ie, uint16_t ie_len,
1616 					tDot11fIEeht_cap *dot11f_eht_cap,
1617 					tDot11fIEhe_cap dot11f_he_cap,
1618 					uint16_t freq);
1619 
1620 /**
1621  * lim_ieee80211_pack_ehtop() - Pack EHT Operations IE
1622  * @ie: output pointer for eht operations IE
1623  * @dot11f_eht_cap: dot11f EHT operations IE structure
1624  * @dot11f_vht_op: dot11f VHT operation IE structure
1625  * @dot11f_he_op: dot11f HE operation IE structure
1626  * @dot11f_ht_info: dot11f HT info IE structure
1627  *
1628  * This API is used to encode EHT operations IE which is of variable in
1629  * length depending on the HE capabilities IE content.
1630  *
1631  * Return: Void
1632  */
1633 void lim_ieee80211_pack_ehtop(uint8_t *ie, tDot11fIEeht_op dot11f_eht_op,
1634 			      tDot11fIEVHTOperation dot11f_vht_op,
1635 			      tDot11fIEhe_op dot11f_he_op,
1636 			      tDot11fIEHTInfo dot11f_ht_info);
1637 
1638 /**
1639  * lim_strip_and_decode_eht_op() - API to decode EHT Operations IE
1640  * @ie: source ie address
1641  * @ie_len: source ie length
1642  * @dot11f_eht_op: output pointer to dot11f EHT Operations IE structure
1643  * @dot11f_vht_op: dot11f VHT operation IE structure
1644  * @dot11f_he_op: dot11f HE operation IE structure
1645  * @dot11f_ht_info: dot11f HT info IE structure
1646  *
1647  * This API is used to strip and decode EHT operations IE which is of variable
1648  * in length depending on the HE capabilities IE content.
1649  *
1650  * Return: QDF_STATUS
1651  */
1652 QDF_STATUS lim_strip_and_decode_eht_op(uint8_t *ie, uint16_t ie_len,
1653 				       tDot11fIEeht_op *dot11f_eht_op,
1654 				       tDot11fIEVHTOperation dot11f_vht_op,
1655 				       tDot11fIEhe_op dot11f_he_op,
1656 				       tDot11fIEHTInfo dot11f_ht_info);
1657 
1658 #else
1659 static inline QDF_STATUS
populate_dot11f_eht_caps(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEeht_cap * eht_cap)1660 populate_dot11f_eht_caps(struct mac_context *mac_ctx,
1661 			 struct pe_session *session, tDot11fIEeht_cap *eht_cap)
1662 {
1663 	return QDF_STATUS_SUCCESS;
1664 }
1665 
1666 static inline QDF_STATUS
populate_dot11f_eht_caps_by_band(struct mac_context * mac_ctx,bool is_2g,tDot11fIEeht_cap * eht_cap,struct pe_session * session)1667 populate_dot11f_eht_caps_by_band(struct mac_context *mac_ctx,
1668 				 bool is_2g,
1669 				 tDot11fIEeht_cap *eht_cap,
1670 				 struct pe_session *session)
1671 {
1672 	return QDF_STATUS_SUCCESS;
1673 }
1674 
1675 static inline QDF_STATUS
populate_dot11f_eht_operation(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEeht_op * eht_op)1676 populate_dot11f_eht_operation(struct mac_context *mac_ctx,
1677 			      struct pe_session *session,
1678 			      tDot11fIEeht_op *eht_op)
1679 {
1680 	return QDF_STATUS_SUCCESS;
1681 }
1682 
1683 static inline
populate_dot11f_bw_ind_element(struct mac_context * mac_ctx,struct pe_session * session,tDot11fIEbw_ind_element * bw_ind)1684 QDF_STATUS populate_dot11f_bw_ind_element(struct mac_context *mac_ctx,
1685 					  struct pe_session *session,
1686 					  tDot11fIEbw_ind_element *bw_ind)
1687 {
1688 	return QDF_STATUS_SUCCESS;
1689 }
1690 
lim_ieee80211_pack_ehtcap(uint8_t * ie,tDot11fIEeht_cap dot11f_eht_cap,tDot11fIEhe_cap dot11f_he_cap,bool is_band_2g)1691 static inline void lim_ieee80211_pack_ehtcap(uint8_t *ie,
1692 					     tDot11fIEeht_cap dot11f_eht_cap,
1693 					     tDot11fIEhe_cap dot11f_he_cap,
1694 					     bool is_band_2g)
1695 {
1696 }
1697 
1698 static inline
lim_strip_and_decode_eht_cap(uint8_t * ie,uint16_t ie_len,tDot11fIEeht_cap * dot11f_eht_cap,tDot11fIEhe_cap dot11f_he_cap,uint16_t freq)1699 QDF_STATUS lim_strip_and_decode_eht_cap(uint8_t *ie, uint16_t ie_len,
1700 					tDot11fIEeht_cap *dot11f_eht_cap,
1701 					tDot11fIEhe_cap dot11f_he_cap,
1702 					uint16_t freq)
1703 {
1704 	return QDF_STATUS_SUCCESS;
1705 }
1706 
lim_ieee80211_pack_ehtop(uint8_t * ie,tDot11fIEeht_op dot11f_eht_op,tDot11fIEVHTOperation dot11f_vht_op,tDot11fIEhe_op dot11f_he_op,tDot11fIEHTInfo dot11f_ht_info)1707 static inline void lim_ieee80211_pack_ehtop(uint8_t *ie,
1708 					    tDot11fIEeht_op dot11f_eht_op,
1709 					    tDot11fIEVHTOperation dot11f_vht_op,
1710 					    tDot11fIEhe_op dot11f_he_op,
1711 					    tDot11fIEHTInfo dot11f_ht_info)
1712 {
1713 }
1714 
1715 static inline
lim_strip_and_decode_eht_op(uint8_t * ie,uint16_t ie_len,tDot11fIEeht_op * dot11f_eht_op,tDot11fIEVHTOperation dot11f_vht_op,tDot11fIEhe_op dot11f_he_op,tDot11fIEHTInfo dot11f_ht_info)1716 QDF_STATUS lim_strip_and_decode_eht_op(uint8_t *ie, uint16_t ie_len,
1717 				       tDot11fIEeht_op *dot11f_eht_op,
1718 				       tDot11fIEVHTOperation dot11f_vht_op,
1719 				       tDot11fIEhe_op dot11f_he_op,
1720 				       tDot11fIEHTInfo dot11f_ht_info)
1721 {
1722 	return QDF_STATUS_SUCCESS;
1723 }
1724 #endif
1725 
1726 #ifdef WLAN_FEATURE_11BE_MLO
1727 /**
1728  * populate_dot11f_auth_mlo_ie() - populate MLO IE in Auth frame
1729  * @mac_ctx: Global MAC context
1730  * @pe_session: PE session
1731  * @mlo_ie: pointer to MLO IE struct
1732  *
1733  * Return: Success if MLO IE is populated in Auth frame, else Failure
1734  *
1735  * Populate the MLO IE in Auth frame based on the session.
1736  */
1737 QDF_STATUS populate_dot11f_auth_mlo_ie(struct mac_context *mac_ctx,
1738 				       struct pe_session *pe_session,
1739 				       struct wlan_mlo_ie *mlo_ie);
1740 
1741 /**
1742  * populate_dot11f_assoc_req_mlo_ie() - populate MLO Operation IE in assoc req
1743  * @mac_ctx: Global MAC context
1744  * @session: PE session
1745  * @frm: Pointer to Assoc Req IE
1746  *
1747  * Populate the mlo IE in assoc req based on the session.
1748  */
1749 QDF_STATUS
1750 populate_dot11f_assoc_req_mlo_ie(struct mac_context *mac_ctx,
1751 				 struct pe_session *session,
1752 				 tDot11fAssocRequest *frm);
1753 
1754 /**
1755  * populate_dot11f_mlo_ie() - populate MLO Operation IE
1756  * @mac_ctx: Global MAC context
1757  * @vdev: Pointer to vdev
1758  * @mlo_ie: Pointer to MLO Operation IE
1759  *
1760  * Populate mlo IE for vdev by self capability.
1761  */
1762 QDF_STATUS populate_dot11f_mlo_ie(struct mac_context *mac_ctx,
1763 				  struct wlan_objmgr_vdev *vdev,
1764 				  struct wlan_mlo_ie *mlo_ie);
1765 #endif
1766 
1767 /**
1768  * populate_dot11f_btm_extended_caps() - populate btm extended capabilities
1769  * @mac_ctx: Global MAC context.
1770  * @pe_session: Pointer to the PE session.
1771  * @dot11f: Pointer to the extended capabilities of the session.
1772  *
1773  * Disable btm for SAE types for Helium firmware limit
1774  *
1775  * Return: QDF_STATUS Success or Failure
1776  */
1777 QDF_STATUS populate_dot11f_btm_extended_caps(struct mac_context *mac_ctx,
1778 					     struct pe_session *pe_session,
1779 					     struct sDot11fIEExtCap *dot11f);
1780 
1781 /**
1782  * lim_truncate_ppet: truncates ppet of trailing zeros
1783  * @ppet: ppet to truncate
1784  * max_len: max length of ppet
1785  *
1786  * Return: new length after truncation
1787  */
lim_truncate_ppet(uint8_t * ppet,uint32_t max_len)1788 static inline uint32_t lim_truncate_ppet(uint8_t *ppet, uint32_t max_len)
1789 {
1790 	while (max_len) {
1791 		if (ppet[max_len - 1])
1792 			break;
1793 		max_len--;
1794 	}
1795 	return max_len;
1796 }
1797 
1798 QDF_STATUS wlan_parse_bss_description_ies(struct mac_context *mac_ctx,
1799 					  struct bss_description *bss_desc,
1800 					  tDot11fBeaconIEs *ie_struct);
1801 
1802 QDF_STATUS
1803 wlan_get_parsed_bss_description_ies(struct mac_context *mac_ctx,
1804 				    struct bss_description *bss_desc,
1805 				    tDot11fBeaconIEs **ie_struct);
1806 
1807 void wlan_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates,
1808 			       bool is_basic_rates);
1809 
1810 uint32_t wlan_get_11h_power_constraint(struct mac_context *mac_ctx,
1811 				       tDot11fIEPowerConstraints *constraints);
1812 
1813 QDF_STATUS
1814 wlan_fill_bss_desc_from_scan_entry(struct mac_context *mac_ctx,
1815 				   struct bss_description *bss_desc,
1816 				   struct scan_cache_entry *scan_entry);
1817 
1818 /**
1819  * wlan_get_ielen_from_bss_description() - to get IE length
1820  * from struct bss_description structure
1821  * @pBssDescr: pBssDescr
1822  *
1823  * This function is called in various places to get IE length
1824  * from struct bss_description structure
1825  *
1826  * @Return: total IE length
1827  */
1828 uint16_t
1829 wlan_get_ielen_from_bss_description(struct bss_description *bss_desc);
1830 
1831 bool wlan_rates_is_dot11_rate_supported(struct mac_context *mac_ctx,
1832 					uint8_t rate);
1833 
1834 bool wlan_check_rate_bitmap(uint8_t rate, uint16_t rate_bitmap);
1835 
1836 QDF_STATUS wlan_get_rate_set(struct mac_context *mac,
1837 			     tDot11fBeaconIEs *ie_struct,
1838 			     struct pe_session *pe_session);
1839 
1840 void wlan_add_rate_bitmap(uint8_t rate, uint16_t *rate_bitmap);
1841 
1842 /**
1843  * dot11f_parse_assoc_response() - API to parse Assoc IE buffer to struct
1844  * @mac_ctx: MAC context
1845  * @p_buf: Pointer to the assoc IE buffer
1846  * @n_buf: length of the @p_buf
1847  * @p_frm: Struct to populate the IE buffer after parsing
1848  * @append_ie: Boolean to indicate whether to reset @p_frm or not. If @append_ie
1849  *             is true, @p_frm struct is not reset to zeros.
1850  *
1851  * Return: QDF_STATUS
1852  */
1853 QDF_STATUS dot11f_parse_assoc_response(struct mac_context *mac_ctx,
1854 				       uint8_t *p_buf, uint32_t n_buf,
1855 				       tDot11fAssocResponse *p_frm,
1856 				       bool append_ie);
1857 
1858 #ifdef WLAN_FEATURE_11BE_MLO
1859 /**
1860  * dot11f_parse_assoc_rsp_mlo_partner_info() - get mlo partner info in assoc rsp
1861  * @pe_session: pointer to PE session
1862  * @pframe: pointer of assoc response buffer
1863  * @nframe: length of assoc response buffer
1864  *
1865  * Return: none
1866  */
1867 void dot11f_parse_assoc_rsp_mlo_partner_info(struct pe_session *pe_session,
1868 					     uint8_t *pframe, uint32_t nframe);
1869 #else
1870 static inline void
dot11f_parse_assoc_rsp_mlo_partner_info(struct pe_session * pe_session,uint8_t * pframe,uint32_t nframe)1871 dot11f_parse_assoc_rsp_mlo_partner_info(struct pe_session *pe_session,
1872 					uint8_t *pframe, uint32_t nframe)
1873 {
1874 }
1875 #endif
1876 
1877 /**
1878  * populate_dot11f_6g_rnr() - populate rnr with 6g bss information
1879  * @mac_ctx: MAC context
1880  * @session: reporting session
1881  * @dot11f: pointer to tDot11fIEreduced_neighbor_report to fill
1882  *
1883  * Return: none
1884  */
1885 void populate_dot11f_6g_rnr(struct mac_context *mac_ctx,
1886 			    struct pe_session *session,
1887 			    tDot11fIEreduced_neighbor_report *dot11f);
1888 
1889 /**
1890  * populate_dot11f_rnr_tbtt_info() - populate rnr for the tbtt_len specified
1891  * @mac_ctx: pointer to mac_context
1892  * @pe_session: pe session
1893  * @rnr_session: session to populate in rnr ie
1894  * @dot11f: tDot11fIEreduced_neighbor_report to be filled
1895  * @tbtt_len: length of the TBTT params
1896  *
1897  * Return: QDF STATUS
1898  */
1899 QDF_STATUS
1900 populate_dot11f_rnr_tbtt_info(struct mac_context *mac_ctx,
1901 			      struct pe_session *pe_session,
1902 			      struct pe_session *rnr_session,
1903 			      tDot11fIEreduced_neighbor_report *dot11f,
1904 			      uint8_t tbtt_len);
1905 
1906 /**
1907  * populate_dot11f_edca_pifs_param_set() - populate edca/pifs param ie
1908  * @mac: Mac context
1909  * @qcn_ie: pointer to tDot11fIEqcn_ie
1910  *
1911  * Return: none
1912  */
1913 void populate_dot11f_edca_pifs_param_set(
1914 				struct mac_context *mac,
1915 				tDot11fIEqcn_ie *qcn_ie);
1916 
1917 /**
1918  * populate_dot11f_bcn_prot_caps() - populate Beacon protection extended caps
1919  *
1920  * @mac_ctx: Global MAC context.
1921  * @pe_session: Pointer to the PE session.
1922  * @dot11f: Pointer to the extended capabilities of the session.
1923  *
1924  * Populate the Beacon protection extended capabilities based on the target and
1925  * INI support.
1926  *
1927  * Return: QDF_STATUS Success or Failure
1928  */
1929 QDF_STATUS populate_dot11f_bcn_prot_extcaps(struct mac_context *mac_ctx,
1930 					    struct pe_session *pe_session,
1931 					    tDot11fIEExtCap *dot11f);
1932 #endif /* __PARSE_H__ */
1933