summaryrefslogtreecommitdiff
path: root/core/mac/src/pe/include/lim_global.h
blob: be266725c364252b32344fed98a83f18a7a41e5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
/*
 * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
 * above copyright notice and this permission notice appear in all
 * copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 */

/*
 *
 * This file lim_global.h contains the definitions exported by
 * LIM module.
 * Author:        Chandra Modumudi
 * Date:          02/11/02
 * History:-
 * Date           Modified by    Modification Information
 * --------------------------------------------------------------------
 *
 */
#ifndef __LIM_GLOBAL_H
#define __LIM_GLOBAL_H

#include "wni_api.h"
#include "sir_api.h"
#include "sir_mac_prot_def.h"
#include "sir_mac_prop_exts.h"
#include "sir_common.h"
#include "sir_debug.h"
#include "wni_cfg.h"
#include "csr_api.h"
#include "sap_api.h"
#include "dot11f.h"
#include "wma_if.h"

/* Deferred Message Queue Length */
#define MAX_DEFERRED_QUEUE_LEN                  80

#ifdef CHANNEL_HOPPING_ALL_BANDS
#define CHAN_HOP_ALL_BANDS_ENABLE        1
#else
#define CHAN_HOP_ALL_BANDS_ENABLE        0
#endif

/* enums exported by LIM are as follows */

/*System role definition */
typedef enum eLimSystemRole {
	eLIM_UNKNOWN_ROLE,
	eLIM_AP_ROLE,
	eLIM_STA_IN_IBSS_ROLE,
	eLIM_STA_ROLE,
	eLIM_P2P_DEVICE_ROLE,
	eLIM_P2P_DEVICE_GO,
	eLIM_P2P_DEVICE_CLIENT,
	eLIM_NDI_ROLE
} tLimSystemRole;

/*
 * SME state definition accessible across all Sirius modules.
 * AP only states are LIM_SME_CHANNEL_SCAN_STATE &
 * LIM_SME_NORMAL_CHANNEL_SCAN_STATE.
 * Note that these states may also be present in STA
 * side too when DFS support is present for a STA in IBSS mode.
 */
typedef enum eLimSmeStates {
	eLIM_SME_OFFLINE_STATE,
	eLIM_SME_IDLE_STATE,
	eLIM_SME_SUSPEND_STATE,
	eLIM_SME_WT_JOIN_STATE,
	eLIM_SME_WT_AUTH_STATE,
	eLIM_SME_WT_ASSOC_STATE,
	eLIM_SME_WT_REASSOC_STATE,
	eLIM_SME_JOIN_FAILURE_STATE,
	eLIM_SME_ASSOCIATED_STATE,
	eLIM_SME_REASSOCIATED_STATE,
	eLIM_SME_LINK_EST_STATE,
	eLIM_SME_WT_PRE_AUTH_STATE,
	eLIM_SME_WT_DISASSOC_STATE,
	eLIM_SME_WT_DEAUTH_STATE,
	eLIM_SME_WT_START_BSS_STATE,
	eLIM_SME_WT_STOP_BSS_STATE,
	eLIM_SME_NORMAL_STATE,
} tLimSmeStates;

/*
 * MLM state definition.
 * While these states are present on AP too when it is
 * STA mode, per-STA MLM state exclusive to AP is:
 * eLIM_MLM_WT_AUTH_FRAME3.
 */
typedef enum eLimMlmStates {
	eLIM_MLM_OFFLINE_STATE,
	eLIM_MLM_IDLE_STATE,
	eLIM_MLM_WT_JOIN_BEACON_STATE,
	eLIM_MLM_JOINED_STATE,
	eLIM_MLM_BSS_STARTED_STATE,
	eLIM_MLM_WT_AUTH_FRAME2_STATE,
	eLIM_MLM_WT_AUTH_FRAME3_STATE,
	eLIM_MLM_WT_AUTH_FRAME4_STATE,
	eLIM_MLM_AUTH_RSP_TIMEOUT_STATE,
	eLIM_MLM_AUTHENTICATED_STATE,
	eLIM_MLM_WT_ASSOC_RSP_STATE,
	eLIM_MLM_WT_REASSOC_RSP_STATE,
	eLIM_MLM_ASSOCIATED_STATE,
	eLIM_MLM_REASSOCIATED_STATE,
	eLIM_MLM_LINK_ESTABLISHED_STATE,
	eLIM_MLM_WT_ASSOC_CNF_STATE,
	eLIM_MLM_WT_ADD_BSS_RSP_STATE,
	eLIM_MLM_WT_DEL_BSS_RSP_STATE,
	eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE,
	eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE,
	eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE,
	eLIM_MLM_WT_ADD_STA_RSP_STATE,
	eLIM_MLM_WT_DEL_STA_RSP_STATE,
	/*
	 * MLM goes to this state when LIM initiates DELETE_STA
	 * as processing of Assoc req because the entry already exists.
	 * LIM comes out of this state when DELETE_STA response from
	 * HAL is received. LIM needs to maintain this state so that ADD_STA
	 * can be issued while processing DELETE_STA response from HAL.
	 */
	eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE,
	eLIM_MLM_WT_SET_BSS_KEY_STATE,
	eLIM_MLM_WT_SET_STA_KEY_STATE,
	eLIM_MLM_WT_SET_STA_BCASTKEY_STATE,
	eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE,
	eLIM_MLM_WT_FT_REASSOC_RSP_STATE,
	eLIM_MLM_WT_SAE_AUTH_STATE,
} tLimMlmStates;

/* 11h channel switch states */

/*
 * This enum indicates in which state the channel-swith
 * is presently operating.
 * eLIM_11H_CHANSW_INIT - Default state
 * eLIM_11H_CHANSW_RUNNING - When channel switch is running
 * eLIM_11H_CHANSW_END - After channel switch is complete
 */
typedef enum eLimDot11hChanSwStates {
	eLIM_11H_CHANSW_INIT,
	eLIM_11H_CHANSW_RUNNING,
	eLIM_11H_CHANSW_END
} tLimDot11hChanSwStates;

/* MLM Req/Cnf structure definitions */
typedef struct sLimMlmAuthReq {
	tSirMacAddr peerMacAddr;
	tAniAuthType authType;
	uint8_t sessionId;
} tLimMlmAuthReq, *tpLimMlmAuthReq;

typedef struct sLimMlmJoinReq {
	tSirMacRateSet operationalRateSet;
	uint8_t sessionId;
	struct bss_description bssDescription;
	/*
	 * WARNING: Pls make bssDescription as last variable in struct
	 * tLimMlmJoinReq as it has ieFields followed after this bss
	 * description. Adding a variable after this corrupts the ieFields
	 */
} tLimMlmJoinReq, *tpLimMlmJoinReq;

/* Forward declarations */
struct sSirAssocReq;
struct sDphHashNode;

/* struct lim_assoc_data - Assoc data to be cached to defer association
 *			   indication to SME
 * @present: Indicates whether assoc data is present or not
 * @sub_type: Indicates whether it is Association Request(=0) or Reassociation
 *            Request(=1) frame
 * @hdr: MAC header
 * @assoc_req: pointer to parsed ASSOC/REASSOC Request frame
 * @pmf_connection: flag indicating pmf connection
 * @assoc_req_copied: boolean to indicate if assoc req was copied to tmp above
 * @dup_entry: flag indicating if duplicate entry found
 * @sta_ds: station dph entry
 */
struct lim_assoc_data {
	bool present;
	uint8_t sub_type;
	tSirMacMgmtHdr hdr;
	struct sSirAssocReq *assoc_req;
	bool pmf_connection;
	bool assoc_req_copied;
	bool dup_entry;
	struct sDphHashNode *sta_ds;
};

/* Pre-authentication structure definition */
typedef struct tLimPreAuthNode {
	struct tLimPreAuthNode *next;
	tSirMacAddr peerMacAddr;
	tAniAuthType authType;
	tLimMlmStates mlmState;
	uint8_t authNodeIdx;
	uint8_t challengeText[SIR_MAC_AUTH_CHALLENGE_LENGTH];
	uint8_t fTimerStarted:1;
	uint8_t fSeen:1;
	uint8_t fFree:1;
	uint8_t rsvd:5;
	TX_TIMER timer;
	uint16_t seq_num;
	unsigned long timestamp;
	/* keeping copy of association request received, this is
	 * to defer the association request processing
	 */
	struct lim_assoc_data assoc_req;
} tLimPreAuthNode, *tpLimPreAuthNode;

/* Pre-authentication table definition */
typedef struct tLimPreAuthTable {
	uint32_t numEntry;
	tLimPreAuthNode **pTable;
} tLimPreAuthTable, *tpLimPreAuthTable;

/**
 * struct lim_sta_context - LIM per STA structure
 * @mlmState: LIM State
 * @authType: Authentication algorithm
 * @akm_type: AKM of the connection
 * @listenInterval: Listen interval
 * @capabilityInfo: Capabilities
 * @disassocReason: Disassociation reason code
 * @resultCode:     Result code
 * @subType:        Indicates association or reassociation
 * @updateContext:  Update context
 * @schClean:       Scheduler clean
 * @htCapability:   802.11n HT capability
 * @vhtCapability:  802.11ac VHT capability
 * @cleanupTrigger: Cleanup trigger
 * @protStatusCode: Protocol Status code
 * @he_capable:     802.11ax HE capability
 * @owe_ie:         Pointer to OWE IE
 * @owe_ie_len:     Length of OWE IE
 */
struct lim_sta_context {
	tLimMlmStates mlmState;
	tAniAuthType authType;		/* auth algo in auth frame */
	enum ani_akm_type akm_type;	/* akm in rsn/wpa ie */
	uint16_t listenInterval;
	tSirMacCapabilityInfo capabilityInfo;
	tSirMacReasonCodes disassocReason;

	tSirResultCodes resultCode;

	uint8_t subType:1;      /* Indicates ASSOC (0) or REASSOC (1) */
	uint8_t updateContext:1;
	uint8_t schClean:1;
	/* 802.11n HT Capability in Station: Enabled 1 or DIsabled 0 */
	uint8_t htCapability:1;
	uint8_t vhtCapability:1;
	uint16_t cleanupTrigger;
	uint16_t protStatusCode;
#ifdef WLAN_FEATURE_11AX
	bool he_capable;
#endif
	uint8_t *owe_ie;
	uint32_t owe_ie_len;
};

/* Structure definition to hold deferred messages queue parameters */
typedef struct sLimDeferredMsgQParams {
	struct scheduler_msg deferredQueue[MAX_DEFERRED_QUEUE_LEN];
	uint16_t size;
	uint16_t read;
	uint16_t write;
} tLimDeferredMsgQParams, *tpLimDeferredMsgQParams;

typedef struct sCfgProtection {
	uint32_t overlapFromlla:1;
	uint32_t overlapFromllb:1;
	uint32_t overlapFromllg:1;
	uint32_t overlapHt20:1;
	uint32_t overlapNonGf:1;
	uint32_t overlapLsigTxop:1;
	uint32_t overlapRifs:1;
	uint32_t overlapOBSS:1; /* added for obss */
	uint32_t fromlla:1;
	uint32_t fromllb:1;
	uint32_t fromllg:1;
	uint32_t ht20:1;
	uint32_t nonGf:1;
	uint32_t lsigTxop:1;
	uint32_t rifs:1;
	uint32_t obss:1;        /* added for Obss */
} tCfgProtection, *tpCfgProtection;

typedef enum eLimProtStaCacheType {
	eLIM_PROT_STA_CACHE_TYPE_INVALID,
	eLIM_PROT_STA_CACHE_TYPE_llB,
	eLIM_PROT_STA_CACHE_TYPE_llG,
	eLIM_PROT_STA_CACHE_TYPE_HT20
} tLimProtStaCacheType;

typedef struct sCacheParams {
	uint8_t active;
	tSirMacAddr addr;
	tLimProtStaCacheType protStaCacheType;

} tCacheParams, *tpCacheParams;

#define LIM_PROT_STA_OVERLAP_CACHE_SIZE    HAL_NUM_ASSOC_STA
#define LIM_PROT_STA_CACHE_SIZE            HAL_NUM_ASSOC_STA

typedef struct sLimProtStaParams {
	uint8_t numSta;
	uint8_t protectionEnabled;
} tLimProtStaParams, *tpLimProtStaParams;

typedef struct sLimNoShortParams {
	uint8_t numNonShortPreambleSta;
	tCacheParams staNoShortCache[LIM_PROT_STA_CACHE_SIZE];
} tLimNoShortParams, *tpLimNoShortParams;

typedef struct sLimNoShortSlotParams {
	uint8_t numNonShortSlotSta;
	tCacheParams staNoShortSlotCache[LIM_PROT_STA_CACHE_SIZE];
} tLimNoShortSlotParams, *tpLimNoShortSlotParams;

typedef struct tLimIbssPeerNode tLimIbssPeerNode;
struct tLimIbssPeerNode {
	tLimIbssPeerNode *next;
	tSirMacAddr peerMacAddr;
	uint8_t extendedRatesPresent:1;
	uint8_t edcaPresent:1;
	uint8_t wmeEdcaPresent:1;
	uint8_t wmeInfoPresent:1;
	uint8_t htCapable:1;
	uint8_t vhtCapable:1;
	uint8_t rsvd:2;
	uint8_t htSecondaryChannelOffset;
	tSirMacCapabilityInfo capabilityInfo;
	tSirMacRateSet supportedRates;
	tSirMacRateSet extendedRates;
	uint8_t supportedMCSSet[SIZE_OF_SUPPORTED_MCS_SET];
	tSirMacEdcaParamSetIE edcaParams;
	uint8_t erpIePresent;

	/* HT Capabilities of IBSS Peer */
	uint8_t htGreenfield;
	uint8_t htShortGI40Mhz;
	uint8_t htShortGI20Mhz;

	/* DSSS/CCK at 40 MHz: Enabled 1 or Disabled */
	uint8_t htDsssCckRate40MHzSupport;

	/* MIMO Power Save */
	tSirMacHTMIMOPowerSaveState htMIMOPSState;

	/* */
	/* A-MPDU Density */
	/* 000 - No restriction */
	/* 001 - 1/8 usec */
	/* 010 - 1/4 usec */
	/* 011 - 1/2 usec */
	/* 100 - 1 usec */
	/* 101 - 2 usec */
	/* 110 - 4 usec */
	/* 111 - 8 usec */
	/* */
	uint8_t htAMpduDensity;

	/* Maximum Rx A-MPDU factor */
	uint8_t htMaxRxAMpduFactor;

	/* Set to 0 for 3839 octets */
	/* Set to 1 for 7935 octets */
	uint8_t htMaxAmsduLength;

	/* */
	/* Recommended Tx Width Set */
	/* 0 - use 20 MHz channel (control channel) */
	/* 1 - use 40 Mhz channel */
	/* */
	uint8_t htSupportedChannelWidthSet;

	uint8_t htLdpcCapable;

	uint8_t beaconHBCount;
	uint8_t heartbeatFailure;

	uint8_t *beacon;        /* Hold beacon to be sent to HDD/CSR */
	uint16_t beaconLen;

	tDot11fIEVHTCaps VHTCaps;
	uint8_t vhtSupportedChannelWidthSet;
	uint8_t vhtBeamFormerCapable;
	/*
	 * Peer Atim Info
	 */
	uint8_t atimIePresent;
	uint32_t peerAtimWindowLength;
};

/* Enums used for channel switching. */
typedef enum eLimChannelSwitchState {
	eLIM_CHANNEL_SWITCH_IDLE,
	eLIM_CHANNEL_SWITCH_PRIMARY_ONLY,
	eLIM_CHANNEL_SWITCH_PRIMARY_AND_SECONDARY
} tLimChannelSwitchState;

/* Channel Switch Info */
typedef struct sLimChannelSwitchInfo {
	tLimChannelSwitchState state;
	uint8_t primaryChannel;
	uint8_t ch_center_freq_seg0;
	uint8_t ch_center_freq_seg1;
	uint8_t sec_ch_offset;
	enum phy_ch_width ch_width;
	int8_t switchCount;
	uint32_t switchTimeoutValue;
	uint8_t switchMode;
} tLimChannelSwitchInfo, *tpLimChannelSwitchInfo;

typedef struct sLimOperatingModeInfo {
	uint8_t present;
	uint8_t chanWidth:2;
	uint8_t reserved:2;
	uint8_t rxNSS:3;
	uint8_t rxNSSType:1;
} tLimOperatingModeInfo, *tpLimOperatingModeInfo;

typedef struct sLimWiderBWChannelSwitch {
	uint8_t newChanWidth;
	uint8_t newCenterChanFreq0;
	uint8_t newCenterChanFreq1;
} tLimWiderBWChannelSwitchInfo, *tpLimWiderBWChannelSwitchInfo;

typedef struct sLimTspecInfo {
	/* 0==free, else used */
	uint8_t inuse;
	/* index in list */
	uint8_t idx;
	tSirMacAddr staAddr;
	uint16_t assocId;
	struct mac_tspec_ie tspec;
	/* number of Tclas elements */
	uint8_t numTclas;
	tSirTclasInfo tclasInfo[SIR_MAC_TCLASIE_MAXNUM];
	uint8_t tclasProc;
	/* tclassProc is valid only if this is set to 1. */
	uint8_t tclasProcPresent:1;
} qdf_packed tLimTspecInfo, *tpLimTspecInfo;

typedef struct sLimAdmitPolicyInfo {
	/* admit control policy type */
	uint8_t type;
	/* oversubscription factor : 0 means nothing is allowed */
	uint8_t bw_factor;
	/* valid only when 'type' is set BW_FACTOR */
} tLimAdmitPolicyInfo, *tpLimAdmitPolicyInfo;

typedef enum eLimWscEnrollState {
	eLIM_WSC_ENROLL_NOOP,
	eLIM_WSC_ENROLL_BEGIN,
	eLIM_WSC_ENROLL_IN_PROGRESS,
	eLIM_WSC_ENROLL_END
} tLimWscEnrollState;

#define WSC_PASSWD_ID_PUSH_BUTTON         (0x0004)

typedef struct sLimWscIeInfo {
	bool apSetupLocked;
	bool selectedRegistrar;
	uint16_t selectedRegistrarConfigMethods;
	tLimWscEnrollState wscEnrollmentState;
	tLimWscEnrollState probeRespWscEnrollmentState;
	uint8_t reqType;
	uint8_t respType;
} tLimWscIeInfo, *tpLimWscIeInfo;

/* maximum number of tspec's supported */
#define LIM_NUM_TSPEC_MAX      15

/* structure to hold all 11h specific data */
typedef struct sLimSpecMgmtInfo {
	tLimDot11hChanSwStates dot11hChanSwState;
} tLimSpecMgmtInfo, *tpLimSpecMgmtInfo;

/**
 * struct lim_delba_req_info - Delba request struct
 * @vdev_id: vdev id
 * @peer_macaddr: peer mac address
 * @tid: tid
 * @reason_code: reason code
 */
struct lim_delba_req_info {
	uint8_t vdev_id;
	tSirMacAddr peer_macaddr;
	uint8_t tid;
	uint8_t reason_code;
};
#endif