blob: e417448fe078c5e9591116185e174bb23e20333d [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Abhishek Singhd0854382019-01-03 11:40:22 +05302 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19/*
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080020 *
21 * This file lim_global.h contains the definitions exported by
22 * LIM module.
23 * Author: Chandra Modumudi
24 * Date: 02/11/02
25 * History:-
26 * Date Modified by Modification Information
27 * --------------------------------------------------------------------
28 *
29 */
30#ifndef __LIM_GLOBAL_H
31#define __LIM_GLOBAL_H
32
33#include "wni_api.h"
34#include "sir_api.h"
35#include "sir_mac_prot_def.h"
36#include "sir_mac_prop_exts.h"
37#include "sir_common.h"
38#include "sir_debug.h"
39#include "wni_cfg.h"
40#include "csr_api.h"
41#include "sap_api.h"
42#include "dot11f.h"
43#include "wma_if.h"
44
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080045/* Deferred Message Queue Length */
46#define MAX_DEFERRED_QUEUE_LEN 80
47
48/* Maximum number of PS - TIM's to be sent with out wakeup from STA */
49#define LIM_TIM_WAIT_COUNT_FACTOR 5
50
51/*
52 * Use this count if (LIM_TIM_WAIT_FACTOR * ListenInterval)
53 * is less than LIM_MIN_TIM_WAIT_CNT
54 */
55#define LIM_MIN_TIM_WAIT_COUNT 50
56
gaolez76d2a162017-03-21 19:23:58 +080057#ifdef CHANNEL_HOPPING_ALL_BANDS
58#define CHAN_HOP_ALL_BANDS_ENABLE 1
59#else
60#define CHAN_HOP_ALL_BANDS_ENABLE 0
61#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080062
63/* enums exported by LIM are as follows */
64
65/*System role definition */
66typedef enum eLimSystemRole {
67 eLIM_UNKNOWN_ROLE,
68 eLIM_AP_ROLE,
69 eLIM_STA_IN_IBSS_ROLE,
70 eLIM_STA_ROLE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080071 eLIM_P2P_DEVICE_ROLE,
72 eLIM_P2P_DEVICE_GO,
Deepak Dhamdherec9acc442016-05-26 02:12:58 -070073 eLIM_P2P_DEVICE_CLIENT,
74 eLIM_NDI_ROLE
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080075} tLimSystemRole;
76
77/*
78 * SME state definition accessible across all Sirius modules.
79 * AP only states are LIM_SME_CHANNEL_SCAN_STATE &
80 * LIM_SME_NORMAL_CHANNEL_SCAN_STATE.
81 * Note that these states may also be present in STA
82 * side too when DFS support is present for a STA in IBSS mode.
83 */
84typedef enum eLimSmeStates {
85 eLIM_SME_OFFLINE_STATE,
86 eLIM_SME_IDLE_STATE,
87 eLIM_SME_SUSPEND_STATE,
88 eLIM_SME_WT_SCAN_STATE,
89 eLIM_SME_WT_JOIN_STATE,
90 eLIM_SME_WT_AUTH_STATE,
91 eLIM_SME_WT_ASSOC_STATE,
92 eLIM_SME_WT_REASSOC_STATE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080093 eLIM_SME_JOIN_FAILURE_STATE,
94 eLIM_SME_ASSOCIATED_STATE,
95 eLIM_SME_REASSOCIATED_STATE,
96 eLIM_SME_LINK_EST_STATE,
97 eLIM_SME_LINK_EST_WT_SCAN_STATE,
98 eLIM_SME_WT_PRE_AUTH_STATE,
99 eLIM_SME_WT_DISASSOC_STATE,
100 eLIM_SME_WT_DEAUTH_STATE,
101 eLIM_SME_WT_START_BSS_STATE,
102 eLIM_SME_WT_STOP_BSS_STATE,
103 eLIM_SME_NORMAL_STATE,
104 eLIM_SME_CHANNEL_SCAN_STATE,
105 eLIM_SME_NORMAL_CHANNEL_SCAN_STATE
106} tLimSmeStates;
107
108/*
109 * MLM state definition.
110 * While these states are present on AP too when it is
111 * STA mode, per-STA MLM state exclusive to AP is:
112 * eLIM_MLM_WT_AUTH_FRAME3.
113 */
114typedef enum eLimMlmStates {
115 eLIM_MLM_OFFLINE_STATE,
116 eLIM_MLM_IDLE_STATE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800117 eLIM_MLM_WT_JOIN_BEACON_STATE,
118 eLIM_MLM_JOINED_STATE,
119 eLIM_MLM_BSS_STARTED_STATE,
120 eLIM_MLM_WT_AUTH_FRAME2_STATE,
121 eLIM_MLM_WT_AUTH_FRAME3_STATE,
122 eLIM_MLM_WT_AUTH_FRAME4_STATE,
123 eLIM_MLM_AUTH_RSP_TIMEOUT_STATE,
124 eLIM_MLM_AUTHENTICATED_STATE,
125 eLIM_MLM_WT_ASSOC_RSP_STATE,
126 eLIM_MLM_WT_REASSOC_RSP_STATE,
127 eLIM_MLM_ASSOCIATED_STATE,
128 eLIM_MLM_REASSOCIATED_STATE,
129 eLIM_MLM_LINK_ESTABLISHED_STATE,
130 eLIM_MLM_WT_ASSOC_CNF_STATE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800131 eLIM_MLM_WT_ADD_BSS_RSP_STATE,
132 eLIM_MLM_WT_DEL_BSS_RSP_STATE,
133 eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE,
134 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE,
135 eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE,
136 eLIM_MLM_WT_ADD_STA_RSP_STATE,
137 eLIM_MLM_WT_DEL_STA_RSP_STATE,
138 /*
139 * MLM goes to this state when LIM initiates DELETE_STA
140 * as processing of Assoc req because the entry already exists.
141 * LIM comes out of this state when DELETE_STA response from
142 * HAL is received. LIM needs to maintain this state so that ADD_STA
143 * can be issued while processing DELETE_STA response from HAL.
144 */
145 eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE,
146 eLIM_MLM_WT_SET_BSS_KEY_STATE,
147 eLIM_MLM_WT_SET_STA_KEY_STATE,
148 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149 eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE,
150 eLIM_MLM_WT_FT_REASSOC_RSP_STATE,
Padma, Santhosh Kumarb38ab512018-01-16 16:16:46 +0530151 eLIM_MLM_WT_SAE_AUTH_STATE,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152} tLimMlmStates;
153
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800154/* 11h channel switch states */
155
156/*
157 * This enum indicates in which state the channel-swith
158 * is presently operating.
159 * eLIM_11H_CHANSW_INIT - Default state
160 * eLIM_11H_CHANSW_RUNNING - When channel switch is running
161 * eLIM_11H_CHANSW_END - After channel switch is complete
162 */
163typedef enum eLimDot11hChanSwStates {
164 eLIM_11H_CHANSW_INIT,
165 eLIM_11H_CHANSW_RUNNING,
166 eLIM_11H_CHANSW_END
167} tLimDot11hChanSwStates;
168
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800169/* MLM Req/Cnf structure definitions */
170typedef struct sLimMlmAuthReq {
171 tSirMacAddr peerMacAddr;
172 tAniAuthType authType;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173 uint8_t sessionId;
174} tLimMlmAuthReq, *tpLimMlmAuthReq;
175
176typedef struct sLimMlmJoinReq {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800177 tSirMacRateSet operationalRateSet;
178 uint8_t sessionId;
179 tSirBssDescription bssDescription;
Selvaraj, Sridhar81ab80d2017-06-08 12:21:39 +0530180 /*
181 * WARNING: Pls make bssDescription as last variable in struct
182 * tLimMlmJoinReq as it has ieFields followed after this bss
183 * description. Adding a variable after this corrupts the ieFields
184 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800185} tLimMlmJoinReq, *tpLimMlmJoinReq;
186
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800187/* Pre-authentication structure definition */
188typedef struct tLimPreAuthNode {
189 struct tLimPreAuthNode *next;
190 tSirMacAddr peerMacAddr;
191 tAniAuthType authType;
192 tLimMlmStates mlmState;
193 uint8_t authNodeIdx;
194 uint8_t challengeText[SIR_MAC_AUTH_CHALLENGE_LENGTH];
195 uint8_t fTimerStarted:1;
196 uint8_t fSeen:1;
197 uint8_t fFree:1;
198 uint8_t rsvd:5;
199 TX_TIMER timer;
200 uint16_t seq_num;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530201 unsigned long timestamp;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800202} tLimPreAuthNode, *tpLimPreAuthNode;
203
204/* Pre-authentication table definition */
205typedef struct tLimPreAuthTable {
206 uint32_t numEntry;
Naveen Rawate6ddcaa2016-02-05 16:50:18 -0800207 tLimPreAuthNode **pTable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208} tLimPreAuthTable, *tpLimPreAuthTable;
209
210/* / Per STA context structure definition */
211typedef struct sLimMlmStaContext {
212 tLimMlmStates mlmState;
213 tAniAuthType authType;
214 uint16_t listenInterval;
215 tSirMacCapabilityInfo capabilityInfo;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800216 tSirMacReasonCodes disassocReason;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800217
218 tSirResultCodes resultCode;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800219
220 uint8_t subType:1; /* Indicates ASSOC (0) or REASSOC (1) */
221 uint8_t updateContext:1;
222 uint8_t schClean:1;
223 /* 802.11n HT Capability in Station: Enabled 1 or DIsabled 0 */
224 uint8_t htCapability:1;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800225 uint8_t vhtCapability:1;
Rachit Kankane02471912017-12-27 17:13:57 +0530226 uint16_t cleanupTrigger;
227 uint16_t protStatusCode;
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800228#ifdef WLAN_FEATURE_11AX
229 bool he_capable;
230#endif
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800231} tLimMlmStaContext, *tpLimMlmStaContext;
232
233/* Structure definition to hold deferred messages queue parameters */
234typedef struct sLimDeferredMsgQParams {
Rajeev Kumar416b73f2017-01-21 16:45:21 -0800235 struct scheduler_msg deferredQueue[MAX_DEFERRED_QUEUE_LEN];
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800236 uint16_t size;
237 uint16_t read;
238 uint16_t write;
239} tLimDeferredMsgQParams, *tpLimDeferredMsgQParams;
240
241typedef struct sCfgProtection {
242 uint32_t overlapFromlla:1;
243 uint32_t overlapFromllb:1;
244 uint32_t overlapFromllg:1;
245 uint32_t overlapHt20:1;
246 uint32_t overlapNonGf:1;
247 uint32_t overlapLsigTxop:1;
248 uint32_t overlapRifs:1;
249 uint32_t overlapOBSS:1; /* added for obss */
250 uint32_t fromlla:1;
251 uint32_t fromllb:1;
252 uint32_t fromllg:1;
253 uint32_t ht20:1;
254 uint32_t nonGf:1;
255 uint32_t lsigTxop:1;
256 uint32_t rifs:1;
257 uint32_t obss:1; /* added for Obss */
258} tCfgProtection, *tpCfgProtection;
259
260typedef enum eLimProtStaCacheType {
261 eLIM_PROT_STA_CACHE_TYPE_INVALID,
262 eLIM_PROT_STA_CACHE_TYPE_llB,
263 eLIM_PROT_STA_CACHE_TYPE_llG,
264 eLIM_PROT_STA_CACHE_TYPE_HT20
265} tLimProtStaCacheType;
266
267typedef struct sCacheParams {
268 uint8_t active;
269 tSirMacAddr addr;
270 tLimProtStaCacheType protStaCacheType;
271
272} tCacheParams, *tpCacheParams;
273
274#define LIM_PROT_STA_OVERLAP_CACHE_SIZE HAL_NUM_ASSOC_STA
275#define LIM_PROT_STA_CACHE_SIZE HAL_NUM_ASSOC_STA
276
277typedef struct sLimProtStaParams {
278 uint8_t numSta;
279 uint8_t protectionEnabled;
280} tLimProtStaParams, *tpLimProtStaParams;
281
282typedef struct sLimNoShortParams {
283 uint8_t numNonShortPreambleSta;
284 tCacheParams staNoShortCache[LIM_PROT_STA_CACHE_SIZE];
285} tLimNoShortParams, *tpLimNoShortParams;
286
287typedef struct sLimNoShortSlotParams {
288 uint8_t numNonShortSlotSta;
289 tCacheParams staNoShortSlotCache[LIM_PROT_STA_CACHE_SIZE];
290} tLimNoShortSlotParams, *tpLimNoShortSlotParams;
291
292typedef struct tLimIbssPeerNode tLimIbssPeerNode;
293struct tLimIbssPeerNode {
294 tLimIbssPeerNode *next;
295 tSirMacAddr peerMacAddr;
296 uint8_t extendedRatesPresent:1;
297 uint8_t edcaPresent:1;
298 uint8_t wmeEdcaPresent:1;
299 uint8_t wmeInfoPresent:1;
300 uint8_t htCapable:1;
301 uint8_t vhtCapable:1;
302 uint8_t rsvd:2;
303 uint8_t htSecondaryChannelOffset;
304 tSirMacCapabilityInfo capabilityInfo;
305 tSirMacRateSet supportedRates;
306 tSirMacRateSet extendedRates;
307 uint8_t supportedMCSSet[SIZE_OF_SUPPORTED_MCS_SET];
308 tSirMacEdcaParamSetIE edcaParams;
309 uint8_t erpIePresent;
310
311 /* HT Capabilities of IBSS Peer */
312 uint8_t htGreenfield;
313 uint8_t htShortGI40Mhz;
314 uint8_t htShortGI20Mhz;
315
316 /* DSSS/CCK at 40 MHz: Enabled 1 or Disabled */
317 uint8_t htDsssCckRate40MHzSupport;
318
319 /* MIMO Power Save */
320 tSirMacHTMIMOPowerSaveState htMIMOPSState;
321
322 /* */
323 /* A-MPDU Density */
324 /* 000 - No restriction */
325 /* 001 - 1/8 usec */
326 /* 010 - 1/4 usec */
327 /* 011 - 1/2 usec */
328 /* 100 - 1 usec */
329 /* 101 - 2 usec */
330 /* 110 - 4 usec */
331 /* 111 - 8 usec */
332 /* */
333 uint8_t htAMpduDensity;
334
335 /* Maximum Rx A-MPDU factor */
336 uint8_t htMaxRxAMpduFactor;
337
338 /* Set to 0 for 3839 octets */
339 /* Set to 1 for 7935 octets */
340 uint8_t htMaxAmsduLength;
341
342 /* */
343 /* Recommended Tx Width Set */
344 /* 0 - use 20 MHz channel (control channel) */
345 /* 1 - use 40 Mhz channel */
346 /* */
347 uint8_t htSupportedChannelWidthSet;
348
349 uint8_t htLdpcCapable;
350
351 uint8_t beaconHBCount;
352 uint8_t heartbeatFailure;
353
354 uint8_t *beacon; /* Hold beacon to be sent to HDD/CSR */
355 uint16_t beaconLen;
356
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800357 tDot11fIEVHTCaps VHTCaps;
358 uint8_t vhtSupportedChannelWidthSet;
359 uint8_t vhtBeamFormerCapable;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800360 /*
361 * Peer Atim Info
362 */
363 uint8_t atimIePresent;
364 uint32_t peerAtimWindowLength;
365};
366
367/* Enums used for channel switching. */
368typedef enum eLimChannelSwitchState {
369 eLIM_CHANNEL_SWITCH_IDLE,
370 eLIM_CHANNEL_SWITCH_PRIMARY_ONLY,
371 eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY
372} tLimChannelSwitchState;
373
374/* Channel Switch Info */
375typedef struct sLimChannelSwitchInfo {
376 tLimChannelSwitchState state;
377 uint8_t primaryChannel;
378 uint8_t ch_center_freq_seg0;
379 uint8_t ch_center_freq_seg1;
Kiran Kumar Lokere999e58c2016-01-07 02:18:39 -0800380 uint8_t sec_ch_offset;
Kiran Kumar Lokere13644672016-02-29 15:40:10 -0800381 enum phy_ch_width ch_width;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800382 int8_t switchCount;
383 uint32_t switchTimeoutValue;
384 uint8_t switchMode;
385} tLimChannelSwitchInfo, *tpLimChannelSwitchInfo;
386
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800387typedef struct sLimOperatingModeInfo {
388 uint8_t present;
389 uint8_t chanWidth:2;
390 uint8_t reserved:2;
391 uint8_t rxNSS:3;
392 uint8_t rxNSSType:1;
393} tLimOperatingModeInfo, *tpLimOperatingModeInfo;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800394
395typedef struct sLimWiderBWChannelSwitch {
396 uint8_t newChanWidth;
397 uint8_t newCenterChanFreq0;
398 uint8_t newCenterChanFreq1;
399} tLimWiderBWChannelSwitchInfo, *tpLimWiderBWChannelSwitchInfo;
400
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800401typedef struct sLimTspecInfo {
402 /* 0==free, else used */
403 uint8_t inuse;
404 /* index in list */
405 uint8_t idx;
406 tSirMacAddr staAddr;
407 uint16_t assocId;
Jeff Johnson56471b92018-12-22 14:36:06 -0800408 struct mac_tspec_ie tspec;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800409 /* number of Tclas elements */
410 uint8_t numTclas;
411 tSirTclasInfo tclasInfo[SIR_MAC_TCLASIE_MAXNUM];
412 uint8_t tclasProc;
413 /* tclassProc is valid only if this is set to 1. */
414 uint8_t tclasProcPresent:1;
Anurag Chouhan6d760662016-02-20 16:05:43 +0530415} qdf_packed tLimTspecInfo, *tpLimTspecInfo;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800416
417typedef struct sLimAdmitPolicyInfo {
418 /* admit control policy type */
419 uint8_t type;
420 /* oversubscription factor : 0 means nothing is allowed */
421 uint8_t bw_factor;
422 /* valid only when 'type' is set BW_FACTOR */
423} tLimAdmitPolicyInfo, *tpLimAdmitPolicyInfo;
424
425typedef enum eLimWscEnrollState {
426 eLIM_WSC_ENROLL_NOOP,
427 eLIM_WSC_ENROLL_BEGIN,
428 eLIM_WSC_ENROLL_IN_PROGRESS,
429 eLIM_WSC_ENROLL_END
430} tLimWscEnrollState;
431
432#define WSC_PASSWD_ID_PUSH_BUTTON (0x0004)
433
434typedef struct sLimWscIeInfo {
435 bool apSetupLocked;
436 bool selectedRegistrar;
437 uint16_t selectedRegistrarConfigMethods;
438 tLimWscEnrollState wscEnrollmentState;
439 tLimWscEnrollState probeRespWscEnrollmentState;
440 uint8_t reqType;
441 uint8_t respType;
442} tLimWscIeInfo, *tpLimWscIeInfo;
443
444/* maximum number of tspec's supported */
445#define LIM_NUM_TSPEC_MAX 15
446
447/* structure to hold all 11h specific data */
448typedef struct sLimSpecMgmtInfo {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800449 tLimDot11hChanSwStates dot11hChanSwState;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450} tLimSpecMgmtInfo, *tpLimSpecMgmtInfo;
451
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800452#endif