blob: 6d344618fee6dd8672decfab2ccbcc1d02abb6f3 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singheef5c992016-01-27 13:41:54 +05302 * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limApi.cc contains the functions that are
33 * exported by LIM to other modules.
34 *
35 * Author: Chandra Modumudi
36 * Date: 02/11/02
37 * History:-
38 * Date Modified by Modification Information
39 * --------------------------------------------------------------------
40 *
41 */
42#include "palTypes.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053043#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "sirCommon.h"
46#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070047#include "cfgApi.h"
48
49#include "schApi.h"
50#include "utilsApi.h"
51#include "limApi.h"
52#include "limGlobal.h"
53#include "limTypes.h"
54#include "limUtils.h"
55#include "limAssocUtils.h"
56#include "limPropExtsUtils.h"
57#include "limSerDesUtils.h"
58#include "limIbssPeerMgmt.h"
59#include "limAdmitControl.h"
60#include "pmmApi.h"
61#include "logDump.h"
62#include "limSendSmeRspMessages.h"
63#include "wmmApsd.h"
64#include "limTrace.h"
65#include "limSession.h"
66#include "wlan_qct_wda.h"
67
68#if defined WLAN_FEATURE_VOWIFI
69#include "rrmApi.h"
70#endif
71
72#include <limFT.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "vos_types.h"
74#include "vos_packet.h"
75#include "wlan_qct_tl.h"
76#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79static void __limInitScanVars(tpAniSirGlobal pMac)
80{
81 pMac->lim.gLimUseScanModeForLearnMode = 1;
82
83 pMac->lim.gLimSystemInScanLearnMode = 0;
84
85 // Scan related globals on STA
86 pMac->lim.gLimReturnAfterFirstMatch = 0;
87 pMac->lim.gLim24Band11dScanDone = 0;
88 pMac->lim.gLim50Band11dScanDone = 0;
89 pMac->lim.gLimReturnUniqueResults = 0;
90
91 // Background Scan related globals on STA
92 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
93 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
94 pMac->lim.gLimNumOfForcedBkgndScan = 0;
95 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
96 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
97 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -080098 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100 pMac->lim.gLimCurrentScanChannelId = 0;
101 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid440e682013-03-06 02:25:31 -0800102 pMac->lim.gDeferMsgTypeForNOA = 0;
103 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700104 pMac->lim.gLimMlmScanResultLength = 0;
105 pMac->lim.gLimSmeScanResultLength = 0;
106
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530107 vos_mem_set(pMac->lim.gLimCachedScanHashTable,
108 sizeof(pMac->lim.gLimCachedScanHashTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700110#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
111
112 pMac->lim.gLimMlmLfrScanResultLength = 0;
113 pMac->lim.gLimSmeLfrScanResultLength = 0;
114
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530115 vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
116 sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700117#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 pMac->lim.gLimBackgroundScanChannelId = 0;
119 pMac->lim.gLimBackgroundScanStarted = 0;
120 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
121 pMac->lim.gLimRestoreCBCount = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530122 vos_mem_set(pMac->lim.gLimLegacyBssidList,
123 sizeof(pMac->lim.gLimLegacyBssidList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700124
125 /* Fill in default values */
126 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
127
Jeff Johnson295189b2012-06-20 16:38:30 -0700128
129 // abort scan is used to abort an on-going scan
130 pMac->lim.abortScan = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530131 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
132 vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700133
134//WLAN_SUSPEND_LINK Related
135 pMac->lim.gpLimSuspendCallback = NULL;
136 pMac->lim.gpLimResumeCallback = NULL;
137//end WLAN_SUSPEND_LINK Related
138}
139
140
141static void __limInitBssVars(tpAniSirGlobal pMac)
142{
143
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530144 vos_mem_set((void*)pMac->lim.gpSession,
145 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700146
147
148 //pMac->lim.gpLimStartBssReq = NULL;
149
Jeff Johnson295189b2012-06-20 16:38:30 -0700150
151
152
153/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
154#if 0
155
156 // Place holder for BSS description that we're
157 // currently joined with
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530158 vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530160 vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700161 pMac->lim.gLimCurrentBssCaps = 0;
162 QosCaps is a bit map of various qos capabilities - see defn above
163 pMac->lim.gLimCurrentBssQosCaps = 0;
164 pMac->lim.gLimCurrentBssPropCap = 0;
165 pMac->lim.gLimSentCapsChangeNtf = 0;
166
167 // Place holder for BSS description that
168 // we're currently Reassociating
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530169 vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 pMac->lim.gLimReassocChannelId = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530171 vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 pMac->lim.gLimReassocBssCaps = 0;
173 pMac->lim.gLimReassocBssQosCaps = 0;
174 pMac->lim.gLimReassocBssPropCap = 0;
175 #endif
176
177 /* This is for testing purposes only, be default should always be off */
178 pMac->lim.gLimForceNoPropIE = 0;
179
180 // pMac->lim.gLimBssIdx = 0;
181
182 pMac->lim.gpLimMlmSetKeysReq = NULL;
183 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
184 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
185
186}
187
188
189static void __limInitStatsVars(tpAniSirGlobal pMac)
190{
191 pMac->lim.gLimNumBeaconsRcvd = 0;
192 pMac->lim.gLimNumBeaconsIgnored = 0;
193
194 pMac->lim.gLimNumDeferredMsgs = 0;
195
196 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800197 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
199
200 /// This indicates number of RXed Beacons during HB period
201 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
202
203 // Heart-Beat interval value
204 pMac->lim.gLimHeartBeatCount = 0;
205
Abhishek Singhde51a412014-05-20 19:17:26 +0530206 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[0],
207 sizeof(tSirMacAddr));
208 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[1],
209 sizeof(tSirMacAddr));
210 pMac->lim.gLimHeartBeatApMacIndex = 0;
211
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530213 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
214 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700215
216#ifdef WLAN_DEBUG
217 // Debug counters
218 pMac->lim.numTot = 0;
219 pMac->lim.numBbt = 0;
220 pMac->lim.numProtErr = 0;
221 pMac->lim.numLearn = 0;
222 pMac->lim.numLearnIgnore = 0;
223 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530224 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 pMac->lim.gLimNumAssocReqDropInvldState = 0;
226 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
227 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
228 pMac->lim.gLimNumReassocReqDropInvldState = 0;
229 pMac->lim.gLimNumHashMissIgnored = 0;
230 pMac->lim.gLimUnexpBcnCnt = 0;
231 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
232 pMac->lim.gLimNumLinkEsts = 0;
233 pMac->lim.gLimNumRxCleanup = 0;
234 pMac->lim.gLim11bStaAssocRejectCount = 0;
235#endif
236}
237
238
239
240static void __limInitStates(tpAniSirGlobal pMac)
241{
242 // Counts Heartbeat failures
243 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
244 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
245 pMac->lim.gLimHBfailureCntInOtherStates = 0;
246 pMac->lim.gLimRspReqd = 0;
247 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
248
249 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700250 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
252
253 /// Previous MLM State
254 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
255
256#ifdef GEN4_SCAN
257 // LIM to HAL SCAN Management Message Interface states
258 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
259#endif // GEN4_SCAN
260
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700262 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700264 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700265
266 /**
267 * By default assume 'unknown' role. This will be updated
268 * when SME_START_BSS_REQ is received.
269 */
270
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530271 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
272 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
273 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
274 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
275 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
276 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700277
278 pMac->lim.gLimPhyMode = 0;
279 pMac->lim.scanStartTime = 0; // used to measure scan time
280
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530281 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 pMac->lim.ackPolicy = 0;
283
284#if 0 /* Moving all these to session specific elements */
285 pMac->lim.gLimQosEnabled = 0; //11E
286 pMac->lim.gLimWmeEnabled = 0; //WME
287 pMac->lim.gLimWsmEnabled = 0; //WSM
288 pMac->lim.gLimHcfEnabled = 0;
289 pMac->lim.gLim11dEnabled = 0;
290#endif
291
292 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
293}
294
295static void __limInitVars(tpAniSirGlobal pMac)
296{
297
Jeff Johnson295189b2012-06-20 16:38:30 -0700298
299 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700300
301 // WDS info
302 pMac->lim.gLimNumWdsInfoInd = 0;
303 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530304 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 /* initialize some parameters */
306 limInitWdsInfoParams(pMac);
307
308 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530309 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700310
311 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530312 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 pMac->lim.gLimAddtsSent = 0;
314 pMac->lim.gLimAddtsRspTimerCount = 0;
315
316 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530317 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530319 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
321
Jeff Johnsone7245742012-09-05 17:12:55 -0700322#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
325 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700326#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 // WMM Related Flag
328 pMac->lim.gUapsdEnable = 0;
329 pMac->lim.gUapsdPerAcBitmask = 0;
330 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
331 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
332
333 // QoS-AC Downgrade: Initially, no AC is admitted
334 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
335 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
336
337 //dialogue token List head/tail for Action frames request sent.
338 pMac->lim.pDialogueTokenHead = NULL;
339 pMac->lim.pDialogueTokenTail = NULL;
340
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530341 vos_mem_set(&pMac->lim.tspecInfo,
342 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700343
344 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530345 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700346
347 pMac->lim.gLastBeaconDtimCount = 0;
348 pMac->lim.gLastBeaconDtimPeriod = 0;
349
350 //Scan in Power Save Flag
351 pMac->lim.gScanInPowersave = 0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800352 pMac->lim.probeCounter = 0;
353 pMac->lim.maxProbe = 0;
Ganesh Kondabattini10e67352015-03-16 17:41:57 +0530354 pMac->lim.txBdToken = 0;
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +0530355
356 pMac->lim.EnableTdls2040BSSCoexIE = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700357}
358
359static void __limInitAssocVars(tpAniSirGlobal pMac)
360{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800361 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800362#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530363 vos_mem_set(pMac->lim.gpLimAIDpool,
364 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 pMac->lim.freeAidHead = 0;
366 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800367#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800368 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
369 {
370 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
371 }
372 pMac->lim.gLimAssocStaLimit = val;
Ravi Joshi0fc681b2013-09-11 16:46:07 -0700373 pMac->lim.gLimIbssStaLimit = 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
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530394 vos_mem_set(pMac->lim.protStaOverlapCache,
395 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
396 vos_mem_set(pMac->lim.protStaCache,
397 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800399#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700400 pMac->lim.pSessionEntry = NULL;
401 pMac->lim.reAssocRetryAttempt = 0;
402#endif
403
Jeff Johnson295189b2012-06-20 16:38:30 -0700404}
405
406
407static void __limInitTitanVars(tpAniSirGlobal pMac)
408{
Jeff Johnsone7245742012-09-05 17:12:55 -0700409#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530410 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700412 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
413#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 // Debug workaround for BEACON's
415 // State change triggered by "dump 222"
416 pMac->lim.gLimScanOverride = 1;
417 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 pMac->lim.gLimTitanStaCount = 0;
419 pMac->lim.gLimBlockNonTitanSta = 0;
420}
421
422static void __limInitHTVars(tpAniSirGlobal pMac)
423{
424 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 pMac->lim.gHTShortGI40Mhz = 0;
427 pMac->lim.gHTShortGI20Mhz = 0;
428 pMac->lim.gHTMaxAmsduLength = 0;
429 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
430 pMac->lim.gHTPSMPSupport = 0;
431 pMac->lim.gHTLsigTXOPProtection = 0;
432 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
433 pMac->lim.gHTAMpduDensity = 0;
434
435 pMac->lim.gMaxAmsduSizeEnabled = false;
436 pMac->lim.gHTMaxRxAMpduFactor = 0;
437 pMac->lim.gHTServiceIntervalGranularity = 0;
438 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
440 pMac->lim.gHTPCOActive = 0;
441
442 pMac->lim.gHTPCOPhase = 0;
443 pMac->lim.gHTSecondaryBeacon = 0;
444 pMac->lim.gHTDualCTSProtection = 0;
445 pMac->lim.gHTSTBCBasicMCS = 0;
446 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
447}
448
Jeff Johnson295189b2012-06-20 16:38:30 -0700449static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
450{
Jeff Johnsone7245742012-09-05 17:12:55 -0700451 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 tANI_U16 val16;
453 tANI_U8 val8;
454 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
455 tSirMacHTInfoField1 *pHTInfoField1;
456 tpSirPowerSaveCfg pPowerSaveConfig;
457 tSirMacHTParametersInfo *pAmpduParamInfo;
458
459 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700460 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
461 * and they will be used throughout when there is no session
462 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700463
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
465 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700466 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 return eSIR_FAILURE;
468 }
469
470 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
471 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700472 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 return eSIR_FAILURE;
474 }
475 val16 = ( tANI_U16 ) val1;
476 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
477
478 //channel bonding mode could be set to anything from 0 to 4(Titan had these
479 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
480 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
481 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
482 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
483 != eSIR_SUCCESS)
484 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700485 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 return eSIR_FAILURE;
487 }
488
489 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
490 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700491 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 return eSIR_FAILURE;
493 }
494
495 val8 = ( tANI_U8 ) val1;
496 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
497 pHTInfoField1->recommendedTxWidthSet =
498 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
500 != eSIR_SUCCESS)
501 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700502 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 return eSIR_FAILURE;
504 }
505
506 /* WNI_CFG_HEART_BEAT_THRESHOLD */
507
508 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
509 eSIR_SUCCESS )
510 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700511 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 return eSIR_FAILURE;
513 }
514 if(!val1)
515 {
516 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
517 pMac->sys.gSysEnableLinkMonitorMode = 0;
518 }
519 else
520 {
521 //No need to activate the timer during init time.
522 pMac->sys.gSysEnableLinkMonitorMode = 1;
523 }
524
525 /* WNI_CFG_SHORT_GI_20MHZ */
526
527 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
528 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700529 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 return eSIR_FAILURE;
531 }
532 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
533 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700534 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 return eSIR_FAILURE;
536 }
537 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
538 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700539 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 return eSIR_FAILURE;
541 }
542
543 val16 = ( tANI_U16 ) val1;
544 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
545 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
546 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
547
548 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
549 eSIR_SUCCESS)
550 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700551 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 return eSIR_FAILURE;
553 }
554
555 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
556
557 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
558 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700559 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 return eSIR_FAILURE;
561 }
562 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
563 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700564 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 return eSIR_FAILURE;
566 }
567 val16 = ( tANI_U16 ) val1;
568 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
569 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
570 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
571 eSIR_SUCCESS)
572 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700573 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 return eSIR_FAILURE;
575 }
576
577 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
578 limHandleCFGparamUpdate do we want to update this? */
579 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
580 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530581 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 return eSIR_FAILURE;
583 }
584
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 /* WNI_CFG_MAX_PS_POLL */
586
587 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530588 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
589 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 {
591 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700592 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 return eSIR_FAILURE;
594 }
595
596 /* This context should be valid if power-save configuration message has been
597 * already dispatched during initialization process. Re-using the present
598 * configuration mask
599 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530600 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700601
602 /* Note: it is okay to do this since DAL/HAL is alrady started */
603 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
604 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700605 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 return eSIR_FAILURE;
607 }
608
609 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
610
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700612 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
615 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
616
617 /* This was initially done after resume notification from HAL. Now, DAL is
618 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700619 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800620 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
621 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700622 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800623 return eSIR_FAILURE;
624 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530625#ifdef FEATURE_WLAN_TDLS
626 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
627 {
628 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
629 return eSIR_FAILURE;
630 }
631 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
632 {
633 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
634 return eSIR_FAILURE;
635 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530636 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
637 {
638 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
639 return eSIR_FAILURE;
640 }
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530641
642 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_WMM_MODE_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSWmmMode) != eSIR_SUCCESS)
643 {
644 limLog(pMac, LOGP, FL("cfg get LimTDLSWmmMode failed"));
645 return eSIR_FAILURE;
646 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530647#endif
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530648
Rashmi Ramannac7744532013-10-06 16:49:08 +0530649 if (eSIR_SUCCESS !=
650 wlan_cfgGetInt(pMac, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
651 (tANI_U32 *)&pMac->lim.gDebugP2pRemainOnChannel))
652 {
653 limLog( pMac, LOGE,
654 "%s: Couldn't get WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL value",
655 __func__);
656 pMac->lim.gDebugP2pRemainOnChannel = 0;
657 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 return eSIR_SUCCESS;
659}
Jeff Johnson295189b2012-06-20 16:38:30 -0700660
661/*
662 limStart
663 This function is to replace the __limProcessSmeStartReq since there is no
664 eWNI_SME_START_REQ post to PE.
665*/
666tSirRetStatus limStart(tpAniSirGlobal pMac)
667{
668 tSirResultCodes retCode = eSIR_SUCCESS;
669
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530670 limLog(pMac, LOG1, FL(" enter"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700671
672 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
673 {
674 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
675
Jeff Johnsone7245742012-09-05 17:12:55 -0700676 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700677
678 // By default do not return after first scan match
679 pMac->lim.gLimReturnAfterFirstMatch = 0;
680
681 // Initialize MLM state machine
682 limInitMlm(pMac);
683
684 // By default return unique scan results
685 pMac->lim.gLimReturnUniqueResults = true;
686 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700687#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
688 pMac->lim.gLimSmeLfrScanResultLength = 0;
689#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691 else
692 {
693 /**
694 * Should not have received eWNI_SME_START_REQ in states
695 * other than OFFLINE. Return response to host and
696 * log error
697 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530698 limLog(pMac, LOGE, FL("Invalid SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 retCode = eSIR_FAILURE;
700 }
701
702 return retCode;
703}
704
705/**
706 * limInitialize()
707 *
708 *FUNCTION:
709 * This function is called from LIM thread entry function.
710 * LIM related global data structures are initialized in this function.
711 *
712 *LOGIC:
713 * NA
714 *
715 *ASSUMPTIONS:
716 * NA
717 *
718 *NOTE:
719 * NA
720 *
721 * @param pMac - Pointer to global MAC structure
722 * @return None
723 */
724
725tSirRetStatus
726limInitialize(tpAniSirGlobal pMac)
727{
728 tSirRetStatus status = eSIR_SUCCESS;
729
730 __limInitAssocVars(pMac);
731 __limInitVars(pMac);
732 __limInitStates(pMac);
733 __limInitStatsVars(pMac);
734 __limInitBssVars(pMac);
735 __limInitScanVars(pMac);
736 __limInitHTVars(pMac);
737 __limInitTitanVars(pMac);
738
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 status = limStart(pMac);
740 if(eSIR_SUCCESS != status)
741 {
742 return status;
743 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700744
745 /*
746 * MLM will be intitalized when 'START' request comes from SME.
747 * limInitMlm calls limCreateTimers, which actually relies on
748 * CFG to be downloaded. So it should not be called as part of
749 * peStart, as CFG download is happening after peStart.
750 */
751 //limInitMlm(pMac);
752 // Initializations for maintaining peers in IBSS
753 limIbssInit(pMac);
754
755 pmmInitialize(pMac);
756
757
758#if defined WLAN_FEATURE_VOWIFI
759 rrmInitialize(pMac);
760#endif
761#if defined WLAN_FEATURE_VOWIFI_11R
762 limFTOpen(pMac);
763#endif
764
Abhishek Singh00b71972016-01-07 10:51:04 +0530765#ifdef WLAN_FEATURE_RMC
766 limRmcInit(pMac);
767#endif /* WLAN_FEATURE_RMC */
768
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700770
771#if 0
772
773 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
774 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
775 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
776
777 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
778 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
779
780 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
781 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
782 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
783
784 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
785
786 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
787
788 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
789 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
790
791 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
792
793
794 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
795
796 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
797#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700798
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 //Initialize the configurations needed by PE
800 if( eSIR_FAILURE == __limInitConfig(pMac))
801 {
802 //We need to undo everything in limStart
803 limCleanupMlm(pMac);
804 return eSIR_FAILURE;
805 }
806
807 //initialize the TSPEC admission control table.
808 //Note that this was initially done after resume notification from HAL.
809 //Now, DAL is started before PE so this can be done here
810 limAdmitControlInit(pMac);
811 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700812
813 return status;
814
815} /*** end limInitialize() ***/
816
817
818
819/**
820 * limCleanup()
821 *
822 *FUNCTION:
823 * This function is called upon reset or persona change
824 * to cleanup LIM state
825 *
826 *LOGIC:
827 * NA
828 *
829 *ASSUMPTIONS:
830 * NA
831 *
832 *NOTE:
833 * NA
834 *
835 * @param pMac - Pointer to Global MAC structure
836 * @return None
837 */
838
839void
840limCleanup(tpAniSirGlobal pMac)
841{
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 v_PVOID_t pvosGCTx;
843 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700844
Jeff Johnson295189b2012-06-20 16:38:30 -0700845//Before destroying the list making sure all the nodes have been deleted.
846//Which should be the normal case, but a memory leak has been reported.
847
848 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
849
850 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
851 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
852 {
853 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
854 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
855
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530856 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 }
858
859 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700860
861 limCleanupMlm(pMac);
862 limCleanupLmm(pMac);
863
Abhishek Singh00b71972016-01-07 10:51:04 +0530864#ifdef WLAN_FEATURE_RMC
865 limRmcCleanup(pMac);
866#endif /* WLAN_FEATURE_RMC */
867
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 // free up preAuth table
869 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
870 {
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530871 vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
873 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
874 }
875
876 if(NULL != pMac->lim.pDialogueTokenHead)
877 {
878 limDeleteDialogueTokenList(pMac);
879 }
880
881 if(NULL != pMac->lim.pDialogueTokenTail)
882 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530883 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 pMac->lim.pDialogueTokenTail = NULL;
885 }
886
887 # if 0
888 if (pMac->lim.gpLimStartBssReq != NULL)
889 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530890 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 pMac->lim.gpLimStartBssReq = NULL;
892 }
893 #endif
894
895 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
896 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530897 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 pMac->lim.gpLimMlmSetKeysReq = NULL;
899 }
900
901 #if 0
902 if (pMac->lim.gpLimJoinReq != NULL)
903 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530904 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 pMac->lim.gpLimJoinReq = NULL;
906 }
907 #endif
908
909 if (pMac->lim.gpLimMlmAuthReq != NULL)
910 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530911 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 pMac->lim.gpLimMlmAuthReq = NULL;
913 }
914
Jeff Johnsone7245742012-09-05 17:12:55 -0700915#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 if (pMac->lim.gpLimMlmJoinReq != NULL)
917 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530918 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 pMac->lim.gpLimMlmJoinReq = NULL;
920 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700921#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700922
923 #if 0
924 if (pMac->lim.gpLimReassocReq != NULL)
925 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530926 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 pMac->lim.gpLimReassocReq = NULL;
928 }
929 #endif
930
931 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
932 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530933 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
935 }
936
Viral Modid440e682013-03-06 02:25:31 -0800937 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800938 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530939 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800940 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800941 }
Viral Modid86bde22012-12-10 13:09:21 -0800942
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 if (pMac->lim.gpLimMlmScanReq != NULL)
944 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530945 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 pMac->lim.gpLimMlmScanReq = NULL;
947 }
948
949#if 0
950 if(NULL != pMac->lim.beacon)
951 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530952 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 pMac->lim.beacon = NULL;
954 }
955#endif
956 #if 0
957 if(NULL != pMac->lim.assocReq)
958 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530959 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 pMac->lim.assocReq= NULL;
961 }
962 #endif
963
964#if 0
965 if(NULL != pMac->lim.assocRsp)
966 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530967 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 pMac->lim.assocRsp= NULL;
969 }
970#endif
971 // Now, finally reset the deferred message queue pointers
972 limResetDeferredMsgQ(pMac);
973
Jeff Johnson295189b2012-06-20 16:38:30 -0700974
975 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
976 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
977
978 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700979 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700980
981#if defined WLAN_FEATURE_VOWIFI
982 rrmCleanup(pMac);
983#endif
984#if defined WLAN_FEATURE_VOWIFI_11R
985 limFTCleanup(pMac);
986#endif
987
988} /*** end limCleanup() ***/
989
990
991/** -------------------------------------------------------------
992\fn peOpen
993\brief will be called in Open sequence from macOpen
994\param tpAniSirGlobal pMac
995\param tHalOpenParameters *pHalOpenParam
996\return tSirRetStatus
997 -------------------------------------------------------------*/
998
999tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
1000{
Kaushik, Sushant16def7c2014-06-17 14:20:49 +05301001 if (eDRIVER_TYPE_MFG == pMacOpenParam->driverType)
1002 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
1004 pMac->lim.maxStation = pMacOpenParam->maxStation;
Katya Nigam53799202014-12-18 15:59:38 +05301005 vos_spin_lock_init( &pMac->sys.lock );
Jeff Johnson295189b2012-06-20 16:38:30 -07001006
1007 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
1008 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001009 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 return eSIR_FAILURE;
1011 }
1012
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301013 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_vmalloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301014 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001016 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 return eSIR_FAILURE;
1018 }
1019
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301020 pMac->lim.gpSession = vos_mem_vmalloc(sizeof(tPESession)* pMac->lim.maxBssId);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301021 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001023 limLog(pMac, LOGE, FL("memory allocate failed!"));
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301024 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 return eSIR_FAILURE;
1026 }
1027
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301028 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001029
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301030 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1031 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001033 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301034 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
1035 vos_mem_vfree(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 return eSIR_FAILURE;
1037 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301038 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001040 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001041 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001042
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001043 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1044 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001045 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301046 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001047 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301048 vos_mem_vfree(pMac->lim.gpSession);
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001049 pMac->lim.gpSession = NULL;
1050 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1051 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001052 return eSIR_FAILURE;
1053 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001054 pMac->lim.deauthMsgCnt = 0;
Agarwal Ashishb4ce9922014-11-04 18:40:38 +05301055 pMac->lim.retryPacketCnt = 0;
Sushant Kaushike06bd872015-03-12 16:17:48 +05301056 pMac->lim.gLimIbssRetryCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001057
1058 /*
1059 * peOpen is successful by now, so it is right time to initialize
1060 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1061 * then nothing will be logged for PE module.
1062 */
1063#ifdef LIM_TRACE_RECORD
1064 MTRACE(limTraceInit(pMac));
1065#endif
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301066 lim_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 return eSIR_SUCCESS;
1068}
1069
1070/** -------------------------------------------------------------
1071\fn peClose
1072\brief will be called in close sequence from macClose
1073\param tpAniSirGlobal pMac
1074\return tSirRetStatus
1075 -------------------------------------------------------------*/
1076
1077tSirRetStatus peClose(tpAniSirGlobal pMac)
1078{
1079 tANI_U8 i;
1080
1081 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1082 return eSIR_SUCCESS;
Katya Nigam53799202014-12-18 15:59:38 +05301083
1084 vos_spin_lock_destroy( &pMac->sys.lock );
1085
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 for(i =0; i < pMac->lim.maxBssId; i++)
1087 {
1088 if(pMac->lim.gpSession[i].valid == TRUE)
1089 {
1090 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1091 }
1092 }
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301093 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001094 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301095 vos_mem_vfree(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 pMac->lim.gpSession = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301097
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301098 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001100 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1101 {
1102 return eSIR_FAILURE;
1103 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 return eSIR_SUCCESS;
1105}
1106
1107/** -------------------------------------------------------------
1108\fn peStart
1109\brief will be called in start sequence from macStart
1110\param tpAniSirGlobal pMac
1111\return none
1112 -------------------------------------------------------------*/
1113
1114tSirRetStatus peStart(tpAniSirGlobal pMac)
1115{
1116 tSirRetStatus status = eSIR_SUCCESS;
1117
1118 status = limInitialize(pMac);
1119#if defined(ANI_LOGDUMP)
1120 limDumpInit(pMac);
1121#endif //#if defined(ANI_LOGDUMP)
1122
1123 return status;
1124}
1125
1126/** -------------------------------------------------------------
1127\fn peStop
1128\brief will be called in stop sequence from macStop
1129\param tpAniSirGlobal pMac
1130\return none
1131 -------------------------------------------------------------*/
1132
1133void peStop(tpAniSirGlobal pMac)
1134{
1135 limCleanup(pMac);
1136 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1137 return;
1138}
1139
1140/** -------------------------------------------------------------
1141\fn peFreeMsg
1142\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1143\ to free a given PE message on the TX and MC thread.
1144\ This happens when there are messages pending in the PE
1145\ queue when system is being stopped and reset.
1146\param tpAniSirGlobal pMac
1147\param tSirMsgQ pMsg
1148\return none
1149-----------------------------------------------------------------*/
1150v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1151{
1152 if (pMsg != NULL)
1153 {
1154 if (NULL != pMsg->bodyptr)
1155 {
1156 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1157 {
1158 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1159 }
1160 else
1161 {
1162 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1163 }
1164 }
1165 pMsg->bodyptr = 0;
1166 pMsg->bodyval = 0;
1167 pMsg->type = 0;
1168 }
1169 return;
1170}
1171
1172
1173/**
1174 * The function checks if a particular timer should be allowed
1175 * into LIM while device is sleeping
1176 */
1177tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1178{
1179 tANI_U8 retStatus = TRUE;
1180
1181 if(!limIsSystemInActiveState(pMac))
1182 {
1183 switch(pMsg->type)
1184 {
1185 /* Don't allow following timer messages if in sleep */
1186 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1187 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1188 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1189 retStatus = FALSE;
1190 break;
1191 /* May allow following timer messages in sleep mode */
Jeff Johnson295189b2012-06-20 16:38:30 -07001192
1193 /* Safe to allow as of today, this triggers background scan
1194 * which will not be started if the device is in power-save mode
1195 * might need to block in the future if we decide to implement
1196 * spectrum management
1197 */
1198 case SIR_LIM_QUIET_TIMEOUT:
1199
1200 /* Safe to allow as of today, this triggers background scan
1201 * which will not be started if the device is in power-save mode
1202 * might need to block in the future if we decide to implement
1203 * spectrum management
1204 */
1205 case SIR_LIM_QUIET_BSS_TIMEOUT:
1206
1207 /* Safe to allow this timermessage, triggers background scan
1208 * which is blocked in sleep mode
1209 */
1210 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1211
1212 /* Safe to allow this timer, since, while in IMPS this timer will not
1213 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1214 * when heart-beat control is handled back to PE, device would have
1215 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1216 */
1217 case SIR_LIM_HEART_BEAT_TIMEOUT:
1218 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1219
1220 /* Safe to allow, PE is not handling this message as of now. May need
1221 * to block it, basically, free the buffer and restart the timer
1222 */
1223 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1224 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001225 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1227 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1228 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Sushant Kaushik9e923872015-04-02 17:09:31 +05301229 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 retStatus = TRUE;
1231 break;
1232
1233 /* by default allow rest of messages */
1234 default:
1235 retStatus = TRUE;
1236 break;
1237
1238
1239 }
1240 }
1241
1242 return retStatus;
1243
1244}
1245
1246
1247
1248/**
1249 * limPostMsgApi()
1250 *
1251 *FUNCTION:
1252 * This function is called from other thread while posting a
1253 * message to LIM message Queue gSirLimMsgQ.
1254 *
1255 *LOGIC:
1256 * NA
1257 *
1258 *ASSUMPTIONS:
1259 * NA
1260 *
1261 *NOTE:
1262 * NA
1263 *
1264 * @param pMac - Pointer to Global MAC structure
1265 * @param pMsg - Pointer to the message structure
1266 * @return None
1267 */
1268
1269tANI_U32
1270limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1271{
Jeff Johnson295189b2012-06-20 16:38:30 -07001272 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1273
1274
Jeff Johnson295189b2012-06-20 16:38:30 -07001275} /*** end limPostMsgApi() ***/
1276
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +05301277/**
1278 * limPostMsgApiHighPri()
1279 *
1280 * FUNCTION:
1281 * This function is called from other thread while posting a
1282 * message to LIM message Queue gSirLimMsgQ.
1283 *
1284 * LOGIC:
1285 * NA
1286 *
1287 * ASSUMPTIONS:
1288 * NA
1289 *
1290 * NOTE:
1291 * NA
1292 *
1293 * @param pMac - Pointer to Global MAC structure
1294 * @param pMsg - Pointer to the message structure
1295 * @return None
1296 */
1297
1298tANI_U32
1299limPostMsgApiHighPri(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1300{
1301 return vos_mq_post_message_high_pri(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1302
1303
1304} /*** end limPostMsgApi() ***/
1305
Jeff Johnson295189b2012-06-20 16:38:30 -07001306
1307/*--------------------------------------------------------------------------
1308
1309 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1310
1311 This function can be called by legacy code to post message to voss queues OR
1312 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1313 for dispatching it later.
1314
1315 \param pMac - Pointer to Global MAC structure
1316 \param pMsg - Pointer to the message structure
1317
1318 \return tANI_U32 - TX_SUCCESS for success.
1319
1320 --------------------------------------------------------------------------*/
1321
1322tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1323{
1324 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1325}
1326
1327/*--------------------------------------------------------------------------
1328
1329 \brief peProcessMessages() - Message Processor for PE
1330
1331 Voss calls this function to dispatch the message to PE
1332
1333 \param pMac - Pointer to Global MAC structure
1334 \param pMsg - Pointer to the message structure
1335
1336 \return tANI_U32 - TX_SUCCESS for success.
1337
1338 --------------------------------------------------------------------------*/
1339
1340tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1341{
1342 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1343 {
1344 return eSIR_SUCCESS;
1345 }
1346 /**
1347 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1348 * for all the other cases post it to LIM
1349 */
1350 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1351 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1352 else
1353 limMessageProcessor(pMac, pMsg);
1354 return eSIR_SUCCESS;
1355}
1356
Katya Nigam53799202014-12-18 15:59:38 +05301357#define RSRVD_MGMT_RX_PACKETS 10
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359// ---------------------------------------------------------------------------
1360/**
1361 * peHandleMgmtFrame
1362 *
1363 * FUNCTION:
1364 * Process the Management frames from TL
1365 *
1366 * LOGIC:
1367 *
1368 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1369 *
1370 * NOTE:
1371 *
1372 * @param pvosGCtx Global Vos Context
1373 * @param vossBuff Packet
1374 * @return None
1375 */
1376
1377VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1378{
1379 tpAniSirGlobal pMac;
1380 tpSirMacMgmtHdr mHdr;
1381 tSirMsgQ msg;
1382 vos_pkt_t *pVosPkt;
1383 VOS_STATUS vosStatus;
1384 v_U8_t *pRxPacketInfo;
1385
1386 pVosPkt = (vos_pkt_t *)vosBuff;
1387 if (NULL == pVosPkt)
1388 {
1389 return VOS_STATUS_E_FAILURE;
1390 }
1391
1392 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1393 if (NULL == pMac)
1394 {
1395 // cannot log a failure without a valid pMac
1396 vos_pkt_return_packet(pVosPkt);
1397 return VOS_STATUS_E_FAILURE;
1398 }
1399
1400 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1401
1402 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1403 {
1404 vos_pkt_return_packet(pVosPkt);
1405 return VOS_STATUS_E_FAILURE;
1406 }
1407
1408
1409 //
1410 // The MPDU header is now present at a certain "offset" in
1411 // the BD and is specified in the BD itself
1412 //
1413 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1414 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1415 {
1416 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001417 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001418 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
Padma, Santhosh Kumar30971cf2015-04-06 19:59:37 +05301420#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1421 if (WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
1422 limLog(pMac, LOG1, FL("roamCandidateInd %d"),
1423 WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo));
1424
1425 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
1426 limLog(pMac, LOG1, FL("offloadScanLearn %d"),
1427 WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo));
1428#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 }
1430
1431
1432 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1433 msg.type = SIR_BB_XPORT_MGMT_MSG;
1434 msg.bodyptr = vosBuff;
1435 msg.bodyval = 0;
1436
Katya Nigam53799202014-12-18 15:59:38 +05301437 vos_spin_lock_acquire( &pMac->sys.lock );
1438 if( pMac->sys.gSysBbtPendingMgmtCount > (vos_pkt_get_num_of_rx_raw_pkts()/4) )
1439 {
1440 vos_spin_lock_release( &pMac->sys.lock );
1441 // drop all management packets
Katya Nigamfdf5a522015-02-03 14:38:55 +05301442 limLog( pMac, LOGW,
1443 FL ( "Management queue 1/4th full, dropping management packets" ));
Katya Nigam53799202014-12-18 15:59:38 +05301444 vos_pkt_return_packet(pVosPkt);
1445 return VOS_STATUS_SUCCESS;
1446 }
1447
1448 if( pMac->sys.gSysBbtPendingMgmtCount > ( vos_pkt_get_num_of_rx_raw_pkts()/4
1449 - RSRVD_MGMT_RX_PACKETS ))
1450 {
1451 // drop all probereq, proberesp and beacons
1452 if( mHdr->fc.subType == SIR_MAC_MGMT_BEACON || mHdr->fc.subType ==
1453 SIR_MAC_MGMT_PROBE_REQ || mHdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP )
1454 {
1455 vos_spin_lock_release( &pMac->sys.lock );
Katya Nigamfdf5a522015-02-03 14:38:55 +05301456 limLog( pMac, LOGW,
1457 FL ( "Dropping probe req, probe resp or beacon" ));
Katya Nigam53799202014-12-18 15:59:38 +05301458 vos_pkt_return_packet(pVosPkt);
1459 return VOS_STATUS_SUCCESS;
1460 }
1461 }
1462 pMac->sys.gSysBbtPendingMgmtCount++;
1463 vos_spin_lock_release( &pMac->sys.lock );
1464
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1466 &msg,
1467 mHdr->fc.type,
1468 mHdr->fc.subType ))
1469 {
1470 vos_pkt_return_packet(pVosPkt);
Abhishek Singh5d765712015-03-12 14:04:16 +05301471
1472 /* Decrement gSysBbtPendingMgmtCount if packet
1473 * is dropped before posting to LIM
1474 */
1475 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001477 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 return VOS_STATUS_E_FAILURE;
1479 }
1480
1481 return VOS_STATUS_SUCCESS;
1482}
1483
1484// ---------------------------------------------------------------------------
1485/**
1486 * peRegisterTLHandle
1487 *
1488 * FUNCTION:
1489 * Registers the Handler which, process the Management frames from TL
1490 *
1491 * LOGIC:
1492 *
1493 * ASSUMPTIONS:
1494 *
1495 * NOTE:
1496 *
1497 * @return None
1498 */
1499
1500void peRegisterTLHandle(tpAniSirGlobal pMac)
1501{
1502 v_PVOID_t pvosGCTx;
1503 VOS_STATUS retStatus;
1504
1505 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1506
1507 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1508
1509 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001510 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001511
1512}
Jeff Johnson295189b2012-06-20 16:38:30 -07001513
1514
1515/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 * limIsSystemInScanState()
1517 *
1518 *FUNCTION:
1519 * This function is called by various MAC software modules to
1520 * determine if System is in Scan/Learn state
1521 *
1522 *LOGIC:
1523 * NA
1524 *
1525 *ASSUMPTIONS:
1526 * NA
1527 *
1528 *NOTE:
1529 *
1530 * @param pMac - Pointer to Global MAC structure
1531 * @return true - System is in Scan/Learn state
1532 * false - System is NOT in Scan/Learn state
1533 */
1534
1535tANI_U8
1536limIsSystemInScanState(tpAniSirGlobal pMac)
1537{
1538 switch (pMac->lim.gLimSmeState)
1539 {
1540 case eLIM_SME_CHANNEL_SCAN_STATE:
1541 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1542 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1543 case eLIM_SME_WT_SCAN_STATE:
1544 // System is in Learn mode
1545 return true;
1546
1547 default:
1548 // System is NOT in Learn mode
1549 return false;
1550 }
1551} /*** end limIsSystemInScanState() ***/
1552
1553
1554
1555/**
1556 * limIsSystemInActiveState()
1557 *
1558 *FUNCTION:
1559 * This function is called by various MAC software modules to
1560 * determine if System is in Active/Wakeup state
1561 *
1562 *LOGIC:
1563 * NA
1564 *
1565 *ASSUMPTIONS:
1566 * NA
1567 *
1568 *NOTE:
1569 *
1570 * @param pMac - Pointer to Global MAC structure
1571 * @return true - System is in Active state
1572 * false - System is not in Active state
1573 */
1574
1575tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1576{
1577 switch (pMac->pmm.gPmmState)
1578 {
1579 case ePMM_STATE_BMPS_WAKEUP:
1580 case ePMM_STATE_IMPS_WAKEUP:
1581 case ePMM_STATE_READY:
1582 // System is in Active mode
1583 return true;
1584 default:
1585 return false;
1586 // System is NOT in Active mode
1587 }
1588}
1589
1590
Jeff Johnson295189b2012-06-20 16:38:30 -07001591
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
1593
1594/**
1595*\brief limReceivedHBHandler()
1596*
1597* This function is called by schBeaconProcess() upon
1598* receiving a Beacon on STA. This also gets called upon
1599* receiving Probe Response after heat beat failure is
1600* detected.
1601*
1602* param pMac - global mac structure
1603* param channel - channel number indicated in Beacon, Probe Response
1604* return - none
1605*/
1606
1607
1608void
1609limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1610{
1611 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1612 psessionEntry->LimRxedBeaconCntDuringHB++;
1613
1614 pMac->pmm.inMissedBeaconScenario = FALSE;
1615} /*** end limReceivedHBHandler() ***/
1616
1617
1618
1619#if 0
1620void limResetHBPktCount(tpPESession psessionEntry)
1621{
1622 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1623}
1624#endif
1625
1626
1627/*
1628 * limProcessWdsInfo()
1629 *
1630 *FUNCTION:
1631 * This function is called from schBeaconProcess in BP
1632 *
1633 *PARAMS:
1634 * @param pMac - Pointer to Global MAC structure
1635 * @param propIEInfo - proprietary IE info
1636 *
1637 *LOGIC:
1638 *
1639 *ASSUMPTIONS:
1640 * NA
1641 *
1642 *NOTE:
1643 *
1644 *
1645 *RETURNS:
1646 *
1647 */
1648
1649void limProcessWdsInfo(tpAniSirGlobal pMac,
1650 tSirPropIEStruct propIEInfo)
1651{
Jeff Johnson295189b2012-06-20 16:38:30 -07001652}
1653
1654
1655
1656/**
1657 * limInitWdsInfoParams()
1658 *
1659 *FUNCTION:
1660 * This function is called while processing
1661 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1662 * ind/set related parameters.
1663 *
1664 *LOGIC:
1665 *
1666 *ASSUMPTIONS:
1667 *
1668 *NOTE:
1669 *
1670 * @param pMac Pointer to Global MAC structure
1671 * @return None
1672 */
1673
1674void
1675limInitWdsInfoParams(tpAniSirGlobal pMac)
1676{
1677 pMac->lim.gLimWdsInfo.wdsLength = 0;
1678 pMac->lim.gLimNumWdsInfoInd = 0;
1679 pMac->lim.gLimNumWdsInfoSet = 0;
1680} /*** limInitWdsInfoParams() ***/
1681
1682
1683/** -------------------------------------------------------------
1684\fn limUpdateOverlapStaParam
1685\brief Updates overlap cache and param data structure
1686\param tpAniSirGlobal pMac
1687\param tSirMacAddr bssId
1688\param tpLimProtStaParams pStaParams
1689\return None
1690 -------------------------------------------------------------*/
1691void
1692limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1693{
1694 int i;
1695 if (!pStaParams->numSta)
1696 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301697 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1698 bssId,
1699 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 pMac->lim.protStaOverlapCache[0].active = true;
1701
1702 pStaParams->numSta = 1;
1703
1704 return;
1705 }
1706
1707 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1708 {
1709 if (pMac->lim.protStaOverlapCache[i].active)
1710 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301711 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 bssId,
1713 sizeof(tSirMacAddr))) {
1714 return; }
1715 }
1716 else
1717 break;
1718 }
1719
1720 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1721 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301722 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001723 }
1724 else
1725 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301726 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1727 bssId,
1728 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 pMac->lim.protStaOverlapCache[i].active = true;
1730
1731 pStaParams->numSta++;
1732 }
1733}
1734
1735
1736/**
1737 * limHandleIBSScoalescing()
1738 *
1739 *FUNCTION:
1740 * This function is called upon receiving Beacon/Probe Response
1741 * while operating in IBSS mode.
1742 *
1743 *LOGIC:
1744 *
1745 *ASSUMPTIONS:
1746 *
1747 *NOTE:
1748 *
1749 * @param pMac - Pointer to Global MAC structure
1750 * @param pBeacon - Parsed Beacon Frame structure
1751 * @param pRxPacketInfo - Pointer to RX packet info structure
1752 *
1753 * @return Status whether to process or ignore received Beacon Frame
1754 */
1755
1756tSirRetStatus
1757limHandleIBSScoalescing(
1758 tpAniSirGlobal pMac,
1759 tpSchBeaconStruct pBeacon,
1760 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1761{
1762 tpSirMacMgmtHdr pHdr;
1763 tSirRetStatus retCode;
1764
1765 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001766 if ( (!pBeacon->capabilityInfo.ibss) ||
Abhishek Singhd5c31272014-03-07 14:46:50 +05301767 ( psessionEntry->privacy !=
1768 (tANI_U8)pBeacon->capabilityInfo.privacy ) ||
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001769 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1770 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 /* Received SSID does not match => Ignore received Beacon frame. */
1772 retCode = eSIR_LIM_IGNORE_BEACON;
1773 else
1774 {
1775 tANI_U32 ieLen;
1776 tANI_U16 tsfLater;
1777 tANI_U8 *pIEs;
1778 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1779 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1780 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Abhishek Singh127a8442014-12-15 17:31:27 +05301781 limLog(pMac, LOG1, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1783 }
1784 return retCode;
1785} /*** end limHandleIBSScoalescing() ***/
1786
Abhishek Singh5fef4042014-11-25 18:33:00 +05301787tAniBool limEncTypeMatched(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,
1788 tpPESession pSession)
1789{
1790 if (!pBeacon || !pSession)
1791 return eSIR_FALSE;
1792
1793 limLog(pMac, LOG1,
1794 FL("Beacon/Probe:: Privacy :%d WPA Present:%d RSN Present: %d"),
1795 pBeacon->capabilityInfo.privacy, pBeacon->wpaPresent,
1796 pBeacon->rsnPresent);
1797 limLog(pMac, LOG1,
Abhishek Singheef5c992016-01-27 13:41:54 +05301798 FL("pSession:: Privacy :%d EncyptionType: %d WPS %d OSEN %d"),
Abhishek Singh5fef4042014-11-25 18:33:00 +05301799 SIR_MAC_GET_PRIVACY(pSession->limCurrentBssCaps),
Abhishek Singheef5c992016-01-27 13:41:54 +05301800 pSession->encryptType, pSession->bWPSAssociation,
1801 pSession->bOSENAssociation);
Abhishek Singh5fef4042014-11-25 18:33:00 +05301802
1803 /* This is handled by sending probe req due to IOT issues so return TRUE
1804 */
1805 if ( (pBeacon->capabilityInfo.privacy) !=
1806 SIR_MAC_GET_PRIVACY(pSession->limCurrentBssCaps))
1807 {
1808 limLog(pMac, LOG1, FL("Return for Privacy bit miss match, As "
1809 "for this driver need to send the probe request to handle"
1810 " IOT issues "));
1811 return eSIR_TRUE;
1812 }
1813
1814 /*Open*/
1815 if( (pBeacon->capabilityInfo.privacy == 0) &&
1816 (pSession->encryptType == eSIR_ED_NONE))
1817 return eSIR_TRUE;
1818
1819 /* WEP */
1820 if ( (pBeacon->capabilityInfo.privacy == 1) && (pBeacon->wpaPresent == 0) &&
1821 (pBeacon->rsnPresent == 0) &&
Abhishek Singh31dfa3c2014-12-12 17:25:19 +05301822 ( ( pSession->encryptType == eSIR_ED_WEP40 ) ||
1823 ( pSession->encryptType == eSIR_ED_WEP104 )
1824#ifdef FEATURE_WLAN_WAPI
1825 || ( pSession->encryptType == eSIR_ED_WPI )
1826#endif
1827 ))
Abhishek Singh5fef4042014-11-25 18:33:00 +05301828 return eSIR_TRUE;
1829
1830 /* WPA OR RSN*/
1831 if ( (pBeacon->capabilityInfo.privacy == 1) &&
1832 ( (pBeacon->wpaPresent == 1) ||
1833 ( pBeacon->rsnPresent == 1)) &&
1834 ( (pSession->encryptType == eSIR_ED_TKIP) ||
1835 (pSession->encryptType == eSIR_ED_CCMP) ||
1836 (pSession->encryptType == eSIR_ED_AES_128_CMAC)))
1837 return eSIR_TRUE;
1838
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301839 /* For HS2.0, RSN ie is not present
1840 * in beacon. Therefore no need to
1841 * check for security type in case
1842 * OSEN session.
Abhishek Singheef5c992016-01-27 13:41:54 +05301843 * For WPS registration session no need to detect
1844 * security mismatch as it wont match and
1845 * driver may end up sending probe request without
1846 * WPS IE during WPS registartion process.
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301847 */
1848 /*TODO: AP capability mismatch
1849 * is not checked here because
1850 * no logic for beacon parsing
1851 * is avilable for HS2.0.
1852 */
Abhishek Singheef5c992016-01-27 13:41:54 +05301853 if (pSession->bOSENAssociation ||
1854 pSession->bWPSAssociation)
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301855 return eSIR_TRUE;
1856
Abhishek Singh5fef4042014-11-25 18:33:00 +05301857 return eSIR_FALSE;
1858}
Jeff Johnson295189b2012-06-20 16:38:30 -07001859
1860
1861/**
1862 * limDetectChangeInApCapabilities()
1863 *
1864 *FUNCTION:
1865 * This function is called while SCH is processing
1866 * received Beacon from AP on STA to detect any
1867 * change in AP's capabilities. If there any change
1868 * is detected, Roaming is informed of such change
1869 * so that it can trigger reassociation.
1870 *
1871 *LOGIC:
1872 *
1873 *ASSUMPTIONS:
1874 *
1875 *NOTE:
1876 * Notification is enabled for STA product only since
1877 * it is not a requirement on BP side.
1878 *
1879 * @param pMac Pointer to Global MAC structure
1880 * @param pBeacon Pointer to parsed Beacon structure
1881 * @return None
1882 */
1883
1884void
1885limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1886 tpSirProbeRespBeacon pBeacon,
1887 tpPESession psessionEntry)
1888{
Jeff Johnson295189b2012-06-20 16:38:30 -07001889 tANI_U8 len;
1890 tSirSmeApNewCaps apNewCaps;
1891 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301892 tSirRetStatus status = eSIR_SUCCESS;
Abhishek Singh5fef4042014-11-25 18:33:00 +05301893 tAniBool securityCapsMatched = eSIR_TRUE;
1894
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1896 newChannel = (tANI_U8) pBeacon->channelNumber;
1897
Abhishek Singh5fef4042014-11-25 18:33:00 +05301898 securityCapsMatched = limEncTypeMatched(pMac, pBeacon, psessionEntry);
1899
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301900 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
Abhishek Singh4f8446a2014-05-22 14:07:31 +05301901 ( ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1902 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ||
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301903 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1904 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1905 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1906 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1907 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1908 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1909 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1910 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
Abhishek Singh5fef4042014-11-25 18:33:00 +05301911 ( newChannel != psessionEntry->currentOperChannel ) ||
1912 (eSIR_FALSE == securityCapsMatched)
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301913 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301914 {
Abhishek Singha9325f72015-01-05 11:49:23 +05301915 if ( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301916 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301917 /* If Beacon capabilities is not matching with the current capability,
1918 * then send unicast probe request to AP and take decision after
1919 * receiving probe response */
1920 if ( true == psessionEntry->fIgnoreCapsChange )
1921 {
1922 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1923 return;
1924 }
1925 psessionEntry->fWaitForProbeRsp = true;
1926 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1927 "sending directed probe request.. "));
1928 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1929 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1930 psessionEntry->dot11mode, 0, NULL);
1931
1932 if ( eSIR_SUCCESS != status )
1933 {
1934 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1935 psessionEntry->fWaitForProbeRsp = false;
1936 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301937 return;
1938 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 /**
1940 * BSS capabilities have changed.
1941 * Inform Roaming.
1942 */
1943 len = sizeof(tSirMacCapabilityInfo) +
1944 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1945 3 * sizeof(tANI_U8) + // reserved fields
1946 pBeacon->ssId.length + 1;
1947
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301948 vos_mem_copy(apNewCaps.bssId,
1949 psessionEntry->bssId,
1950 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 if (newChannel != psessionEntry->currentOperChannel)
1952 {
1953 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001954 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 psessionEntry->currentOperChannel, newChannel);)
1956 return;
1957 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301958
1959 /**
1960 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1961 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1962 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1963 * the privacy bit is set in Probe and association responses.
1964 * Due to this anomaly, we detect a change in
1965 * AP capabilities when we receive a beacon after association and
1966 * disconnect from the AP. The following check makes sure that we can
1967 * connect to such APs
1968 */
1969 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1970 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1971 {
1972 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001973 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301974 return;
1975 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 else
1977 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301978 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1979 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 pBeacon->ssId.length + 1);
1981
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301982 psessionEntry->fIgnoreCapsChange = false;
1983 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 psessionEntry->limSentCapsChangeNtf = true;
1985 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1986 (tANI_U32 *) &apNewCaps,
1987 len, psessionEntry->smeSessionId);
1988 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301989 else if ( true == psessionEntry->fWaitForProbeRsp )
1990 {
1991 /* Only for probe response frames and matching capabilities the control
1992 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1993 * will be false, the control will not come here*/
1994
1995 limLog(pMac, LOG1, FL("capabilities in probe response are"
1996 "matching with the current setting,"
1997 "Ignoring subsequent capability"
1998 "mismatch"));
1999 psessionEntry->fIgnoreCapsChange = true;
2000 psessionEntry->fWaitForProbeRsp = false;
2001 }
2002
Jeff Johnson295189b2012-06-20 16:38:30 -07002003} /*** limDetectChangeInApCapabilities() ***/
2004
2005
2006
2007
2008// ---------------------------------------------------------------------
2009/**
2010 * limUpdateShortSlot
2011 *
2012 * FUNCTION:
2013 * Enable/Disable short slot
2014 *
2015 * LOGIC:
2016 *
2017 * ASSUMPTIONS:
2018 *
2019 * NOTE:
2020 *
2021 * @param enable Flag to enable/disable short slot
2022 * @return None
2023 */
2024
2025tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
2026{
2027
2028 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07002029 tANI_U32 nShortSlot;
2030 tANI_U32 val = 0;
2031 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002032
Jeff Johnsone7245742012-09-05 17:12:55 -07002033 // Check Admin mode first. If it is disabled just return
2034 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
2035 != eSIR_SUCCESS)
2036 {
2037 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002038 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002039 return eSIR_FAILURE;
2040 }
2041 if (val == false)
2042 return eSIR_SUCCESS;
2043
2044 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
2045 limGetPhyMode(pMac, &phyMode, psessionEntry);
2046 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
2047 return eSIR_SUCCESS;
2048
2049 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002050
2051 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
2052 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
2053 // if no erp present, use short slot based on current ap caps
2054
2055 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
2056
2057 //Resolution : always use the shortSlot setting the capability info to decide slot time.
2058 // The difference between the earlier implementation and the new one is only Case4.
2059 /*
2060 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
2061 Case1 1 1 1 1 //AP should not advertise this combination.
2062 Case2 1 1 0 0
2063 Case3 1 0 1 1
2064 Case4 1 0 0 0
2065 Case5 0 1 1 1
2066 Case6 0 1 0 0
2067 Case7 0 0 1 1
2068 Case8 0 0 0 0
2069 */
2070 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
2071
Jeff Johnsone7245742012-09-05 17:12:55 -07002072 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 {
2074 // Short slot time capability of AP has changed. Adopt to it.
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302075 limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07002077 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
2079 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 }
2081 return eSIR_SUCCESS;
2082}
2083
2084
Jeff Johnson295189b2012-06-20 16:38:30 -07002085
2086
Jeff Johnson295189b2012-06-20 16:38:30 -07002087
Jeff Johnson295189b2012-06-20 16:38:30 -07002088
2089
2090/** -----------------------------------------------------------------
2091 \brief limHandleLowRssiInd() - handles low rssi indication
2092
2093 This function process the SIR_HAL_LOW_RSSI_IND message from
2094 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
2095
2096 \param pMac - global mac structure
2097
2098 \return
2099
2100 \sa
2101 ----------------------------------------------------------------- */
2102void limHandleLowRssiInd(tpAniSirGlobal pMac)
2103{
2104#if 0 //RSSI related indications will now go to TL and not PE
2105 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2106 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2107 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2108 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002109 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
2111 }
2112 else
2113 {
2114 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002115 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 pMac->pmm.gPmmState);
2117 }
2118 return;
2119#endif
2120}
2121
2122
2123/** -----------------------------------------------------------------
2124 \brief limHandleBmpsStatusInd() - handles BMPS status indication
2125
2126 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
2127 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2128 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
2129
2130 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
2131 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
2132 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
2133 This message can also come from FW anytime after we have entered BMPS.
2134 This means we should handle it in WoWL and UAPSD states as well
2135
2136 \param pMac - global mac structure
2137 \return - none
2138 \sa
2139 ----------------------------------------------------------------- */
2140void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2141{
2142 switch(pMac->pmm.gPmmState)
2143 {
2144 case ePMM_STATE_BMPS_SLEEP:
2145 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2146 case ePMM_STATE_UAPSD_SLEEP:
2147 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2148 case ePMM_STATE_WOWLAN:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302149 limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2151 break;
2152
2153 default:
2154 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002155 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 pMac->pmm.gPmmState);
2157 break;
2158 }
2159 return;
2160}
2161
2162
2163/** -----------------------------------------------------------------
2164 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2165
2166 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2167 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2168 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2169
2170 \param pMac - global mac structure
2171 \return - none
2172 \sa
2173 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002174void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002175{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002176#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2177 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2178 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2179 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2180 if (psessionEntry == NULL)
2181 {
2182 limLog(pMac, LOGE,
2183 FL("session does not exist for given BSSIdx:%d"),
2184 pSirMissedBeaconInd->bssIdx);
2185 return;
2186 }
2187#endif
Gupta, Kapil2fc8ca22016-02-19 12:22:17 +05302188 if (pMac->pmm.inMissedBeaconScenario == TRUE) {
2189 limLog(pMac, LOGW,
2190 FL("beacon miss handling is already going on for BSSIdx:%d"),
2191 pSirMissedBeaconInd->bssIdx);
2192 return;
2193 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2195 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2196 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2197 {
2198 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302199 PELOGE(limLog(pMac, LOGE,
2200 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2202 }
Yathish9f22e662012-12-10 14:21:35 -08002203/* ACTIVE_MODE_HB_OFFLOAD */
2204#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2205 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2206 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2207 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2208 {
2209 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002210 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002211 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002212 }
2213#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 else
2215 {
2216 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002217 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 pMac->pmm.gPmmState);
2219 }
2220 return;
2221}
2222
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05302223
2224void limUpdateLostLinkParams(tpAniSirGlobal pMac,
2225 tpPESession psessionEntry, tANI_U8 *pRxPacketInfo)
2226{
2227 tpSirSmeLostLinkParamsInd pSmeLostLinkParams;
2228 tSirMsgQ mmhMsg;
2229 if (NULL == pRxPacketInfo)
2230 {
2231 return;
2232 }
2233 pSmeLostLinkParams =
2234 (tpSirSmeLostLinkParamsInd)vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05302235 if (NULL == pSmeLostLinkParams)
2236 {
2237 limLog(pMac, LOGP,
2238 FL("Failed to alloc mem of size %zu for tSirSmeLostLinkParamsInd"),
2239 sizeof(*pSmeLostLinkParams));
2240 return;
2241 }
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05302242 vos_mem_set(pSmeLostLinkParams, sizeof(tSirSmeLostLinkParamsInd), 0);
2243 pSmeLostLinkParams->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
2244 pSmeLostLinkParams->length = sizeof(tSirSmeLostLinkParamsInd);
2245 pSmeLostLinkParams->sessionId = psessionEntry->smeSessionId;
2246 pSmeLostLinkParams->info.bssIdx = psessionEntry->bssIdx;
2247
2248 /*
2249 * Since FW adds 100 to RSSI, here also we are adding 100 so that
2250 * HDD has common logic to subtract 100 from RSSI received
2251 */
2252 pSmeLostLinkParams->info.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo) + 100;
2253 vos_mem_copy(pSmeLostLinkParams->info.selfMacAddr,
2254 psessionEntry->selfMacAddr,
2255 sizeof(tSirMacAddr));
2256 pSmeLostLinkParams->info.lastDataRate = 0;
2257 pSmeLostLinkParams->info.linkFlCnt = 0;
2258 pSmeLostLinkParams->info.linkFlTx = 0;
2259 pSmeLostLinkParams->info.rsvd1 = 0;
2260 pSmeLostLinkParams->info.rsvd2 = 0;
2261
2262 mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
2263 mmhMsg.bodyptr = pSmeLostLinkParams;
2264 mmhMsg.bodyval = 0;
2265 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2266}
2267
2268/** -----------------------------------------------------------------
2269 \brief limProcessLostLinkParamsInd() - handles lost link params indication
2270
2271 This function process the SIR_HAL_LOST_LINK_PARAMS_IND message from HAL,
2272
2273 \param pMac - global mac structure
2274 \return - none
2275 \sa
2276 ----------------------------------------------------------------- */
2277
2278void limProcessLostLinkParamsInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2279{
2280 tpSirSmeLostLinkParamsInd pSmeLostLinkParamsInd;
2281 tpSirSmeLostLinkParamsInd pLostLInkParamsInd = (tpSirSmeLostLinkParamsInd)pMsg->bodyptr;
2282 tpPESession psessionEntry ;
2283 tSirMsgQ mmhMsg;
2284
2285 if (NULL == pLostLInkParamsInd)
2286 {
2287 limLog(pMac, LOGE,
2288 FL("pLostLInkParamsInd is NULL"));
2289 return;
2290 }
2291
2292 psessionEntry = peFindSessionByBssIdx(pMac,pLostLInkParamsInd->info.bssIdx);
2293 if (psessionEntry == NULL)
2294 {
2295 limLog(pMac, LOGE,
2296 FL("session does not exist for bdssIdx : %d"),
2297 pLostLInkParamsInd->info.bssIdx);
2298
2299 return;
2300 }
2301 pSmeLostLinkParamsInd = vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
2302 if (pSmeLostLinkParamsInd == NULL)
2303 {
2304 limLog(pMac, LOGP,
2305 FL("memory allocate failed for eWNI_SME_LOST_LINK_PARAMD_IND"));
2306 return;
2307 }
2308 pSmeLostLinkParamsInd->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
2309 pSmeLostLinkParamsInd->length = sizeof(tSirSmeLostLinkParamsInd);
2310 pSmeLostLinkParamsInd->sessionId = psessionEntry->smeSessionId;
2311 pSmeLostLinkParamsInd->info.bssIdx = pLostLInkParamsInd->info.bssIdx;
2312 pSmeLostLinkParamsInd->info.rssi = pLostLInkParamsInd->info.rssi;
2313 vos_mem_copy(pSmeLostLinkParamsInd->info.selfMacAddr,
2314 pLostLInkParamsInd->info.selfMacAddr,
2315 sizeof(tSirMacAddr));
2316 pSmeLostLinkParamsInd->info.linkFlCnt = pLostLInkParamsInd->info.linkFlCnt;
2317 pSmeLostLinkParamsInd->info.linkFlTx = pLostLInkParamsInd->info.linkFlTx;
2318 pSmeLostLinkParamsInd->info.lastDataRate = pLostLInkParamsInd->info.lastDataRate;
2319 pSmeLostLinkParamsInd->info.rsvd1 = pLostLInkParamsInd->info.rsvd1;
2320 pSmeLostLinkParamsInd->info.rsvd2 = pLostLInkParamsInd->info.rsvd2;
2321
2322 mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
2323 mmhMsg.bodyptr = pSmeLostLinkParamsInd;
2324 mmhMsg.bodyval = 0;
2325 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2326 return;
2327}
2328
Jeff Johnson295189b2012-06-20 16:38:30 -07002329/** -----------------------------------------------------------------
2330 \brief limMicFailureInd() - handles mic failure indication
2331
2332 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2333
2334 \param pMac - global mac structure
2335 \return - none
2336 \sa
2337 ----------------------------------------------------------------- */
2338void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2339{
2340 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2341 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2342 tSirMsgQ mmhMsg;
2343 tpPESession psessionEntry ;
2344 tANI_U8 sessionId;
2345
2346 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2347 {
2348 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002349 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 return;
2351 }
2352
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302353 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2354 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 {
2356 // Log error
2357 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002358 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 return;
2360 }
2361
2362 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
Sunkad, Anand Ningappabf1650a2016-02-08 12:08:13 +05302363 pSirSmeMicFailureInd->length = sizeof(*pSirSmeMicFailureInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2365
2366 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302367 pSirMicFailureInd->bssId,
2368 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002369
2370 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302371 pSirMicFailureInd->info.srcMacAddr,
2372 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002373
2374 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302375 pSirMicFailureInd->info.taMacAddr,
2376 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002377
2378 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302379 pSirMicFailureInd->info.dstMacAddr,
2380 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302383 pSirMicFailureInd->info.rxMacAddr,
2384 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002385
2386 pSirSmeMicFailureInd->info.multicast =
2387 pSirMicFailureInd->info.multicast;
2388
2389 pSirSmeMicFailureInd->info.keyId=
2390 pSirMicFailureInd->info.keyId;
2391
2392 pSirSmeMicFailureInd->info.IV1=
2393 pSirMicFailureInd->info.IV1;
2394
2395 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302396 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397
2398 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2399 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2400 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302401 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2403 return;
2404}
2405
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +05302406#ifdef WLAN_FEATURE_11W
2407/** --------------------------------------------------------------------
2408 * lim_is_assoc_req_for_drop()- function to decides to drop assoc\reassoc
2409 * frames.
2410 * @mac: pointer to global mac structure
2411 * @rx_pkt_info: rx packet meta information
2412 *
2413 * This function is called before enqueuing the frame to PE queue to
2414 * drop flooded assoc/reassoc frames getting into PE Queue.
2415 *
2416 * Return: true for dropping the frame otherwise false
2417----------------------------------------------------------------------*/
2418
2419bool lim_is_assoc_req_for_drop(tpAniSirGlobal pMac, uint8_t *rx_pkt_info)
2420{
2421 tANI_U8 session_id;
2422 tANI_U16 aid;
2423 tpPESession session_entry;
2424 tpSirMacMgmtHdr pMacHdr;
2425 tpDphHashNode sta_ds;
2426
2427 pMacHdr = WDA_GET_RX_MAC_HEADER(rx_pkt_info);
2428 session_entry = peFindSessionByBssid(pMac, pMacHdr->bssId, &session_id);
2429 if (!session_entry)
2430 {
2431 PELOG1(limLog(pMac, LOG1,
2432 FL("session does not exist for given STA [%pM]"),
2433 pMacHdr->sa););
2434 return false;
2435 }
2436 sta_ds = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
2437 &session_entry->dph.dphHashTable);
2438 if (!sta_ds)
2439 {
2440 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL")););
2441 return false;
2442 }
2443
2444 if (!sta_ds->rmfEnabled)
2445 return false;
2446
2447 if (sta_ds->pmfSaQueryState == DPH_SA_QUERY_IN_PROGRESS)
2448 return true;
2449
2450 if (sta_ds->last_assoc_received_time &&
2451 ((vos_timer_get_system_time() -
2452 sta_ds->last_assoc_received_time) < 1000))
2453 return true;
2454
2455 sta_ds->last_assoc_received_time = vos_timer_get_system_time();
2456 return false;
2457}
2458#endif
2459
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302460/** ----------------------------------------------------------------------
2461 *\brief limIsDeauthDiassocForDrop()..decides to drop deauth\diassoc frames.
2462 *This function is called before enqueuing the frame to PE queue.
2463 *This prevents deauth/diassoc frames getting into PE Queue.
Jeff Johnson295189b2012-06-20 16:38:30 -07002464
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302465------------------------------------------------------------------------ */
2466
2467
2468boolean limIsDeauthDiassocForDrop(tpAniSirGlobal pMac,
2469 tANI_U8 *pRxPacketInfo)
2470{
2471 tANI_U8 sessionId;
2472 tANI_U16 aid;
2473 tpPESession psessionEntry;
2474 tpSirMacMgmtHdr pMacHdr;
2475 tpDphHashNode pStaDs;
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302476 eHalStatus lock_status = eHAL_STATUS_SUCCESS;
2477 boolean ret = FALSE;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302478
2479 pMacHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2480 psessionEntry = peFindSessionByBssid(pMac,pMacHdr->bssId,&sessionId);
2481 if (!psessionEntry)
2482 {
2483 PELOG1(sysLog(pMac, LOG1,
2484 FL("session does not exist for given STA [%pM]"),
2485 pMacHdr->sa););
2486 return TRUE;
2487 }
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302488
2489 lock_status = pe_AcquireGlobalLock(&pMac->lim);
2490 if (lock_status != eHAL_STATUS_SUCCESS)
2491 {
2492 limLog(pMac, LOGE, FL("pe_AcquireGlobalLock error"));
2493 return TRUE;
2494 }
2495
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302496 pStaDs = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
2497 &psessionEntry->dph.dphHashTable);
2498 if (!pStaDs)
2499 {
2500 PELOG1(sysLog(pMac, LOG1,FL("pStaDs is NULL")););
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302501 ret = TRUE;
2502 goto end;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302503 }
2504#ifdef WLAN_FEATURE_11W
2505 if (psessionEntry->limRmfEnabled)
2506 {
2507 if ((WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) &
2508 DPU_FEEDBACK_UNPROTECTED_ERROR))
2509 {
2510 /* It may be possible that deauth/diassoc frames from a spoofy
2511 * AP is received. So if all further deauth/diassoc frmaes are
2512 * dropped, then it may result in lossing deauth/diassoc frames
2513 * from genuine AP. So process all deauth/diassoc frames with
2514 * a time difference of 1 sec.
2515 */
2516 if (vos_timer_get_system_time() - pStaDs->last_unprot_deauth_disassoc < 1000)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302517 {
2518 ret = TRUE;
2519 goto end;
2520 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302521 pStaDs->last_unprot_deauth_disassoc =
2522 vos_timer_get_system_time();
2523 }
2524/* PMF enabed, Management frames are protected */
2525 else
2526 {
2527 if (pStaDs->proct_deauh_disassoc_cnt)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302528 {
2529 ret = TRUE;
2530 goto end;
2531 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302532 else
2533 pStaDs->proct_deauh_disassoc_cnt++;
2534 }
2535 }
2536 else
2537#endif
2538/* PMF disabled */
2539 {
2540 if (pStaDs->isDisassocDeauthInProgress)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302541 {
2542 ret = TRUE;
2543 goto end;
2544 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302545 else
2546 pStaDs->isDisassocDeauthInProgress++;
2547 }
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302548
2549end:
2550 pe_ReleaseGlobalLock(&pMac->lim);
2551 return ret;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302552}
Jeff Johnson295189b2012-06-20 16:38:30 -07002553/** -----------------------------------------------------------------
2554 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2555
2556 This function is called before enqueuing the frame to PE queue for further processing.
2557 This prevents unnecessary frames getting into PE Queue and drops them right away.
2558 Frames will be droped in the following scenarios:
2559
2560 - In Scan State, drop the frames which are not marked as scan frames
2561 - In non-Scan state, drop the frames which are marked as scan frames.
2562 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2563 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2564
2565 \param pMac - global mac structure
2566 \return - none
2567 \sa
2568 ----------------------------------------------------------------- */
2569
2570tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2571{
2572 tANI_U32 framelen;
2573 tANI_U8 *pBody;
2574 tSirMacCapabilityInfo capabilityInfo;
2575
2576 /*
2577 *
2578 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2579 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2580 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2581 * other than beacons or probe responses in scan state.
2582 */
2583 if( (subType == SIR_MAC_MGMT_BEACON) ||
2584 (subType == SIR_MAC_MGMT_PROBE_RSP))
2585 {
2586 if(pMac->pmm.inMissedBeaconScenario)
2587 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002588 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2589 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 }
2591 if (limIsSystemInScanState(pMac))
2592 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002593 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002595#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2596 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2597 {
2598 return eMGMT_DROP_NO_DROP;
2599 }
2600#endif
Dino Mycle7a76e662014-06-10 11:36:34 +05302601#ifdef WLAN_FEATURE_EXTSCAN
2602 else if (WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
2603 {
2604 return eMGMT_DROP_NO_DROP;
2605 }
2606#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2608 {
2609 return eMGMT_DROP_SCAN_MODE_FRAME;
2610 }
2611 }
2612
2613 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2614 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2615
2616 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2617 * beacons from an infrastructure network
2618 */
2619 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2620 if(!capabilityInfo.ibss)
2621 return eMGMT_DROP_NO_DROP;
2622#if 0
2623 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2624 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2625 return eMGMT_DROP_NO_DROP;
2626#endif
2627
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +05302628#ifdef WLAN_FEATURE_11W
2629 if ((subType == SIR_MAC_MGMT_ASSOC_REQ ||
2630 subType == SIR_MAC_MGMT_REASSOC_REQ) &&
2631 lim_is_assoc_req_for_drop(pMac, pRxPacketInfo))
2632 return eMGMT_DROP_SPURIOUS_FRAME;
2633#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2635 if( (subType == SIR_MAC_MGMT_BEACON) ||
2636 (subType == SIR_MAC_MGMT_PROBE_RSP))
2637 {
2638 //drop the frame if length is less than 12
2639 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2640 return eMGMT_DROP_INVALID_SIZE;
2641
2642 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2643
2644 //This can be enhanced to even check the SSID before deciding to enque the frame.
2645 if(capabilityInfo.ess)
2646 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2647 }
2648 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2649 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2650 {
2651 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2652 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2653 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2654 }
2655
2656 return eMGMT_DROP_NO_DROP;
2657}
2658
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002659eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2660{
2661 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002662
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002663 if(psPe)
2664 {
2665 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2666 {
2667 status = eHAL_STATUS_SUCCESS;
2668 }
2669 }
2670 return (status);
2671}
2672eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2673{
2674 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2675 if(psPe)
2676 {
2677 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2678 {
2679 status = eHAL_STATUS_SUCCESS;
2680 }
2681 }
2682 return (status);
2683}