blob: 32ad7f31e4b05eb09a7bc8818a37e6fe30f758e6 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
6/*
Jeff Johnson295189b2012-06-20 16:38:30 -07007 * Airgo Networks, Inc proprietary. All rights reserved.
8 * This file limApi.cc contains the functions that are
9 * exported by LIM to other modules.
10 *
11 * Author: Chandra Modumudi
12 * Date: 02/11/02
13 * History:-
14 * Date Modified by Modification Information
15 * --------------------------------------------------------------------
16 *
17 */
18#include "palTypes.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070019#include "wniCfgSta.h"
20#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070021#include "sirCommon.h"
22#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070023#include "cfgApi.h"
24
25#include "schApi.h"
26#include "utilsApi.h"
27#include "limApi.h"
28#include "limGlobal.h"
29#include "limTypes.h"
30#include "limUtils.h"
31#include "limAssocUtils.h"
32#include "limPropExtsUtils.h"
33#include "limSerDesUtils.h"
34#include "limIbssPeerMgmt.h"
35#include "limAdmitControl.h"
36#include "pmmApi.h"
37#include "logDump.h"
38#include "limSendSmeRspMessages.h"
39#include "wmmApsd.h"
40#include "limTrace.h"
41#include "limSession.h"
42#include "wlan_qct_wda.h"
43
44#if defined WLAN_FEATURE_VOWIFI
45#include "rrmApi.h"
46#endif
47
48#include <limFT.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070049#include "vos_types.h"
50#include "vos_packet.h"
51#include "wlan_qct_tl.h"
52#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070053
54
55static void __limInitScanVars(tpAniSirGlobal pMac)
56{
57 pMac->lim.gLimUseScanModeForLearnMode = 1;
58
59 pMac->lim.gLimSystemInScanLearnMode = 0;
60
61 // Scan related globals on STA
62 pMac->lim.gLimReturnAfterFirstMatch = 0;
63 pMac->lim.gLim24Band11dScanDone = 0;
64 pMac->lim.gLim50Band11dScanDone = 0;
65 pMac->lim.gLimReturnUniqueResults = 0;
66
67 // Background Scan related globals on STA
68 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
69 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
70 pMac->lim.gLimNumOfForcedBkgndScan = 0;
71 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
72 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
73 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -080074 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76 pMac->lim.gLimCurrentScanChannelId = 0;
77 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid440e682013-03-06 02:25:31 -080078 pMac->lim.gDeferMsgTypeForNOA = 0;
79 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -070080 pMac->lim.gLimMlmScanResultLength = 0;
81 pMac->lim.gLimSmeScanResultLength = 0;
82
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +053083 vos_mem_set(pMac->lim.gLimCachedScanHashTable,
84 sizeof(pMac->lim.gLimCachedScanHashTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -070085
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070086#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
87
88 pMac->lim.gLimMlmLfrScanResultLength = 0;
89 pMac->lim.gLimSmeLfrScanResultLength = 0;
90
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +053091 vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
92 sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070093#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070094 pMac->lim.gLimBackgroundScanChannelId = 0;
95 pMac->lim.gLimBackgroundScanStarted = 0;
96 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
97 pMac->lim.gLimRestoreCBCount = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +053098 vos_mem_set(pMac->lim.gLimLegacyBssidList,
99 sizeof(pMac->lim.gLimLegacyBssidList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700100
101 /* Fill in default values */
102 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
103
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
105 // abort scan is used to abort an on-going scan
106 pMac->lim.abortScan = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530107 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
108 vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
110//WLAN_SUSPEND_LINK Related
111 pMac->lim.gpLimSuspendCallback = NULL;
112 pMac->lim.gpLimResumeCallback = NULL;
113//end WLAN_SUSPEND_LINK Related
114}
115
116
117static void __limInitBssVars(tpAniSirGlobal pMac)
118{
119
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530120 vos_mem_set((void*)pMac->lim.gpSession,
121 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700122
123
124 //pMac->lim.gpLimStartBssReq = NULL;
125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126
127
128
129/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
130#if 0
131
132 // Place holder for BSS description that we're
133 // currently joined with
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530134 vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700135 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530136 vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 pMac->lim.gLimCurrentBssCaps = 0;
138 QosCaps is a bit map of various qos capabilities - see defn above
139 pMac->lim.gLimCurrentBssQosCaps = 0;
140 pMac->lim.gLimCurrentBssPropCap = 0;
141 pMac->lim.gLimSentCapsChangeNtf = 0;
142
143 // Place holder for BSS description that
144 // we're currently Reassociating
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530145 vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700146 pMac->lim.gLimReassocChannelId = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530147 vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700148 pMac->lim.gLimReassocBssCaps = 0;
149 pMac->lim.gLimReassocBssQosCaps = 0;
150 pMac->lim.gLimReassocBssPropCap = 0;
151 #endif
152
153 /* This is for testing purposes only, be default should always be off */
154 pMac->lim.gLimForceNoPropIE = 0;
155
156 // pMac->lim.gLimBssIdx = 0;
157
158 pMac->lim.gpLimMlmSetKeysReq = NULL;
159 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
160 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
161
162}
163
164
165static void __limInitStatsVars(tpAniSirGlobal pMac)
166{
167 pMac->lim.gLimNumBeaconsRcvd = 0;
168 pMac->lim.gLimNumBeaconsIgnored = 0;
169
170 pMac->lim.gLimNumDeferredMsgs = 0;
171
172 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800173 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
175
176 /// This indicates number of RXed Beacons during HB period
177 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
178
179 // Heart-Beat interval value
180 pMac->lim.gLimHeartBeatCount = 0;
181
182 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530183 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
184 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700185
186#ifdef WLAN_DEBUG
187 // Debug counters
188 pMac->lim.numTot = 0;
189 pMac->lim.numBbt = 0;
190 pMac->lim.numProtErr = 0;
191 pMac->lim.numLearn = 0;
192 pMac->lim.numLearnIgnore = 0;
193 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530194 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 pMac->lim.gLimNumAssocReqDropInvldState = 0;
196 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
197 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
198 pMac->lim.gLimNumReassocReqDropInvldState = 0;
199 pMac->lim.gLimNumHashMissIgnored = 0;
200 pMac->lim.gLimUnexpBcnCnt = 0;
201 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
202 pMac->lim.gLimNumLinkEsts = 0;
203 pMac->lim.gLimNumRxCleanup = 0;
204 pMac->lim.gLim11bStaAssocRejectCount = 0;
205#endif
206}
207
208
209
210static void __limInitStates(tpAniSirGlobal pMac)
211{
212 // Counts Heartbeat failures
213 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
214 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
215 pMac->lim.gLimHBfailureCntInOtherStates = 0;
216 pMac->lim.gLimRspReqd = 0;
217 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
218
219 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700220 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
222
223 /// Previous MLM State
224 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
225
226#ifdef GEN4_SCAN
227 // LIM to HAL SCAN Management Message Interface states
228 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
229#endif // GEN4_SCAN
230
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700232 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700234 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700235
236 /**
237 * By default assume 'unknown' role. This will be updated
238 * when SME_START_BSS_REQ is received.
239 */
240
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530241 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
242 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
243 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
244 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
245 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
246 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700247
248 pMac->lim.gLimPhyMode = 0;
249 pMac->lim.scanStartTime = 0; // used to measure scan time
250
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530251 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 pMac->lim.ackPolicy = 0;
253
254#if 0 /* Moving all these to session specific elements */
255 pMac->lim.gLimQosEnabled = 0; //11E
256 pMac->lim.gLimWmeEnabled = 0; //WME
257 pMac->lim.gLimWsmEnabled = 0; //WSM
258 pMac->lim.gLimHcfEnabled = 0;
259 pMac->lim.gLim11dEnabled = 0;
260#endif
261
262 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
263}
264
265static void __limInitVars(tpAniSirGlobal pMac)
266{
267
Jeff Johnson295189b2012-06-20 16:38:30 -0700268
269 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700270
271 // WDS info
272 pMac->lim.gLimNumWdsInfoInd = 0;
273 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530274 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 /* initialize some parameters */
276 limInitWdsInfoParams(pMac);
277
278 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530279 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700280
281 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530282 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 pMac->lim.gLimAddtsSent = 0;
284 pMac->lim.gLimAddtsRspTimerCount = 0;
285
286 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530287 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530289 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
291
Jeff Johnsone7245742012-09-05 17:12:55 -0700292#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
295 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700296#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 // WMM Related Flag
298 pMac->lim.gUapsdEnable = 0;
299 pMac->lim.gUapsdPerAcBitmask = 0;
300 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
301 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
302
303 // QoS-AC Downgrade: Initially, no AC is admitted
304 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
305 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
306
307 //dialogue token List head/tail for Action frames request sent.
308 pMac->lim.pDialogueTokenHead = NULL;
309 pMac->lim.pDialogueTokenTail = NULL;
310
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530311 vos_mem_set(&pMac->lim.tspecInfo,
312 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700313
314 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530315 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 pMac->lim.gLastBeaconDtimCount = 0;
318 pMac->lim.gLastBeaconDtimPeriod = 0;
319
320 //Scan in Power Save Flag
321 pMac->lim.gScanInPowersave = 0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800322 pMac->lim.probeCounter = 0;
323 pMac->lim.maxProbe = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700324}
325
326static void __limInitAssocVars(tpAniSirGlobal pMac)
327{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800328 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800329#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530330 vos_mem_set(pMac->lim.gpLimAIDpool,
331 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 pMac->lim.freeAidHead = 0;
333 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800334#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800335 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
336 {
337 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
338 }
339 pMac->lim.gLimAssocStaLimit = val;
Ravi Joshi0fc681b2013-09-11 16:46:07 -0700340 pMac->lim.gLimIbssStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700341
342 // Place holder for current authentication request
343 // being handled
344 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700345 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700346
347 /// MAC level Pre-authentication related globals
348 pMac->lim.gLimPreAuthChannelNumber = 0;
349 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530350 vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 pMac->lim.gLimNumPreAuthContexts = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530352 vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
354 // Placed holder to deauth reason
355 pMac->lim.gLimDeauthReasonCode = 0;
356
357 // Place holder for Pre-authentication node list
358 pMac->lim.pLimPreAuthList = NULL;
359
360 // Send Disassociate frame threshold parameters
361 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
362 pMac->lim.gLimDisassocFrameCredit = 0;
363
364 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530365 vos_mem_set(pMac->lim.protStaOverlapCache,
366 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
367 vos_mem_set(pMac->lim.protStaCache,
368 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700369
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700370#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
371 pMac->lim.pSessionEntry = NULL;
372 pMac->lim.reAssocRetryAttempt = 0;
373#endif
374
Jeff Johnson295189b2012-06-20 16:38:30 -0700375}
376
377
378static void __limInitTitanVars(tpAniSirGlobal pMac)
379{
Jeff Johnsone7245742012-09-05 17:12:55 -0700380#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530381 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700383 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
384#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 // Debug workaround for BEACON's
386 // State change triggered by "dump 222"
387 pMac->lim.gLimScanOverride = 1;
388 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 pMac->lim.gLimTitanStaCount = 0;
390 pMac->lim.gLimBlockNonTitanSta = 0;
391}
392
393static void __limInitHTVars(tpAniSirGlobal pMac)
394{
395 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 pMac->lim.gHTShortGI40Mhz = 0;
398 pMac->lim.gHTShortGI20Mhz = 0;
399 pMac->lim.gHTMaxAmsduLength = 0;
400 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
401 pMac->lim.gHTPSMPSupport = 0;
402 pMac->lim.gHTLsigTXOPProtection = 0;
403 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
404 pMac->lim.gHTAMpduDensity = 0;
405
406 pMac->lim.gMaxAmsduSizeEnabled = false;
407 pMac->lim.gHTMaxRxAMpduFactor = 0;
408 pMac->lim.gHTServiceIntervalGranularity = 0;
409 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
411 pMac->lim.gHTPCOActive = 0;
412
413 pMac->lim.gHTPCOPhase = 0;
414 pMac->lim.gHTSecondaryBeacon = 0;
415 pMac->lim.gHTDualCTSProtection = 0;
416 pMac->lim.gHTSTBCBasicMCS = 0;
417 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
418}
419
Jeff Johnson295189b2012-06-20 16:38:30 -0700420static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
421{
Jeff Johnsone7245742012-09-05 17:12:55 -0700422 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 tANI_U16 val16;
424 tANI_U8 val8;
425 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
426 tSirMacHTInfoField1 *pHTInfoField1;
427 tpSirPowerSaveCfg pPowerSaveConfig;
428 tSirMacHTParametersInfo *pAmpduParamInfo;
429
430 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700431 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
432 * and they will be used throughout when there is no session
433 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700434
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
436 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700437 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 return eSIR_FAILURE;
439 }
440
441 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
442 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700443 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 return eSIR_FAILURE;
445 }
446 val16 = ( tANI_U16 ) val1;
447 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
448
449 //channel bonding mode could be set to anything from 0 to 4(Titan had these
450 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
451 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
452 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
453 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
454 != eSIR_SUCCESS)
455 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700456 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 return eSIR_FAILURE;
458 }
459
460 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
461 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700462 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return eSIR_FAILURE;
464 }
465
466 val8 = ( tANI_U8 ) val1;
467 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
468 pHTInfoField1->recommendedTxWidthSet =
469 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
471 != eSIR_SUCCESS)
472 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700473 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 return eSIR_FAILURE;
475 }
476
477 /* WNI_CFG_HEART_BEAT_THRESHOLD */
478
479 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
480 eSIR_SUCCESS )
481 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700482 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 return eSIR_FAILURE;
484 }
485 if(!val1)
486 {
487 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
488 pMac->sys.gSysEnableLinkMonitorMode = 0;
489 }
490 else
491 {
492 //No need to activate the timer during init time.
493 pMac->sys.gSysEnableLinkMonitorMode = 1;
494 }
495
496 /* WNI_CFG_SHORT_GI_20MHZ */
497
498 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
499 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700500 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 return eSIR_FAILURE;
502 }
503 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
504 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700505 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 return eSIR_FAILURE;
507 }
508 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
509 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700510 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 return eSIR_FAILURE;
512 }
513
514 val16 = ( tANI_U16 ) val1;
515 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
516 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
517 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
518
519 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
520 eSIR_SUCCESS)
521 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700522 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 return eSIR_FAILURE;
524 }
525
526 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
527
528 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
529 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 return eSIR_FAILURE;
532 }
533 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
534 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700535 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 return eSIR_FAILURE;
537 }
538 val16 = ( tANI_U16 ) val1;
539 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
540 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
541 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
542 eSIR_SUCCESS)
543 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700544 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 return eSIR_FAILURE;
546 }
547
548 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
549 limHandleCFGparamUpdate do we want to update this? */
550 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
551 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530552 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 return eSIR_FAILURE;
554 }
555
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 /* WNI_CFG_MAX_PS_POLL */
557
558 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530559 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
560 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 {
562 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700563 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 return eSIR_FAILURE;
565 }
566
567 /* This context should be valid if power-save configuration message has been
568 * already dispatched during initialization process. Re-using the present
569 * configuration mask
570 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530571 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700572
573 /* Note: it is okay to do this since DAL/HAL is alrady started */
574 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
575 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700576 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 return eSIR_FAILURE;
578 }
579
580 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
581
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700583 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700585
586 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
587
588 /* This was initially done after resume notification from HAL. Now, DAL is
589 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700590 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800591 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
592 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700593 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800594 return eSIR_FAILURE;
595 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530596#ifdef FEATURE_WLAN_TDLS
597 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
598 {
599 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
600 return eSIR_FAILURE;
601 }
602 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
603 {
604 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
605 return eSIR_FAILURE;
606 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530607 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
608 {
609 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
610 return eSIR_FAILURE;
611 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530612#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 return eSIR_SUCCESS;
614}
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
616/*
617 limStart
618 This function is to replace the __limProcessSmeStartReq since there is no
619 eWNI_SME_START_REQ post to PE.
620*/
621tSirRetStatus limStart(tpAniSirGlobal pMac)
622{
623 tSirResultCodes retCode = eSIR_SUCCESS;
624
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700625 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700626
627 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
628 {
629 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
630
Jeff Johnsone7245742012-09-05 17:12:55 -0700631 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
633 // By default do not return after first scan match
634 pMac->lim.gLimReturnAfterFirstMatch = 0;
635
636 // Initialize MLM state machine
637 limInitMlm(pMac);
638
639 // By default return unique scan results
640 pMac->lim.gLimReturnUniqueResults = true;
641 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700642#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
643 pMac->lim.gLimSmeLfrScanResultLength = 0;
644#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 }
646 else
647 {
648 /**
649 * Should not have received eWNI_SME_START_REQ in states
650 * other than OFFLINE. Return response to host and
651 * log error
652 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700653 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 retCode = eSIR_FAILURE;
655 }
656
657 return retCode;
658}
659
660/**
661 * limInitialize()
662 *
663 *FUNCTION:
664 * This function is called from LIM thread entry function.
665 * LIM related global data structures are initialized in this function.
666 *
667 *LOGIC:
668 * NA
669 *
670 *ASSUMPTIONS:
671 * NA
672 *
673 *NOTE:
674 * NA
675 *
676 * @param pMac - Pointer to global MAC structure
677 * @return None
678 */
679
680tSirRetStatus
681limInitialize(tpAniSirGlobal pMac)
682{
683 tSirRetStatus status = eSIR_SUCCESS;
684
685 __limInitAssocVars(pMac);
686 __limInitVars(pMac);
687 __limInitStates(pMac);
688 __limInitStatsVars(pMac);
689 __limInitBssVars(pMac);
690 __limInitScanVars(pMac);
691 __limInitHTVars(pMac);
692 __limInitTitanVars(pMac);
693
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 status = limStart(pMac);
695 if(eSIR_SUCCESS != status)
696 {
697 return status;
698 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700699
700 /*
701 * MLM will be intitalized when 'START' request comes from SME.
702 * limInitMlm calls limCreateTimers, which actually relies on
703 * CFG to be downloaded. So it should not be called as part of
704 * peStart, as CFG download is happening after peStart.
705 */
706 //limInitMlm(pMac);
707 // Initializations for maintaining peers in IBSS
708 limIbssInit(pMac);
709
710 pmmInitialize(pMac);
711
712
713#if defined WLAN_FEATURE_VOWIFI
714 rrmInitialize(pMac);
715#endif
716#if defined WLAN_FEATURE_VOWIFI_11R
717 limFTOpen(pMac);
718#endif
719
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700721
722#if 0
723
724 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
725 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
726 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
727
728 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
729 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
730
731 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
732 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
733 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
734
735 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
736
737 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
738
739 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
740 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
741
742 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
743
744
745 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
746
747 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
748#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700749
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 //Initialize the configurations needed by PE
751 if( eSIR_FAILURE == __limInitConfig(pMac))
752 {
753 //We need to undo everything in limStart
754 limCleanupMlm(pMac);
755 return eSIR_FAILURE;
756 }
757
758 //initialize the TSPEC admission control table.
759 //Note that this was initially done after resume notification from HAL.
760 //Now, DAL is started before PE so this can be done here
761 limAdmitControlInit(pMac);
762 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700763
764 return status;
765
766} /*** end limInitialize() ***/
767
768
769
770/**
771 * limCleanup()
772 *
773 *FUNCTION:
774 * This function is called upon reset or persona change
775 * to cleanup LIM state
776 *
777 *LOGIC:
778 * NA
779 *
780 *ASSUMPTIONS:
781 * NA
782 *
783 *NOTE:
784 * NA
785 *
786 * @param pMac - Pointer to Global MAC structure
787 * @return None
788 */
789
790void
791limCleanup(tpAniSirGlobal pMac)
792{
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 v_PVOID_t pvosGCTx;
794 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700795
Jeff Johnson295189b2012-06-20 16:38:30 -0700796//Before destroying the list making sure all the nodes have been deleted.
797//Which should be the normal case, but a memory leak has been reported.
798
799 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
800
801 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
802 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
803 {
804 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
805 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
806
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530807 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 }
809
810 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812 limCleanupMlm(pMac);
813 limCleanupLmm(pMac);
814
815 // free up preAuth table
816 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
817 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530818 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
820 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
821 }
822
823 if(NULL != pMac->lim.pDialogueTokenHead)
824 {
825 limDeleteDialogueTokenList(pMac);
826 }
827
828 if(NULL != pMac->lim.pDialogueTokenTail)
829 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530830 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 pMac->lim.pDialogueTokenTail = NULL;
832 }
833
834 # if 0
835 if (pMac->lim.gpLimStartBssReq != NULL)
836 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530837 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 pMac->lim.gpLimStartBssReq = NULL;
839 }
840 #endif
841
842 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
843 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530844 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 pMac->lim.gpLimMlmSetKeysReq = NULL;
846 }
847
848 #if 0
849 if (pMac->lim.gpLimJoinReq != NULL)
850 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530851 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 pMac->lim.gpLimJoinReq = NULL;
853 }
854 #endif
855
856 if (pMac->lim.gpLimMlmAuthReq != NULL)
857 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530858 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 pMac->lim.gpLimMlmAuthReq = NULL;
860 }
861
Jeff Johnsone7245742012-09-05 17:12:55 -0700862#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 if (pMac->lim.gpLimMlmJoinReq != NULL)
864 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530865 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 pMac->lim.gpLimMlmJoinReq = NULL;
867 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700868#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700869
870 #if 0
871 if (pMac->lim.gpLimReassocReq != NULL)
872 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530873 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 pMac->lim.gpLimReassocReq = NULL;
875 }
876 #endif
877
878 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
879 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530880 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
882 }
883
Viral Modid440e682013-03-06 02:25:31 -0800884 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800885 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530886 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800887 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800888 }
Viral Modid86bde22012-12-10 13:09:21 -0800889
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 if (pMac->lim.gpLimMlmScanReq != NULL)
891 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530892 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 pMac->lim.gpLimMlmScanReq = NULL;
894 }
895
896#if 0
897 if(NULL != pMac->lim.beacon)
898 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530899 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 pMac->lim.beacon = NULL;
901 }
902#endif
903 #if 0
904 if(NULL != pMac->lim.assocReq)
905 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530906 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 pMac->lim.assocReq= NULL;
908 }
909 #endif
910
911#if 0
912 if(NULL != pMac->lim.assocRsp)
913 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530914 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 pMac->lim.assocRsp= NULL;
916 }
917#endif
918 // Now, finally reset the deferred message queue pointers
919 limResetDeferredMsgQ(pMac);
920
Jeff Johnson295189b2012-06-20 16:38:30 -0700921
922 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
923 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
924
925 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700926 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928#if defined WLAN_FEATURE_VOWIFI
929 rrmCleanup(pMac);
930#endif
931#if defined WLAN_FEATURE_VOWIFI_11R
932 limFTCleanup(pMac);
933#endif
934
935} /*** end limCleanup() ***/
936
937
938/** -------------------------------------------------------------
939\fn peOpen
940\brief will be called in Open sequence from macOpen
941\param tpAniSirGlobal pMac
942\param tHalOpenParameters *pHalOpenParam
943\return tSirRetStatus
944 -------------------------------------------------------------*/
945
946tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
947{
948 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
949 pMac->lim.maxStation = pMacOpenParam->maxStation;
950
951 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
952 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700953 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 return eSIR_FAILURE;
955 }
956
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530957 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
958 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700959 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700960 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 return eSIR_FAILURE;
962 }
963
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800964#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530965 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
966 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700968 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 return eSIR_FAILURE;
970 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800971#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530972 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
973 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700975 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 return eSIR_FAILURE;
977 }
978
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530979 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700980
981
982 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530983 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
984 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700986 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 return eSIR_FAILURE;
988 }
989
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530990 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
991 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700993 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 return eSIR_FAILURE;
995 }
996 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530997 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
998 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001000 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 return eSIR_FAILURE;
1002 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301003 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001004
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001005 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001006 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001007
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001008 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1009 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001010 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001011 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1012 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1013 vos_mem_free(pMac->lim.gpSession);
1014 pMac->lim.gpSession = NULL;
1015 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1016 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001017 return eSIR_FAILURE;
1018 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001019 pMac->lim.deauthMsgCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001020
1021 /*
1022 * peOpen is successful by now, so it is right time to initialize
1023 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1024 * then nothing will be logged for PE module.
1025 */
1026#ifdef LIM_TRACE_RECORD
1027 MTRACE(limTraceInit(pMac));
1028#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 return eSIR_SUCCESS;
1030}
1031
1032/** -------------------------------------------------------------
1033\fn peClose
1034\brief will be called in close sequence from macClose
1035\param tpAniSirGlobal pMac
1036\return tSirRetStatus
1037 -------------------------------------------------------------*/
1038
1039tSirRetStatus peClose(tpAniSirGlobal pMac)
1040{
1041 tANI_U8 i;
1042
1043 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1044 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001045
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 for(i =0; i < pMac->lim.maxBssId; i++)
1047 {
1048 if(pMac->lim.gpSession[i].valid == TRUE)
1049 {
1050 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1051 }
1052 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301053 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001054 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001055#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301056 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001057 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001058#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001059
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301060 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 pMac->lim.gpSession = NULL;
1062 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301063 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301065 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1067 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301068 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001070 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1071 {
1072 return eSIR_FAILURE;
1073 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 return eSIR_SUCCESS;
1075}
1076
1077/** -------------------------------------------------------------
1078\fn peStart
1079\brief will be called in start sequence from macStart
1080\param tpAniSirGlobal pMac
1081\return none
1082 -------------------------------------------------------------*/
1083
1084tSirRetStatus peStart(tpAniSirGlobal pMac)
1085{
1086 tSirRetStatus status = eSIR_SUCCESS;
1087
1088 status = limInitialize(pMac);
1089#if defined(ANI_LOGDUMP)
1090 limDumpInit(pMac);
1091#endif //#if defined(ANI_LOGDUMP)
1092
1093 return status;
1094}
1095
1096/** -------------------------------------------------------------
1097\fn peStop
1098\brief will be called in stop sequence from macStop
1099\param tpAniSirGlobal pMac
1100\return none
1101 -------------------------------------------------------------*/
1102
1103void peStop(tpAniSirGlobal pMac)
1104{
1105 limCleanup(pMac);
1106 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1107 return;
1108}
1109
1110/** -------------------------------------------------------------
1111\fn peFreeMsg
1112\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1113\ to free a given PE message on the TX and MC thread.
1114\ This happens when there are messages pending in the PE
1115\ queue when system is being stopped and reset.
1116\param tpAniSirGlobal pMac
1117\param tSirMsgQ pMsg
1118\return none
1119-----------------------------------------------------------------*/
1120v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1121{
1122 if (pMsg != NULL)
1123 {
1124 if (NULL != pMsg->bodyptr)
1125 {
1126 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1127 {
1128 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1129 }
1130 else
1131 {
1132 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1133 }
1134 }
1135 pMsg->bodyptr = 0;
1136 pMsg->bodyval = 0;
1137 pMsg->type = 0;
1138 }
1139 return;
1140}
1141
1142
1143/**
1144 * The function checks if a particular timer should be allowed
1145 * into LIM while device is sleeping
1146 */
1147tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1148{
1149 tANI_U8 retStatus = TRUE;
1150
1151 if(!limIsSystemInActiveState(pMac))
1152 {
1153 switch(pMsg->type)
1154 {
1155 /* Don't allow following timer messages if in sleep */
1156 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1157 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1158 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1159 retStatus = FALSE;
1160 break;
1161 /* May allow following timer messages in sleep mode */
1162 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1163
1164 /* Safe to allow as of today, this triggers background scan
1165 * which will not be started if the device is in power-save mode
1166 * might need to block in the future if we decide to implement
1167 * spectrum management
1168 */
1169 case SIR_LIM_QUIET_TIMEOUT:
1170
1171 /* Safe to allow as of today, this triggers background scan
1172 * which will not be started if the device is in power-save mode
1173 * might need to block in the future if we decide to implement
1174 * spectrum management
1175 */
1176 case SIR_LIM_QUIET_BSS_TIMEOUT:
1177
1178 /* Safe to allow this timermessage, triggers background scan
1179 * which is blocked in sleep mode
1180 */
1181 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1182
1183 /* Safe to allow this timer, since, while in IMPS this timer will not
1184 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1185 * when heart-beat control is handled back to PE, device would have
1186 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1187 */
1188 case SIR_LIM_HEART_BEAT_TIMEOUT:
1189 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1190
1191 /* Safe to allow, PE is not handling this message as of now. May need
1192 * to block it, basically, free the buffer and restart the timer
1193 */
1194 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1195 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001196 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1198 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1199 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1200 retStatus = TRUE;
1201 break;
1202
1203 /* by default allow rest of messages */
1204 default:
1205 retStatus = TRUE;
1206 break;
1207
1208
1209 }
1210 }
1211
1212 return retStatus;
1213
1214}
1215
1216
1217
1218/**
1219 * limPostMsgApi()
1220 *
1221 *FUNCTION:
1222 * This function is called from other thread while posting a
1223 * message to LIM message Queue gSirLimMsgQ.
1224 *
1225 *LOGIC:
1226 * NA
1227 *
1228 *ASSUMPTIONS:
1229 * NA
1230 *
1231 *NOTE:
1232 * NA
1233 *
1234 * @param pMac - Pointer to Global MAC structure
1235 * @param pMsg - Pointer to the message structure
1236 * @return None
1237 */
1238
1239tANI_U32
1240limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1241{
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1243
1244
Jeff Johnson295189b2012-06-20 16:38:30 -07001245} /*** end limPostMsgApi() ***/
1246
1247
1248/*--------------------------------------------------------------------------
1249
1250 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1251
1252 This function can be called by legacy code to post message to voss queues OR
1253 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1254 for dispatching it later.
1255
1256 \param pMac - Pointer to Global MAC structure
1257 \param pMsg - Pointer to the message structure
1258
1259 \return tANI_U32 - TX_SUCCESS for success.
1260
1261 --------------------------------------------------------------------------*/
1262
1263tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1264{
1265 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1266}
1267
1268/*--------------------------------------------------------------------------
1269
1270 \brief peProcessMessages() - Message Processor for PE
1271
1272 Voss calls this function to dispatch the message to PE
1273
1274 \param pMac - Pointer to Global MAC structure
1275 \param pMsg - Pointer to the message structure
1276
1277 \return tANI_U32 - TX_SUCCESS for success.
1278
1279 --------------------------------------------------------------------------*/
1280
1281tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1282{
1283 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1284 {
1285 return eSIR_SUCCESS;
1286 }
1287 /**
1288 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1289 * for all the other cases post it to LIM
1290 */
1291 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1292 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1293 else
1294 limMessageProcessor(pMac, pMsg);
1295 return eSIR_SUCCESS;
1296}
1297
1298
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300// ---------------------------------------------------------------------------
1301/**
1302 * peHandleMgmtFrame
1303 *
1304 * FUNCTION:
1305 * Process the Management frames from TL
1306 *
1307 * LOGIC:
1308 *
1309 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1310 *
1311 * NOTE:
1312 *
1313 * @param pvosGCtx Global Vos Context
1314 * @param vossBuff Packet
1315 * @return None
1316 */
1317
1318VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1319{
1320 tpAniSirGlobal pMac;
1321 tpSirMacMgmtHdr mHdr;
1322 tSirMsgQ msg;
1323 vos_pkt_t *pVosPkt;
1324 VOS_STATUS vosStatus;
1325 v_U8_t *pRxPacketInfo;
1326
1327 pVosPkt = (vos_pkt_t *)vosBuff;
1328 if (NULL == pVosPkt)
1329 {
1330 return VOS_STATUS_E_FAILURE;
1331 }
1332
1333 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1334 if (NULL == pMac)
1335 {
1336 // cannot log a failure without a valid pMac
1337 vos_pkt_return_packet(pVosPkt);
1338 return VOS_STATUS_E_FAILURE;
1339 }
1340
1341 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1342
1343 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1344 {
1345 vos_pkt_return_packet(pVosPkt);
1346 return VOS_STATUS_E_FAILURE;
1347 }
1348
1349
1350 //
1351 // The MPDU header is now present at a certain "offset" in
1352 // the BD and is specified in the BD itself
1353 //
1354 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1355 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1356 {
1357 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001358 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001359 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
Jeff Johnsone7245742012-09-05 17:12:55 -07001361 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1363 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1364 }
1365
1366
1367 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1368 msg.type = SIR_BB_XPORT_MGMT_MSG;
1369 msg.bodyptr = vosBuff;
1370 msg.bodyval = 0;
1371
1372 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1373 &msg,
1374 mHdr->fc.type,
1375 mHdr->fc.subType ))
1376 {
1377 vos_pkt_return_packet(pVosPkt);
1378 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001379 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 return VOS_STATUS_E_FAILURE;
1381 }
1382
1383 return VOS_STATUS_SUCCESS;
1384}
1385
1386// ---------------------------------------------------------------------------
1387/**
1388 * peRegisterTLHandle
1389 *
1390 * FUNCTION:
1391 * Registers the Handler which, process the Management frames from TL
1392 *
1393 * LOGIC:
1394 *
1395 * ASSUMPTIONS:
1396 *
1397 * NOTE:
1398 *
1399 * @return None
1400 */
1401
1402void peRegisterTLHandle(tpAniSirGlobal pMac)
1403{
1404 v_PVOID_t pvosGCTx;
1405 VOS_STATUS retStatus;
1406
1407 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1408
1409 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1410
1411 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001412 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001413
1414}
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
1416
1417/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 * limIsSystemInScanState()
1419 *
1420 *FUNCTION:
1421 * This function is called by various MAC software modules to
1422 * determine if System is in Scan/Learn state
1423 *
1424 *LOGIC:
1425 * NA
1426 *
1427 *ASSUMPTIONS:
1428 * NA
1429 *
1430 *NOTE:
1431 *
1432 * @param pMac - Pointer to Global MAC structure
1433 * @return true - System is in Scan/Learn state
1434 * false - System is NOT in Scan/Learn state
1435 */
1436
1437tANI_U8
1438limIsSystemInScanState(tpAniSirGlobal pMac)
1439{
1440 switch (pMac->lim.gLimSmeState)
1441 {
1442 case eLIM_SME_CHANNEL_SCAN_STATE:
1443 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1444 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1445 case eLIM_SME_WT_SCAN_STATE:
1446 // System is in Learn mode
1447 return true;
1448
1449 default:
1450 // System is NOT in Learn mode
1451 return false;
1452 }
1453} /*** end limIsSystemInScanState() ***/
1454
1455
1456
1457/**
1458 * limIsSystemInActiveState()
1459 *
1460 *FUNCTION:
1461 * This function is called by various MAC software modules to
1462 * determine if System is in Active/Wakeup state
1463 *
1464 *LOGIC:
1465 * NA
1466 *
1467 *ASSUMPTIONS:
1468 * NA
1469 *
1470 *NOTE:
1471 *
1472 * @param pMac - Pointer to Global MAC structure
1473 * @return true - System is in Active state
1474 * false - System is not in Active state
1475 */
1476
1477tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1478{
1479 switch (pMac->pmm.gPmmState)
1480 {
1481 case ePMM_STATE_BMPS_WAKEUP:
1482 case ePMM_STATE_IMPS_WAKEUP:
1483 case ePMM_STATE_READY:
1484 // System is in Active mode
1485 return true;
1486 default:
1487 return false;
1488 // System is NOT in Active mode
1489 }
1490}
1491
1492
Jeff Johnson295189b2012-06-20 16:38:30 -07001493
Jeff Johnson295189b2012-06-20 16:38:30 -07001494
1495
1496/**
1497*\brief limReceivedHBHandler()
1498*
1499* This function is called by schBeaconProcess() upon
1500* receiving a Beacon on STA. This also gets called upon
1501* receiving Probe Response after heat beat failure is
1502* detected.
1503*
1504* param pMac - global mac structure
1505* param channel - channel number indicated in Beacon, Probe Response
1506* return - none
1507*/
1508
1509
1510void
1511limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1512{
1513 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1514 psessionEntry->LimRxedBeaconCntDuringHB++;
1515
1516 pMac->pmm.inMissedBeaconScenario = FALSE;
1517} /*** end limReceivedHBHandler() ***/
1518
1519
1520
1521#if 0
1522void limResetHBPktCount(tpPESession psessionEntry)
1523{
1524 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1525}
1526#endif
1527
1528
1529/*
1530 * limProcessWdsInfo()
1531 *
1532 *FUNCTION:
1533 * This function is called from schBeaconProcess in BP
1534 *
1535 *PARAMS:
1536 * @param pMac - Pointer to Global MAC structure
1537 * @param propIEInfo - proprietary IE info
1538 *
1539 *LOGIC:
1540 *
1541 *ASSUMPTIONS:
1542 * NA
1543 *
1544 *NOTE:
1545 *
1546 *
1547 *RETURNS:
1548 *
1549 */
1550
1551void limProcessWdsInfo(tpAniSirGlobal pMac,
1552 tSirPropIEStruct propIEInfo)
1553{
Jeff Johnson295189b2012-06-20 16:38:30 -07001554}
1555
1556
1557
1558/**
1559 * limInitWdsInfoParams()
1560 *
1561 *FUNCTION:
1562 * This function is called while processing
1563 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1564 * ind/set related parameters.
1565 *
1566 *LOGIC:
1567 *
1568 *ASSUMPTIONS:
1569 *
1570 *NOTE:
1571 *
1572 * @param pMac Pointer to Global MAC structure
1573 * @return None
1574 */
1575
1576void
1577limInitWdsInfoParams(tpAniSirGlobal pMac)
1578{
1579 pMac->lim.gLimWdsInfo.wdsLength = 0;
1580 pMac->lim.gLimNumWdsInfoInd = 0;
1581 pMac->lim.gLimNumWdsInfoSet = 0;
1582} /*** limInitWdsInfoParams() ***/
1583
1584
1585/** -------------------------------------------------------------
1586\fn limUpdateOverlapStaParam
1587\brief Updates overlap cache and param data structure
1588\param tpAniSirGlobal pMac
1589\param tSirMacAddr bssId
1590\param tpLimProtStaParams pStaParams
1591\return None
1592 -------------------------------------------------------------*/
1593void
1594limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1595{
1596 int i;
1597 if (!pStaParams->numSta)
1598 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301599 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1600 bssId,
1601 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 pMac->lim.protStaOverlapCache[0].active = true;
1603
1604 pStaParams->numSta = 1;
1605
1606 return;
1607 }
1608
1609 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1610 {
1611 if (pMac->lim.protStaOverlapCache[i].active)
1612 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301613 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 bssId,
1615 sizeof(tSirMacAddr))) {
1616 return; }
1617 }
1618 else
1619 break;
1620 }
1621
1622 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1623 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301624 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 }
1626 else
1627 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301628 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1629 bssId,
1630 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001631 pMac->lim.protStaOverlapCache[i].active = true;
1632
1633 pStaParams->numSta++;
1634 }
1635}
1636
1637
1638/**
1639 * limHandleIBSScoalescing()
1640 *
1641 *FUNCTION:
1642 * This function is called upon receiving Beacon/Probe Response
1643 * while operating in IBSS mode.
1644 *
1645 *LOGIC:
1646 *
1647 *ASSUMPTIONS:
1648 *
1649 *NOTE:
1650 *
1651 * @param pMac - Pointer to Global MAC structure
1652 * @param pBeacon - Parsed Beacon Frame structure
1653 * @param pRxPacketInfo - Pointer to RX packet info structure
1654 *
1655 * @return Status whether to process or ignore received Beacon Frame
1656 */
1657
1658tSirRetStatus
1659limHandleIBSScoalescing(
1660 tpAniSirGlobal pMac,
1661 tpSchBeaconStruct pBeacon,
1662 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1663{
1664 tpSirMacMgmtHdr pHdr;
1665 tSirRetStatus retCode;
1666
1667 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001668 if ( (!pBeacon->capabilityInfo.ibss) ||
1669 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1670 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 /* Received SSID does not match => Ignore received Beacon frame. */
1672 retCode = eSIR_LIM_IGNORE_BEACON;
1673 else
1674 {
1675 tANI_U32 ieLen;
1676 tANI_U16 tsfLater;
1677 tANI_U8 *pIEs;
1678 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1679 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1680 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1681 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1682 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1683 }
1684 return retCode;
1685} /*** end limHandleIBSScoalescing() ***/
1686
1687
1688
1689/**
1690 * limDetectChangeInApCapabilities()
1691 *
1692 *FUNCTION:
1693 * This function is called while SCH is processing
1694 * received Beacon from AP on STA to detect any
1695 * change in AP's capabilities. If there any change
1696 * is detected, Roaming is informed of such change
1697 * so that it can trigger reassociation.
1698 *
1699 *LOGIC:
1700 *
1701 *ASSUMPTIONS:
1702 *
1703 *NOTE:
1704 * Notification is enabled for STA product only since
1705 * it is not a requirement on BP side.
1706 *
1707 * @param pMac Pointer to Global MAC structure
1708 * @param pBeacon Pointer to parsed Beacon structure
1709 * @return None
1710 */
1711
1712void
1713limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1714 tpSirProbeRespBeacon pBeacon,
1715 tpPESession psessionEntry)
1716{
Jeff Johnson295189b2012-06-20 16:38:30 -07001717 tANI_U8 len;
1718 tSirSmeApNewCaps apNewCaps;
1719 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301720 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1722 newChannel = (tANI_U8) pBeacon->channelNumber;
1723
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301724 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
1725 ( ( ( limIsNullSsid(&pBeacon->ssId) ) ||
1726 ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1727 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ) ||
1728 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1729 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1730 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1731 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1732 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1733 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1734 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1735 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1736 ( newChannel != psessionEntry->currentOperChannel )
1737 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301738 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301739 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301740 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301741 /* If Beacon capabilities is not matching with the current capability,
1742 * then send unicast probe request to AP and take decision after
1743 * receiving probe response */
1744 if ( true == psessionEntry->fIgnoreCapsChange )
1745 {
1746 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1747 return;
1748 }
1749 psessionEntry->fWaitForProbeRsp = true;
1750 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1751 "sending directed probe request.. "));
1752 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1753 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1754 psessionEntry->dot11mode, 0, NULL);
1755
1756 if ( eSIR_SUCCESS != status )
1757 {
1758 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1759 psessionEntry->fWaitForProbeRsp = false;
1760 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301761 return;
1762 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 /**
1764 * BSS capabilities have changed.
1765 * Inform Roaming.
1766 */
1767 len = sizeof(tSirMacCapabilityInfo) +
1768 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1769 3 * sizeof(tANI_U8) + // reserved fields
1770 pBeacon->ssId.length + 1;
1771
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301772 vos_mem_copy(apNewCaps.bssId,
1773 psessionEntry->bssId,
1774 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 if (newChannel != psessionEntry->currentOperChannel)
1776 {
1777 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001778 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 psessionEntry->currentOperChannel, newChannel);)
1780 return;
1781 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301782
1783 /**
1784 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1785 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1786 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1787 * the privacy bit is set in Probe and association responses.
1788 * Due to this anomaly, we detect a change in
1789 * AP capabilities when we receive a beacon after association and
1790 * disconnect from the AP. The following check makes sure that we can
1791 * connect to such APs
1792 */
1793 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1794 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1795 {
1796 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001797 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301798 return;
1799 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 else
1801 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301802 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1803 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 pBeacon->ssId.length + 1);
1805
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301806 psessionEntry->fIgnoreCapsChange = false;
1807 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 psessionEntry->limSentCapsChangeNtf = true;
1809 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1810 (tANI_U32 *) &apNewCaps,
1811 len, psessionEntry->smeSessionId);
1812 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301813 else if ( true == psessionEntry->fWaitForProbeRsp )
1814 {
1815 /* Only for probe response frames and matching capabilities the control
1816 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1817 * will be false, the control will not come here*/
1818
1819 limLog(pMac, LOG1, FL("capabilities in probe response are"
1820 "matching with the current setting,"
1821 "Ignoring subsequent capability"
1822 "mismatch"));
1823 psessionEntry->fIgnoreCapsChange = true;
1824 psessionEntry->fWaitForProbeRsp = false;
1825 }
1826
Jeff Johnson295189b2012-06-20 16:38:30 -07001827} /*** limDetectChangeInApCapabilities() ***/
1828
1829
1830
1831
1832// ---------------------------------------------------------------------
1833/**
1834 * limUpdateShortSlot
1835 *
1836 * FUNCTION:
1837 * Enable/Disable short slot
1838 *
1839 * LOGIC:
1840 *
1841 * ASSUMPTIONS:
1842 *
1843 * NOTE:
1844 *
1845 * @param enable Flag to enable/disable short slot
1846 * @return None
1847 */
1848
1849tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1850{
1851
1852 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001853 tANI_U32 nShortSlot;
1854 tANI_U32 val = 0;
1855 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001856
Jeff Johnsone7245742012-09-05 17:12:55 -07001857 // Check Admin mode first. If it is disabled just return
1858 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1859 != eSIR_SUCCESS)
1860 {
1861 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001862 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001863 return eSIR_FAILURE;
1864 }
1865 if (val == false)
1866 return eSIR_SUCCESS;
1867
1868 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1869 limGetPhyMode(pMac, &phyMode, psessionEntry);
1870 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1871 return eSIR_SUCCESS;
1872
1873 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001874
1875 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1876 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1877 // if no erp present, use short slot based on current ap caps
1878
1879 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1880
1881 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1882 // The difference between the earlier implementation and the new one is only Case4.
1883 /*
1884 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1885 Case1 1 1 1 1 //AP should not advertise this combination.
1886 Case2 1 1 0 0
1887 Case3 1 0 1 1
1888 Case4 1 0 0 0
1889 Case5 0 1 1 1
1890 Case6 0 1 0 0
1891 Case7 0 0 1 1
1892 Case8 0 0 0 0
1893 */
1894 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1895
Jeff Johnsone7245742012-09-05 17:12:55 -07001896 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 {
1898 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001899 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001901 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1903 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 }
1905 return eSIR_SUCCESS;
1906}
1907
1908
Jeff Johnson295189b2012-06-20 16:38:30 -07001909
1910
Jeff Johnson295189b2012-06-20 16:38:30 -07001911
Jeff Johnson295189b2012-06-20 16:38:30 -07001912
1913
1914/** -----------------------------------------------------------------
1915 \brief limHandleLowRssiInd() - handles low rssi indication
1916
1917 This function process the SIR_HAL_LOW_RSSI_IND message from
1918 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1919
1920 \param pMac - global mac structure
1921
1922 \return
1923
1924 \sa
1925 ----------------------------------------------------------------- */
1926void limHandleLowRssiInd(tpAniSirGlobal pMac)
1927{
1928#if 0 //RSSI related indications will now go to TL and not PE
1929 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1930 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1931 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1932 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001933 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1935 }
1936 else
1937 {
1938 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001939 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 pMac->pmm.gPmmState);
1941 }
1942 return;
1943#endif
1944}
1945
1946
1947/** -----------------------------------------------------------------
1948 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1949
1950 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1951 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1952 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1953
1954 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1955 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1956 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1957 This message can also come from FW anytime after we have entered BMPS.
1958 This means we should handle it in WoWL and UAPSD states as well
1959
1960 \param pMac - global mac structure
1961 \return - none
1962 \sa
1963 ----------------------------------------------------------------- */
1964void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1965{
1966 switch(pMac->pmm.gPmmState)
1967 {
1968 case ePMM_STATE_BMPS_SLEEP:
1969 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1970 case ePMM_STATE_UAPSD_SLEEP:
1971 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
1972 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001973 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
1975 break;
1976
1977 default:
1978 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001979 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 pMac->pmm.gPmmState);
1981 break;
1982 }
1983 return;
1984}
1985
1986
1987/** -----------------------------------------------------------------
1988 \brief limHandleMissedBeaconInd() - handles missed beacon indication
1989
1990 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
1991 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1992 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
1993
1994 \param pMac - global mac structure
1995 \return - none
1996 \sa
1997 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001998void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07001999{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002000#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2001 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2002 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2003 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2004 if (psessionEntry == NULL)
2005 {
2006 limLog(pMac, LOGE,
2007 FL("session does not exist for given BSSIdx:%d"),
2008 pSirMissedBeaconInd->bssIdx);
2009 return;
2010 }
2011#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2013 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2014 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2015 {
2016 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302017 PELOGE(limLog(pMac, LOGE,
2018 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2020 }
Yathish9f22e662012-12-10 14:21:35 -08002021/* ACTIVE_MODE_HB_OFFLOAD */
2022#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2023 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2024 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2025 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2026 {
2027 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002028 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002029 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002030 }
2031#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002032 else
2033 {
2034 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002035 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 pMac->pmm.gPmmState);
2037 }
2038 return;
2039}
2040
2041/** -----------------------------------------------------------------
2042 \brief limMicFailureInd() - handles mic failure indication
2043
2044 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2045
2046 \param pMac - global mac structure
2047 \return - none
2048 \sa
2049 ----------------------------------------------------------------- */
2050void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2051{
2052 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2053 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2054 tSirMsgQ mmhMsg;
2055 tpPESession psessionEntry ;
2056 tANI_U8 sessionId;
2057
2058 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2059 {
2060 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002061 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 return;
2063 }
2064
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302065 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2066 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 {
2068 // Log error
2069 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002070 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 return;
2072 }
2073
2074 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2075 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2076 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2077
2078 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302079 pSirMicFailureInd->bssId,
2080 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002081
2082 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302083 pSirMicFailureInd->info.srcMacAddr,
2084 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002085
2086 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302087 pSirMicFailureInd->info.taMacAddr,
2088 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002089
2090 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302091 pSirMicFailureInd->info.dstMacAddr,
2092 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002093
2094 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302095 pSirMicFailureInd->info.rxMacAddr,
2096 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002097
2098 pSirSmeMicFailureInd->info.multicast =
2099 pSirMicFailureInd->info.multicast;
2100
2101 pSirSmeMicFailureInd->info.keyId=
2102 pSirMicFailureInd->info.keyId;
2103
2104 pSirSmeMicFailureInd->info.IV1=
2105 pSirMicFailureInd->info.IV1;
2106
2107 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302108 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002109
2110 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2111 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2112 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002113 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2115 return;
2116}
2117
2118
2119/** -----------------------------------------------------------------
2120 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2121
2122 This function is called before enqueuing the frame to PE queue for further processing.
2123 This prevents unnecessary frames getting into PE Queue and drops them right away.
2124 Frames will be droped in the following scenarios:
2125
2126 - In Scan State, drop the frames which are not marked as scan frames
2127 - In non-Scan state, drop the frames which are marked as scan frames.
2128 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2129 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2130
2131 \param pMac - global mac structure
2132 \return - none
2133 \sa
2134 ----------------------------------------------------------------- */
2135
2136tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2137{
2138 tANI_U32 framelen;
2139 tANI_U8 *pBody;
2140 tSirMacCapabilityInfo capabilityInfo;
2141
2142 /*
2143 *
2144 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2145 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2146 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2147 * other than beacons or probe responses in scan state.
2148 */
2149 if( (subType == SIR_MAC_MGMT_BEACON) ||
2150 (subType == SIR_MAC_MGMT_PROBE_RSP))
2151 {
2152 if(pMac->pmm.inMissedBeaconScenario)
2153 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002154 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2155 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 }
2157 if (limIsSystemInScanState(pMac))
2158 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002159 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002161#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2162 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2163 {
2164 return eMGMT_DROP_NO_DROP;
2165 }
2166#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2168 {
2169 return eMGMT_DROP_SCAN_MODE_FRAME;
2170 }
2171 }
2172
2173 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2174 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2175
2176 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2177 * beacons from an infrastructure network
2178 */
2179 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2180 if(!capabilityInfo.ibss)
2181 return eMGMT_DROP_NO_DROP;
2182#if 0
2183 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2184 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2185 return eMGMT_DROP_NO_DROP;
2186#endif
2187
2188 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2189 if( (subType == SIR_MAC_MGMT_BEACON) ||
2190 (subType == SIR_MAC_MGMT_PROBE_RSP))
2191 {
2192 //drop the frame if length is less than 12
2193 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2194 return eMGMT_DROP_INVALID_SIZE;
2195
2196 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2197
2198 //This can be enhanced to even check the SSID before deciding to enque the frame.
2199 if(capabilityInfo.ess)
2200 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2201 }
2202 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2203 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2204 {
2205 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2206 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2207 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2208 }
2209
2210 return eMGMT_DROP_NO_DROP;
2211}
2212
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002213eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2214{
2215 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002216
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002217 if(psPe)
2218 {
2219 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2220 {
2221 status = eHAL_STATUS_SUCCESS;
2222 }
2223 }
2224 return (status);
2225}
2226eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2227{
2228 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2229 if(psPe)
2230 {
2231 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2232 {
2233 status = eHAL_STATUS_SUCCESS;
2234 }
2235 }
2236 return (status);
2237}