xref: /wlan-driver/qcacld-3.0/core/mac/inc/ani_global.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 #ifndef _ANIGLOBAL_H
21 #define _ANIGLOBAL_H
22 
23 #include "qdf_types.h"
24 #include "sir_common.h"
25 #include "ani_system_defs.h"
26 #include "sys_def.h"
27 #include "dph_global.h"
28 #include "lim_global.h"
29 #include "sch_global.h"
30 #include "sys_global.h"
31 #include "sir_api.h"
32 
33 #include "csr_api.h"
34 #include "csr_support.h"
35 #include "sme_internal.h"
36 #include "sap_api.h"
37 #include "csr_internal.h"
38 
39 #include "sme_rrm_internal.h"
40 #include "rrm_global.h"
41 
42 #include <lim_ft_defs.h>
43 #include "wlan_objmgr_psoc_obj.h"
44 #include "wlan_mlme_public_struct.h"
45 
46 /**
47  * MAC_CONTEXT() - Convert an opaque mac handle into a mac context
48  * @handle: MAC handle to be converted
49  *
50  * Given an opaque mac handle this function will return the mac
51  * context that is associated with that handle.
52  *
53  * This is the inverse function of MAC_HANDLE()
54  *
55  * Return: mac context for @handle
56  */
MAC_CONTEXT(mac_handle_t handle)57 static inline struct mac_context *MAC_CONTEXT(mac_handle_t handle)
58 {
59 	return (struct mac_context *)handle;
60 }
61 
62 /**
63  * MAC_HANDLE() - Convert a mac context into an opaque mac handle
64  * @mac: MAC context to be converted
65  *
66  * Given a mac context this function will return the opaque mac handle
67  * that is associated with that handle.
68  *
69  * This is the inverse function of MAC_CONTEXT()
70  *
71  * Return: opaque handle for @mac
72  */
MAC_HANDLE(struct mac_context * mac)73 static inline mac_handle_t MAC_HANDLE(struct mac_context *mac)
74 {
75 	return (mac_handle_t)mac;
76 }
77 
78 #define ANI_DRIVER_TYPE(mac)     (((struct mac_context *)(mac))->gDriverType)
79 
80 /* ------------------------------------------------------------------- */
81 /* Bss Qos Caps bit map definition */
82 #define LIM_BSS_CAPS_OFFSET_HCF 0
83 #define LIM_BSS_CAPS_OFFSET_WME 1
84 #define LIM_BSS_CAPS_OFFSET_WSM 2
85 
86 #define LIM_BSS_CAPS_HCF (1 << LIM_BSS_CAPS_OFFSET_HCF)
87 #define LIM_BSS_CAPS_WME (1 << LIM_BSS_CAPS_OFFSET_WME)
88 #define LIM_BSS_CAPS_WSM (1 << LIM_BSS_CAPS_OFFSET_WSM)
89 
90 /* cap should be one of HCF/WME/WSM */
91 #define LIM_BSS_CAPS_GET(cap, val) (((val) & (LIM_BSS_CAPS_ ## cap)) >> LIM_BSS_CAPS_OFFSET_ ## cap)
92 #define LIM_BSS_CAPS_SET(cap, val) ((val) |= (LIM_BSS_CAPS_ ## cap))
93 #define LIM_BSS_CAPS_CLR(cap, val) ((val) &= (~(LIM_BSS_CAPS_ ## cap)))
94 
95 #define SPACE_ASCII_VALUE  32
96 
97 #define WLAN_HOST_SEQ_NUM_MIN                           2048
98 #define WLAN_HOST_SEQ_NUM_MAX                           4095
99 #define LOW_SEQ_NUM_MASK                                0x000F
100 #define HIGH_SEQ_NUM_MASK                               0x0FF0
101 #define HIGH_SEQ_NUM_OFFSET                             4
102 #define DEF_HE_AUTO_SGI_LTF                             0x0F07
103 
104 #define PMF_WEP_DISABLE 2
105 #define PMF_INCORRECT_KEY 1
106 #define PMF_CORRECT_KEY 0
107 
108 /**
109  * enum log_event_type - Type of event initiating bug report
110  * @WLAN_LOG_TYPE_NON_FATAL: Non fatal event
111  * @WLAN_LOG_TYPE_FATAL: Fatal event
112  *
113  * Enum indicating the type of event that is initiating the bug report
114  */
115 enum log_event_type {
116 	WLAN_LOG_TYPE_NON_FATAL,
117 	WLAN_LOG_TYPE_FATAL,
118 };
119 
120 /**
121  * enum log_event_indicator - Module triggering bug report
122  * @WLAN_LOG_INDICATOR_UNUSED: Unused
123  * @WLAN_LOG_INDICATOR_FRAMEWORK: Framework triggers bug report
124  * @WLAN_LOG_INDICATOR_HOST_DRIVER: Host driver triggers bug report
125  * @WLAN_LOG_INDICATOR_FIRMWARE: FW initiates bug report
126  * @WLAN_LOG_INDICATOR_HOST_ONLY: Host triggers fatal event bug report
127  *
128  * Enum indicating the module that triggered the bug report
129  */
130 enum log_event_indicator {
131 	WLAN_LOG_INDICATOR_UNUSED,
132 	WLAN_LOG_INDICATOR_FRAMEWORK,
133 	WLAN_LOG_INDICATOR_HOST_DRIVER,
134 	WLAN_LOG_INDICATOR_FIRMWARE,
135 	WLAN_LOG_INDICATOR_HOST_ONLY,
136 };
137 
138 /**
139  * enum log_event_host_reason_code - Reason code for bug report
140  * @WLAN_LOG_REASON_CODE_UNUSED: Unused
141  * @WLAN_LOG_REASON_ROAM_FAIL: Driver initiated roam has failed
142  * @WLAN_LOG_REASON_DATA_STALL: Unable to send/receive data due to low resource
143  * scenario for a prolonged period
144  * @WLAN_LOG_REASON_SME_COMMAND_STUCK: SME command is stuck in SME active queue
145  * @WLAN_LOG_REASON_QUEUE_FULL: Defer queue becomes full for a prolonged period
146  * @WLAN_LOG_REASON_POWER_COLLAPSE_FAIL: Unable to allow apps power collapse
147  * for a prolonged period
148  * @WLAN_LOG_REASON_MALLOC_FAIL: Memory allocation Fails
149  * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper
150  * @WLAN_LOG_REASON_HDD_TIME_OUT: Wait for event Timeout in HDD layer
151    @WLAN_LOG_REASON_SME_OUT_OF_CMD_BUFL sme out of cmd buffer
152  * @WLAN_LOG_REASON_NO_SCAN_RESULTS: no scan results to report from HDD
153  * This enum contains the different reason codes for bug report
154  * @WLAN_LOG_REASON_SCAN_NOT_ALLOWED: scan not allowed due to connection states
155  * @WLAN_LOG_REASON_HB_FAILURE: station triggered heart beat failure with AP
156  * @WLAN_LOG_REASON_ROAM_HO_FAILURE: Handover failed during LFR3 roaming
157  * @WLAN_LOG_REASON_DISCONNECT: Disconnect because of some failure
158  * @WLAN_LOG_REASON_VDEV_DELETE_RSP_TIMED_OUT: vdev delete rsp time out
159  */
160 enum log_event_host_reason_code {
161 	WLAN_LOG_REASON_CODE_UNUSED,
162 	WLAN_LOG_REASON_ROAM_FAIL,
163 	WLAN_LOG_REASON_DATA_STALL,
164 	WLAN_LOG_REASON_SME_COMMAND_STUCK,
165 	WLAN_LOG_REASON_QUEUE_FULL,
166 	WLAN_LOG_REASON_POWER_COLLAPSE_FAIL,
167 	WLAN_LOG_REASON_MALLOC_FAIL,
168 	WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
169 	WLAN_LOG_REASON_HDD_TIME_OUT,
170 	WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
171 	WLAN_LOG_REASON_NO_SCAN_RESULTS,
172 	WLAN_LOG_REASON_SCAN_NOT_ALLOWED,
173 	WLAN_LOG_REASON_HB_FAILURE,
174 	WLAN_LOG_REASON_ROAM_HO_FAILURE,
175 	WLAN_LOG_REASON_DISCONNECT,
176 	WLAN_LOG_REASON_VDEV_DELETE_RSP_TIMED_OUT
177 };
178 
179 
180 /**
181  * enum userspace_log_level - Log level at userspace
182  * @LOG_LEVEL_NO_COLLECTION: verbose_level 0 corresponds to no collection
183  * @LOG_LEVEL_NORMAL_COLLECT: verbose_level 1 correspond to normal log level,
184  * with minimal user impact. this is the default value
185  * @LOG_LEVEL_ISSUE_REPRO: verbose_level 2 are enabled when user is lazily
186  * trying to reproduce a problem, wifi performances and power can be impacted
187  * but device should not otherwise be significantly impacted
188  * @LOG_LEVEL_ACTIVE: verbose_level 3+ are used when trying to
189  * actively debug a problem
190  *
191  * Various log levels defined in the userspace for logging applications
192  */
193 enum userspace_log_level {
194 	LOG_LEVEL_NO_COLLECTION,
195 	LOG_LEVEL_NORMAL_COLLECT,
196 	LOG_LEVEL_ISSUE_REPRO,
197 	LOG_LEVEL_ACTIVE,
198 };
199 
200 /**
201  * enum wifi_driver_log_level - Log level defined in the driver for logging
202  * @WLAN_LOG_LEVEL_OFF: No logging
203  * @WLAN_LOG_LEVEL_NORMAL: Default logging
204  * @WLAN_LOG_LEVEL_REPRO: Normal debug level
205  * @WLAN_LOG_LEVEL_ACTIVE: Active debug level
206  *
207  * Log levels defined for logging by the wifi driver
208  */
209 enum wifi_driver_log_level {
210 	WLAN_LOG_LEVEL_OFF,
211 	WLAN_LOG_LEVEL_NORMAL,
212 	WLAN_LOG_LEVEL_REPRO,
213 	WLAN_LOG_LEVEL_ACTIVE,
214 };
215 
216 /**
217  * enum wifi_logging_ring_id - Ring id of logging entities
218  * @RING_ID_WAKELOCK:         Power events ring id
219  * @RING_ID_CONNECTIVITY:     Connectivity event ring id
220  * @RING_ID_PER_PACKET_STATS: Per packet statistic ring id
221  * @RING_ID_DRIVER_DEBUG:     Driver debug messages ring id
222  * @RING_ID_FIRMWARE_DEBUG:   Firmware debug messages ring id
223  *
224  * This enum has the ring id values of logging rings
225  */
226 enum wifi_logging_ring_id {
227 	RING_ID_WAKELOCK,
228 	RING_ID_CONNECTIVITY,
229 	RING_ID_PER_PACKET_STATS,
230 	RING_ID_DRIVER_DEBUG,
231 	RING_ID_FIRMWARE_DEBUG,
232 };
233 
234 /* ------------------------------------------------------------------- */
235 /* Change channel generic scheme */
236 typedef void (*CHANGE_CHANNEL_CALLBACK)(struct mac_context *mac, QDF_STATUS status,
237 					uint32_t *data,
238 					struct pe_session *pe_session);
239 
240 typedef struct sDialogueToken {
241 	/* bytes 0-3 */
242 	uint16_t assocId;
243 	uint8_t token;
244 	uint8_t rsvd1;
245 	/* Bytes 4-7 */
246 	uint16_t tid;
247 	uint8_t rsvd2[2];
248 
249 	struct sDialogueToken *next;
250 } tDialogueToken, *tpDialogueToken;
251 
252 typedef struct sLimTimers {
253 	/* TIMERS IN LIM ARE NOT SUPPOSED TO BE ZEROED OUT DURING RESET. */
254 	/* DURING lim_initialize DONOT ZERO THEM OUT. */
255 
256 /* STA SPECIFIC TIMERS */
257 
258 	TX_TIMER gLimPreAuthClnupTimer;
259 
260 	/* Association related timers */
261 	TX_TIMER gLimAssocFailureTimer;
262 	TX_TIMER gLimReassocFailureTimer;
263 
264 	/* Authentication related timers */
265 	TX_TIMER gLimAuthFailureTimer;
266 
267 	/* Join Failure timeout on STA */
268 	TX_TIMER gLimJoinFailureTimer;
269 
270 	/* CNF_WAIT timer */
271 	TX_TIMER *gpLimCnfWaitTimer;
272 
273 	TX_TIMER gLimAddtsRspTimer;     /* max wait for a response */
274 
275 	/* Update OLBC Cache Timer */
276 	TX_TIMER gLimUpdateOlbcCacheTimer;
277 
278 	TX_TIMER gLimFTPreAuthRspTimer;
279 
280 	TX_TIMER gLimPeriodicJoinProbeReqTimer;
281 	TX_TIMER gLimDisassocAckTimer;
282 	TX_TIMER gLimDeauthAckTimer;
283 	TX_TIMER g_lim_periodic_auth_retry_timer;
284 
285 	/* SAE authentication related timer */
286 	TX_TIMER sae_auth_timer;
287 
288 	/* RRM sta stats response related timer */
289 	TX_TIMER rrm_sta_stats_resp_timer;
290 /* ********************TIMER SECTION ENDS************************************************** */
291 /* ALL THE FIELDS BELOW THIS CAN BE ZEROED OUT in lim_initialize */
292 /* **************************************************************************************** */
293 
294 } tLimTimers;
295 
296 typedef struct {
297 	void *pMlmDisassocReq;
298 	void *pMlmDeauthReq;
299 } tLimDisassocDeauthCnfReq;
300 
301 struct lim_context {
302 	/* ////////////////////////////////////     TIMER RELATED START /////////////////////////////////////////// */
303 
304 	tLimTimers lim_timers;
305 	/* / Flag to track if LIM timers are created or not */
306 	uint32_t gLimTimersCreated;
307 
308 	/* ////////////////////////////////////     TIMER RELATED END /////////////////////////////////////////// */
309 
310 	uint8_t gLimCurrentBssUapsd;
311 	/* ////////////////////////////////////////     BSS RELATED END /////////////////////////////////////////// */
312 
313 	/* ////////////////////////////////////////     STATS/COUNTER RELATED START /////////////////////////////////////////// */
314 
315 	uint16_t maxStation;
316 	uint16_t maxBssId;
317 
318 	/* / Variable to keep track of number of currently associated STAs */
319 	uint16_t gLimNumOfAniSTAs;      /* count of ANI peers */
320 
321 	tSirMacAddr gLimHeartBeatApMac[2];
322 	uint8_t gLimHeartBeatApMacIndex;
323 
324 	/* ////////////////////////////////////////     STATS/COUNTER RELATED END /////////////////////////////////////////// */
325 
326 	/* ////////////////////////////////////////     STATES RELATED START /////////////////////////////////////////// */
327 	/* Counts Heartbeat failures */
328 	uint8_t gLimHBfailureCntInLinkEstState;
329 	uint8_t gLimProbeFailureAfterHBfailedCnt;
330 	uint8_t gLimHBfailureCntInOtherStates;
331 
332 	/**
333 	 * This variable indicates whether LIM module need to
334 	 * send response to host. Used to identify whether a request
335 	 * is generated internally within LIM module or by host
336 	 */
337 	uint8_t gLimRspReqd;
338 
339 	/* / Previous SME State */
340 	tLimSmeStates gLimPrevSmeState;
341 
342 	/* / MLM State visible across all Sirius modules */
343 	tLimMlmStates gLimMlmState;
344 
345 	/* / Previous MLM State */
346 	tLimMlmStates gLimPrevMlmState;
347 
348 	/* Can be set to invalid channel. If it is invalid, HAL */
349 	/* should move to previous valid channel or stay in the */
350 	/* current channel. CB state goes along with channel to resume to */
351 	uint16_t gResumeChannel;
352 	ePhyChanBondState gResumePhyCbState;
353 
354 	/* Change channel generic scheme */
355 	CHANGE_CHANNEL_CALLBACK gpchangeChannelCallback;
356 	uint32_t *gpchangeChannelData;
357 
358 	/* / SME State visible across all Sirius modules */
359 	tLimSmeStates gLimSmeState;
360 	/* / This indicates whether we're an AP, STA in BSS/IBSS */
361 	tLimSystemRole gLimSystemRole;
362 
363 	/* Number of STAs that do not support short preamble */
364 	tLimNoShortParams gLimNoShortParams;
365 
366 	/* Number of STAs that do not support short slot time */
367 	tLimNoShortSlotParams gLimNoShortSlotParams;
368 
369 	/* */
370 	/* ---------------- DPH ----------------------- */
371 	uint32_t gLimPhyMode;
372 
373 	/* ---------------- DPH ----------------------- */
374 
375 	/* ////////////////////////////////////////     STATES RELATED END /////////////////////////////////////////// */
376 
377 	/* ////////////////////////////////////////     MISC RELATED START /////////////////////////////////////////// */
378 
379 	/* Deferred Queue Parameters */
380 	tLimDeferredMsgQParams gLimDeferredMsgQ;
381 
382 	/* addts request if any - only one can be outstanding at any time */
383 	tSirAddtsReq gLimAddtsReq;
384 	uint8_t gLimAddtsSent;
385 	uint8_t gLimAddtsRspTimerCount;
386 
387 	/* protection related config cache */
388 	tCfgProtection cfgProtection;
389 
390 	uint8_t gLimProtectionControl;
391 	/* This flag will remain to be set except while LIM is waiting for specific response messages */
392 	/* from HAL. e.g when LIM issues ADD_STA req it will clear this flag and when it will receive */
393 	/* the response the flag will be set. */
394 	uint8_t gLimProcessDefdMsgs;
395 
396 	/* UAPSD flag used on AP */
397 	uint8_t gUapsdEnable;
398 
399 	/* Used on STA for AC downgrade. This is a dynamic mask
400 	 * setting which keep tracks of ACs being admitted.
401 	 * If bit is set to 0: That particular AC is not admitted
402 	 * If bit is set to 1: That particular AC is admitted
403 	 */
404 	uint8_t gAcAdmitMask[SIR_MAC_DIRECTION_DIRECT];
405 
406 	/* dialogue token List head/tail for Action frames request sent. */
407 	tpDialogueToken pDialogueTokenHead;
408 	tpDialogueToken pDialogueTokenTail;
409 
410 	tLimTspecInfo tspecInfo[LIM_NUM_TSPEC_MAX];
411 
412 	/* admission control policy information */
413 	tLimAdmitPolicyInfo admitPolicyInfo;
414 #ifdef FEATURE_WLAN_TDLS
415 	uint8_t gLimTDLSBufStaEnabled;
416 	uint8_t gLimTDLSUapsdMask;
417 	uint8_t gLimTDLSOffChannelEnabled;
418 	uint8_t gLimTDLSWmmMode;
419 #endif
420 	/* ////////////////////////////////////////     MISC RELATED END /////////////////////////////////////////// */
421 
422 	/* ASSOC RELATED START */
423 
424 	/* Place holder for current authentication request */
425 	/* being handled */
426 	tLimMlmAuthReq *gpLimMlmAuthReq;
427 
428 	/* Reason code to determine the channel change context while sending */
429 	/* WMA_CHNL_SWITCH_REQ message to HAL */
430 	uint32_t channelChangeReasonCode;
431 
432 	/* / MAC level Pre-authentication related globals */
433 	tSirMacChanNum gLimPreAuthChannelNumber;
434 	tAniAuthType gLimPreAuthType;
435 	tSirMacAddr gLimPreAuthPeerAddr;
436 	uint32_t gLimNumPreAuthContexts;
437 	tLimPreAuthTable gLimPreAuthTimerTable;
438 
439 	/* Place holder for Pre-authentication node list */
440 	struct tLimPreAuthNode *pLimPreAuthList;
441 
442 	/* Assoc or ReAssoc Response Data/Frame */
443 	void *gLimAssocResponseData;
444 
445 	/* One cache for each overlap and associated case. */
446 	tCacheParams protStaOverlapCache[LIM_PROT_STA_OVERLAP_CACHE_SIZE];
447 	tCacheParams protStaCache[LIM_PROT_STA_CACHE_SIZE];
448 
449 	/* Peer RSSI value */
450 	int8_t bss_rssi;
451 
452 	/* ASSOC RELATED END */
453 
454 	/* //////////////////////////////  HT RELATED           ////////////////////////////////////////// */
455 	/* */
456 	/* The following global LIM variables maintain/manage */
457 	/* the runtime configurations related to 802.11n */
458 
459 	/* 802.11n Station detected HT capability in Beacon Frame */
460 	uint8_t htCapabilityPresentInBeacon;
461 
462 	/* 802.11 HT capability: Enabled or Disabled */
463 	uint8_t htCapability;
464 
465 	uint8_t gHTGreenfield;
466 
467 	uint8_t gHTShortGI40Mhz;
468 	uint8_t gHTShortGI20Mhz;
469 
470 	/* Set to 0 for 3839 octets */
471 	/* Set to 1 for 7935 octets */
472 	uint8_t gHTMaxAmsduLength;
473 
474 	/* DSSS/CCK at 40 MHz: Enabled 1 or Disabled */
475 	uint8_t gHTDsssCckRate40MHzSupport;
476 
477 	/* PSMP Support: Enabled 1 or Disabled 0 */
478 	uint8_t gHTPSMPSupport;
479 
480 	/* L-SIG TXOP Protection used only if peer support available */
481 	uint8_t gHTLsigTXOPProtection;
482 
483 	/* MIMO Power Save */
484 	tSirMacHTMIMOPowerSaveState gHTMIMOPSState;
485 
486 	/* */
487 	/* A-MPDU Density */
488 	/* 000 - No restriction */
489 	/* 001 - 1/8 usec */
490 	/* 010 - 1/4 usec */
491 	/* 011 - 1/2 usec */
492 	/* 100 - 1 usec */
493 	/* 101 - 2 usec */
494 	/* 110 - 4 usec */
495 	/* 111 - 8 usec */
496 	/* */
497 	uint8_t gHTAMpduDensity;
498 
499 	bool gMaxAmsduSizeEnabled;
500 	/* Maximum Tx/Rx A-MPDU factor */
501 	uint8_t gHTMaxRxAMpduFactor;
502 
503 	/* */
504 	/* Scheduled PSMP related - Service Interval Granularity */
505 	/* 000 - 5 ms */
506 	/* 001 - 10 ms */
507 	/* 010 - 15 ms */
508 	/* 011 - 20 ms */
509 	/* 100 - 25 ms */
510 	/* 101 - 30 ms */
511 	/* 110 - 35 ms */
512 	/* 111 - 40 ms */
513 	/* */
514 	uint8_t gHTServiceIntervalGranularity;
515 
516 	/* Indicates whether an AP wants to associate PSMP enabled Stations */
517 	uint8_t gHTControlledAccessOnly;
518 
519 	/* OBss Mode . set when we have Non HT STA is associated or with in overlap bss */
520 	uint8_t gHTObssMode;
521 
522 	/* Identifies the current Operating Mode */
523 	tSirMacHTOperatingMode gHTOperMode;
524 
525 	/* Indicates if PCO is activated in the BSS */
526 	uint8_t gHTPCOActive;
527 
528 	/* */
529 	/* If PCO is active, indicates which PCO phase to use */
530 	/* 0 - switch to 20 MHz phase */
531 	/* 1 - switch to 40 MHz phase */
532 	/* */
533 	uint8_t gHTPCOPhase;
534 
535 	/* */
536 	/* Used only in beacons. For PR, this is set to 0 */
537 	/* 0 - Primary beacon */
538 	/* 1 - Secondary beacon */
539 	/* */
540 	uint8_t gHTSecondaryBeacon;
541 
542 	/* */
543 	/* Dual CTS Protection */
544 	/* 0 - Use RTS/CTS */
545 	/* 1 - Dual CTS Protection is used */
546 	/* */
547 	uint8_t gHTDualCTSProtection;
548 
549 	/* */
550 	/* Identifies a single STBC MCS that shall ne used for */
551 	/* STBC control frames and STBC beacons */
552 	/* */
553 	uint8_t gHTSTBCBasicMCS;
554 
555 	uint8_t gHTNonGFDevicesPresent;
556 
557 	/* HT RELATED END */
558 
559 	/* wsc info required to form the wsc IE */
560 	tLimWscIeInfo wscIeInfo;
561 	struct pe_session *gpSession;  /* Pointer to  session table */
562 	uint8_t max_sta_of_pe_session;
563 
564 	qdf_mutex_t lim_frame_register_lock;
565 	qdf_list_t gLimMgmtFrameRegistratinQueue;
566 	uint32_t tdls_frm_session_id;
567 
568 	struct pe_session *pe_session;
569 	uint8_t reAssocRetryAttempt;
570 	tLimDisassocDeauthCnfReq limDisassocDeauthCnfReq;
571 	uint8_t deferredMsgCnt;
572 	uint8_t deauthMsgCnt;
573 	uint8_t disassocMsgCnt;
574 	uint8_t gLimIbssStaLimit;
575 
576 	QDF_STATUS(*sme_msg_callback)
577 		(struct mac_context *mac, struct scheduler_msg *msg);
578 	stop_roaming_fn_t stop_roaming_callback;
579 	uint8_t retry_packet_cnt;
580 	uint8_t beacon_probe_rsp_cnt_per_scan;
581 	wlan_scan_requester req_id;
582 	QDF_STATUS (*sme_bcn_rcv_callback)(hdd_handle_t hdd_handle,
583 				struct wlan_beacon_report *beacon_report);
584 };
585 
586 struct mgmt_frm_reg_info {
587 	qdf_list_node_t node;   /* MUST be first element */
588 	uint16_t frameType;
589 	uint16_t matchLen;
590 	uint16_t sessionId;
591 	QDF_FLEX_ARRAY(uint8_t, matchData);
592 };
593 
594 typedef struct sRrmContext {
595 	struct rrm_config_param rrmConfig;
596 	tRrmSMEContext rrmSmeContext[MAX_MEASUREMENT_REQUEST];
597 	tRrmPEContext rrmPEContext;
598 } tRrmContext, *tpRrmContext;
599 
600 /**
601  * enum tx_ack_status - Indicate TX status
602  * @LIM_ACK_NOT_RCD: Default status while waiting for ack status.
603  * @LIM_ACK_RCD_SUCCESS: Ack is received.
604  * @LIM_ACK_RCD_FAILURE: No Ack received.
605  * @LIM_TX_FAILED: Failed to TX
606  *
607  * Indicate if driver is waiting for ACK status of auth or ACK received for AUTH
608  * OR NO ACK is received for the auth sent.
609  */
610 enum tx_ack_status {
611 	LIM_ACK_NOT_RCD,
612 	LIM_ACK_RCD_SUCCESS,
613 	LIM_ACK_RCD_FAILURE,
614 	LIM_TX_FAILED,
615 };
616 
617 /**
618  * struct vdev_type_nss - vdev type nss structure
619  * @sta: STA Nss value.
620  * @sap: SAP Nss value.
621  * @p2p_go: P2P GO Nss value.
622  * @p2p_cli: P2P CLI Nss value.
623  * @p2p_dev: P2P device Nss value.
624  * @ibss: IBSS Nss value.
625  * @tdls: TDLS Nss value.
626  * @ocb: OCB Nss value.
627  * @nan: NAN Nss value.
628  *
629  * Holds the Nss values of different vdev types.
630  */
631 struct vdev_type_nss {
632 	uint8_t sta;
633 	uint8_t sap;
634 	uint8_t p2p_go;
635 	uint8_t p2p_cli;
636 	uint8_t p2p_dev;
637 	uint8_t ibss;
638 	uint8_t tdls;
639 	uint8_t ocb;
640 	uint8_t nan;
641 	uint8_t ndi;
642 };
643 
644 /**
645  * struct mgmt_beacon_probe_filter
646  * @num_sta_sessions: Number of active PE STA sessions
647  * @sta_bssid: Array of PE STA session's peer BSSIDs
648  * @num_sap_session: Number of active PE SAP sessions
649  * @sap_channel: Array of PE SAP session's channels
650  *
651  * Used to filter the STA/IBSS/SAP beacons/probes required in PE and
652  * drop other unwanted beacon/probe response frames
653  */
654 struct mgmt_beacon_probe_filter {
655 	uint8_t num_sta_sessions;
656 	tSirMacAddr sta_bssid[WLAN_MAX_VDEVS];
657 	uint8_t num_sap_sessions;
658 	uint8_t sap_channel[WLAN_MAX_VDEVS];
659 };
660 
661 #ifdef FEATURE_ANI_LEVEL_REQUEST
662 struct ani_level_params {
663 	void (*ani_level_cb)(struct wmi_host_ani_level_event *ani, uint8_t num,
664 			     void *context);
665 	void *context;
666 };
667 #endif
668 
669 /**
670  * struct mac_context - Global MAC context
671  */
672 struct mac_context {
673 	enum qdf_driver_type gDriverType;
674 	struct wlan_mlme_chain_cfg fw_chain_cfg;
675 	struct wlan_mlme_cfg *mlme_cfg;
676 	struct lim_context lim;
677 	struct sch_context sch;
678 	tAniSirSys sys;
679 
680 	/* PAL/HDD handle */
681 	hdd_handle_t hdd_handle;
682 
683 	struct sme_context sme;
684 	tSapStruct sap;
685 	struct csr_scanstruct scan;
686 	struct csr_roamstruct roam;
687 	tRrmContext rrm;
688 	uint8_t beacon_offload;
689 	bool pmf_offload;
690 	uint32_t f_sta_miracast_mcc_rest_time_val;
691 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT
692 	csr_readyToExtWoWCallback readyToExtWoWCallback;
693 	void *readyToExtWoWContext;
694 #endif
695 	struct vdev_type_nss vdev_type_nss_2g;
696 	struct vdev_type_nss vdev_type_nss_5g;
697 
698 	uint16_t mgmtSeqNum;
699 	sir_mgmt_frame_ind_callback mgmt_frame_ind_cb;
700 	qdf_atomic_t global_cmd_id;
701 	struct wlan_objmgr_psoc *psoc;
702 	struct wlan_objmgr_pdev *pdev;
703 	void (*chan_info_cb)(struct scan_chan_info *chan_info);
704 	void (*del_peers_ind_cb)(struct wlan_objmgr_psoc *psoc,
705 				 uint8_t vdev_id);
706 	uint32_t rx_packet_drop_counter;
707 	enum tx_ack_status auth_ack_status;
708 	enum tx_ack_status assoc_ack_status;
709 	uint8_t user_configured_nss;
710 	uint32_t peer_rssi;
711 	uint32_t peer_txrate;
712 	uint32_t peer_rxrate;
713 	uint32_t rx_retry_cnt;
714 	uint32_t rx_mc_bc_cnt;
715 	/* 11k Offload Support */
716 	bool is_11k_offload_supported;
717 	uint8_t reject_addba_req;
718 	uint16_t usr_cfg_ba_buff_size;
719 	bool is_usr_cfg_amsdu_enabled;
720 	uint8_t no_ack_policy_cfg[QCA_WLAN_AC_ALL];
721 	uint32_t he_sgi_ltf_cfg_bit_mask;
722 	uint8_t usr_cfg_tx_bfee_nsts;
723 	struct mgmt_beacon_probe_filter bcn_filter;
724 	tSirMacEdcaParamRecord usr_mu_edca_params[QCA_WLAN_AC_ALL];
725 	bool usr_cfg_mu_edca_params;
726 	bool he_om_ctrl_cfg_bw_set;
727 	uint8_t he_om_ctrl_cfg_bw;
728 	bool he_om_ctrl_cfg_nss_set;
729 	uint8_t he_om_ctrl_cfg_nss;
730 	bool he_om_ctrl_cfg_ul_mu_dis;
731 	bool he_om_ctrl_cfg_tx_nsts_set;
732 	uint8_t he_om_ctrl_cfg_tx_nsts;
733 	bool he_om_ctrl_ul_mu_data_dis;
734 	uint8_t usr_cfg_disable_rsp_tx;
735 	uint8_t is_usr_cfg_pmf_wep;
736 	uint8_t usr_cfg_ru_242_tone_tx;
737 	bool usr_eht_testbed_cfg;
738 #ifdef WLAN_FEATURE_11AX
739 	tDot11fIEhe_cap he_cap_2g;
740 	tDot11fIEhe_cap he_cap_5g;
741 	tDot11fIEhe_cap he_cap_2g_orig;
742 	tDot11fIEhe_cap he_cap_5g_orig;
743 #endif
744 	bool obss_scan_offload;
745 	bool bcn_reception_stats;
746 	csr_session_close_cb session_close_cb;
747 	csr_roam_complete_cb session_roam_complete_cb;
748 #ifdef FEATURE_ANI_LEVEL_REQUEST
749 	struct ani_level_params ani_params;
750 #endif
751 #ifdef WLAN_FEATURE_11BE
752 	tDot11fIEeht_cap eht_cap_2g;
753 	tDot11fIEeht_cap eht_cap_5g;
754 	tDot11fIEeht_cap eht_cap_2g_orig;
755 	tDot11fIEeht_cap eht_cap_5g_orig;
756 #endif
757 #ifdef WLAN_FEATURE_CAL_FAILURE_TRIGGER
758 	void (*cal_failure_event_cb)(uint8_t cal_type, uint8_t reason);
759 #endif
760 };
761 
762 #ifdef FEATURE_WLAN_TDLS
763 
764 #define RFC1042_HDR_LENGTH      (6)
765 #define GET_BE16(x)             ((uint16_t) (((x)[0] << 8) | (x)[1]))
766 #define ETH_TYPE_89_0d          (0x890d)
767 #define ETH_TYPE_LEN            (2)
768 #define PAYLOAD_TYPE_TDLS_SIZE  (1)
769 #define PAYLOAD_TYPE_TDLS       (2)
770 
771 #endif
772 
773 #endif /* _ANIGLOBAL_H */
774