blob: 2e2e9856ae0d5a9162e9fed98b36167af01accd2 [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>
Jeff Johnson295189b2012-06-20 16:38:30 -070085#include "vos_types.h"
86#include "vos_packet.h"
87#include "wlan_qct_tl.h"
88#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070089
90
91static void __limInitScanVars(tpAniSirGlobal pMac)
92{
93 pMac->lim.gLimUseScanModeForLearnMode = 1;
94
95 pMac->lim.gLimSystemInScanLearnMode = 0;
96
97 // Scan related globals on STA
98 pMac->lim.gLimReturnAfterFirstMatch = 0;
99 pMac->lim.gLim24Band11dScanDone = 0;
100 pMac->lim.gLim50Band11dScanDone = 0;
101 pMac->lim.gLimReturnUniqueResults = 0;
102
103 // Background Scan related globals on STA
104 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
105 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
106 pMac->lim.gLimNumOfForcedBkgndScan = 0;
107 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
108 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
109 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -0800110 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
112 pMac->lim.gLimCurrentScanChannelId = 0;
113 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid440e682013-03-06 02:25:31 -0800114 pMac->lim.gDeferMsgTypeForNOA = 0;
115 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700116 pMac->lim.gLimMlmScanResultLength = 0;
117 pMac->lim.gLimSmeScanResultLength = 0;
118
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530119 vos_mem_set(pMac->lim.gLimCachedScanHashTable,
120 sizeof(pMac->lim.gLimCachedScanHashTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700121
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700122#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
123
124 pMac->lim.gLimMlmLfrScanResultLength = 0;
125 pMac->lim.gLimSmeLfrScanResultLength = 0;
126
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530127 vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
128 sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700129#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 pMac->lim.gLimBackgroundScanChannelId = 0;
131 pMac->lim.gLimBackgroundScanStarted = 0;
132 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
133 pMac->lim.gLimRestoreCBCount = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530134 vos_mem_set(pMac->lim.gLimLegacyBssidList,
135 sizeof(pMac->lim.gLimLegacyBssidList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700136
137 /* Fill in default values */
138 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
139
Jeff Johnson295189b2012-06-20 16:38:30 -0700140
141 // abort scan is used to abort an on-going scan
142 pMac->lim.abortScan = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530143 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
144 vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
146//WLAN_SUSPEND_LINK Related
147 pMac->lim.gpLimSuspendCallback = NULL;
148 pMac->lim.gpLimResumeCallback = NULL;
149//end WLAN_SUSPEND_LINK Related
150}
151
152
153static void __limInitBssVars(tpAniSirGlobal pMac)
154{
155
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530156 vos_mem_set((void*)pMac->lim.gpSession,
157 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700158
159
160 //pMac->lim.gpLimStartBssReq = NULL;
161
Jeff Johnson295189b2012-06-20 16:38:30 -0700162
163
164
165/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
166#if 0
167
168 // Place holder for BSS description that we're
169 // currently joined with
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530170 vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530172 vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 pMac->lim.gLimCurrentBssCaps = 0;
174 QosCaps is a bit map of various qos capabilities - see defn above
175 pMac->lim.gLimCurrentBssQosCaps = 0;
176 pMac->lim.gLimCurrentBssPropCap = 0;
177 pMac->lim.gLimSentCapsChangeNtf = 0;
178
179 // Place holder for BSS description that
180 // we're currently Reassociating
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530181 vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 pMac->lim.gLimReassocChannelId = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530183 vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 pMac->lim.gLimReassocBssCaps = 0;
185 pMac->lim.gLimReassocBssQosCaps = 0;
186 pMac->lim.gLimReassocBssPropCap = 0;
187 #endif
188
189 /* This is for testing purposes only, be default should always be off */
190 pMac->lim.gLimForceNoPropIE = 0;
191
192 // pMac->lim.gLimBssIdx = 0;
193
194 pMac->lim.gpLimMlmSetKeysReq = NULL;
195 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
196 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
197
198}
199
200
201static void __limInitStatsVars(tpAniSirGlobal pMac)
202{
203 pMac->lim.gLimNumBeaconsRcvd = 0;
204 pMac->lim.gLimNumBeaconsIgnored = 0;
205
206 pMac->lim.gLimNumDeferredMsgs = 0;
207
208 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800209 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
211
212 /// This indicates number of RXed Beacons during HB period
213 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
214
215 // Heart-Beat interval value
216 pMac->lim.gLimHeartBeatCount = 0;
217
218 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530219 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
220 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700221
222#ifdef WLAN_DEBUG
223 // Debug counters
224 pMac->lim.numTot = 0;
225 pMac->lim.numBbt = 0;
226 pMac->lim.numProtErr = 0;
227 pMac->lim.numLearn = 0;
228 pMac->lim.numLearnIgnore = 0;
229 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530230 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 pMac->lim.gLimNumAssocReqDropInvldState = 0;
232 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
233 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
234 pMac->lim.gLimNumReassocReqDropInvldState = 0;
235 pMac->lim.gLimNumHashMissIgnored = 0;
236 pMac->lim.gLimUnexpBcnCnt = 0;
237 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
238 pMac->lim.gLimNumLinkEsts = 0;
239 pMac->lim.gLimNumRxCleanup = 0;
240 pMac->lim.gLim11bStaAssocRejectCount = 0;
241#endif
242}
243
244
245
246static void __limInitStates(tpAniSirGlobal pMac)
247{
248 // Counts Heartbeat failures
249 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
250 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
251 pMac->lim.gLimHBfailureCntInOtherStates = 0;
252 pMac->lim.gLimRspReqd = 0;
253 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
254
255 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700256 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
258
259 /// Previous MLM State
260 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
261
262#ifdef GEN4_SCAN
263 // LIM to HAL SCAN Management Message Interface states
264 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
265#endif // GEN4_SCAN
266
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700268 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700270 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700271
272 /**
273 * By default assume 'unknown' role. This will be updated
274 * when SME_START_BSS_REQ is received.
275 */
276
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530277 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
278 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
279 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
280 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
281 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
282 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283
284 pMac->lim.gLimPhyMode = 0;
285 pMac->lim.scanStartTime = 0; // used to measure scan time
286
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530287 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 pMac->lim.ackPolicy = 0;
289
290#if 0 /* Moving all these to session specific elements */
291 pMac->lim.gLimQosEnabled = 0; //11E
292 pMac->lim.gLimWmeEnabled = 0; //WME
293 pMac->lim.gLimWsmEnabled = 0; //WSM
294 pMac->lim.gLimHcfEnabled = 0;
295 pMac->lim.gLim11dEnabled = 0;
296#endif
297
298 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
299}
300
301static void __limInitVars(tpAniSirGlobal pMac)
302{
303
Jeff Johnson295189b2012-06-20 16:38:30 -0700304
305 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
307 // WDS info
308 pMac->lim.gLimNumWdsInfoInd = 0;
309 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530310 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 /* initialize some parameters */
312 limInitWdsInfoParams(pMac);
313
314 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530315 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530318 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 pMac->lim.gLimAddtsSent = 0;
320 pMac->lim.gLimAddtsRspTimerCount = 0;
321
322 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530323 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530325 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
327
Jeff Johnsone7245742012-09-05 17:12:55 -0700328#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
331 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 // WMM Related Flag
334 pMac->lim.gUapsdEnable = 0;
335 pMac->lim.gUapsdPerAcBitmask = 0;
336 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
337 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
338
339 // QoS-AC Downgrade: Initially, no AC is admitted
340 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
341 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
342
343 //dialogue token List head/tail for Action frames request sent.
344 pMac->lim.pDialogueTokenHead = NULL;
345 pMac->lim.pDialogueTokenTail = NULL;
346
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530347 vos_mem_set(&pMac->lim.tspecInfo,
348 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700349
350 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530351 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700352
353 pMac->lim.gLastBeaconDtimCount = 0;
354 pMac->lim.gLastBeaconDtimPeriod = 0;
355
356 //Scan in Power Save Flag
357 pMac->lim.gScanInPowersave = 0;
358}
359
360static void __limInitAssocVars(tpAniSirGlobal pMac)
361{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800362 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800363#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530364 vos_mem_set(pMac->lim.gpLimAIDpool,
365 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700366 pMac->lim.freeAidHead = 0;
367 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800368#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800369 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
370 {
371 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
372 }
373 pMac->lim.gLimAssocStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700374
375 // Place holder for current authentication request
376 // being handled
377 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700378 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700379
380 /// MAC level Pre-authentication related globals
381 pMac->lim.gLimPreAuthChannelNumber = 0;
382 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530383 vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 pMac->lim.gLimNumPreAuthContexts = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530385 vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700386
387 // Placed holder to deauth reason
388 pMac->lim.gLimDeauthReasonCode = 0;
389
390 // Place holder for Pre-authentication node list
391 pMac->lim.pLimPreAuthList = NULL;
392
393 // Send Disassociate frame threshold parameters
394 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
395 pMac->lim.gLimDisassocFrameCredit = 0;
396
397 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530398 vos_mem_set(pMac->lim.protStaOverlapCache,
399 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
400 vos_mem_set(pMac->lim.protStaCache,
401 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700402
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700403#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
404 pMac->lim.pSessionEntry = NULL;
405 pMac->lim.reAssocRetryAttempt = 0;
406#endif
407
Jeff Johnson295189b2012-06-20 16:38:30 -0700408}
409
410
411static void __limInitTitanVars(tpAniSirGlobal pMac)
412{
Jeff Johnsone7245742012-09-05 17:12:55 -0700413#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530414 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700416 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
417#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 // Debug workaround for BEACON's
419 // State change triggered by "dump 222"
420 pMac->lim.gLimScanOverride = 1;
421 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700422 pMac->lim.gLimTitanStaCount = 0;
423 pMac->lim.gLimBlockNonTitanSta = 0;
424}
425
426static void __limInitHTVars(tpAniSirGlobal pMac)
427{
428 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 pMac->lim.gHTShortGI40Mhz = 0;
431 pMac->lim.gHTShortGI20Mhz = 0;
432 pMac->lim.gHTMaxAmsduLength = 0;
433 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
434 pMac->lim.gHTPSMPSupport = 0;
435 pMac->lim.gHTLsigTXOPProtection = 0;
436 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
437 pMac->lim.gHTAMpduDensity = 0;
438
439 pMac->lim.gMaxAmsduSizeEnabled = false;
440 pMac->lim.gHTMaxRxAMpduFactor = 0;
441 pMac->lim.gHTServiceIntervalGranularity = 0;
442 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
444 pMac->lim.gHTPCOActive = 0;
445
446 pMac->lim.gHTPCOPhase = 0;
447 pMac->lim.gHTSecondaryBeacon = 0;
448 pMac->lim.gHTDualCTSProtection = 0;
449 pMac->lim.gHTSTBCBasicMCS = 0;
450 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
451}
452
Jeff Johnson295189b2012-06-20 16:38:30 -0700453static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
454{
Jeff Johnsone7245742012-09-05 17:12:55 -0700455 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 tANI_U16 val16;
457 tANI_U8 val8;
458 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
459 tSirMacHTInfoField1 *pHTInfoField1;
460 tpSirPowerSaveCfg pPowerSaveConfig;
461 tSirMacHTParametersInfo *pAmpduParamInfo;
462
463 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700464 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
465 * and they will be used throughout when there is no session
466 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700467
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
469 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700470 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 return eSIR_FAILURE;
472 }
473
474 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
475 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700476 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 return eSIR_FAILURE;
478 }
479 val16 = ( tANI_U16 ) val1;
480 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
481
482 //channel bonding mode could be set to anything from 0 to 4(Titan had these
483 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
484 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
485 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
486 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
487 != eSIR_SUCCESS)
488 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700489 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 return eSIR_FAILURE;
491 }
492
493 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
494 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700495 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 return eSIR_FAILURE;
497 }
498
499 val8 = ( tANI_U8 ) val1;
500 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
501 pHTInfoField1->recommendedTxWidthSet =
502 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
504 != eSIR_SUCCESS)
505 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700506 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 return eSIR_FAILURE;
508 }
509
510 /* WNI_CFG_HEART_BEAT_THRESHOLD */
511
512 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
513 eSIR_SUCCESS )
514 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700515 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 return eSIR_FAILURE;
517 }
518 if(!val1)
519 {
520 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
521 pMac->sys.gSysEnableLinkMonitorMode = 0;
522 }
523 else
524 {
525 //No need to activate the timer during init time.
526 pMac->sys.gSysEnableLinkMonitorMode = 1;
527 }
528
529 /* WNI_CFG_SHORT_GI_20MHZ */
530
531 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
532 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700533 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 return eSIR_FAILURE;
535 }
536 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
537 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700538 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 return eSIR_FAILURE;
540 }
541 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
542 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700543 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 return eSIR_FAILURE;
545 }
546
547 val16 = ( tANI_U16 ) val1;
548 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
549 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
550 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
551
552 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
553 eSIR_SUCCESS)
554 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700555 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 return eSIR_FAILURE;
557 }
558
559 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
560
561 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
562 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700563 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 return eSIR_FAILURE;
565 }
566 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
567 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700568 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 return eSIR_FAILURE;
570 }
571 val16 = ( tANI_U16 ) val1;
572 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
573 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
574 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
575 eSIR_SUCCESS)
576 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700577 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 return eSIR_FAILURE;
579 }
580
581 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
582 limHandleCFGparamUpdate do we want to update this? */
583 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
584 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700585 limLog(pMac, LOGP, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 return eSIR_FAILURE;
587 }
588
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 /* WNI_CFG_MAX_PS_POLL */
590
591 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530592 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
593 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 {
595 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700596 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 return eSIR_FAILURE;
598 }
599
600 /* This context should be valid if power-save configuration message has been
601 * already dispatched during initialization process. Re-using the present
602 * configuration mask
603 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530604 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700605
606 /* Note: it is okay to do this since DAL/HAL is alrady started */
607 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
608 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700609 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 return eSIR_FAILURE;
611 }
612
613 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
614
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700616 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700618
619 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
620
621 /* This was initially done after resume notification from HAL. Now, DAL is
622 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700623 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800624 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
625 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700626 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800627 return eSIR_FAILURE;
628 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530629#ifdef FEATURE_WLAN_TDLS
630 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
631 {
632 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
633 return eSIR_FAILURE;
634 }
635 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
636 {
637 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
638 return eSIR_FAILURE;
639 }
640#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 return eSIR_SUCCESS;
642}
Jeff Johnson295189b2012-06-20 16:38:30 -0700643
644/*
645 limStart
646 This function is to replace the __limProcessSmeStartReq since there is no
647 eWNI_SME_START_REQ post to PE.
648*/
649tSirRetStatus limStart(tpAniSirGlobal pMac)
650{
651 tSirResultCodes retCode = eSIR_SUCCESS;
652
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700653 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700654
655 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
656 {
657 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
658
Jeff Johnsone7245742012-09-05 17:12:55 -0700659 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700660
661 // By default do not return after first scan match
662 pMac->lim.gLimReturnAfterFirstMatch = 0;
663
664 // Initialize MLM state machine
665 limInitMlm(pMac);
666
667 // By default return unique scan results
668 pMac->lim.gLimReturnUniqueResults = true;
669 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700670#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
671 pMac->lim.gLimSmeLfrScanResultLength = 0;
672#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 }
674 else
675 {
676 /**
677 * Should not have received eWNI_SME_START_REQ in states
678 * other than OFFLINE. Return response to host and
679 * log error
680 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700681 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 retCode = eSIR_FAILURE;
683 }
684
685 return retCode;
686}
687
688/**
689 * limInitialize()
690 *
691 *FUNCTION:
692 * This function is called from LIM thread entry function.
693 * LIM related global data structures are initialized in this function.
694 *
695 *LOGIC:
696 * NA
697 *
698 *ASSUMPTIONS:
699 * NA
700 *
701 *NOTE:
702 * NA
703 *
704 * @param pMac - Pointer to global MAC structure
705 * @return None
706 */
707
708tSirRetStatus
709limInitialize(tpAniSirGlobal pMac)
710{
711 tSirRetStatus status = eSIR_SUCCESS;
712
713 __limInitAssocVars(pMac);
714 __limInitVars(pMac);
715 __limInitStates(pMac);
716 __limInitStatsVars(pMac);
717 __limInitBssVars(pMac);
718 __limInitScanVars(pMac);
719 __limInitHTVars(pMac);
720 __limInitTitanVars(pMac);
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 status = limStart(pMac);
723 if(eSIR_SUCCESS != status)
724 {
725 return status;
726 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700727
728 /*
729 * MLM will be intitalized when 'START' request comes from SME.
730 * limInitMlm calls limCreateTimers, which actually relies on
731 * CFG to be downloaded. So it should not be called as part of
732 * peStart, as CFG download is happening after peStart.
733 */
734 //limInitMlm(pMac);
735 // Initializations for maintaining peers in IBSS
736 limIbssInit(pMac);
737
738 pmmInitialize(pMac);
739
740
741#if defined WLAN_FEATURE_VOWIFI
742 rrmInitialize(pMac);
743#endif
744#if defined WLAN_FEATURE_VOWIFI_11R
745 limFTOpen(pMac);
746#endif
747
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700749
750#if 0
751
752 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
753 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
754 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
755
756 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
757 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
758
759 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
760 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
761 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
762
763 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
764
765 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
766
767 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
768 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
769
770 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
771
772
773 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
774
775 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
776#endif
777 MTRACE(limTraceInit(pMac));
778
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 //Initialize the configurations needed by PE
780 if( eSIR_FAILURE == __limInitConfig(pMac))
781 {
782 //We need to undo everything in limStart
783 limCleanupMlm(pMac);
784 return eSIR_FAILURE;
785 }
786
787 //initialize the TSPEC admission control table.
788 //Note that this was initially done after resume notification from HAL.
789 //Now, DAL is started before PE so this can be done here
790 limAdmitControlInit(pMac);
791 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700792
793 return status;
794
795} /*** end limInitialize() ***/
796
797
798
799/**
800 * limCleanup()
801 *
802 *FUNCTION:
803 * This function is called upon reset or persona change
804 * to cleanup LIM state
805 *
806 *LOGIC:
807 * NA
808 *
809 *ASSUMPTIONS:
810 * NA
811 *
812 *NOTE:
813 * NA
814 *
815 * @param pMac - Pointer to Global MAC structure
816 * @return None
817 */
818
819void
820limCleanup(tpAniSirGlobal pMac)
821{
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 v_PVOID_t pvosGCTx;
823 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825//Before destroying the list making sure all the nodes have been deleted.
826//Which should be the normal case, but a memory leak has been reported.
827
828 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
829
830 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
831 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
832 {
833 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
834 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
835
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530836 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 }
838
839 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700840
841 limCleanupMlm(pMac);
842 limCleanupLmm(pMac);
843
844 // free up preAuth table
845 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
846 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530847 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
849 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
850 }
851
852 if(NULL != pMac->lim.pDialogueTokenHead)
853 {
854 limDeleteDialogueTokenList(pMac);
855 }
856
857 if(NULL != pMac->lim.pDialogueTokenTail)
858 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530859 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 pMac->lim.pDialogueTokenTail = NULL;
861 }
862
863 # if 0
864 if (pMac->lim.gpLimStartBssReq != NULL)
865 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530866 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 pMac->lim.gpLimStartBssReq = NULL;
868 }
869 #endif
870
871 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
872 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530873 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 pMac->lim.gpLimMlmSetKeysReq = NULL;
875 }
876
877 #if 0
878 if (pMac->lim.gpLimJoinReq != NULL)
879 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530880 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pMac->lim.gpLimJoinReq = NULL;
882 }
883 #endif
884
885 if (pMac->lim.gpLimMlmAuthReq != NULL)
886 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530887 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 pMac->lim.gpLimMlmAuthReq = NULL;
889 }
890
Jeff Johnsone7245742012-09-05 17:12:55 -0700891#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 if (pMac->lim.gpLimMlmJoinReq != NULL)
893 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530894 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 pMac->lim.gpLimMlmJoinReq = NULL;
896 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700897#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700898
899 #if 0
900 if (pMac->lim.gpLimReassocReq != NULL)
901 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530902 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700903 pMac->lim.gpLimReassocReq = NULL;
904 }
905 #endif
906
907 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
908 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530909 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
911 }
912
Viral Modid440e682013-03-06 02:25:31 -0800913 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800914 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530915 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800916 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800917 }
Viral Modid86bde22012-12-10 13:09:21 -0800918
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 if (pMac->lim.gpLimMlmScanReq != NULL)
920 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530921 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 pMac->lim.gpLimMlmScanReq = NULL;
923 }
924
925#if 0
926 if(NULL != pMac->lim.beacon)
927 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530928 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 pMac->lim.beacon = NULL;
930 }
931#endif
932 #if 0
933 if(NULL != pMac->lim.assocReq)
934 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530935 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 pMac->lim.assocReq= NULL;
937 }
938 #endif
939
940#if 0
941 if(NULL != pMac->lim.assocRsp)
942 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530943 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 pMac->lim.assocRsp= NULL;
945 }
946#endif
947 // Now, finally reset the deferred message queue pointers
948 limResetDeferredMsgQ(pMac);
949
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
951 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
952 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
953
954 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700955 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
957#if defined WLAN_FEATURE_VOWIFI
958 rrmCleanup(pMac);
959#endif
960#if defined WLAN_FEATURE_VOWIFI_11R
961 limFTCleanup(pMac);
962#endif
963
964} /*** end limCleanup() ***/
965
966
967/** -------------------------------------------------------------
968\fn peOpen
969\brief will be called in Open sequence from macOpen
970\param tpAniSirGlobal pMac
971\param tHalOpenParameters *pHalOpenParam
972\return tSirRetStatus
973 -------------------------------------------------------------*/
974
975tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
976{
977 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
978 pMac->lim.maxStation = pMacOpenParam->maxStation;
979
980 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
981 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700982 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700983 return eSIR_FAILURE;
984 }
985
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530986 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
987 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700989 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 return eSIR_FAILURE;
991 }
992
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800993#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530994 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
995 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700997 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700998 return eSIR_FAILURE;
999 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001000#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301001 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
1002 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001004 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 return eSIR_FAILURE;
1006 }
1007
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301008 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001009
1010
1011 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301012 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1013 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001015 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 return eSIR_FAILURE;
1017 }
1018
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301019 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1020 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001022 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 return eSIR_FAILURE;
1024 }
1025 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301026 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1027 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001029 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 return eSIR_FAILURE;
1031 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301032 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001033
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001034 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001035 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001036
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001037 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1038 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001039 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001040 return eSIR_FAILURE;
1041 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001042 pMac->lim.deauthMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 return eSIR_SUCCESS;
1044}
1045
1046/** -------------------------------------------------------------
1047\fn peClose
1048\brief will be called in close sequence from macClose
1049\param tpAniSirGlobal pMac
1050\return tSirRetStatus
1051 -------------------------------------------------------------*/
1052
1053tSirRetStatus peClose(tpAniSirGlobal pMac)
1054{
1055 tANI_U8 i;
1056
1057 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1058 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001059
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 for(i =0; i < pMac->lim.maxBssId; i++)
1061 {
1062 if(pMac->lim.gpSession[i].valid == TRUE)
1063 {
1064 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1065 }
1066 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301067 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001068 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001069#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301070 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001071 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001072#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001073
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301074 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 pMac->lim.gpSession = NULL;
1076 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301077 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301079 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1081 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301082 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001084 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1085 {
1086 return eSIR_FAILURE;
1087 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 return eSIR_SUCCESS;
1089}
1090
1091/** -------------------------------------------------------------
1092\fn peStart
1093\brief will be called in start sequence from macStart
1094\param tpAniSirGlobal pMac
1095\return none
1096 -------------------------------------------------------------*/
1097
1098tSirRetStatus peStart(tpAniSirGlobal pMac)
1099{
1100 tSirRetStatus status = eSIR_SUCCESS;
1101
1102 status = limInitialize(pMac);
1103#if defined(ANI_LOGDUMP)
1104 limDumpInit(pMac);
1105#endif //#if defined(ANI_LOGDUMP)
1106
1107 return status;
1108}
1109
1110/** -------------------------------------------------------------
1111\fn peStop
1112\brief will be called in stop sequence from macStop
1113\param tpAniSirGlobal pMac
1114\return none
1115 -------------------------------------------------------------*/
1116
1117void peStop(tpAniSirGlobal pMac)
1118{
1119 limCleanup(pMac);
1120 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1121 return;
1122}
1123
1124/** -------------------------------------------------------------
1125\fn peFreeMsg
1126\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1127\ to free a given PE message on the TX and MC thread.
1128\ This happens when there are messages pending in the PE
1129\ queue when system is being stopped and reset.
1130\param tpAniSirGlobal pMac
1131\param tSirMsgQ pMsg
1132\return none
1133-----------------------------------------------------------------*/
1134v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1135{
1136 if (pMsg != NULL)
1137 {
1138 if (NULL != pMsg->bodyptr)
1139 {
1140 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1141 {
1142 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1143 }
1144 else
1145 {
1146 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1147 }
1148 }
1149 pMsg->bodyptr = 0;
1150 pMsg->bodyval = 0;
1151 pMsg->type = 0;
1152 }
1153 return;
1154}
1155
1156
1157/**
1158 * The function checks if a particular timer should be allowed
1159 * into LIM while device is sleeping
1160 */
1161tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1162{
1163 tANI_U8 retStatus = TRUE;
1164
1165 if(!limIsSystemInActiveState(pMac))
1166 {
1167 switch(pMsg->type)
1168 {
1169 /* Don't allow following timer messages if in sleep */
1170 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1171 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1172 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1173 retStatus = FALSE;
1174 break;
1175 /* May allow following timer messages in sleep mode */
1176 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1177
1178 /* Safe to allow as of today, this triggers background scan
1179 * which will not be started if the device is in power-save mode
1180 * might need to block in the future if we decide to implement
1181 * spectrum management
1182 */
1183 case SIR_LIM_QUIET_TIMEOUT:
1184
1185 /* Safe to allow as of today, this triggers background scan
1186 * which will not be started if the device is in power-save mode
1187 * might need to block in the future if we decide to implement
1188 * spectrum management
1189 */
1190 case SIR_LIM_QUIET_BSS_TIMEOUT:
1191
1192 /* Safe to allow this timermessage, triggers background scan
1193 * which is blocked in sleep mode
1194 */
1195 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1196
1197 /* Safe to allow this timer, since, while in IMPS this timer will not
1198 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1199 * when heart-beat control is handled back to PE, device would have
1200 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1201 */
1202 case SIR_LIM_HEART_BEAT_TIMEOUT:
1203 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1204
1205 /* Safe to allow, PE is not handling this message as of now. May need
1206 * to block it, basically, free the buffer and restart the timer
1207 */
1208 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1209 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001210 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1212 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1213 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1214 retStatus = TRUE;
1215 break;
1216
1217 /* by default allow rest of messages */
1218 default:
1219 retStatus = TRUE;
1220 break;
1221
1222
1223 }
1224 }
1225
1226 return retStatus;
1227
1228}
1229
1230
1231
1232/**
1233 * limPostMsgApi()
1234 *
1235 *FUNCTION:
1236 * This function is called from other thread while posting a
1237 * message to LIM message Queue gSirLimMsgQ.
1238 *
1239 *LOGIC:
1240 * NA
1241 *
1242 *ASSUMPTIONS:
1243 * NA
1244 *
1245 *NOTE:
1246 * NA
1247 *
1248 * @param pMac - Pointer to Global MAC structure
1249 * @param pMsg - Pointer to the message structure
1250 * @return None
1251 */
1252
1253tANI_U32
1254limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1255{
Jeff Johnson295189b2012-06-20 16:38:30 -07001256 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1257
1258
Jeff Johnson295189b2012-06-20 16:38:30 -07001259} /*** end limPostMsgApi() ***/
1260
1261
1262/*--------------------------------------------------------------------------
1263
1264 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1265
1266 This function can be called by legacy code to post message to voss queues OR
1267 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1268 for dispatching it later.
1269
1270 \param pMac - Pointer to Global MAC structure
1271 \param pMsg - Pointer to the message structure
1272
1273 \return tANI_U32 - TX_SUCCESS for success.
1274
1275 --------------------------------------------------------------------------*/
1276
1277tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1278{
1279 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1280}
1281
1282/*--------------------------------------------------------------------------
1283
1284 \brief peProcessMessages() - Message Processor for PE
1285
1286 Voss calls this function to dispatch the message to PE
1287
1288 \param pMac - Pointer to Global MAC structure
1289 \param pMsg - Pointer to the message structure
1290
1291 \return tANI_U32 - TX_SUCCESS for success.
1292
1293 --------------------------------------------------------------------------*/
1294
1295tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1296{
1297 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1298 {
1299 return eSIR_SUCCESS;
1300 }
1301 /**
1302 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1303 * for all the other cases post it to LIM
1304 */
1305 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1306 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1307 else
1308 limMessageProcessor(pMac, pMsg);
1309 return eSIR_SUCCESS;
1310}
1311
1312
Jeff Johnson295189b2012-06-20 16:38:30 -07001313
1314// ---------------------------------------------------------------------------
1315/**
1316 * peHandleMgmtFrame
1317 *
1318 * FUNCTION:
1319 * Process the Management frames from TL
1320 *
1321 * LOGIC:
1322 *
1323 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1324 *
1325 * NOTE:
1326 *
1327 * @param pvosGCtx Global Vos Context
1328 * @param vossBuff Packet
1329 * @return None
1330 */
1331
1332VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1333{
1334 tpAniSirGlobal pMac;
1335 tpSirMacMgmtHdr mHdr;
1336 tSirMsgQ msg;
1337 vos_pkt_t *pVosPkt;
1338 VOS_STATUS vosStatus;
1339 v_U8_t *pRxPacketInfo;
1340
1341 pVosPkt = (vos_pkt_t *)vosBuff;
1342 if (NULL == pVosPkt)
1343 {
1344 return VOS_STATUS_E_FAILURE;
1345 }
1346
1347 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1348 if (NULL == pMac)
1349 {
1350 // cannot log a failure without a valid pMac
1351 vos_pkt_return_packet(pVosPkt);
1352 return VOS_STATUS_E_FAILURE;
1353 }
1354
1355 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1356
1357 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1358 {
1359 vos_pkt_return_packet(pVosPkt);
1360 return VOS_STATUS_E_FAILURE;
1361 }
1362
1363
1364 //
1365 // The MPDU header is now present at a certain "offset" in
1366 // the BD and is specified in the BD itself
1367 //
1368 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1369 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1370 {
1371 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001372 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001373 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001374
Jeff Johnsone7245742012-09-05 17:12:55 -07001375 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1377 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1378 }
1379
1380
1381 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1382 msg.type = SIR_BB_XPORT_MGMT_MSG;
1383 msg.bodyptr = vosBuff;
1384 msg.bodyval = 0;
1385
1386 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1387 &msg,
1388 mHdr->fc.type,
1389 mHdr->fc.subType ))
1390 {
1391 vos_pkt_return_packet(pVosPkt);
1392 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001393 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 return VOS_STATUS_E_FAILURE;
1395 }
1396
1397 return VOS_STATUS_SUCCESS;
1398}
1399
1400// ---------------------------------------------------------------------------
1401/**
1402 * peRegisterTLHandle
1403 *
1404 * FUNCTION:
1405 * Registers the Handler which, process the Management frames from TL
1406 *
1407 * LOGIC:
1408 *
1409 * ASSUMPTIONS:
1410 *
1411 * NOTE:
1412 *
1413 * @return None
1414 */
1415
1416void peRegisterTLHandle(tpAniSirGlobal pMac)
1417{
1418 v_PVOID_t pvosGCTx;
1419 VOS_STATUS retStatus;
1420
1421 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1422
1423 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1424
1425 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001426 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
1428}
Jeff Johnson295189b2012-06-20 16:38:30 -07001429
1430
1431/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 * limIsSystemInScanState()
1433 *
1434 *FUNCTION:
1435 * This function is called by various MAC software modules to
1436 * determine if System is in Scan/Learn state
1437 *
1438 *LOGIC:
1439 * NA
1440 *
1441 *ASSUMPTIONS:
1442 * NA
1443 *
1444 *NOTE:
1445 *
1446 * @param pMac - Pointer to Global MAC structure
1447 * @return true - System is in Scan/Learn state
1448 * false - System is NOT in Scan/Learn state
1449 */
1450
1451tANI_U8
1452limIsSystemInScanState(tpAniSirGlobal pMac)
1453{
1454 switch (pMac->lim.gLimSmeState)
1455 {
1456 case eLIM_SME_CHANNEL_SCAN_STATE:
1457 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1458 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1459 case eLIM_SME_WT_SCAN_STATE:
1460 // System is in Learn mode
1461 return true;
1462
1463 default:
1464 // System is NOT in Learn mode
1465 return false;
1466 }
1467} /*** end limIsSystemInScanState() ***/
1468
1469
1470
1471/**
1472 * limIsSystemInActiveState()
1473 *
1474 *FUNCTION:
1475 * This function is called by various MAC software modules to
1476 * determine if System is in Active/Wakeup state
1477 *
1478 *LOGIC:
1479 * NA
1480 *
1481 *ASSUMPTIONS:
1482 * NA
1483 *
1484 *NOTE:
1485 *
1486 * @param pMac - Pointer to Global MAC structure
1487 * @return true - System is in Active state
1488 * false - System is not in Active state
1489 */
1490
1491tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1492{
1493 switch (pMac->pmm.gPmmState)
1494 {
1495 case ePMM_STATE_BMPS_WAKEUP:
1496 case ePMM_STATE_IMPS_WAKEUP:
1497 case ePMM_STATE_READY:
1498 // System is in Active mode
1499 return true;
1500 default:
1501 return false;
1502 // System is NOT in Active mode
1503 }
1504}
1505
1506
Jeff Johnson295189b2012-06-20 16:38:30 -07001507
Jeff Johnson295189b2012-06-20 16:38:30 -07001508
1509
1510/**
1511*\brief limReceivedHBHandler()
1512*
1513* This function is called by schBeaconProcess() upon
1514* receiving a Beacon on STA. This also gets called upon
1515* receiving Probe Response after heat beat failure is
1516* detected.
1517*
1518* param pMac - global mac structure
1519* param channel - channel number indicated in Beacon, Probe Response
1520* return - none
1521*/
1522
1523
1524void
1525limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1526{
1527 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1528 psessionEntry->LimRxedBeaconCntDuringHB++;
1529
1530 pMac->pmm.inMissedBeaconScenario = FALSE;
1531} /*** end limReceivedHBHandler() ***/
1532
1533
1534
1535#if 0
1536void limResetHBPktCount(tpPESession psessionEntry)
1537{
1538 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1539}
1540#endif
1541
1542
1543/*
1544 * limProcessWdsInfo()
1545 *
1546 *FUNCTION:
1547 * This function is called from schBeaconProcess in BP
1548 *
1549 *PARAMS:
1550 * @param pMac - Pointer to Global MAC structure
1551 * @param propIEInfo - proprietary IE info
1552 *
1553 *LOGIC:
1554 *
1555 *ASSUMPTIONS:
1556 * NA
1557 *
1558 *NOTE:
1559 *
1560 *
1561 *RETURNS:
1562 *
1563 */
1564
1565void limProcessWdsInfo(tpAniSirGlobal pMac,
1566 tSirPropIEStruct propIEInfo)
1567{
Jeff Johnson295189b2012-06-20 16:38:30 -07001568}
1569
1570
1571
1572/**
1573 * limInitWdsInfoParams()
1574 *
1575 *FUNCTION:
1576 * This function is called while processing
1577 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1578 * ind/set related parameters.
1579 *
1580 *LOGIC:
1581 *
1582 *ASSUMPTIONS:
1583 *
1584 *NOTE:
1585 *
1586 * @param pMac Pointer to Global MAC structure
1587 * @return None
1588 */
1589
1590void
1591limInitWdsInfoParams(tpAniSirGlobal pMac)
1592{
1593 pMac->lim.gLimWdsInfo.wdsLength = 0;
1594 pMac->lim.gLimNumWdsInfoInd = 0;
1595 pMac->lim.gLimNumWdsInfoSet = 0;
1596} /*** limInitWdsInfoParams() ***/
1597
1598
1599/** -------------------------------------------------------------
1600\fn limUpdateOverlapStaParam
1601\brief Updates overlap cache and param data structure
1602\param tpAniSirGlobal pMac
1603\param tSirMacAddr bssId
1604\param tpLimProtStaParams pStaParams
1605\return None
1606 -------------------------------------------------------------*/
1607void
1608limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1609{
1610 int i;
1611 if (!pStaParams->numSta)
1612 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301613 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1614 bssId,
1615 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 pMac->lim.protStaOverlapCache[0].active = true;
1617
1618 pStaParams->numSta = 1;
1619
1620 return;
1621 }
1622
1623 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1624 {
1625 if (pMac->lim.protStaOverlapCache[i].active)
1626 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301627 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 bssId,
1629 sizeof(tSirMacAddr))) {
1630 return; }
1631 }
1632 else
1633 break;
1634 }
1635
1636 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1637 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001638 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 }
1640 else
1641 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301642 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1643 bssId,
1644 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 pMac->lim.protStaOverlapCache[i].active = true;
1646
1647 pStaParams->numSta++;
1648 }
1649}
1650
1651
1652/**
1653 * limHandleIBSScoalescing()
1654 *
1655 *FUNCTION:
1656 * This function is called upon receiving Beacon/Probe Response
1657 * while operating in IBSS mode.
1658 *
1659 *LOGIC:
1660 *
1661 *ASSUMPTIONS:
1662 *
1663 *NOTE:
1664 *
1665 * @param pMac - Pointer to Global MAC structure
1666 * @param pBeacon - Parsed Beacon Frame structure
1667 * @param pRxPacketInfo - Pointer to RX packet info structure
1668 *
1669 * @return Status whether to process or ignore received Beacon Frame
1670 */
1671
1672tSirRetStatus
1673limHandleIBSScoalescing(
1674 tpAniSirGlobal pMac,
1675 tpSchBeaconStruct pBeacon,
1676 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1677{
1678 tpSirMacMgmtHdr pHdr;
1679 tSirRetStatus retCode;
1680
1681 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1682 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
1683 /* Received SSID does not match => Ignore received Beacon frame. */
1684 retCode = eSIR_LIM_IGNORE_BEACON;
1685 else
1686 {
1687 tANI_U32 ieLen;
1688 tANI_U16 tsfLater;
1689 tANI_U8 *pIEs;
1690 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1691 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1692 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1693 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1694 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1695 }
1696 return retCode;
1697} /*** end limHandleIBSScoalescing() ***/
1698
1699
1700
1701/**
1702 * limDetectChangeInApCapabilities()
1703 *
1704 *FUNCTION:
1705 * This function is called while SCH is processing
1706 * received Beacon from AP on STA to detect any
1707 * change in AP's capabilities. If there any change
1708 * is detected, Roaming is informed of such change
1709 * so that it can trigger reassociation.
1710 *
1711 *LOGIC:
1712 *
1713 *ASSUMPTIONS:
1714 *
1715 *NOTE:
1716 * Notification is enabled for STA product only since
1717 * it is not a requirement on BP side.
1718 *
1719 * @param pMac Pointer to Global MAC structure
1720 * @param pBeacon Pointer to parsed Beacon structure
1721 * @return None
1722 */
1723
1724void
1725limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1726 tpSirProbeRespBeacon pBeacon,
1727 tpPESession psessionEntry)
1728{
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 tANI_U8 len;
1730 tSirSmeApNewCaps apNewCaps;
1731 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301732 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1734 newChannel = (tANI_U8) pBeacon->channelNumber;
1735
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301736 /* Some APs are not setting privacy bit when hidden ssid enabled.
1737 * So LIM was keep on sending eSIR_SME_AP_CAPS_CHANGED event to SME */
madan mohan koyyalamudi1388b2f2013-06-19 18:58:59 +05301738 if ((limIsNullSsid(&pBeacon->ssId) &&
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301739 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
madan mohan koyyalamudi1388b2f2013-06-19 18:58:59 +05301740 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps))) ||
1741 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1742 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps))
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301743 )
1744 {
1745 /* If Hidden SSID and privacy bit is not matching with the current capability,
1746 * then send unicast probe request to AP and take decision after
1747 * receiving probe response */
1748 if (psessionEntry->fIgnoreCapsChange == true)
1749 {
1750 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1751 return;
1752 }
1753 psessionEntry->fWaitForProbeRsp = true;
1754 limLog(pMac, LOGW, FL("Hidden SSID and privacy bit is not matching,"
madan mohan koyyalamudi1388b2f2013-06-19 18:58:59 +05301755 " Or Short preamble bit is not matching ,"
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301756 "sending directed probe request.. "));
1757 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1758 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1759 psessionEntry->dot11mode, 0, NULL);
1760
1761 if ( status != eSIR_SUCCESS)
1762 {
1763 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1764 }
1765
1766 return;
1767 }
1768 else
1769 {
1770 /* The control will come here if the frame is beacon with broadcast ssid
1771 * or probe response frame */
1772 if (psessionEntry->fWaitForProbeRsp == true)
1773 {
madan mohan koyyalamudi1388b2f2013-06-19 18:58:59 +05301774 if ((((!limIsNullSsid(&pBeacon->ssId)) &&
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301775 (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == true)) &&
1776 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) ==
madan mohan koyyalamudi1388b2f2013-06-19 18:58:59 +05301777 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps))) &&
1778 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) ==
1779 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps))
1780 )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301781 {
1782 /* Only for probe response frames the control will come here */
1783 /* If beacon with broadcast ssid then fWaitForProbeRsp will be false,
1784 the control wll not come here*/
1785 limLog(pMac, LOGW, FL("Privacy bit in probe response is"
1786 "matching with the current setting,"
1787 "Ignoring subsequent privacy bit capability"
1788 "mismatch"));
1789 psessionEntry->fIgnoreCapsChange = true;
1790 psessionEntry->fWaitForProbeRsp = false;
1791 }
1792 }
1793 }
1794
1795 if ((psessionEntry->limSentCapsChangeNtf == false) &&
1796 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
1798 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
1799 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
1800 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301801 (newChannel != psessionEntry->currentOperChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 )))
1803 {
1804
1805 /**
1806 * BSS capabilities have changed.
1807 * Inform Roaming.
1808 */
1809 len = sizeof(tSirMacCapabilityInfo) +
1810 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1811 3 * sizeof(tANI_U8) + // reserved fields
1812 pBeacon->ssId.length + 1;
1813
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301814 vos_mem_copy(apNewCaps.bssId,
1815 psessionEntry->bssId,
1816 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 if (newChannel != psessionEntry->currentOperChannel)
1818 {
1819 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001820 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 psessionEntry->currentOperChannel, newChannel);)
1822 return;
1823 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301824
1825 /**
1826 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1827 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1828 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1829 * the privacy bit is set in Probe and association responses.
1830 * Due to this anomaly, we detect a change in
1831 * AP capabilities when we receive a beacon after association and
1832 * disconnect from the AP. The following check makes sure that we can
1833 * connect to such APs
1834 */
1835 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1836 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1837 {
1838 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001839 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301840 return;
1841 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 else
1843 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301844 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1845 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 pBeacon->ssId.length + 1);
1847
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301848 psessionEntry->fIgnoreCapsChange = false;
1849 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 psessionEntry->limSentCapsChangeNtf = true;
1851 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1852 (tANI_U32 *) &apNewCaps,
1853 len, psessionEntry->smeSessionId);
1854 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001855} /*** limDetectChangeInApCapabilities() ***/
1856
1857
1858
1859
1860// ---------------------------------------------------------------------
1861/**
1862 * limUpdateShortSlot
1863 *
1864 * FUNCTION:
1865 * Enable/Disable short slot
1866 *
1867 * LOGIC:
1868 *
1869 * ASSUMPTIONS:
1870 *
1871 * NOTE:
1872 *
1873 * @param enable Flag to enable/disable short slot
1874 * @return None
1875 */
1876
1877tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1878{
1879
1880 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001881 tANI_U32 nShortSlot;
1882 tANI_U32 val = 0;
1883 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001884
Jeff Johnsone7245742012-09-05 17:12:55 -07001885 // Check Admin mode first. If it is disabled just return
1886 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1887 != eSIR_SUCCESS)
1888 {
1889 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001890 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001891 return eSIR_FAILURE;
1892 }
1893 if (val == false)
1894 return eSIR_SUCCESS;
1895
1896 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1897 limGetPhyMode(pMac, &phyMode, psessionEntry);
1898 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1899 return eSIR_SUCCESS;
1900
1901 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001902
1903 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1904 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1905 // if no erp present, use short slot based on current ap caps
1906
1907 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1908
1909 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1910 // The difference between the earlier implementation and the new one is only Case4.
1911 /*
1912 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1913 Case1 1 1 1 1 //AP should not advertise this combination.
1914 Case2 1 1 0 0
1915 Case3 1 0 1 1
1916 Case4 1 0 0 0
1917 Case5 0 1 1 1
1918 Case6 0 1 0 0
1919 Case7 0 0 1 1
1920 Case8 0 0 0 0
1921 */
1922 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1923
Jeff Johnsone7245742012-09-05 17:12:55 -07001924 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 {
1926 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001927 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001929 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1931 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 }
1933 return eSIR_SUCCESS;
1934}
1935
1936
Jeff Johnson295189b2012-06-20 16:38:30 -07001937
1938
Jeff Johnson295189b2012-06-20 16:38:30 -07001939
Jeff Johnson295189b2012-06-20 16:38:30 -07001940
1941
1942/** -----------------------------------------------------------------
1943 \brief limHandleLowRssiInd() - handles low rssi indication
1944
1945 This function process the SIR_HAL_LOW_RSSI_IND message from
1946 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1947
1948 \param pMac - global mac structure
1949
1950 \return
1951
1952 \sa
1953 ----------------------------------------------------------------- */
1954void limHandleLowRssiInd(tpAniSirGlobal pMac)
1955{
1956#if 0 //RSSI related indications will now go to TL and not PE
1957 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1958 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1959 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1960 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001961 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1963 }
1964 else
1965 {
1966 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001967 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 pMac->pmm.gPmmState);
1969 }
1970 return;
1971#endif
1972}
1973
1974
1975/** -----------------------------------------------------------------
1976 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1977
1978 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1979 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1980 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1981
1982 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1983 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1984 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1985 This message can also come from FW anytime after we have entered BMPS.
1986 This means we should handle it in WoWL and UAPSD states as well
1987
1988 \param pMac - global mac structure
1989 \return - none
1990 \sa
1991 ----------------------------------------------------------------- */
1992void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1993{
1994 switch(pMac->pmm.gPmmState)
1995 {
1996 case ePMM_STATE_BMPS_SLEEP:
1997 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1998 case ePMM_STATE_UAPSD_SLEEP:
1999 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2000 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002001 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2003 break;
2004
2005 default:
2006 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002007 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 pMac->pmm.gPmmState);
2009 break;
2010 }
2011 return;
2012}
2013
2014
2015/** -----------------------------------------------------------------
2016 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2017
2018 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2019 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2020 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2021
2022 \param pMac - global mac structure
2023 \return - none
2024 \sa
2025 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002026void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002027{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002028#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2029 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2030 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2031 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2032 if (psessionEntry == NULL)
2033 {
2034 limLog(pMac, LOGE,
2035 FL("session does not exist for given BSSIdx:%d"),
2036 pSirMissedBeaconInd->bssIdx);
2037 return;
2038 }
2039#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2041 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2042 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2043 {
2044 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302045 PELOGE(limLog(pMac, LOGE,
2046 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2048 }
Yathish9f22e662012-12-10 14:21:35 -08002049/* ACTIVE_MODE_HB_OFFLOAD */
2050#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2051 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2052 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2053 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2054 {
2055 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002056 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002057 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002058 }
2059#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 else
2061 {
2062 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002063 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 pMac->pmm.gPmmState);
2065 }
2066 return;
2067}
2068
2069/** -----------------------------------------------------------------
2070 \brief limMicFailureInd() - handles mic failure indication
2071
2072 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2073
2074 \param pMac - global mac structure
2075 \return - none
2076 \sa
2077 ----------------------------------------------------------------- */
2078void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2079{
2080 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2081 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2082 tSirMsgQ mmhMsg;
2083 tpPESession psessionEntry ;
2084 tANI_U8 sessionId;
2085
2086 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2087 {
2088 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002089 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 return;
2091 }
2092
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302093 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2094 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 {
2096 // Log error
2097 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002098 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 return;
2100 }
2101
2102 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2103 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2104 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2105
2106 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302107 pSirMicFailureInd->bssId,
2108 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002109
2110 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302111 pSirMicFailureInd->info.srcMacAddr,
2112 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002113
2114 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302115 pSirMicFailureInd->info.taMacAddr,
2116 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002117
2118 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302119 pSirMicFailureInd->info.dstMacAddr,
2120 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
2122 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302123 pSirMicFailureInd->info.rxMacAddr,
2124 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002125
2126 pSirSmeMicFailureInd->info.multicast =
2127 pSirMicFailureInd->info.multicast;
2128
2129 pSirSmeMicFailureInd->info.keyId=
2130 pSirMicFailureInd->info.keyId;
2131
2132 pSirSmeMicFailureInd->info.IV1=
2133 pSirMicFailureInd->info.IV1;
2134
2135 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302136 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002137
2138 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2139 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2140 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002141 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2143 return;
2144}
2145
2146
2147/** -----------------------------------------------------------------
2148 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2149
2150 This function is called before enqueuing the frame to PE queue for further processing.
2151 This prevents unnecessary frames getting into PE Queue and drops them right away.
2152 Frames will be droped in the following scenarios:
2153
2154 - In Scan State, drop the frames which are not marked as scan frames
2155 - In non-Scan state, drop the frames which are marked as scan frames.
2156 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2157 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2158
2159 \param pMac - global mac structure
2160 \return - none
2161 \sa
2162 ----------------------------------------------------------------- */
2163
2164tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2165{
2166 tANI_U32 framelen;
2167 tANI_U8 *pBody;
2168 tSirMacCapabilityInfo capabilityInfo;
2169
2170 /*
2171 *
2172 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2173 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2174 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2175 * other than beacons or probe responses in scan state.
2176 */
2177 if( (subType == SIR_MAC_MGMT_BEACON) ||
2178 (subType == SIR_MAC_MGMT_PROBE_RSP))
2179 {
2180 if(pMac->pmm.inMissedBeaconScenario)
2181 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002182 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2183 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 }
2185 if (limIsSystemInScanState(pMac))
2186 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002187 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002189#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2190 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2191 {
2192 return eMGMT_DROP_NO_DROP;
2193 }
2194#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2196 {
2197 return eMGMT_DROP_SCAN_MODE_FRAME;
2198 }
2199 }
2200
2201 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2202 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2203
2204 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2205 * beacons from an infrastructure network
2206 */
2207 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2208 if(!capabilityInfo.ibss)
2209 return eMGMT_DROP_NO_DROP;
2210#if 0
2211 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2212 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2213 return eMGMT_DROP_NO_DROP;
2214#endif
2215
2216 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2217 if( (subType == SIR_MAC_MGMT_BEACON) ||
2218 (subType == SIR_MAC_MGMT_PROBE_RSP))
2219 {
2220 //drop the frame if length is less than 12
2221 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2222 return eMGMT_DROP_INVALID_SIZE;
2223
2224 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2225
2226 //This can be enhanced to even check the SSID before deciding to enque the frame.
2227 if(capabilityInfo.ess)
2228 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2229 }
2230 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2231 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2232 {
2233 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2234 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2235 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2236 }
2237
2238 return eMGMT_DROP_NO_DROP;
2239}
2240
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002241eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2242{
2243 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002244
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002245 if(psPe)
2246 {
2247 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2248 {
2249 status = eHAL_STATUS_SUCCESS;
2250 }
2251 }
2252 return (status);
2253}
2254eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2255{
2256 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2257 if(psPe)
2258 {
2259 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2260 {
2261 status = eHAL_STATUS_SUCCESS;
2262 }
2263 }
2264 return (status);
2265}