xref: /wlan-dirver/qcacld-3.0/core/mac/src/pe/include/lim_session.h (revision d1eb296939c4184ce7e8a921bf6ffe874f574400)
1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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 #if !defined(__LIM_SESSION_H)
21 #define __LIM_SESSION_H
22 
23 #include "wlan_cm_public_struct.h"
24 /**=========================================================================
25 
26    \file  lim_session.h
27 
28    \brief prototype for lim Session related APIs
29 
30    \author Sunit Bhatia
31 
32    ========================================================================*/
33 
34 /* Master Structure: This will be part of PE Session Entry */
35 typedef struct sPowersaveoffloadInfo {
36 	uint8_t bcnmiss;
37 } tPowersaveoffloadInfo, tpPowersaveoffloadInfo;
38 
39 struct comeback_timer_info {
40 	struct mac_context *mac;
41 	uint8_t vdev_id;
42 	uint8_t retried;
43 	tLimMlmStates lim_prev_mlm_state;  /* Previous MLM State */
44 	tLimMlmStates lim_mlm_state;       /* MLM State */
45 };
46 /*--------------------------------------------------------------------------
47    Include Files
48    ------------------------------------------------------------------------*/
49 
50 /*--------------------------------------------------------------------------
51    Preprocessor definitions and constants
52    ------------------------------------------------------------------------*/
53 /* Maximum Number of WEP KEYS */
54 #define MAX_WEP_KEYS 4
55 
56 #define SCH_PROTECTION_RESET_TIME 4000
57 
58 /*--------------------------------------------------------------------------
59    Type declarations
60    ------------------------------------------------------------------------*/
61 typedef struct {
62 	tSirMacBeaconInterval beaconInterval;
63 	uint8_t fShortPreamble;
64 	uint8_t llaCoexist;
65 	uint8_t llbCoexist;
66 	uint8_t llgCoexist;
67 	uint8_t ht20Coexist;
68 	uint8_t llnNonGFCoexist;
69 	uint8_t fRIFSMode;
70 	uint8_t fLsigTXOPProtectionFullSupport;
71 	uint8_t gHTObssMode;
72 } tBeaconParams, *tpBeaconParams;
73 
74 typedef struct join_params {
75 	uint16_t prot_status_code;
76 	uint16_t pe_session_id;
77 	tSirResultCodes result_code;
78 } join_params;
79 
80 struct reassoc_params {
81 	uint16_t prot_status_code;
82 	tSirResultCodes result_code;
83 	struct pe_session *session;
84 };
85 
86 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
87 #define MAX_BSS_COLOR_VALUE 63
88 #define TIME_BEACON_NOT_UPDATED 30000
89 #define BSS_COLOR_SWITCH_COUNTDOWN 5
90 #define OBSS_COLOR_COLLISION_DETECTION_STA_PERIOD_MS 120000
91 #define OBSS_COLOR_COLLISION_DETECTION_AP_PERIOD_MS 120000
92 #define OBSS_COLOR_COLLISION_SCAN_PERIOD_MS 200
93 #define OBSS_COLOR_COLLISION_FREE_SLOT_EXPIRY_MS 50000
94 struct bss_color_info {
95 	qdf_time_t timestamp;
96 	uint64_t seen_count;
97 };
98 #endif
99 
100 /**
101  * struct obss_detection_cfg - current obss detection cfg set to firmware
102  * @obss_11b_ap_detect_mode: detection mode for 11b access point.
103  * @obss_11b_sta_detect_mode: detection mode for 11b station.
104  * @obss_11g_ap_detect_mode: detection mode for 11g access point.
105  * @obss_11a_detect_mode: detection mode for 11a access point.
106  * @obss_ht_legacy_detect_mode: detection mode for ht ap with legacy mode.
107  * @obss_ht_mixed_detect_mode: detection mode for ht ap with mixed mode.
108  * @obss_ht_20mhz_detect_mode: detection mode for ht ap with 20mhz mode.
109  */
110 struct obss_detection_cfg {
111 	uint8_t obss_11b_ap_detect_mode;
112 	uint8_t obss_11b_sta_detect_mode;
113 	uint8_t obss_11g_ap_detect_mode;
114 	uint8_t obss_11a_detect_mode;
115 	uint8_t obss_ht_legacy_detect_mode;
116 	uint8_t obss_ht_mixed_detect_mode;
117 	uint8_t obss_ht_20mhz_detect_mode;
118 };
119 
120 #define ADAPTIVE_11R_STA_IE_LEN   0x0B
121 #define ADAPTIVE_11R_STA_OUI      "\x00\x00\x0f\x22"
122 #define ADAPTIVE_11R_OUI_LEN      0x04
123 #define ADAPTIVE_11R_OUI_SUBTYPE  0x00
124 #define ADAPTIVE_11R_OUI_VERSION  0x01
125 #define ADAPTIVE_11R_DATA_LEN      0x04
126 #define ADAPTIVE_11R_OUI_DATA     "\x00\x00\x00\x01"
127 
128 #ifdef WLAN_FEATURE_11BE_MLO
129 #define WLAN_STA_PROFILE_MAX_LEN 514
130 #define WLAN_MLO_IE_COM_MAX_LEN 257
131 
132 /**
133  * wlan_mlo_sta_profile - Per STA profile structure
134  * @num_data: the length of data
135  * @data: the Per STA profile subelement data. Subelement ID + LEN + others,
136  * if num_data more than 257, it includes the frag IE for tx; it does not
137  * include the frag IE since it has been skipped when store the IE.
138  */
139 struct wlan_mlo_sta_profile {
140 	uint16_t num_data;
141 	uint8_t data[WLAN_STA_PROFILE_MAX_LEN];
142 };
143 
144 /**
145  * medium_sync_delay - medium sync delay info
146  * @medium_sync_duration: medium sync duration
147  * @medium_sync_ofdm_ed_thresh: medium sync OFDM ED threshold
148  * @medium_sync_max_txop_num: medium sync max txop num
149  */
150 struct medium_sync_delay {
151 	uint16_t medium_sync_duration:8;
152 	uint16_t medium_sync_ofdm_ed_thresh:4;
153 	uint16_t medium_sync_max_txop_num:4;
154 };
155 
156 /**
157  * eml_capabilities - EML capability info
158  * @emlsr_support: EMLSR support
159  * @emlsr_padding_delay: EMLSR padding delay
160  * @emlsr_transition_delay: EMLSR transition delay
161  * @emlmr_support: EMLSR support
162  * @emlmr_delay: EMLSR delay
163  * @transition_timeout: transition timeout
164  * @reserved: reserve
165  */
166 struct eml_capabilities {
167 	uint16_t emlsr_support:1;
168 	uint16_t emlsr_padding_delay:3;
169 	uint16_t emlsr_transition_delay:3;
170 	uint16_t emlmr_support:1;
171 	uint16_t emlmr_delay:3;
172 	uint16_t transition_timeout:4;
173 	uint16_t reserved:1;
174 };
175 
176 /**
177  * mld_capab_and_op - MLD capability and operations info
178  * @max_simultaneous_link_num: MAX simultaneous link num
179  * @srs_support: SRS support
180  * @tid_link_map_supported: TID link map support
181  * @str_freq_separation: STR freq separation
182  * @aar_support: AAR support
183  * @reserved: reserve
184  */
185 struct mld_capab_and_op {
186 	uint16_t max_simultaneous_link_num:4;
187 	uint16_t srs_support:1;
188 	uint16_t tid_link_map_supported:2;
189 	uint16_t str_freq_separation:5;
190 	uint16_t aar_support:1;
191 	uint16_t reserved:3;
192 };
193 
194 /**
195  * wlan_mlo_ie - wlan ML IE info
196  * @type: the variant of the ML IE
197  * @reserved: reserved
198  * @link_id_info_present: the present flag of link id info
199  * @bss_param_change_cnt_present: the present flag of bss prarm change cnt
200  * @medium_sync_delay_info_present: the present flag of medium sync delay info
201  * @eml_capab_present: the present flag of EML capability
202  * @mld_capab_and_op_present: the present flag of MLD capability and operation
203  * @mld_id_present: the present flag of MLD ID
204  * @reserved_1: reserved
205  * @common_info_length: common info length
206  * @mld_mac_addr: MLD mac address
207  * @link_id: link id
208  * @bss_param_change_count: bss param change count
209  * @medium_sync_delay_info: structure of medium_sync_delay
210  * @eml_capabilities_info: structure of eml_capabilities
211  * @mld_capab_and_op_info: structure of mld_capabilities and operations
212  * @mld_id_info: MLD ID
213  * @num_sta_profile: the number of sta profile
214  * @sta_profile: structure of wlan_mlo_sta_profile
215  * @num_data: the length of data
216  * @data: the ML IE data, includes element ID + length + extension element ID +
217  * multi-link control and common info.
218  */
219 struct wlan_mlo_ie {
220 	uint16_t type:3;
221 	uint16_t reserved:1;
222 	uint16_t link_id_info_present:1;
223 	uint16_t bss_param_change_cnt_present:1;
224 	uint16_t medium_sync_delay_info_present:1;
225 	uint16_t eml_capab_present:1;
226 	uint16_t mld_capab_and_op_present: 1;
227 	uint16_t mld_id_present: 1;
228 	uint16_t reserved_1:6;
229 	uint8_t common_info_length;
230 	uint8_t mld_mac_addr[6];
231 	uint8_t link_id;
232 	uint8_t bss_param_change_count;
233 	struct medium_sync_delay medium_sync_delay_info;
234 	struct eml_capabilities eml_capabilities_info;
235 	struct mld_capab_and_op mld_capab_and_op_info;
236 	uint8_t mld_id_info;
237 	uint16_t num_sta_profile;
238 	struct wlan_mlo_sta_profile sta_profile[WLAN_MLO_MAX_VDEVS];
239 	uint16_t num_data;
240 	uint8_t data[WLAN_MLO_IE_COM_MAX_LEN];
241 };
242 
243 /**
244  * struct mlo_link_ie - IE per link to populate mlo ie
245  * @link_ds: DS IE
246  * @link_edca: ecsa IE
247  * @link_wmm_params: wmm params IE
248  * @link_wmm_caps: wmm caps IE
249  * @link_csa: csa IE
250  * @link_ecsa:ecsa IE
251  * @link_swt_time: switch time IE
252  * @link_quiet: quiet IE
253  * @link_ht_cap: ht cap IE
254  * @link_ht_info: ht info IE
255  * @link_cap: link caps IE
256  * @link_ext_cap: link extend cap IE
257  * @link_vht_cap: vht cap IE
258  * @link_vht_op: vht op IE
259  * @link_qcn_ie: qcn IE
260  * @link_he_cap: he cap IE
261  * @link_he_op: he op IE
262  * @link_he_6ghz_band_cap: 6G band cap IE
263  * @link_eht_cap: eht cap IE
264  * @link_eht_op: eht op IE
265  * @max_chan_swt_time: MLOTD
266  * @bss_param_change_cnt: bss param change count
267  */
268 struct mlo_link_ie {
269 	tDot11fIEDSParams                    link_ds;
270 	tDot11fIEEDCAParamSet                link_edca;
271 	tDot11fIEWMMParams                   link_wmm_params;
272 	tDot11fIEWMMCaps                     link_wmm_caps;
273 	tDot11fIEChanSwitchAnn               link_csa;
274 	tDot11fIEext_chan_switch_ann         link_ecsa;
275 	tDot11fIEmax_chan_switch_time        link_swt_time;
276 	tDot11fIEQuiet                       link_quiet;
277 	tDot11fIEHTCaps                      link_ht_cap;
278 	tDot11fIEHTInfo                      link_ht_info;
279 	tDot11fFfCapabilities                link_cap;
280 	tDot11fIEExtCap                      link_ext_cap;
281 	tDot11fIEVHTCaps                     link_vht_cap;
282 	tDot11fIEVHTOperation                link_vht_op;
283 	tDot11fIEqcn_ie                      link_qcn_ie;
284 	tDot11fIEhe_cap                      link_he_cap;
285 	tDot11fIEhe_op                       link_he_op;
286 	tDot11fIEhe_6ghz_band_cap            link_he_6ghz_band_cap;
287 	tDot11fIEeht_cap                     link_eht_cap;
288 	tDot11fIEeht_op                      link_eht_op;
289 	uint32_t                             max_chan_swt_time;
290 	uint8_t                              bss_param_change_cnt;
291 };
292 
293 /**
294  * struct mlo_link_ie_info - information per link to populate mlo ie
295  * @upt_bcn_mlo_ie: notify partner links to update their mlo ie of bcn temp
296  * @bss_param_change: bss param changed
297  * @bcn_tmpl_exist: bcn template is generated or not
298  * @link_ie: IEs which will be used for generating partner mlo IE
299  */
300 struct mlo_link_ie_info {
301 	bool upt_bcn_mlo_ie;
302 	bool bss_param_change;
303 	bool bcn_tmpl_exist;
304 	struct mlo_link_ie link_ie;
305 };
306 
307 /**
308  * struct wlan_mlo_ie_info - struct for mlo IE information
309  * @mld_mac_addr: MLD MAC address
310  * @common_info_length: Common Info Length
311  * @reserved_1: reserved bits
312  * @mld_id_present: MLD ID present
313  * @mld_capab_and_op_present: MLD capability and operations present
314  * @eml_capab_present: EML capability present
315  * @medium_sync_delay_info_present: Medium sync delay information present
316  * @bss_param_change_cnt_present: BSS parameter change count present
317  * @link_id_info_present: Link ID information present
318  * @reserved: reserved bit
319  * @type: Type bits
320  */
321 struct wlan_mlo_ie_info {
322 #ifndef ANI_LITTLE_BIT_ENDIAN
323 	uint8_t mld_mac_addr[6];
324 	uint8_t common_info_length;
325 	uint16_t reserved_1:6;
326 	uint16_t mld_id_present:1;
327 	uint16_t mld_capab_and_op_present:1;
328 	uint16_t eml_capab_present:1;
329 	uint16_t medium_sync_delay_info_present:1;
330 	uint16_t bss_param_change_cnt_present:1;
331 	uint16_t link_id_info_present:1;
332 	uint16_t reserved:1;
333 	uint16_t type:3;
334 #else
335 	uint16_t type:3;
336 	uint16_t reserved:1;
337 	uint16_t link_id_info_present:1;
338 	uint16_t bss_param_change_cnt_present:1;
339 	uint16_t medium_sync_delay_info_present:1;
340 	uint16_t eml_capab_present:1;
341 	uint16_t mld_capab_and_op_present:1;
342 	uint16_t mld_id_present:1;
343 	uint16_t reserved_1:6;
344 	uint8_t common_info_length;
345 	uint8_t mld_mac_addr[6];
346 #endif
347 } qdf_packed;
348 
349 #endif
350 
351 /**
352  * struct pe_session - per-vdev PE context
353  * @available: true if the entry is available, false if it is in use
354  * @peSessionId: unique ID assigned to the entry
355  * @vdev_id: ID of the vdev for which this entry is applicable
356  * @vdev: the actual vdev for which this entry is applicable
357  * @connected_akm: AKM of current connection
358  * @is_adaptive_11R_connection: flag to check if we are connecting
359  * @ap_ecsa_wakelock: wakelock to complete CSA operation.
360  * @ap_ecsa_runtime_lock: runtime lock to complete SAP CSA operation.
361  * to Adaptive 11R network
362  * @prev_auth_seq_num: Sequence number of previously received auth frame to
363  * detect duplicate frames.
364  * @prev_auth_mac_addr: mac_addr of the sta correspond to @prev_auth_seq_num
365  */
366 struct pe_session {
367 	/* To check session table is in use or free */
368 	uint8_t available;
369 	wlan_cm_id cm_id;
370 	uint16_t peSessionId;
371 	union {
372 		uint8_t smeSessionId;
373 		uint8_t vdev_id;
374 	};
375 	struct wlan_objmgr_vdev *vdev;
376 
377 	/* In AP role: BSSID and self_mac_addr will be the same. */
378 	/* In STA role: they will be different */
379 	tSirMacAddr bssId;
380 	tSirMacAddr self_mac_addr;
381 	tSirMacSSid ssId;
382 	uint8_t valid;
383 	tLimMlmStates limMlmState;      /* MLM State */
384 	tLimMlmStates limPrevMlmState;  /* Previous MLM State */
385 	tLimSmeStates limSmeState;      /* SME State */
386 	tLimSmeStates limPrevSmeState;  /* Previous SME State */
387 	tLimSystemRole limSystemRole;
388 	enum bss_type bssType;
389 	tSirNwType nwType;
390 	struct start_bss_config *pLimStartBssReq;
391 	struct join_req *lim_join_req;    /* handle to sme join req */
392 	struct join_req *pLimReAssocReq; /* handle to sme reassoc req */
393 	tpLimMlmJoinReq pLimMlmJoinReq; /* handle to MLM join Req */
394 	void *pLimMlmReassocRetryReq;   /* keep reasoc req for retry */
395 	void *pLimMlmReassocReq;        /* handle to MLM reassoc Req */
396 	uint16_t channelChangeReasonCode;
397 	uint8_t dot11mode;
398 	uint8_t htCapability;
399 	enum ani_akm_type connected_akm;
400 
401 	/* Supported Channel Width Set: 0-20MHz 1 - 40MHz */
402 	uint8_t htSupportedChannelWidthSet;
403 	/* Recommended Tx Width Set
404 	 * 0 - use 20 MHz channel (control channel)
405 	 * 1 - use channel width enabled under Supported Channel Width Set
406 	 */
407 	uint8_t htRecommendedTxWidthSet;
408 	/* Identifies the 40 MHz extension channel */
409 	ePhyChanBondState htSecondaryChannelOffset;
410 	enum reg_wifi_band limRFBand;
411 
412 	/* These global variables moved to session Table to support BT-AMP : Oct 9th review */
413 	tAniAuthType limCurrentAuthType;
414 	uint16_t limCurrentBssCaps;
415 	uint8_t limCurrentBssQosCaps;
416 	uint8_t limSentCapsChangeNtf;
417 	uint16_t limAID;
418 
419 	/* Parameters  For Reassociation */
420 	tSirMacAddr limReAssocbssId;
421 	uint32_t lim_reassoc_chan_freq;
422 	/* CB parameters required/duplicated for Reassoc since re-assoc maintains its own params in lim */
423 	uint8_t reAssocHtSupportedChannelWidthSet;
424 	uint8_t reAssocHtRecommendedTxWidthSet;
425 	ePhyChanBondState reAssocHtSecondaryChannelOffset;
426 	tSirMacSSid limReassocSSID;
427 	uint16_t limReassocBssCaps;
428 	uint8_t limReassocBssQosCaps;
429 
430 	/* Assoc or ReAssoc Response Data/Frame */
431 	void *limAssocResponseData;
432 
433 	/** BSS Table parameters **/
434 
435 	uint16_t statypeForBss; /* to know session is for PEER or SELF */
436 	uint8_t shortSlotTimeSupported;
437 	uint8_t dtimPeriod;
438 	tSirMacRateSet rateSet;
439 	tSirMacRateSet extRateSet;
440 	tSirMacHTOperatingMode htOperMode;
441 	qdf_freq_t curr_op_freq;
442 	uint32_t curr_req_chan_freq;
443 	uint8_t LimRxedBeaconCntDuringHB;
444 
445 	/* Time stamp of the last beacon received from the BSS to which STA is connected. */
446 	uint64_t lastBeaconTimeStamp;
447 	/* RX Beacon count for the current BSS to which STA is connected. */
448 	uint32_t currentBssBeaconCnt;
449 	uint8_t bcon_dtim_period;
450 
451 	uint32_t bcnLen;
452 	uint8_t *beacon;        /* Used to store last beacon / probe response before assoc. */
453 
454 	uint32_t assocReqLen;
455 	uint8_t *assoc_req;      /* Used to store association request frame */
456 
457 	uint32_t assocRspLen;
458 	uint8_t *assocRsp;      /* Used to store association response received while associating */
459 	tAniSirDph dph;
460 	void **parsedAssocReq;  /* Used to store parsed assoc req from various requesting station */
461 	uint32_t RICDataLen;    /* Used to store the Ric data received in the assoc response */
462 	uint8_t *ricData;
463 #ifdef FEATURE_WLAN_ESE
464 	uint32_t tspecLen;      /* Used to store the TSPEC IEs received in the assoc response */
465 	uint8_t *tspecIes;
466 #endif
467 	uint32_t encryptType;
468 
469 	uint8_t gLimProtectionControl;  /* used for 11n protection */
470 
471 	uint8_t gHTNonGFDevicesPresent;
472 
473 	/* protection related config cache */
474 	tCfgProtection cfgProtection;
475 
476 	/* Number of legacy STAs associated */
477 	tLimProtStaParams gLim11bParams;
478 
479 	/* Number of 11A STAs associated */
480 	tLimProtStaParams gLim11aParams;
481 
482 	/* Number of non-ht non-legacy STAs associated */
483 	tLimProtStaParams gLim11gParams;
484 
485 	/* Number of nonGf STA associated */
486 	tLimProtStaParams gLimNonGfParams;
487 
488 	/* Number of HT 20 STAs associated */
489 	tLimProtStaParams gLimHt20Params;
490 
491 	/* Number of Lsig Txop not supported STAs associated */
492 	tLimProtStaParams gLimLsigTxopParams;
493 
494 	/* Number of STAs that do not support short preamble */
495 	tLimNoShortParams gLimNoShortParams;
496 
497 	/* Number of STAs that do not support short slot time */
498 	tLimNoShortSlotParams gLimNoShortSlotParams;
499 
500 	/* OLBC parameters */
501 	tLimProtStaParams gLimOlbcParams;
502 
503 	/* OLBC parameters */
504 	tLimProtStaParams gLimOverlap11gParams;
505 
506 	tLimProtStaParams gLimOverlap11aParams;
507 	tLimProtStaParams gLimOverlapHt20Params;
508 	tLimProtStaParams gLimOverlapNonGfParams;
509 
510 	/* cache for each overlap */
511 	tCacheParams protStaCache[LIM_PROT_STA_CACHE_SIZE];
512 
513 	uint8_t privacy;
514 	tAniAuthType authType;
515 	tSirKeyMaterial WEPKeyMaterial[MAX_WEP_KEYS];
516 
517 	tDot11fIEWMMParams wmm_params;
518 	tDot11fIERSN gStartBssRSNIe;
519 	tDot11fIEWPA gStartBssWPAIe;
520 	tSirAPWPSIEs APWPSIEs;
521 	uint8_t apUapsdEnable;
522 	tSirWPSPBCSession *pAPWPSPBCSession;
523 	uint32_t DefProbeRspIeBitmap[8];
524 	uint32_t proxyProbeRspEn;
525 	tDot11fProbeResponse probeRespFrame;
526 	uint8_t ssidHidden;
527 	bool fwdWPSPBCProbeReq;
528 	uint8_t wps_state;
529 	bool wps_registration;
530 
531 	uint8_t limQosEnabled:1;        /* 11E */
532 	uint8_t limWmeEnabled:1;        /* WME */
533 	uint8_t limWsmEnabled:1;        /* WSM */
534 	uint8_t limHcfEnabled:1;
535 	uint8_t limRmfEnabled:1;        /* 11W */
536 	uint32_t lim11hEnable;
537 
538 	int8_t maxTxPower;   /* MIN (Regulatory and local power constraint) */
539 	int8_t min_11h_pwr;
540 	int8_t max_11h_pwr;
541 	enum QDF_OPMODE opmode;
542 	int8_t txMgmtPower;
543 	bool is11Rconnection;
544 	bool is_adaptive_11r_connection;
545 
546 #ifdef FEATURE_WLAN_ESE
547 	bool isESEconnection;
548 	tEsePEContext eseContext;
549 #endif
550 	bool isFastTransitionEnabled;
551 	bool isFastRoamIniFeatureEnabled;
552 	tSirP2PNoaAttr p2pGoPsUpdate;
553 	uint32_t defaultAuthFailureTimeout;
554 
555 	/* EDCA QoS parameters
556 	 * gLimEdcaParams - These EDCA parameters are used locally on AP or STA.
557 	 * If STA, then these are values taken from the Assoc Rsp when associating,
558 	 * or Beacons/Probe Response after association.  If AP, then these are
559 	 * values originally set locally on AP.
560 	 *
561 	 * gLimEdcaParamsBC - These EDCA parameters are use by AP to broadcast
562 	 * to other STATIONs in the BSS.
563 	 *
564 	 * gLimEdcaParamsActive: These EDCA parameters are what's actively being
565 	 * used on station. Specific AC values may be downgraded depending on
566 	 * admission control for that particular AC.
567 	 */
568 	tSirMacEdcaParamRecord gLimEdcaParams[QCA_WLAN_AC_ALL];      /* used locally */
569 	tSirMacEdcaParamRecord gLimEdcaParamsBC[QCA_WLAN_AC_ALL];    /* used for broadcast */
570 	tSirMacEdcaParamRecord gLimEdcaParamsActive[QCA_WLAN_AC_ALL];
571 
572 	uint8_t gLimEdcaParamSetCount;
573 
574 	tBeaconParams beaconParams;
575 	uint8_t vhtCapability;
576 	tLimOperatingModeInfo gLimOperatingMode;
577 	uint8_t vhtCapabilityPresentInBeacon;
578 	/* center freq number as advertized OTA */
579 	uint8_t ch_center_freq_seg0;
580 	enum phy_ch_width ch_width;
581 	uint8_t ch_center_freq_seg1;
582 	uint8_t enableVhtpAid;
583 	uint8_t enableVhtGid;
584 	tLimWiderBWChannelSwitchInfo gLimWiderBWChannelSwitch;
585 	uint8_t enableAmpduPs;
586 	uint8_t enableHtSmps;
587 	uint8_t htSmpsvalue;
588 	bool send_smps_action;
589 	uint8_t spectrumMgtEnabled;
590 	/* *********************11H related**************************** */
591 	tLimSpecMgmtInfo gLimSpecMgmt;
592 	/* CB Primary/Secondary Channel Switch Info */
593 	tLimChannelSwitchInfo gLimChannelSwitch;
594 	/* *********************End 11H related**************************** */
595 
596 	uint32_t gLimPhyMode;
597 	uint8_t txLdpcIniFeatureEnabled;
598 	/**
599 	 * Following is the place holder for free peer index pool.
600 	 * A non-zero value indicates that peer index is available
601 	 * for assignment.
602 	 */
603 	uint8_t *gpLimPeerIdxpool;
604 	uint8_t freePeerIdxHead;
605 	uint8_t freePeerIdxTail;
606 	uint16_t gLimNumOfCurrentSTAs;
607 #ifdef FEATURE_WLAN_TDLS
608 	 /* TDLS parameters to check whether TDLS
609 	  * and TDLS channel switch is allowed in the
610 	  * AP network
611 	  */
612 	uint32_t peerAIDBitmap[2];
613 	bool tdls_send_set_state_disable;
614 #endif
615 	bool fWaitForProbeRsp;
616 	bool fIgnoreCapsChange;
617 	bool fDeauthReceived;
618 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
619 	int8_t rssi;
620 #endif
621 	uint8_t max_amsdu_num;
622 	struct mlme_ht_capabilities_info ht_config;
623 	struct wlan_vht_config vht_config;
624 	/*
625 	 * Place holder for StartBssReq message
626 	 * received by SME state machine
627 	 */
628 	uint8_t gLimCurrentBssUapsd;
629 
630 	/* Used on STA, this is a static UAPSD mask setting
631 	 * derived from SME_JOIN_REQ and SME_REASSOC_REQ. If a
632 	 * particular AC bit is set, it means the AC is both
633 	 * trigger enabled and delivery enabled.
634 	 */
635 	uint8_t gUapsdPerAcBitmask;
636 
637 	/* Used on STA, this is a dynamic UPASD mask setting
638 	 * derived from AddTS Rsp and DelTS frame. If a
639 	 * particular AC bit is set, it means AC is trigger
640 	 * enabled.
641 	 */
642 	uint8_t gUapsdPerAcTriggerEnableMask;
643 
644 	/* Used on STA, dynamic UPASD mask setting
645 	 * derived from AddTS Rsp and DelTs frame. If
646 	 * a particular AC bit is set, it means AC is
647 	 * delivery enabled.
648 	 */
649 	uint8_t gUapsdPerAcDeliveryEnableMask;
650 
651 	/* Flag to skip CSA IE processing when CSA
652 	 * offload is enabled.
653 	 */
654 	uint8_t csaOffloadEnable;
655 
656 	/* Used on STA for AC downgrade. This is a dynamic mask
657 	 * setting which keep tracks of ACs being admitted.
658 	 * If bit is set to 0: That partiular AC is not admitted
659 	 * If bit is set to 1: That particular AC is admitted
660 	 */
661 	uint8_t gAcAdmitMask[SIR_MAC_DIRECTION_DIRECT];
662 
663 	/* Power Save Off load Parameters */
664 	tPowersaveoffloadInfo pmmOffloadInfo;
665 	/* SMPS mode */
666 	uint8_t smpsMode;
667 
668 	uint8_t chainMask;
669 
670 	/* Flag to indicate Chan Sw announcement is required */
671 	uint8_t dfsIncludeChanSwIe;
672 
673 	/* Flag to indicate Chan Wrapper Element is required */
674 	uint8_t dfsIncludeChanWrapperIe;
675 
676 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
677 	uint8_t cc_switch_mode;
678 #endif
679 
680 	bool isCiscoVendorAP;
681 
682 	struct add_ie_params add_ie_params;
683 
684 	uint8_t *pSchProbeRspTemplate;
685 	/* Beginning portion of the beacon frame to be written to TFP */
686 	uint8_t *pSchBeaconFrameBegin;
687 	/* Trailing portion of the beacon frame to be written to TFP */
688 	uint8_t *pSchBeaconFrameEnd;
689 	/* Size of the beginning portion */
690 	uint16_t schBeaconOffsetBegin;
691 	/* Size of the trailing portion */
692 	uint16_t schBeaconOffsetEnd;
693 	bool isOSENConnection;
694 	/*  DSCP to UP mapping for HS 2.0 */
695 	struct qos_map_set QosMapSet;
696 
697 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
698 	bool bRoamSynchInProgress;
699 #endif
700 
701 	/* Fast Transition (FT) */
702 	tftPEContext ftPEContext;
703 	bool isNonRoamReassoc;
704 	qdf_mc_timer_t pmf_retry_timer;
705 	struct comeback_timer_info pmf_retry_timer_info;
706 	/* timer for resetting protection fields at regular intervals */
707 	qdf_mc_timer_t protection_fields_reset_timer;
708 	/* timer to decrement CSA/ECSA count */
709 	qdf_mc_timer_t ap_ecsa_timer;
710 	qdf_wake_lock_t ap_ecsa_wakelock;
711 	qdf_runtime_lock_t ap_ecsa_runtime_lock;
712 	struct mac_context *mac_ctx;
713 	/*
714 	 * variable to store state of various protection struct like
715 	 * gLimOlbcParams, gLimOverlap11gParams, gLimOverlapHt20Params etc
716 	 */
717 	uint16_t old_protection_state;
718 	tSirMacAddr prev_ap_bssid;
719 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
720 	/* tells if Q2Q IE, from another MDM device in AP MCC mode was recvd */
721 	bool sap_advertise_avoid_ch_ie;
722 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
723 #ifdef FEATURE_WLAN_ESE
724 	uint8_t is_ese_version_ie_present;
725 #endif
726 	bool sap_dot11mc;
727 	bool is_vendor_specific_vhtcaps;
728 	uint8_t vendor_specific_vht_ie_sub_type;
729 	bool vendor_vht_sap;
730 	/* HS 2.0 Indication */
731 	tDot11fIEhs20vendor_ie hs20vendor_ie;
732 	/* flag to indicate country code in beacon */
733 	uint8_t country_info_present;
734 	uint8_t nss;
735 	bool nss_forced_1x1;
736 	bool add_bss_failed;
737 	/* To hold OBSS Scan IE Parameters */
738 	struct obss_scanparam obss_ht40_scanparam;
739 	uint8_t vdev_nss;
740 	/* Supported NSS is intersection of self and peer NSS */
741 	bool supported_nss_1x1;
742 	bool is_ext_caps_present;
743 	uint16_t beacon_tx_rate;
744 	uint8_t *access_policy_vendor_ie;
745 	uint8_t access_policy;
746 	bool send_p2p_conf_frame;
747 	bool process_ho_fail;
748 	/* Number of STAs that do not support ECSA capability */
749 	uint8_t lim_non_ecsa_cap_num;
750 #ifdef WLAN_FEATURE_11AX
751 	bool he_capable;
752 	tDot11fIEhe_cap he_config;
753 	tDot11fIEhe_op he_op;
754 	uint32_t he_sta_obsspd;
755 	bool he_6ghz_band;
756 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
757 	tDot11fIEbss_color_change he_bss_color_change;
758 	struct bss_color_info bss_color_info[MAX_BSS_COLOR_VALUE];
759 	uint8_t bss_color_changing;
760 #endif
761 #endif
762 
763 	struct deauth_retry_params deauth_retry;
764 	bool enable_bcast_probe_rsp;
765 	uint8_t ht_client_cnt;
766 	bool force_24ghz_in_ht20;
767 	bool ch_switch_in_progress;
768 	bool he_with_wep_tkip;
769 #ifdef WLAN_FEATURE_FILS_SK
770 	struct pe_fils_session *fils_info;
771 #endif
772 	/* previous auth frame's sequence number */
773 	uint16_t prev_auth_seq_num;
774 	tSirMacAddr prev_auth_mac_addr;
775 	struct obss_detection_cfg obss_offload_cfg;
776 	struct obss_detection_cfg current_obss_detection;
777 	bool is_session_obss_offload_enabled;
778 	bool is_obss_reset_timer_initialized;
779 	bool sae_pmk_cached;
780 	bool recvd_deauth_while_roaming;
781 	bool recvd_disassoc_while_roaming;
782 	uint16_t deauth_disassoc_rc;
783 	enum wmi_obss_color_collision_evt_type obss_color_collision_dec_evt;
784 	bool is_session_obss_color_collision_det_enabled;
785 	tSirMacEdcaParamRecord ap_mu_edca_params[QCA_WLAN_AC_ALL];
786 	bool mu_edca_present;
787 	int8_t def_max_tx_pwr;
788 	bool active_ba_64_session;
789 	bool is_mbssid_enabled;
790 #ifdef WLAN_SUPPORT_TWT
791 	uint8_t peer_twt_requestor;
792 	uint8_t peer_twt_responder;
793 #endif
794 	bool enable_session_twt_support;
795 	uint32_t cac_duration_ms;
796 	tSirResultCodes stop_bss_reason;
797 	uint16_t prot_status_code;
798 	tSirResultCodes result_code;
799 	uint32_t dfs_regdomain;
800 	/* AP power type */
801 	uint8_t ap_power_type;
802 	bool same_ctry_code;  /* If AP Country IE has same country code as */
803 	/* STA programmed country */
804 	uint8_t ap_power_type_6g;  /* AP power type for 6G (LPI, SP, or VLP) */
805 	bool sta_follows_sap_power;
806 #ifdef WLAN_FEATURE_11BE
807 	bool eht_capable;
808 	tDot11fIEeht_cap eht_config;
809 	tDot11fIEeht_op eht_op;
810 #ifdef WLAN_FEATURE_11BE_MLO
811 	struct mlo_link_ie_info mlo_link_info;
812 	struct mlo_partner_info ml_partner_info;
813 	uint16_t mlo_ie_total_len;
814 	struct wlan_mlo_ie mlo_ie;
815 #endif
816 #endif /* WLAN_FEATURE_11BE */
817 	uint8_t user_edca_set;
818 };
819 
820 /*-------------------------------------------------------------------------
821    Function declarations and documentation
822    ------------------------------------------------------------------------*/
823 
824 #ifdef WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY
825 /**
826  * pe_allocate_dph_node_array_buffer() - Allocate g_dph_node_array
827  * memory dynamically
828  *
829  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_NOMEM on failure
830  */
831 QDF_STATUS pe_allocate_dph_node_array_buffer(void);
832 
833 /**
834  * pe_free_dph_node_array_buffer() - Free memory allocated dynamically
835  *
836  * Return: None
837  */
838 void pe_free_dph_node_array_buffer(void);
839 #else /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
840 static inline QDF_STATUS pe_allocate_dph_node_array_buffer(void)
841 {
842 	return QDF_STATUS_SUCCESS;
843 }
844 
845 static inline void pe_free_dph_node_array_buffer(void)
846 {
847 }
848 #endif /* WLAN_ALLOCATE_GLOBAL_BUFFERS_DYNAMICALLY */
849 
850 /**
851  * pe_create_session() - Creates a new PE session given the BSSID
852  * @mac: pointer to global adapter context
853  * @bssid: BSSID of the new session
854  * @sessionId: PE session ID is returned here, if PE session is created.
855  * @numSta: number of stations
856  * @bssType: bss type of new session to do conditional memory allocation.
857  * @vdev_id: vdev_id
858  *
859  * This function returns the session context and the session ID if the session
860  * corresponding to the passed BSSID is found in the PE session table.
861  *
862  * Return: ptr to the session context or NULL if session can not be created.
863  */
864 struct pe_session *pe_create_session(struct mac_context *mac,
865 				     uint8_t *bssid, uint8_t *sessionId,
866 				     uint16_t numSta, enum bss_type bssType,
867 				     uint8_t vdev_id);
868 
869 /**
870  * pe_find_session_by_bssid() - looks up the PE session given the BSSID.
871  *
872  * @mac:          pointer to global adapter context
873  * @bssid:         BSSID of the new session
874  * @sessionId:     session ID is returned here, if session is created.
875  *
876  * This function returns the session context and the session ID if the session
877  * corresponding to the given BSSID is found in the PE session table.
878  *
879  * Return: pointer to the session context or NULL if session is not found.
880  */
881 struct pe_session *pe_find_session_by_bssid(struct mac_context *mac, uint8_t *bssid,
882 				     uint8_t *sessionId);
883 
884 /**
885  * pe_find_session_by_vdev_id() - looks up the PE session given the vdev_id.
886  * @mac:             pointer to global adapter context
887  * @vdev_id:         vdev id the session
888  *
889  * Return: pointer to the session context or NULL if session is not found.
890  */
891 struct pe_session *pe_find_session_by_vdev_id(struct mac_context *mac,
892 					      uint8_t vdev_id);
893 
894 /**
895  * pe_find_session_by_vdev_id_and_state() - Find PE session by vdev_id and
896  * mlm state.
897  * @mac:             pointer to global adapter context
898  * @vdev_id:         vdev id the session
899  * @vdev_id:         vdev id the session
900  *
901  * During LFR2 roaming, new pe session is created before old pe session
902  * deleted, the 2 pe sessions have different pe session id, but same vdev id,
903  * can't get correct pe session by vdev id at this time.
904  *
905  * Return: pointer to the session context or NULL if session is not found.
906  */
907 struct pe_session
908 *pe_find_session_by_vdev_id_and_state(struct mac_context *mac,
909 				      uint8_t vdev_id,
910 				      enum eLimMlmStates lim_state);
911 
912 /**
913  * pe_find_session_by_peer_sta() - looks up the PE session given the Peer
914  * Station Address.
915  *
916  * @mac:          pointer to global adapter context
917  * @sa:            Peer STA Address of the session
918  * @sessionId:     session ID is returned here, if session is found.
919  *
920  * This function returns the session context and the session ID if the session
921  * corresponding to the given destination address is found in the PE session
922  * table.
923  *
924  * Return: pointer to the session context or NULL if session is not found.
925  */
926 struct pe_session *pe_find_session_by_peer_sta(struct mac_context *mac, uint8_t *sa,
927 					uint8_t *sessionId);
928 
929 /**
930  * pe_find_session_by_session_id() - looks up the PE session given the session
931  * ID.
932  *
933  * @mac:          pointer to global adapter context
934  * @sessionId:     session ID for which session context needs to be looked up.
935  *
936  * This function returns the session context  if the session corresponding to
937  * the given session ID is found in the PE session table.
938  *
939  * Return: pointer to the session context or NULL if session is not found.
940  */
941 struct pe_session *pe_find_session_by_session_id(struct mac_context *mac,
942 					  uint8_t sessionId);
943 
944 /**
945  * pe_delete_session() - deletes the PE session given the session ID.
946  *
947  * @mac:          pointer to global adapter context
948  * @sessionId:     session ID to delete.
949  *
950  * Return: void
951  */
952 void pe_delete_session(struct mac_context *mac, struct pe_session *pe_session);
953 
954 /**
955  * pe_find_session_by_scan_id() - looks up the PE session for given scan id
956  * @mac_ctx:   pointer to global adapter context
957  * @scan_id:   scan id
958  *
959  * looks up the PE session for given scan id
960  *
961  * Return: pe session entry for given scan id if found else NULL
962  */
963 struct pe_session *pe_find_session_by_scan_id(struct mac_context *mac_ctx,
964 				       uint32_t scan_id);
965 
966 uint8_t pe_get_active_session_count(struct mac_context *mac_ctx);
967 #ifdef WLAN_FEATURE_FILS_SK
968 /**
969  * pe_delete_fils_info: API to delete fils session info
970  * @session: pe session
971  *
972  * Return: void
973  */
974 void pe_delete_fils_info(struct pe_session *session);
975 #endif
976 
977 /**
978  * lim_set_bcn_probe_filter - set the beacon/probe filter in mac context
979  *
980  * @mac_ctx: pointer to global mac context
981  * @session: pointer to the PE session
982  * @sap_channel: Operating Channel of the session for SAP sessions
983  *
984  * Sets the beacon/probe filter in the global mac context to filter
985  * and drop beacon/probe frames before posting it to PE queue
986  *
987  * Return: None
988  */
989 void lim_set_bcn_probe_filter(struct mac_context *mac_ctx,
990 				struct pe_session *session,
991 				uint8_t sap_channel);
992 
993 /**
994  * lim_reset_bcn_probe_filter - clear the beacon/probe filter in mac context
995  *
996  * @mac_ctx: pointer to the global mac context
997  * @session: pointer to the PE session whose filter is to be cleared
998  *
999  * Return: None
1000  */
1001 void lim_reset_bcn_probe_filter(struct mac_context *mac_ctx, struct pe_session *session);
1002 
1003 /**
1004  * lim_update_bcn_probe_filter - Update the beacon/probe filter in mac context
1005  *
1006  * @mac_ctx: pointer to the global mac context
1007  * @session: pointer to the PE session whose filter is to be cleared
1008  *
1009  * This API is applicable only for SAP sessions to update the SAP channel
1010  * in the filter during a channel switch
1011  *
1012  * Return: None
1013  */
1014 void lim_update_bcn_probe_filter(struct mac_context *mac_ctx, struct pe_session *session);
1015 
1016 #endif /* #if !defined( __LIM_SESSION_H ) */
1017