blob: cc9bf9b8c2bcdb1e1cd2af11aa74d47708d0e093 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limApi.cc contains the functions that are
45 * exported by LIM to other modules.
46 *
47 * Author: Chandra Modumudi
48 * Date: 02/11/02
49 * History:-
50 * Date Modified by Modification Information
51 * --------------------------------------------------------------------
52 *
53 */
54#include "palTypes.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include "wniCfgSta.h"
56#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "sirCommon.h"
58#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60
61#include "schApi.h"
62#include "utilsApi.h"
63#include "limApi.h"
64#include "limGlobal.h"
65#include "limTypes.h"
66#include "limUtils.h"
67#include "limAssocUtils.h"
68#include "limPropExtsUtils.h"
69#include "limSerDesUtils.h"
70#include "limIbssPeerMgmt.h"
71#include "limAdmitControl.h"
72#include "pmmApi.h"
73#include "logDump.h"
74#include "limSendSmeRspMessages.h"
75#include "wmmApsd.h"
76#include "limTrace.h"
77#include "limSession.h"
78#include "wlan_qct_wda.h"
79
80#if defined WLAN_FEATURE_VOWIFI
81#include "rrmApi.h"
82#endif
83
84#include <limFT.h>
85
86#ifdef VOSS_ENABLED
87#include "vos_types.h"
88#include "vos_packet.h"
89#include "wlan_qct_tl.h"
90#include "sysStartup.h"
91#endif
92
93
94static void __limInitScanVars(tpAniSirGlobal pMac)
95{
96 pMac->lim.gLimUseScanModeForLearnMode = 1;
97
98 pMac->lim.gLimSystemInScanLearnMode = 0;
99
100 // Scan related globals on STA
101 pMac->lim.gLimReturnAfterFirstMatch = 0;
102 pMac->lim.gLim24Band11dScanDone = 0;
103 pMac->lim.gLim50Band11dScanDone = 0;
104 pMac->lim.gLimReturnUniqueResults = 0;
105
106 // Background Scan related globals on STA
107 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
108 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
109 pMac->lim.gLimNumOfForcedBkgndScan = 0;
110 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
111 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
112 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
113 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
114
115 pMac->lim.gLimCurrentScanChannelId = 0;
116 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800117 pMac->lim.gpLimSmeScanReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 pMac->lim.gLimMlmScanResultLength = 0;
119 pMac->lim.gLimSmeScanResultLength = 0;
120
121 palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
122 sizeof(pMac->lim.gLimCachedScanHashTable));
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 pMac->lim.gLimBackgroundScanChannelId = 0;
125 pMac->lim.gLimBackgroundScanStarted = 0;
126 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
127 pMac->lim.gLimRestoreCBCount = 0;
128 palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700129
130 /* Fill in default values */
131 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
132
Jeff Johnson295189b2012-06-20 16:38:30 -0700133
134 // abort scan is used to abort an on-going scan
135 pMac->lim.abortScan = 0;
136 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
137
138//WLAN_SUSPEND_LINK Related
139 pMac->lim.gpLimSuspendCallback = NULL;
140 pMac->lim.gpLimResumeCallback = NULL;
141//end WLAN_SUSPEND_LINK Related
142}
143
144
145static void __limInitBssVars(tpAniSirGlobal pMac)
146{
147
148 palZeroMemory(pMac->hHdd, (void*)pMac->lim.gpSession, sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
149
150
151 //pMac->lim.gpLimStartBssReq = NULL;
152
Jeff Johnson295189b2012-06-20 16:38:30 -0700153
154
155
156/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
157#if 0
158
159 // Place holder for BSS description that we're
160 // currently joined with
161 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
162 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
163 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
164 pMac->lim.gLimCurrentBssCaps = 0;
165 QosCaps is a bit map of various qos capabilities - see defn above
166 pMac->lim.gLimCurrentBssQosCaps = 0;
167 pMac->lim.gLimCurrentBssPropCap = 0;
168 pMac->lim.gLimSentCapsChangeNtf = 0;
169
170 // Place holder for BSS description that
171 // we're currently Reassociating
172 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
173 pMac->lim.gLimReassocChannelId = 0;
174 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
175 pMac->lim.gLimReassocBssCaps = 0;
176 pMac->lim.gLimReassocBssQosCaps = 0;
177 pMac->lim.gLimReassocBssPropCap = 0;
178 #endif
179
180 /* This is for testing purposes only, be default should always be off */
181 pMac->lim.gLimForceNoPropIE = 0;
182
183 // pMac->lim.gLimBssIdx = 0;
184
185 pMac->lim.gpLimMlmSetKeysReq = NULL;
186 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
187 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
188
189}
190
191
192static void __limInitStatsVars(tpAniSirGlobal pMac)
193{
194 pMac->lim.gLimNumBeaconsRcvd = 0;
195 pMac->lim.gLimNumBeaconsIgnored = 0;
196
197 pMac->lim.gLimNumDeferredMsgs = 0;
198
199 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800200 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
202
203 /// This indicates number of RXed Beacons during HB period
204 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
205
206 // Heart-Beat interval value
207 pMac->lim.gLimHeartBeatCount = 0;
208
209 // Statistics to keep track of no. beacons rcvd in heart beat interval
210 palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
211
212#ifdef WLAN_DEBUG
213 // Debug counters
214 pMac->lim.numTot = 0;
215 pMac->lim.numBbt = 0;
216 pMac->lim.numProtErr = 0;
217 pMac->lim.numLearn = 0;
218 pMac->lim.numLearnIgnore = 0;
219 pMac->lim.numSme = 0;
220 palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
221 pMac->lim.gLimNumAssocReqDropInvldState = 0;
222 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
223 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
224 pMac->lim.gLimNumReassocReqDropInvldState = 0;
225 pMac->lim.gLimNumHashMissIgnored = 0;
226 pMac->lim.gLimUnexpBcnCnt = 0;
227 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
228 pMac->lim.gLimNumLinkEsts = 0;
229 pMac->lim.gLimNumRxCleanup = 0;
230 pMac->lim.gLim11bStaAssocRejectCount = 0;
231#endif
232}
233
234
235
236static void __limInitStates(tpAniSirGlobal pMac)
237{
238 // Counts Heartbeat failures
239 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
240 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
241 pMac->lim.gLimHBfailureCntInOtherStates = 0;
242 pMac->lim.gLimRspReqd = 0;
243 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
244
245 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700246 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
248
249 /// Previous MLM State
250 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
251
252#ifdef GEN4_SCAN
253 // LIM to HAL SCAN Management Message Interface states
254 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
255#endif // GEN4_SCAN
256
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700258 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700260 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700261
262 /**
263 * By default assume 'unknown' role. This will be updated
264 * when SME_START_BSS_REQ is received.
265 */
266
267 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
268 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
269 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
270 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
271 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
272 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
273
274 pMac->lim.gLimPhyMode = 0;
275 pMac->lim.scanStartTime = 0; // used to measure scan time
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
278 pMac->lim.ackPolicy = 0;
279
280#if 0 /* Moving all these to session specific elements */
281 pMac->lim.gLimQosEnabled = 0; //11E
282 pMac->lim.gLimWmeEnabled = 0; //WME
283 pMac->lim.gLimWsmEnabled = 0; //WSM
284 pMac->lim.gLimHcfEnabled = 0;
285 pMac->lim.gLim11dEnabled = 0;
286#endif
287
288 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
289}
290
291static void __limInitVars(tpAniSirGlobal pMac)
292{
293
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700296
297 // WDS info
298 pMac->lim.gLimNumWdsInfoInd = 0;
299 pMac->lim.gLimNumWdsInfoSet = 0;
300 palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
301 /* initialize some parameters */
302 limInitWdsInfoParams(pMac);
303
304 // Deferred Queue Paramters
305 palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
306
307 // addts request if any - only one can be outstanding at any time
308 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
309 pMac->lim.gLimAddtsSent = 0;
310 pMac->lim.gLimAddtsRspTimerCount = 0;
311
312 //protection related config cache
313 palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
314 pMac->lim.gLimProtectionControl = 0;
315 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
316 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
317
Jeff Johnsone7245742012-09-05 17:12:55 -0700318#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
321 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700322#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 // WMM Related Flag
324 pMac->lim.gUapsdEnable = 0;
325 pMac->lim.gUapsdPerAcBitmask = 0;
326 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
327 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
328
329 // QoS-AC Downgrade: Initially, no AC is admitted
330 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
331 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
332
333 //dialogue token List head/tail for Action frames request sent.
334 pMac->lim.pDialogueTokenHead = NULL;
335 pMac->lim.pDialogueTokenTail = NULL;
336
337 palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
338
339 // admission control policy information
340 palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
341
342 pMac->lim.gLastBeaconDtimCount = 0;
343 pMac->lim.gLastBeaconDtimPeriod = 0;
344
345 //Scan in Power Save Flag
346 pMac->lim.gScanInPowersave = 0;
347}
348
349static void __limInitAssocVars(tpAniSirGlobal pMac)
350{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800351 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800352#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
354 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
355 pMac->lim.freeAidHead = 0;
356 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800357#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800358 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
359 {
360 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
361 }
362 pMac->lim.gLimAssocStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700363
364 // Place holder for current authentication request
365 // being handled
366 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700367 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700368
369 /// MAC level Pre-authentication related globals
370 pMac->lim.gLimPreAuthChannelNumber = 0;
371 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
372 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
373 pMac->lim.gLimNumPreAuthContexts = 0;
374 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
375
376 // Placed holder to deauth reason
377 pMac->lim.gLimDeauthReasonCode = 0;
378
379 // Place holder for Pre-authentication node list
380 pMac->lim.pLimPreAuthList = NULL;
381
382 // Send Disassociate frame threshold parameters
383 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
384 pMac->lim.gLimDisassocFrameCredit = 0;
385
386 //One cache for each overlap and associated case.
387 palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
388 palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
389
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700390#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
391 pMac->lim.pSessionEntry = NULL;
392 pMac->lim.reAssocRetryAttempt = 0;
393#endif
394
Jeff Johnson295189b2012-06-20 16:38:30 -0700395}
396
397
398static void __limInitTitanVars(tpAniSirGlobal pMac)
399{
Jeff Johnsone7245742012-09-05 17:12:55 -0700400#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700403 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
404#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 // Debug workaround for BEACON's
406 // State change triggered by "dump 222"
407 pMac->lim.gLimScanOverride = 1;
408 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 pMac->lim.gLimTitanStaCount = 0;
410 pMac->lim.gLimBlockNonTitanSta = 0;
411}
412
413static void __limInitHTVars(tpAniSirGlobal pMac)
414{
415 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 pMac->lim.gHTShortGI40Mhz = 0;
418 pMac->lim.gHTShortGI20Mhz = 0;
419 pMac->lim.gHTMaxAmsduLength = 0;
420 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
421 pMac->lim.gHTPSMPSupport = 0;
422 pMac->lim.gHTLsigTXOPProtection = 0;
423 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
424 pMac->lim.gHTAMpduDensity = 0;
425
426 pMac->lim.gMaxAmsduSizeEnabled = false;
427 pMac->lim.gHTMaxRxAMpduFactor = 0;
428 pMac->lim.gHTServiceIntervalGranularity = 0;
429 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
431 pMac->lim.gHTPCOActive = 0;
432
433 pMac->lim.gHTPCOPhase = 0;
434 pMac->lim.gHTSecondaryBeacon = 0;
435 pMac->lim.gHTDualCTSProtection = 0;
436 pMac->lim.gHTSTBCBasicMCS = 0;
437 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
438}
439
Jeff Johnson295189b2012-06-20 16:38:30 -0700440static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
441{
Jeff Johnsone7245742012-09-05 17:12:55 -0700442 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 tANI_U16 val16;
444 tANI_U8 val8;
445 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
446 tSirMacHTInfoField1 *pHTInfoField1;
447 tpSirPowerSaveCfg pPowerSaveConfig;
448 tSirMacHTParametersInfo *pAmpduParamInfo;
449
450 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700451 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
452 * and they will be used throughout when there is no session
453 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
456 {
457 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
458 return eSIR_FAILURE;
459 }
460
461 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
462 {
463 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
464 return eSIR_FAILURE;
465 }
466 val16 = ( tANI_U16 ) val1;
467 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
468
469 //channel bonding mode could be set to anything from 0 to 4(Titan had these
470 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
471 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
472 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
473 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
474 != eSIR_SUCCESS)
475 {
476 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
477 return eSIR_FAILURE;
478 }
479
480 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
481 {
482 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
483 return eSIR_FAILURE;
484 }
485
486 val8 = ( tANI_U8 ) val1;
487 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
488 pHTInfoField1->recommendedTxWidthSet =
489 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
491 != eSIR_SUCCESS)
492 {
493 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
494 return eSIR_FAILURE;
495 }
496
497 /* WNI_CFG_HEART_BEAT_THRESHOLD */
498
499 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
500 eSIR_SUCCESS )
501 {
502 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
503 return eSIR_FAILURE;
504 }
505 if(!val1)
506 {
507 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
508 pMac->sys.gSysEnableLinkMonitorMode = 0;
509 }
510 else
511 {
512 //No need to activate the timer during init time.
513 pMac->sys.gSysEnableLinkMonitorMode = 1;
514 }
515
516 /* WNI_CFG_SHORT_GI_20MHZ */
517
518 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
519 {
520 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
521 return eSIR_FAILURE;
522 }
523 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
524 {
525 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
526 return eSIR_FAILURE;
527 }
528 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
529 {
530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
531 return eSIR_FAILURE;
532 }
533
534 val16 = ( tANI_U16 ) val1;
535 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
536 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
537 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
538
539 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
540 eSIR_SUCCESS)
541 {
542 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
543 return eSIR_FAILURE;
544 }
545
546 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
547
548 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
549 {
550 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
551 return eSIR_FAILURE;
552 }
553 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
554 {
555 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
556 return eSIR_FAILURE;
557 }
558 val16 = ( tANI_U16 ) val1;
559 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
560 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
561 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
562 eSIR_SUCCESS)
563 {
564 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
565 return eSIR_FAILURE;
566 }
567
568 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
569 limHandleCFGparamUpdate do we want to update this? */
570 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
571 {
572 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
573 return eSIR_FAILURE;
574 }
575
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 /* WNI_CFG_MAX_PS_POLL */
577
578 /* Allocate and fill in power save configuration. */
579 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
580 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
581 {
582 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
583 "configuration\n"));)
584 return eSIR_FAILURE;
585 }
586
587 /* This context should be valid if power-save configuration message has been
588 * already dispatched during initialization process. Re-using the present
589 * configuration mask
590 */
591 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
592 sizeof(tSirPowerSaveCfg));
593
594 /* Note: it is okay to do this since DAL/HAL is alrady started */
595 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
596 {
597 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
598 return eSIR_FAILURE;
599 }
600
601 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
602
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 PELOG1(limLog(pMac, LOG1,
604 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
605 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700606
607 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
608
609 /* This was initially done after resume notification from HAL. Now, DAL is
610 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700611 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800612 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
613 {
614 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed\n"));
615 return eSIR_FAILURE;
616 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700617
618 return eSIR_SUCCESS;
619}
Jeff Johnson295189b2012-06-20 16:38:30 -0700620
621/*
622 limStart
623 This function is to replace the __limProcessSmeStartReq since there is no
624 eWNI_SME_START_REQ post to PE.
625*/
626tSirRetStatus limStart(tpAniSirGlobal pMac)
627{
628 tSirResultCodes retCode = eSIR_SUCCESS;
629
630 PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
631
632 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
633 {
634 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
635
Jeff Johnsone7245742012-09-05 17:12:55 -0700636 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700637
638 // By default do not return after first scan match
639 pMac->lim.gLimReturnAfterFirstMatch = 0;
640
641 // Initialize MLM state machine
642 limInitMlm(pMac);
643
644 // By default return unique scan results
645 pMac->lim.gLimReturnUniqueResults = true;
646 pMac->lim.gLimSmeScanResultLength = 0;
647 }
648 else
649 {
650 /**
651 * Should not have received eWNI_SME_START_REQ in states
652 * other than OFFLINE. Return response to host and
653 * log error
654 */
655 limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
656 retCode = eSIR_FAILURE;
657 }
658
659 return retCode;
660}
661
662/**
663 * limInitialize()
664 *
665 *FUNCTION:
666 * This function is called from LIM thread entry function.
667 * LIM related global data structures are initialized in this function.
668 *
669 *LOGIC:
670 * NA
671 *
672 *ASSUMPTIONS:
673 * NA
674 *
675 *NOTE:
676 * NA
677 *
678 * @param pMac - Pointer to global MAC structure
679 * @return None
680 */
681
682tSirRetStatus
683limInitialize(tpAniSirGlobal pMac)
684{
685 tSirRetStatus status = eSIR_SUCCESS;
686
687 __limInitAssocVars(pMac);
688 __limInitVars(pMac);
689 __limInitStates(pMac);
690 __limInitStatsVars(pMac);
691 __limInitBssVars(pMac);
692 __limInitScanVars(pMac);
693 __limInitHTVars(pMac);
694 __limInitTitanVars(pMac);
695
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 status = limStart(pMac);
697 if(eSIR_SUCCESS != status)
698 {
699 return status;
700 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700701
702 /*
703 * MLM will be intitalized when 'START' request comes from SME.
704 * limInitMlm calls limCreateTimers, which actually relies on
705 * CFG to be downloaded. So it should not be called as part of
706 * peStart, as CFG download is happening after peStart.
707 */
708 //limInitMlm(pMac);
709 // Initializations for maintaining peers in IBSS
710 limIbssInit(pMac);
711
712 pmmInitialize(pMac);
713
714
715#if defined WLAN_FEATURE_VOWIFI
716 rrmInitialize(pMac);
717#endif
718#if defined WLAN_FEATURE_VOWIFI_11R
719 limFTOpen(pMac);
720#endif
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700723
724#if 0
725
726 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
727 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
728 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
729
730 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
731 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
732
733 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
734 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
735 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
736
737 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
738
739 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
740
741 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
742 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
743
744 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
745
746
747 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
748
749 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
750#endif
751 MTRACE(limTraceInit(pMac));
752
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 //Initialize the configurations needed by PE
754 if( eSIR_FAILURE == __limInitConfig(pMac))
755 {
756 //We need to undo everything in limStart
757 limCleanupMlm(pMac);
758 return eSIR_FAILURE;
759 }
760
761 //initialize the TSPEC admission control table.
762 //Note that this was initially done after resume notification from HAL.
763 //Now, DAL is started before PE so this can be done here
764 limAdmitControlInit(pMac);
765 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700766
767 return status;
768
769} /*** end limInitialize() ***/
770
771
772
773/**
774 * limCleanup()
775 *
776 *FUNCTION:
777 * This function is called upon reset or persona change
778 * to cleanup LIM state
779 *
780 *LOGIC:
781 * NA
782 *
783 *ASSUMPTIONS:
784 * NA
785 *
786 *NOTE:
787 * NA
788 *
789 * @param pMac - Pointer to Global MAC structure
790 * @return None
791 */
792
793void
794limCleanup(tpAniSirGlobal pMac)
795{
796#ifdef VOSS_ENABLED
797 v_PVOID_t pvosGCTx;
798 VOS_STATUS retStatus;
799#endif
800
Jeff Johnson295189b2012-06-20 16:38:30 -0700801//Before destroying the list making sure all the nodes have been deleted.
802//Which should be the normal case, but a memory leak has been reported.
803
804 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
805
806 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
807 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
808 {
809 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
810 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
811
812 palFreeMemory(pMac, pLimMgmtRegistration);
813 }
814
815 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700816
817 limCleanupMlm(pMac);
818 limCleanupLmm(pMac);
819
820 // free up preAuth table
821 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
822 {
823 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
824 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
825 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
826 }
827
828 if(NULL != pMac->lim.pDialogueTokenHead)
829 {
830 limDeleteDialogueTokenList(pMac);
831 }
832
833 if(NULL != pMac->lim.pDialogueTokenTail)
834 {
835 palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
836 pMac->lim.pDialogueTokenTail = NULL;
837 }
838
839 # if 0
840 if (pMac->lim.gpLimStartBssReq != NULL)
841 {
842 palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
843 pMac->lim.gpLimStartBssReq = NULL;
844 }
845 #endif
846
847 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
848 {
849 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
850 pMac->lim.gpLimMlmSetKeysReq = NULL;
851 }
852
853 #if 0
854 if (pMac->lim.gpLimJoinReq != NULL)
855 {
856 palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
857 pMac->lim.gpLimJoinReq = NULL;
858 }
859 #endif
860
861 if (pMac->lim.gpLimMlmAuthReq != NULL)
862 {
863 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
864 pMac->lim.gpLimMlmAuthReq = NULL;
865 }
866
Jeff Johnsone7245742012-09-05 17:12:55 -0700867#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 if (pMac->lim.gpLimMlmJoinReq != NULL)
869 {
870 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
871 pMac->lim.gpLimMlmJoinReq = NULL;
872 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700873#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700874
875 #if 0
876 if (pMac->lim.gpLimReassocReq != NULL)
877 {
878 palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
879 pMac->lim.gpLimReassocReq = NULL;
880 }
881 #endif
882
883 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
884 {
885 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
886 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
887 }
888
Viral Modid86bde22012-12-10 13:09:21 -0800889 if (pMac->lim.gpLimSmeScanReq != NULL)
890 {
891 palFreeMemory(pMac->hHdd, pMac->lim.gpLimSmeScanReq);
892 pMac->lim.gpLimSmeScanReq = NULL;
893 }
Viral Modid86bde22012-12-10 13:09:21 -0800894
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 if (pMac->lim.gpLimMlmScanReq != NULL)
896 {
897 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
898 pMac->lim.gpLimMlmScanReq = NULL;
899 }
900
901#if 0
902 if(NULL != pMac->lim.beacon)
903 {
904 palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
905 pMac->lim.beacon = NULL;
906 }
907#endif
908 #if 0
909 if(NULL != pMac->lim.assocReq)
910 {
911 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
912 pMac->lim.assocReq= NULL;
913 }
914 #endif
915
916#if 0
917 if(NULL != pMac->lim.assocRsp)
918 {
919 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
920 pMac->lim.assocRsp= NULL;
921 }
922#endif
923 // Now, finally reset the deferred message queue pointers
924 limResetDeferredMsgQ(pMac);
925
926#ifdef VOSS_ENABLED
927
928 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
929 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
930
931 if ( retStatus != VOS_STATUS_SUCCESS )
932 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
933#endif
934
935#if defined WLAN_FEATURE_VOWIFI
936 rrmCleanup(pMac);
937#endif
938#if defined WLAN_FEATURE_VOWIFI_11R
939 limFTCleanup(pMac);
940#endif
941
942} /*** end limCleanup() ***/
943
944
945/** -------------------------------------------------------------
946\fn peOpen
947\brief will be called in Open sequence from macOpen
948\param tpAniSirGlobal pMac
949\param tHalOpenParameters *pHalOpenParam
950\return tSirRetStatus
951 -------------------------------------------------------------*/
952
953tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
954{
955 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
956 pMac->lim.maxStation = pMacOpenParam->maxStation;
957
958 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
959 {
960 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
961 return eSIR_FAILURE;
962 }
963
964 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
965 (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
966 {
967 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
968 return eSIR_FAILURE;
969 }
970
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800971#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
973 (void **) &pMac->lim.gpLimAIDpool,
974 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
975 {
976 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
977 return eSIR_FAILURE;
978 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800979#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
981 (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
982 {
983 limLog(pMac, LOGE, FL("memory allocate failed!\n"));
984 return eSIR_FAILURE;
985 }
986
987 palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
988
989
990 /*
991 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
992 (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
993 {
994 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
995 return eSIR_FAILURE;
996 }
997
998 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
999 (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
1000 {
1001 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1002 return eSIR_FAILURE;
1003 }
1004 */
1005
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1007 (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
1008 {
1009 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
1010 return eSIR_FAILURE;
1011 }
1012 palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -07001013
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001014 pMac->lim.mgmtFrameSessionId = 0xff;
Jeff Johnson295189b2012-06-20 16:38:30 -07001015
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001016 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1017 {
1018 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!\n"));)
1019 return eSIR_FAILURE;
1020 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 return eSIR_SUCCESS;
1022}
1023
1024/** -------------------------------------------------------------
1025\fn peClose
1026\brief will be called in close sequence from macClose
1027\param tpAniSirGlobal pMac
1028\return tSirRetStatus
1029 -------------------------------------------------------------*/
1030
1031tSirRetStatus peClose(tpAniSirGlobal pMac)
1032{
1033 tANI_U8 i;
1034
1035 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1036 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001037
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 for(i =0; i < pMac->lim.maxBssId; i++)
1039 {
1040 if(pMac->lim.gpSession[i].valid == TRUE)
1041 {
1042 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1043 }
1044 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001045 palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
1046 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001047#if 0
Jeff Johnsone7245742012-09-05 17:12:55 -07001048 palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
1049 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001050#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001051
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
1053 pMac->lim.gpSession = NULL;
1054 /*
1055 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
1056 pMac->dph.dphHashTable.pHashTable = NULL;
1057 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
1058 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1059 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
1061 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001062 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1063 {
1064 return eSIR_FAILURE;
1065 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 return eSIR_SUCCESS;
1067}
1068
1069/** -------------------------------------------------------------
1070\fn peStart
1071\brief will be called in start sequence from macStart
1072\param tpAniSirGlobal pMac
1073\return none
1074 -------------------------------------------------------------*/
1075
1076tSirRetStatus peStart(tpAniSirGlobal pMac)
1077{
1078 tSirRetStatus status = eSIR_SUCCESS;
1079
1080 status = limInitialize(pMac);
1081#if defined(ANI_LOGDUMP)
1082 limDumpInit(pMac);
1083#endif //#if defined(ANI_LOGDUMP)
1084
1085 return status;
1086}
1087
1088/** -------------------------------------------------------------
1089\fn peStop
1090\brief will be called in stop sequence from macStop
1091\param tpAniSirGlobal pMac
1092\return none
1093 -------------------------------------------------------------*/
1094
1095void peStop(tpAniSirGlobal pMac)
1096{
1097 limCleanup(pMac);
1098 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1099 return;
1100}
1101
1102/** -------------------------------------------------------------
1103\fn peFreeMsg
1104\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1105\ to free a given PE message on the TX and MC thread.
1106\ This happens when there are messages pending in the PE
1107\ queue when system is being stopped and reset.
1108\param tpAniSirGlobal pMac
1109\param tSirMsgQ pMsg
1110\return none
1111-----------------------------------------------------------------*/
1112v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1113{
1114 if (pMsg != NULL)
1115 {
1116 if (NULL != pMsg->bodyptr)
1117 {
1118 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1119 {
1120 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1121 }
1122 else
1123 {
1124 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1125 }
1126 }
1127 pMsg->bodyptr = 0;
1128 pMsg->bodyval = 0;
1129 pMsg->type = 0;
1130 }
1131 return;
1132}
1133
1134
1135/**
1136 * The function checks if a particular timer should be allowed
1137 * into LIM while device is sleeping
1138 */
1139tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1140{
1141 tANI_U8 retStatus = TRUE;
1142
1143 if(!limIsSystemInActiveState(pMac))
1144 {
1145 switch(pMsg->type)
1146 {
1147 /* Don't allow following timer messages if in sleep */
1148 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1149 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1150 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1151 retStatus = FALSE;
1152 break;
1153 /* May allow following timer messages in sleep mode */
1154 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1155
1156 /* Safe to allow as of today, this triggers background scan
1157 * which will not be started if the device is in power-save mode
1158 * might need to block in the future if we decide to implement
1159 * spectrum management
1160 */
1161 case SIR_LIM_QUIET_TIMEOUT:
1162
1163 /* Safe to allow as of today, this triggers background scan
1164 * which will not be started if the device is in power-save mode
1165 * might need to block in the future if we decide to implement
1166 * spectrum management
1167 */
1168 case SIR_LIM_QUIET_BSS_TIMEOUT:
1169
1170 /* Safe to allow this timermessage, triggers background scan
1171 * which is blocked in sleep mode
1172 */
1173 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1174
1175 /* Safe to allow this timer, since, while in IMPS this timer will not
1176 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1177 * when heart-beat control is handled back to PE, device would have
1178 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1179 */
1180 case SIR_LIM_HEART_BEAT_TIMEOUT:
1181 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1182
1183 /* Safe to allow, PE is not handling this message as of now. May need
1184 * to block it, basically, free the buffer and restart the timer
1185 */
1186 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1187 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001188 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1190 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1191 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1192 retStatus = TRUE;
1193 break;
1194
1195 /* by default allow rest of messages */
1196 default:
1197 retStatus = TRUE;
1198 break;
1199
1200
1201 }
1202 }
1203
1204 return retStatus;
1205
1206}
1207
1208
1209
1210/**
1211 * limPostMsgApi()
1212 *
1213 *FUNCTION:
1214 * This function is called from other thread while posting a
1215 * message to LIM message Queue gSirLimMsgQ.
1216 *
1217 *LOGIC:
1218 * NA
1219 *
1220 *ASSUMPTIONS:
1221 * NA
1222 *
1223 *NOTE:
1224 * NA
1225 *
1226 * @param pMac - Pointer to Global MAC structure
1227 * @param pMsg - Pointer to the message structure
1228 * @return None
1229 */
1230
1231tANI_U32
1232limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1233{
1234#ifdef VOSS_ENABLED
1235 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1236
1237
1238#elif defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
1239 return tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_WAIT_FOREVER);
1240
1241#else
1242 /* Check if this is a timeout message from a timer
1243 * and if the timeout message is allowed if the device is in power-save state
1244 */
1245 if(!limIsTimerAllowedInPowerSaveState(pMac, pMsg))
1246 {
1247 limLog(pMac, LOGW,
1248 FL("Timeout message %d is not allowed while device is in Power-Save mode\n"),
1249 pMsg->type);
1250
1251 return TX_SUCCESS;
1252 }
1253 if(pMac->gDriverType != eDRIVER_TYPE_MFG)
1254 {
1255 limMessageProcessor(pMac, pMsg);
1256 }
1257
1258 return TX_SUCCESS;
1259
1260#endif
1261} /*** end limPostMsgApi() ***/
1262
1263
1264/*--------------------------------------------------------------------------
1265
1266 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1267
1268 This function can be called by legacy code to post message to voss queues OR
1269 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1270 for dispatching it later.
1271
1272 \param pMac - Pointer to Global MAC structure
1273 \param pMsg - Pointer to the message structure
1274
1275 \return tANI_U32 - TX_SUCCESS for success.
1276
1277 --------------------------------------------------------------------------*/
1278
1279tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1280{
1281 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1282}
1283
1284/*--------------------------------------------------------------------------
1285
1286 \brief peProcessMessages() - Message Processor for PE
1287
1288 Voss calls this function to dispatch the message to PE
1289
1290 \param pMac - Pointer to Global MAC structure
1291 \param pMsg - Pointer to the message structure
1292
1293 \return tANI_U32 - TX_SUCCESS for success.
1294
1295 --------------------------------------------------------------------------*/
1296
1297tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1298{
1299 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1300 {
1301 return eSIR_SUCCESS;
1302 }
1303 /**
1304 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1305 * for all the other cases post it to LIM
1306 */
1307 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1308 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1309 else
1310 limMessageProcessor(pMac, pMsg);
1311 return eSIR_SUCCESS;
1312}
1313
1314
1315#ifdef VOSS_ENABLED
1316
1317// ---------------------------------------------------------------------------
1318/**
1319 * peHandleMgmtFrame
1320 *
1321 * FUNCTION:
1322 * Process the Management frames from TL
1323 *
1324 * LOGIC:
1325 *
1326 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1327 *
1328 * NOTE:
1329 *
1330 * @param pvosGCtx Global Vos Context
1331 * @param vossBuff Packet
1332 * @return None
1333 */
1334
1335VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1336{
1337 tpAniSirGlobal pMac;
1338 tpSirMacMgmtHdr mHdr;
1339 tSirMsgQ msg;
1340 vos_pkt_t *pVosPkt;
1341 VOS_STATUS vosStatus;
1342 v_U8_t *pRxPacketInfo;
1343
1344 pVosPkt = (vos_pkt_t *)vosBuff;
1345 if (NULL == pVosPkt)
1346 {
1347 return VOS_STATUS_E_FAILURE;
1348 }
1349
1350 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1351 if (NULL == pMac)
1352 {
1353 // cannot log a failure without a valid pMac
1354 vos_pkt_return_packet(pVosPkt);
1355 return VOS_STATUS_E_FAILURE;
1356 }
1357
1358 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1359
1360 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1361 {
1362 vos_pkt_return_packet(pVosPkt);
1363 return VOS_STATUS_E_FAILURE;
1364 }
1365
1366
1367 //
1368 // The MPDU header is now present at a certain "offset" in
1369 // the BD and is specified in the BD itself
1370 //
1371 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1372 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1373 {
1374 PELOG1(limLog( pMac, LOG1,
1375 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001376 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001377
Jeff Johnsone7245742012-09-05 17:12:55 -07001378 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1380 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1381 }
1382
1383
1384 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1385 msg.type = SIR_BB_XPORT_MGMT_MSG;
1386 msg.bodyptr = vosBuff;
1387 msg.bodyval = 0;
1388
1389 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1390 &msg,
1391 mHdr->fc.type,
1392 mHdr->fc.subType ))
1393 {
1394 vos_pkt_return_packet(pVosPkt);
1395 limLog( pMac, LOGW,
1396 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
1397 return VOS_STATUS_E_FAILURE;
1398 }
1399
1400 return VOS_STATUS_SUCCESS;
1401}
1402
1403// ---------------------------------------------------------------------------
1404/**
1405 * peRegisterTLHandle
1406 *
1407 * FUNCTION:
1408 * Registers the Handler which, process the Management frames from TL
1409 *
1410 * LOGIC:
1411 *
1412 * ASSUMPTIONS:
1413 *
1414 * NOTE:
1415 *
1416 * @return None
1417 */
1418
1419void peRegisterTLHandle(tpAniSirGlobal pMac)
1420{
1421 v_PVOID_t pvosGCTx;
1422 VOS_STATUS retStatus;
1423
1424 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1425
1426 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1427
1428 if (retStatus != VOS_STATUS_SUCCESS)
1429 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
1430
1431}
1432#endif
1433
1434
1435/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 * limIsSystemInScanState()
1437 *
1438 *FUNCTION:
1439 * This function is called by various MAC software modules to
1440 * determine if System is in Scan/Learn state
1441 *
1442 *LOGIC:
1443 * NA
1444 *
1445 *ASSUMPTIONS:
1446 * NA
1447 *
1448 *NOTE:
1449 *
1450 * @param pMac - Pointer to Global MAC structure
1451 * @return true - System is in Scan/Learn state
1452 * false - System is NOT in Scan/Learn state
1453 */
1454
1455tANI_U8
1456limIsSystemInScanState(tpAniSirGlobal pMac)
1457{
1458 switch (pMac->lim.gLimSmeState)
1459 {
1460 case eLIM_SME_CHANNEL_SCAN_STATE:
1461 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1462 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1463 case eLIM_SME_WT_SCAN_STATE:
1464 // System is in Learn mode
1465 return true;
1466
1467 default:
1468 // System is NOT in Learn mode
1469 return false;
1470 }
1471} /*** end limIsSystemInScanState() ***/
1472
1473
1474
1475/**
1476 * limIsSystemInActiveState()
1477 *
1478 *FUNCTION:
1479 * This function is called by various MAC software modules to
1480 * determine if System is in Active/Wakeup state
1481 *
1482 *LOGIC:
1483 * NA
1484 *
1485 *ASSUMPTIONS:
1486 * NA
1487 *
1488 *NOTE:
1489 *
1490 * @param pMac - Pointer to Global MAC structure
1491 * @return true - System is in Active state
1492 * false - System is not in Active state
1493 */
1494
1495tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1496{
1497 switch (pMac->pmm.gPmmState)
1498 {
1499 case ePMM_STATE_BMPS_WAKEUP:
1500 case ePMM_STATE_IMPS_WAKEUP:
1501 case ePMM_STATE_READY:
1502 // System is in Active mode
1503 return true;
1504 default:
1505 return false;
1506 // System is NOT in Active mode
1507 }
1508}
1509
1510
Jeff Johnson295189b2012-06-20 16:38:30 -07001511
Jeff Johnson295189b2012-06-20 16:38:30 -07001512
1513
1514/**
1515*\brief limReceivedHBHandler()
1516*
1517* This function is called by schBeaconProcess() upon
1518* receiving a Beacon on STA. This also gets called upon
1519* receiving Probe Response after heat beat failure is
1520* detected.
1521*
1522* param pMac - global mac structure
1523* param channel - channel number indicated in Beacon, Probe Response
1524* return - none
1525*/
1526
1527
1528void
1529limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1530{
1531 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1532 psessionEntry->LimRxedBeaconCntDuringHB++;
1533
1534 pMac->pmm.inMissedBeaconScenario = FALSE;
1535} /*** end limReceivedHBHandler() ***/
1536
1537
1538
1539#if 0
1540void limResetHBPktCount(tpPESession psessionEntry)
1541{
1542 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1543}
1544#endif
1545
1546
1547/*
1548 * limProcessWdsInfo()
1549 *
1550 *FUNCTION:
1551 * This function is called from schBeaconProcess in BP
1552 *
1553 *PARAMS:
1554 * @param pMac - Pointer to Global MAC structure
1555 * @param propIEInfo - proprietary IE info
1556 *
1557 *LOGIC:
1558 *
1559 *ASSUMPTIONS:
1560 * NA
1561 *
1562 *NOTE:
1563 *
1564 *
1565 *RETURNS:
1566 *
1567 */
1568
1569void limProcessWdsInfo(tpAniSirGlobal pMac,
1570 tSirPropIEStruct propIEInfo)
1571{
Jeff Johnson295189b2012-06-20 16:38:30 -07001572}
1573
1574
1575
1576/**
1577 * limInitWdsInfoParams()
1578 *
1579 *FUNCTION:
1580 * This function is called while processing
1581 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1582 * ind/set related parameters.
1583 *
1584 *LOGIC:
1585 *
1586 *ASSUMPTIONS:
1587 *
1588 *NOTE:
1589 *
1590 * @param pMac Pointer to Global MAC structure
1591 * @return None
1592 */
1593
1594void
1595limInitWdsInfoParams(tpAniSirGlobal pMac)
1596{
1597 pMac->lim.gLimWdsInfo.wdsLength = 0;
1598 pMac->lim.gLimNumWdsInfoInd = 0;
1599 pMac->lim.gLimNumWdsInfoSet = 0;
1600} /*** limInitWdsInfoParams() ***/
1601
1602
1603/** -------------------------------------------------------------
1604\fn limUpdateOverlapStaParam
1605\brief Updates overlap cache and param data structure
1606\param tpAniSirGlobal pMac
1607\param tSirMacAddr bssId
1608\param tpLimProtStaParams pStaParams
1609\return None
1610 -------------------------------------------------------------*/
1611void
1612limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1613{
1614 int i;
1615 if (!pStaParams->numSta)
1616 {
1617 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
1618 bssId,
1619 sizeof(tSirMacAddr));
1620 pMac->lim.protStaOverlapCache[0].active = true;
1621
1622 pStaParams->numSta = 1;
1623
1624 return;
1625 }
1626
1627 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1628 {
1629 if (pMac->lim.protStaOverlapCache[i].active)
1630 {
1631 if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
1632 bssId,
1633 sizeof(tSirMacAddr))) {
1634 return; }
1635 }
1636 else
1637 break;
1638 }
1639
1640 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1641 {
1642 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
1643 }
1644 else
1645 {
1646 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
1647 bssId,
1648 sizeof(tSirMacAddr));
1649 pMac->lim.protStaOverlapCache[i].active = true;
1650
1651 pStaParams->numSta++;
1652 }
1653}
1654
1655
1656/**
1657 * limHandleIBSScoalescing()
1658 *
1659 *FUNCTION:
1660 * This function is called upon receiving Beacon/Probe Response
1661 * while operating in IBSS mode.
1662 *
1663 *LOGIC:
1664 *
1665 *ASSUMPTIONS:
1666 *
1667 *NOTE:
1668 *
1669 * @param pMac - Pointer to Global MAC structure
1670 * @param pBeacon - Parsed Beacon Frame structure
1671 * @param pRxPacketInfo - Pointer to RX packet info structure
1672 *
1673 * @return Status whether to process or ignore received Beacon Frame
1674 */
1675
1676tSirRetStatus
1677limHandleIBSScoalescing(
1678 tpAniSirGlobal pMac,
1679 tpSchBeaconStruct pBeacon,
1680 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1681{
1682 tpSirMacMgmtHdr pHdr;
1683 tSirRetStatus retCode;
1684
1685 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1686 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
1687 /* Received SSID does not match => Ignore received Beacon frame. */
1688 retCode = eSIR_LIM_IGNORE_BEACON;
1689 else
1690 {
1691 tANI_U32 ieLen;
1692 tANI_U16 tsfLater;
1693 tANI_U8 *pIEs;
1694 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1695 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1696 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1697 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1698 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1699 }
1700 return retCode;
1701} /*** end limHandleIBSScoalescing() ***/
1702
1703
1704
1705/**
1706 * limDetectChangeInApCapabilities()
1707 *
1708 *FUNCTION:
1709 * This function is called while SCH is processing
1710 * received Beacon from AP on STA to detect any
1711 * change in AP's capabilities. If there any change
1712 * is detected, Roaming is informed of such change
1713 * so that it can trigger reassociation.
1714 *
1715 *LOGIC:
1716 *
1717 *ASSUMPTIONS:
1718 *
1719 *NOTE:
1720 * Notification is enabled for STA product only since
1721 * it is not a requirement on BP side.
1722 *
1723 * @param pMac Pointer to Global MAC structure
1724 * @param pBeacon Pointer to parsed Beacon structure
1725 * @return None
1726 */
1727
1728void
1729limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1730 tpSirProbeRespBeacon pBeacon,
1731 tpPESession psessionEntry)
1732{
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 tANI_U8 len;
1734 tSirSmeApNewCaps apNewCaps;
1735 tANI_U8 newChannel;
1736 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1737 newChannel = (tANI_U8) pBeacon->channelNumber;
1738
1739 if ((psessionEntry->limSentCapsChangeNtf == false) &&
1740 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
1741 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
1742 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
1743 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
1744 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
1745 (newChannel != psessionEntry->currentOperChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 )))
1747 {
1748
1749 /**
1750 * BSS capabilities have changed.
1751 * Inform Roaming.
1752 */
1753 len = sizeof(tSirMacCapabilityInfo) +
1754 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1755 3 * sizeof(tANI_U8) + // reserved fields
1756 pBeacon->ssId.length + 1;
1757
1758 palCopyMemory( pMac->hHdd, apNewCaps.bssId,
1759 psessionEntry->bssId,
1760 sizeof(tSirMacAddr));
1761 if (newChannel != psessionEntry->currentOperChannel)
1762 {
1763 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
1764 "Ignoring beacon!\n"),
1765 psessionEntry->currentOperChannel, newChannel);)
1766 return;
1767 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301768
1769 /**
1770 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1771 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1772 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1773 * the privacy bit is set in Probe and association responses.
1774 * Due to this anomaly, we detect a change in
1775 * AP capabilities when we receive a beacon after association and
1776 * disconnect from the AP. The following check makes sure that we can
1777 * connect to such APs
1778 */
1779 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1780 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1781 {
1782 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
1783 " but WPA or RSN IE present, Ignore Beacon!\n"));)
1784 return;
1785 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 else
1787 apNewCaps.channelId = psessionEntry->currentOperChannel;
1788 palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
1789 (tANI_U8 *) &pBeacon->ssId,
1790 pBeacon->ssId.length + 1);
1791
1792 psessionEntry->limSentCapsChangeNtf = true;
1793 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1794 (tANI_U32 *) &apNewCaps,
1795 len, psessionEntry->smeSessionId);
1796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001797} /*** limDetectChangeInApCapabilities() ***/
1798
1799
1800
1801
1802// ---------------------------------------------------------------------
1803/**
1804 * limUpdateShortSlot
1805 *
1806 * FUNCTION:
1807 * Enable/Disable short slot
1808 *
1809 * LOGIC:
1810 *
1811 * ASSUMPTIONS:
1812 *
1813 * NOTE:
1814 *
1815 * @param enable Flag to enable/disable short slot
1816 * @return None
1817 */
1818
1819tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1820{
1821
1822 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001823 tANI_U32 nShortSlot;
1824 tANI_U32 val = 0;
1825 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001826
Jeff Johnsone7245742012-09-05 17:12:55 -07001827 // Check Admin mode first. If it is disabled just return
1828 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1829 != eSIR_SUCCESS)
1830 {
1831 limLog(pMac, LOGP,
1832 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
1833 return eSIR_FAILURE;
1834 }
1835 if (val == false)
1836 return eSIR_SUCCESS;
1837
1838 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1839 limGetPhyMode(pMac, &phyMode, psessionEntry);
1840 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1841 return eSIR_SUCCESS;
1842
1843 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001844
1845 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1846 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1847 // if no erp present, use short slot based on current ap caps
1848
1849 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1850
1851 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1852 // The difference between the earlier implementation and the new one is only Case4.
1853 /*
1854 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1855 Case1 1 1 1 1 //AP should not advertise this combination.
1856 Case2 1 1 0 0
1857 Case3 1 0 1 1
1858 Case4 1 0 0 0
1859 Case5 0 1 1 1
1860 Case6 0 1 0 0
1861 Case7 0 0 1 1
1862 Case8 0 0 0 0
1863 */
1864 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1865
Jeff Johnsone7245742012-09-05 17:12:55 -07001866 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 {
1868 // Short slot time capability of AP has changed. Adopt to it.
1869 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
1870 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001871 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1873 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 }
1875 return eSIR_SUCCESS;
1876}
1877
1878
Jeff Johnson295189b2012-06-20 16:38:30 -07001879
1880
Jeff Johnson295189b2012-06-20 16:38:30 -07001881
Jeff Johnson295189b2012-06-20 16:38:30 -07001882
1883
1884/** -----------------------------------------------------------------
1885 \brief limHandleLowRssiInd() - handles low rssi indication
1886
1887 This function process the SIR_HAL_LOW_RSSI_IND message from
1888 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1889
1890 \param pMac - global mac structure
1891
1892 \return
1893
1894 \sa
1895 ----------------------------------------------------------------- */
1896void limHandleLowRssiInd(tpAniSirGlobal pMac)
1897{
1898#if 0 //RSSI related indications will now go to TL and not PE
1899 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1900 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1901 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1902 {
1903 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
1904 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1905 }
1906 else
1907 {
1908 limLog(pMac, LOGE,
1909 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
1910 pMac->pmm.gPmmState);
1911 }
1912 return;
1913#endif
1914}
1915
1916
1917/** -----------------------------------------------------------------
1918 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1919
1920 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1921 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1922 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1923
1924 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1925 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1926 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1927 This message can also come from FW anytime after we have entered BMPS.
1928 This means we should handle it in WoWL and UAPSD states as well
1929
1930 \param pMac - global mac structure
1931 \return - none
1932 \sa
1933 ----------------------------------------------------------------- */
1934void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1935{
1936 switch(pMac->pmm.gPmmState)
1937 {
1938 case ePMM_STATE_BMPS_SLEEP:
1939 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1940 case ePMM_STATE_UAPSD_SLEEP:
1941 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
1942 case ePMM_STATE_WOWLAN:
1943 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1944 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
1945 break;
1946
1947 default:
1948 limLog(pMac, LOGE,
1949 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
1950 pMac->pmm.gPmmState);
1951 break;
1952 }
1953 return;
1954}
1955
1956
1957/** -----------------------------------------------------------------
1958 \brief limHandleMissedBeaconInd() - handles missed beacon indication
1959
1960 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
1961 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1962 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
1963
1964 \param pMac - global mac structure
1965 \return - none
1966 \sa
1967 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001968void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07001969{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001970#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1971 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
1972 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
1973 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
1974 if (psessionEntry == NULL)
1975 {
1976 limLog(pMac, LOGE,
1977 FL("session does not exist for given BSSIdx:%d"),
1978 pSirMissedBeaconInd->bssIdx);
1979 return;
1980 }
1981#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1983 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1984 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1985 {
1986 pMac->pmm.inMissedBeaconScenario = TRUE;
1987 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1988 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
1989 }
Yathish9f22e662012-12-10 14:21:35 -08001990/* ACTIVE_MODE_HB_OFFLOAD */
1991#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1992 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
1993 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
1994 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1995 {
1996 pMac->pmm.inMissedBeaconScenario = TRUE;
1997 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure\n"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001998 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08001999 }
2000#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 else
2002 {
2003 limLog(pMac, LOGE,
2004 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
2005 pMac->pmm.gPmmState);
2006 }
2007 return;
2008}
2009
2010/** -----------------------------------------------------------------
2011 \brief limMicFailureInd() - handles mic failure indication
2012
2013 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2014
2015 \param pMac - global mac structure
2016 \return - none
2017 \sa
2018 ----------------------------------------------------------------- */
2019void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2020{
2021 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2022 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2023 tSirMsgQ mmhMsg;
2024 tpPESession psessionEntry ;
2025 tANI_U8 sessionId;
2026
2027 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2028 {
2029 limLog(pMac, LOGE,
2030 FL("session does not exist for given BSSId\n"));
2031 return;
2032 }
2033
2034 if (eHAL_STATUS_SUCCESS !=
2035 palAllocateMemory(pMac->hHdd,
2036 (void **) &pSirSmeMicFailureInd,
2037 sizeof(tSirSmeMicFailureInd)))
2038 {
2039 // Log error
2040 limLog(pMac, LOGP,
2041 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
2042 return;
2043 }
2044
2045 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2046 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2047 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2048
2049 vos_mem_copy(pSirSmeMicFailureInd->bssId,
2050 pSirMicFailureInd->bssId,
2051 sizeof(tSirMacAddr));
2052
2053 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
2054 pSirMicFailureInd->info.srcMacAddr,
2055 sizeof(tSirMacAddr));
2056
2057 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
2058 pSirMicFailureInd->info.taMacAddr,
2059 sizeof(tSirMacAddr));
2060
2061 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
2062 pSirMicFailureInd->info.dstMacAddr,
2063 sizeof(tSirMacAddr));
2064
2065 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
2066 pSirMicFailureInd->info.rxMacAddr,
2067 sizeof(tSirMacAddr));
2068
2069 pSirSmeMicFailureInd->info.multicast =
2070 pSirMicFailureInd->info.multicast;
2071
2072 pSirSmeMicFailureInd->info.keyId=
2073 pSirMicFailureInd->info.keyId;
2074
2075 pSirSmeMicFailureInd->info.IV1=
2076 pSirMicFailureInd->info.IV1;
2077
2078 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
2079 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
2080
2081 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2082 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2083 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002084 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2086 return;
2087}
2088
2089
2090/** -----------------------------------------------------------------
2091 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2092
2093 This function is called before enqueuing the frame to PE queue for further processing.
2094 This prevents unnecessary frames getting into PE Queue and drops them right away.
2095 Frames will be droped in the following scenarios:
2096
2097 - In Scan State, drop the frames which are not marked as scan frames
2098 - In non-Scan state, drop the frames which are marked as scan frames.
2099 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2100 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2101
2102 \param pMac - global mac structure
2103 \return - none
2104 \sa
2105 ----------------------------------------------------------------- */
2106
2107tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2108{
2109 tANI_U32 framelen;
2110 tANI_U8 *pBody;
2111 tSirMacCapabilityInfo capabilityInfo;
2112
2113 /*
2114 *
2115 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2116 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2117 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2118 * other than beacons or probe responses in scan state.
2119 */
2120 if( (subType == SIR_MAC_MGMT_BEACON) ||
2121 (subType == SIR_MAC_MGMT_PROBE_RSP))
2122 {
2123 if(pMac->pmm.inMissedBeaconScenario)
2124 {
Jeff Johnsonab79c8d2012-12-10 14:30:13 -08002125 PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon scenario"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 return eMGMT_DROP_NO_DROP;
2127 }
2128 if (limIsSystemInScanState(pMac))
2129 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002130 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 }
2132 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2133 {
2134 return eMGMT_DROP_SCAN_MODE_FRAME;
2135 }
2136 }
2137
2138 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2139 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2140
2141 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2142 * beacons from an infrastructure network
2143 */
2144 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2145 if(!capabilityInfo.ibss)
2146 return eMGMT_DROP_NO_DROP;
2147#if 0
2148 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2149 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2150 return eMGMT_DROP_NO_DROP;
2151#endif
2152
2153 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2154 if( (subType == SIR_MAC_MGMT_BEACON) ||
2155 (subType == SIR_MAC_MGMT_PROBE_RSP))
2156 {
2157 //drop the frame if length is less than 12
2158 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2159 return eMGMT_DROP_INVALID_SIZE;
2160
2161 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2162
2163 //This can be enhanced to even check the SSID before deciding to enque the frame.
2164 if(capabilityInfo.ess)
2165 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2166 }
2167 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2168 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2169 {
2170 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2171 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2172 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2173 }
2174
2175 return eMGMT_DROP_NO_DROP;
2176}
2177
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002178eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2179{
2180 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002181
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002182 if(psPe)
2183 {
2184 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2185 {
2186 status = eHAL_STATUS_SUCCESS;
2187 }
2188 }
2189 return (status);
2190}
2191eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2192{
2193 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2194 if(psPe)
2195 {
2196 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2197 {
2198 status = eHAL_STATUS_SUCCESS;
2199 }
2200 }
2201 return (status);
2202}