blob: f49aa01580f432a7709c503d538f8a280f17796c [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
Sreelakshmi Konamki60ccfb32016-07-08 12:53:12 +0530447 vos_mem_set(&pMac->lim.staBaInfo, sizeof(pMac->lim.staBaInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700448}
449
Jeff Johnson295189b2012-06-20 16:38:30 -0700450static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
451{
Jeff Johnsone7245742012-09-05 17:12:55 -0700452 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 tANI_U16 val16;
454 tANI_U8 val8;
455 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
456 tSirMacHTInfoField1 *pHTInfoField1;
457 tpSirPowerSaveCfg pPowerSaveConfig;
458 tSirMacHTParametersInfo *pAmpduParamInfo;
459
460 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700461 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
462 * and they will be used throughout when there is no session
463 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700464
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
466 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700467 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 return eSIR_FAILURE;
469 }
470
471 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
472 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700473 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 return eSIR_FAILURE;
475 }
476 val16 = ( tANI_U16 ) val1;
477 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
478
479 //channel bonding mode could be set to anything from 0 to 4(Titan had these
480 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
481 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
482 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
483 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
484 != eSIR_SUCCESS)
485 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700486 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 return eSIR_FAILURE;
488 }
489
490 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
491 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700492 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 return eSIR_FAILURE;
494 }
495
496 val8 = ( tANI_U8 ) val1;
497 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
498 pHTInfoField1->recommendedTxWidthSet =
499 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
501 != eSIR_SUCCESS)
502 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700503 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 return eSIR_FAILURE;
505 }
506
507 /* WNI_CFG_HEART_BEAT_THRESHOLD */
508
509 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
510 eSIR_SUCCESS )
511 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700512 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 return eSIR_FAILURE;
514 }
515 if(!val1)
516 {
517 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
518 pMac->sys.gSysEnableLinkMonitorMode = 0;
519 }
520 else
521 {
522 //No need to activate the timer during init time.
523 pMac->sys.gSysEnableLinkMonitorMode = 1;
524 }
525
526 /* WNI_CFG_SHORT_GI_20MHZ */
527
528 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
529 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 return eSIR_FAILURE;
532 }
533 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
534 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700535 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 return eSIR_FAILURE;
537 }
538 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
539 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700540 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 return eSIR_FAILURE;
542 }
543
544 val16 = ( tANI_U16 ) val1;
545 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
546 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
547 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
548
549 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
550 eSIR_SUCCESS)
551 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700552 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 return eSIR_FAILURE;
554 }
555
556 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
557
558 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
559 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700560 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 return eSIR_FAILURE;
562 }
563 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700565 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 return eSIR_FAILURE;
567 }
568 val16 = ( tANI_U16 ) val1;
569 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
570 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
571 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
572 eSIR_SUCCESS)
573 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700574 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 return eSIR_FAILURE;
576 }
577
578 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
579 limHandleCFGparamUpdate do we want to update this? */
580 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
581 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530582 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 return eSIR_FAILURE;
584 }
585
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 /* WNI_CFG_MAX_PS_POLL */
587
588 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530589 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
590 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 {
592 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700593 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 return eSIR_FAILURE;
595 }
596
597 /* This context should be valid if power-save configuration message has been
598 * already dispatched during initialization process. Re-using the present
599 * configuration mask
600 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530601 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700602
603 /* Note: it is okay to do this since DAL/HAL is alrady started */
604 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
605 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700606 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 return eSIR_FAILURE;
608 }
609
610 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
611
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700613 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
616 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
617
618 /* This was initially done after resume notification from HAL. Now, DAL is
619 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700620 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800621 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
622 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700623 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800624 return eSIR_FAILURE;
625 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530626#ifdef FEATURE_WLAN_TDLS
627 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
628 {
629 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
630 return eSIR_FAILURE;
631 }
632 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
633 {
634 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
635 return eSIR_FAILURE;
636 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530637 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
638 {
639 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
640 return eSIR_FAILURE;
641 }
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530642
643 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_WMM_MODE_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSWmmMode) != eSIR_SUCCESS)
644 {
645 limLog(pMac, LOGP, FL("cfg get LimTDLSWmmMode failed"));
646 return eSIR_FAILURE;
647 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530648#endif
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530649
Rashmi Ramannac7744532013-10-06 16:49:08 +0530650 if (eSIR_SUCCESS !=
651 wlan_cfgGetInt(pMac, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
652 (tANI_U32 *)&pMac->lim.gDebugP2pRemainOnChannel))
653 {
654 limLog( pMac, LOGE,
655 "%s: Couldn't get WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL value",
656 __func__);
657 pMac->lim.gDebugP2pRemainOnChannel = 0;
658 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 return eSIR_SUCCESS;
660}
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662/*
663 limStart
664 This function is to replace the __limProcessSmeStartReq since there is no
665 eWNI_SME_START_REQ post to PE.
666*/
667tSirRetStatus limStart(tpAniSirGlobal pMac)
668{
669 tSirResultCodes retCode = eSIR_SUCCESS;
670
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530671 limLog(pMac, LOG1, FL(" enter"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700672
673 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
674 {
675 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
676
Jeff Johnsone7245742012-09-05 17:12:55 -0700677 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700678
679 // By default do not return after first scan match
680 pMac->lim.gLimReturnAfterFirstMatch = 0;
681
682 // Initialize MLM state machine
683 limInitMlm(pMac);
684
685 // By default return unique scan results
686 pMac->lim.gLimReturnUniqueResults = true;
687 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700688#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
689 pMac->lim.gLimSmeLfrScanResultLength = 0;
690#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 }
692 else
693 {
694 /**
695 * Should not have received eWNI_SME_START_REQ in states
696 * other than OFFLINE. Return response to host and
697 * log error
698 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530699 limLog(pMac, LOGE, FL("Invalid SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 retCode = eSIR_FAILURE;
701 }
702
703 return retCode;
704}
705
706/**
707 * limInitialize()
708 *
709 *FUNCTION:
710 * This function is called from LIM thread entry function.
711 * LIM related global data structures are initialized in this function.
712 *
713 *LOGIC:
714 * NA
715 *
716 *ASSUMPTIONS:
717 * NA
718 *
719 *NOTE:
720 * NA
721 *
722 * @param pMac - Pointer to global MAC structure
723 * @return None
724 */
725
726tSirRetStatus
727limInitialize(tpAniSirGlobal pMac)
728{
729 tSirRetStatus status = eSIR_SUCCESS;
730
731 __limInitAssocVars(pMac);
732 __limInitVars(pMac);
733 __limInitStates(pMac);
734 __limInitStatsVars(pMac);
735 __limInitBssVars(pMac);
736 __limInitScanVars(pMac);
737 __limInitHTVars(pMac);
738 __limInitTitanVars(pMac);
739
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 status = limStart(pMac);
741 if(eSIR_SUCCESS != status)
742 {
743 return status;
744 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700745
746 /*
747 * MLM will be intitalized when 'START' request comes from SME.
748 * limInitMlm calls limCreateTimers, which actually relies on
749 * CFG to be downloaded. So it should not be called as part of
750 * peStart, as CFG download is happening after peStart.
751 */
752 //limInitMlm(pMac);
753 // Initializations for maintaining peers in IBSS
754 limIbssInit(pMac);
755
756 pmmInitialize(pMac);
757
758
759#if defined WLAN_FEATURE_VOWIFI
760 rrmInitialize(pMac);
761#endif
762#if defined WLAN_FEATURE_VOWIFI_11R
763 limFTOpen(pMac);
764#endif
765
Abhishek Singh00b71972016-01-07 10:51:04 +0530766#ifdef WLAN_FEATURE_RMC
767 limRmcInit(pMac);
768#endif /* WLAN_FEATURE_RMC */
769
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700771
772#if 0
773
774 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
775 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
776 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
777
778 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
779 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
780
781 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
782 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
783 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
784
785 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
786
787 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
788
789 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
790 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
791
792 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
793
794
795 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
796
797 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
798#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700799
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 //Initialize the configurations needed by PE
801 if( eSIR_FAILURE == __limInitConfig(pMac))
802 {
803 //We need to undo everything in limStart
804 limCleanupMlm(pMac);
805 return eSIR_FAILURE;
806 }
807
808 //initialize the TSPEC admission control table.
809 //Note that this was initially done after resume notification from HAL.
810 //Now, DAL is started before PE so this can be done here
811 limAdmitControlInit(pMac);
812 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700813
814 return status;
815
816} /*** end limInitialize() ***/
817
818
819
820/**
821 * limCleanup()
822 *
823 *FUNCTION:
824 * This function is called upon reset or persona change
825 * to cleanup LIM state
826 *
827 *LOGIC:
828 * NA
829 *
830 *ASSUMPTIONS:
831 * NA
832 *
833 *NOTE:
834 * NA
835 *
836 * @param pMac - Pointer to Global MAC structure
837 * @return None
838 */
839
840void
841limCleanup(tpAniSirGlobal pMac)
842{
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 v_PVOID_t pvosGCTx;
844 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
Jeff Johnson295189b2012-06-20 16:38:30 -0700846//Before destroying the list making sure all the nodes have been deleted.
847//Which should be the normal case, but a memory leak has been reported.
848
849 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
850
851 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
852 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
853 {
854 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
855 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
856
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530857 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 }
859
860 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700861
862 limCleanupMlm(pMac);
863 limCleanupLmm(pMac);
864
Abhishek Singh00b71972016-01-07 10:51:04 +0530865#ifdef WLAN_FEATURE_RMC
866 limRmcCleanup(pMac);
867#endif /* WLAN_FEATURE_RMC */
868
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 // free up preAuth table
870 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
871 {
Sushant Kaushikf4a27972015-04-16 16:48:00 +0530872 vos_mem_vfree(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
874 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
875 }
876
877 if(NULL != pMac->lim.pDialogueTokenHead)
878 {
879 limDeleteDialogueTokenList(pMac);
880 }
881
882 if(NULL != pMac->lim.pDialogueTokenTail)
883 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530884 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 pMac->lim.pDialogueTokenTail = NULL;
886 }
887
888 # if 0
889 if (pMac->lim.gpLimStartBssReq != NULL)
890 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530891 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 pMac->lim.gpLimStartBssReq = NULL;
893 }
894 #endif
895
896 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
897 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530898 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 pMac->lim.gpLimMlmSetKeysReq = NULL;
900 }
901
902 #if 0
903 if (pMac->lim.gpLimJoinReq != NULL)
904 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530905 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 pMac->lim.gpLimJoinReq = NULL;
907 }
908 #endif
909
910 if (pMac->lim.gpLimMlmAuthReq != NULL)
911 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530912 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 pMac->lim.gpLimMlmAuthReq = NULL;
914 }
915
Jeff Johnsone7245742012-09-05 17:12:55 -0700916#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 if (pMac->lim.gpLimMlmJoinReq != NULL)
918 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530919 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 pMac->lim.gpLimMlmJoinReq = NULL;
921 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700922#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700923
924 #if 0
925 if (pMac->lim.gpLimReassocReq != NULL)
926 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530927 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 pMac->lim.gpLimReassocReq = NULL;
929 }
930 #endif
931
932 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
933 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530934 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
936 }
937
Viral Modid440e682013-03-06 02:25:31 -0800938 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800939 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530940 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800941 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800942 }
Viral Modid86bde22012-12-10 13:09:21 -0800943
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 if (pMac->lim.gpLimMlmScanReq != NULL)
945 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530946 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 pMac->lim.gpLimMlmScanReq = NULL;
948 }
949
950#if 0
951 if(NULL != pMac->lim.beacon)
952 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530953 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 pMac->lim.beacon = NULL;
955 }
956#endif
957 #if 0
958 if(NULL != pMac->lim.assocReq)
959 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530960 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 pMac->lim.assocReq= NULL;
962 }
963 #endif
964
965#if 0
966 if(NULL != pMac->lim.assocRsp)
967 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530968 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 pMac->lim.assocRsp= NULL;
970 }
971#endif
972 // Now, finally reset the deferred message queue pointers
973 limResetDeferredMsgQ(pMac);
974
Jeff Johnson295189b2012-06-20 16:38:30 -0700975
976 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
977 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
978
979 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700980 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700981
982#if defined WLAN_FEATURE_VOWIFI
983 rrmCleanup(pMac);
984#endif
985#if defined WLAN_FEATURE_VOWIFI_11R
986 limFTCleanup(pMac);
987#endif
988
989} /*** end limCleanup() ***/
990
991
992/** -------------------------------------------------------------
993\fn peOpen
994\brief will be called in Open sequence from macOpen
995\param tpAniSirGlobal pMac
996\param tHalOpenParameters *pHalOpenParam
997\return tSirRetStatus
998 -------------------------------------------------------------*/
999
1000tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
1001{
Kaushik, Sushant16def7c2014-06-17 14:20:49 +05301002 if (eDRIVER_TYPE_MFG == pMacOpenParam->driverType)
1003 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
1005 pMac->lim.maxStation = pMacOpenParam->maxStation;
Katya Nigam53799202014-12-18 15:59:38 +05301006 vos_spin_lock_init( &pMac->sys.lock );
Jeff Johnson295189b2012-06-20 16:38:30 -07001007
1008 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
1009 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001010 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 return eSIR_FAILURE;
1012 }
1013
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301014 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_vmalloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301015 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001017 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 return eSIR_FAILURE;
1019 }
1020
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301021 pMac->lim.gpSession = vos_mem_vmalloc(sizeof(tPESession)* pMac->lim.maxBssId);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301022 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001024 limLog(pMac, LOGE, FL("memory allocate failed!"));
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301025 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 return eSIR_FAILURE;
1027 }
1028
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301029 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001030
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301031 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1032 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001034 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301035 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
1036 vos_mem_vfree(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 return eSIR_FAILURE;
1038 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301039 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001040
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001041 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001042 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001043
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001044 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1045 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001046 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301047 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001048 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301049 vos_mem_vfree(pMac->lim.gpSession);
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001050 pMac->lim.gpSession = NULL;
1051 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1052 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001053 return eSIR_FAILURE;
1054 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001055 pMac->lim.deauthMsgCnt = 0;
Agarwal Ashishb4ce9922014-11-04 18:40:38 +05301056 pMac->lim.retryPacketCnt = 0;
Sushant Kaushike06bd872015-03-12 16:17:48 +05301057 pMac->lim.gLimIbssRetryCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001058
1059 /*
1060 * peOpen is successful by now, so it is right time to initialize
1061 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1062 * then nothing will be logged for PE module.
1063 */
1064#ifdef LIM_TRACE_RECORD
1065 MTRACE(limTraceInit(pMac));
1066#endif
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301067 lim_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 return eSIR_SUCCESS;
1069}
1070
1071/** -------------------------------------------------------------
1072\fn peClose
1073\brief will be called in close sequence from macClose
1074\param tpAniSirGlobal pMac
1075\return tSirRetStatus
1076 -------------------------------------------------------------*/
1077
1078tSirRetStatus peClose(tpAniSirGlobal pMac)
1079{
1080 tANI_U8 i;
1081
1082 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1083 return eSIR_SUCCESS;
Katya Nigam53799202014-12-18 15:59:38 +05301084
1085 vos_spin_lock_destroy( &pMac->sys.lock );
1086
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 for(i =0; i < pMac->lim.maxBssId; i++)
1088 {
1089 if(pMac->lim.gpSession[i].valid == TRUE)
1090 {
1091 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1092 }
1093 }
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301094 vos_mem_vfree(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001095 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301096 vos_mem_vfree(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 pMac->lim.gpSession = NULL;
Sushant Kaushikf4a27972015-04-16 16:48:00 +05301098
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301099 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001101 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1102 {
1103 return eSIR_FAILURE;
1104 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 return eSIR_SUCCESS;
1106}
1107
1108/** -------------------------------------------------------------
1109\fn peStart
1110\brief will be called in start sequence from macStart
1111\param tpAniSirGlobal pMac
1112\return none
1113 -------------------------------------------------------------*/
1114
1115tSirRetStatus peStart(tpAniSirGlobal pMac)
1116{
1117 tSirRetStatus status = eSIR_SUCCESS;
1118
1119 status = limInitialize(pMac);
1120#if defined(ANI_LOGDUMP)
1121 limDumpInit(pMac);
1122#endif //#if defined(ANI_LOGDUMP)
1123
1124 return status;
1125}
1126
1127/** -------------------------------------------------------------
1128\fn peStop
1129\brief will be called in stop sequence from macStop
1130\param tpAniSirGlobal pMac
1131\return none
1132 -------------------------------------------------------------*/
1133
1134void peStop(tpAniSirGlobal pMac)
1135{
1136 limCleanup(pMac);
1137 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1138 return;
1139}
1140
1141/** -------------------------------------------------------------
1142\fn peFreeMsg
1143\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1144\ to free a given PE message on the TX and MC thread.
1145\ This happens when there are messages pending in the PE
1146\ queue when system is being stopped and reset.
1147\param tpAniSirGlobal pMac
1148\param tSirMsgQ pMsg
1149\return none
1150-----------------------------------------------------------------*/
1151v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1152{
1153 if (pMsg != NULL)
1154 {
1155 if (NULL != pMsg->bodyptr)
1156 {
1157 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1158 {
1159 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1160 }
1161 else
1162 {
1163 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1164 }
1165 }
1166 pMsg->bodyptr = 0;
1167 pMsg->bodyval = 0;
1168 pMsg->type = 0;
1169 }
1170 return;
1171}
1172
1173
1174/**
1175 * The function checks if a particular timer should be allowed
1176 * into LIM while device is sleeping
1177 */
1178tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1179{
1180 tANI_U8 retStatus = TRUE;
1181
1182 if(!limIsSystemInActiveState(pMac))
1183 {
1184 switch(pMsg->type)
1185 {
1186 /* Don't allow following timer messages if in sleep */
1187 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1188 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1189 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1190 retStatus = FALSE;
1191 break;
1192 /* May allow following timer messages in sleep mode */
Jeff Johnson295189b2012-06-20 16:38:30 -07001193
1194 /* Safe to allow as of today, this triggers background scan
1195 * which will not be started if the device is in power-save mode
1196 * might need to block in the future if we decide to implement
1197 * spectrum management
1198 */
1199 case SIR_LIM_QUIET_TIMEOUT:
1200
1201 /* Safe to allow as of today, this triggers background scan
1202 * which will not be started if the device is in power-save mode
1203 * might need to block in the future if we decide to implement
1204 * spectrum management
1205 */
1206 case SIR_LIM_QUIET_BSS_TIMEOUT:
1207
1208 /* Safe to allow this timermessage, triggers background scan
1209 * which is blocked in sleep mode
1210 */
1211 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1212
1213 /* Safe to allow this timer, since, while in IMPS this timer will not
1214 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1215 * when heart-beat control is handled back to PE, device would have
1216 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1217 */
1218 case SIR_LIM_HEART_BEAT_TIMEOUT:
1219 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1220
1221 /* Safe to allow, PE is not handling this message as of now. May need
1222 * to block it, basically, free the buffer and restart the timer
1223 */
1224 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1225 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001226 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1228 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1229 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Sushant Kaushik9e923872015-04-02 17:09:31 +05301230 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 retStatus = TRUE;
1232 break;
1233
1234 /* by default allow rest of messages */
1235 default:
1236 retStatus = TRUE;
1237 break;
1238
1239
1240 }
1241 }
1242
1243 return retStatus;
1244
1245}
1246
1247
1248
1249/**
1250 * limPostMsgApi()
1251 *
1252 *FUNCTION:
1253 * This function is called from other thread while posting a
1254 * message to LIM message Queue gSirLimMsgQ.
1255 *
1256 *LOGIC:
1257 * NA
1258 *
1259 *ASSUMPTIONS:
1260 * NA
1261 *
1262 *NOTE:
1263 * NA
1264 *
1265 * @param pMac - Pointer to Global MAC structure
1266 * @param pMsg - Pointer to the message structure
1267 * @return None
1268 */
1269
1270tANI_U32
1271limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1272{
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1274
1275
Jeff Johnson295189b2012-06-20 16:38:30 -07001276} /*** end limPostMsgApi() ***/
1277
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +05301278/**
1279 * limPostMsgApiHighPri()
1280 *
1281 * FUNCTION:
1282 * This function is called from other thread while posting a
1283 * message to LIM message Queue gSirLimMsgQ.
1284 *
1285 * LOGIC:
1286 * NA
1287 *
1288 * ASSUMPTIONS:
1289 * NA
1290 *
1291 * NOTE:
1292 * NA
1293 *
1294 * @param pMac - Pointer to Global MAC structure
1295 * @param pMsg - Pointer to the message structure
1296 * @return None
1297 */
1298
1299tANI_U32
1300limPostMsgApiHighPri(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1301{
1302 return vos_mq_post_message_high_pri(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1303
1304
1305} /*** end limPostMsgApi() ***/
1306
Jeff Johnson295189b2012-06-20 16:38:30 -07001307
1308/*--------------------------------------------------------------------------
1309
1310 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1311
1312 This function can be called by legacy code to post message to voss queues OR
1313 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1314 for dispatching it later.
1315
1316 \param pMac - Pointer to Global MAC structure
1317 \param pMsg - Pointer to the message structure
1318
1319 \return tANI_U32 - TX_SUCCESS for success.
1320
1321 --------------------------------------------------------------------------*/
1322
1323tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1324{
1325 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1326}
1327
1328/*--------------------------------------------------------------------------
1329
1330 \brief peProcessMessages() - Message Processor for PE
1331
1332 Voss calls this function to dispatch the message to PE
1333
1334 \param pMac - Pointer to Global MAC structure
1335 \param pMsg - Pointer to the message structure
1336
1337 \return tANI_U32 - TX_SUCCESS for success.
1338
1339 --------------------------------------------------------------------------*/
1340
1341tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1342{
1343 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1344 {
1345 return eSIR_SUCCESS;
1346 }
1347 /**
1348 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1349 * for all the other cases post it to LIM
1350 */
1351 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1352 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1353 else
1354 limMessageProcessor(pMac, pMsg);
1355 return eSIR_SUCCESS;
1356}
1357
Katya Nigam53799202014-12-18 15:59:38 +05301358#define RSRVD_MGMT_RX_PACKETS 10
Jeff Johnson295189b2012-06-20 16:38:30 -07001359
1360// ---------------------------------------------------------------------------
1361/**
1362 * peHandleMgmtFrame
1363 *
1364 * FUNCTION:
1365 * Process the Management frames from TL
1366 *
1367 * LOGIC:
1368 *
1369 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1370 *
1371 * NOTE:
1372 *
1373 * @param pvosGCtx Global Vos Context
1374 * @param vossBuff Packet
1375 * @return None
1376 */
1377
1378VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1379{
1380 tpAniSirGlobal pMac;
1381 tpSirMacMgmtHdr mHdr;
1382 tSirMsgQ msg;
1383 vos_pkt_t *pVosPkt;
1384 VOS_STATUS vosStatus;
1385 v_U8_t *pRxPacketInfo;
1386
1387 pVosPkt = (vos_pkt_t *)vosBuff;
1388 if (NULL == pVosPkt)
1389 {
1390 return VOS_STATUS_E_FAILURE;
1391 }
1392
1393 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1394 if (NULL == pMac)
1395 {
1396 // cannot log a failure without a valid pMac
1397 vos_pkt_return_packet(pVosPkt);
1398 return VOS_STATUS_E_FAILURE;
1399 }
1400
1401 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1402
1403 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1404 {
1405 vos_pkt_return_packet(pVosPkt);
1406 return VOS_STATUS_E_FAILURE;
1407 }
1408
1409
1410 //
1411 // The MPDU header is now present at a certain "offset" in
1412 // the BD and is specified in the BD itself
1413 //
1414 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1415 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1416 {
1417 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001418 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001419 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
Padma, Santhosh Kumar30971cf2015-04-06 19:59:37 +05301421#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1422 if (WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
1423 limLog(pMac, LOG1, FL("roamCandidateInd %d"),
1424 WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo));
1425
1426 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
1427 limLog(pMac, LOG1, FL("offloadScanLearn %d"),
1428 WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo));
1429#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001430 }
1431
1432
1433 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1434 msg.type = SIR_BB_XPORT_MGMT_MSG;
1435 msg.bodyptr = vosBuff;
1436 msg.bodyval = 0;
1437
Katya Nigam53799202014-12-18 15:59:38 +05301438 vos_spin_lock_acquire( &pMac->sys.lock );
1439 if( pMac->sys.gSysBbtPendingMgmtCount > (vos_pkt_get_num_of_rx_raw_pkts()/4) )
1440 {
1441 vos_spin_lock_release( &pMac->sys.lock );
1442 // drop all management packets
Katya Nigamfdf5a522015-02-03 14:38:55 +05301443 limLog( pMac, LOGW,
1444 FL ( "Management queue 1/4th full, dropping management packets" ));
Katya Nigam53799202014-12-18 15:59:38 +05301445 vos_pkt_return_packet(pVosPkt);
1446 return VOS_STATUS_SUCCESS;
1447 }
1448
1449 if( pMac->sys.gSysBbtPendingMgmtCount > ( vos_pkt_get_num_of_rx_raw_pkts()/4
1450 - RSRVD_MGMT_RX_PACKETS ))
1451 {
1452 // drop all probereq, proberesp and beacons
1453 if( mHdr->fc.subType == SIR_MAC_MGMT_BEACON || mHdr->fc.subType ==
1454 SIR_MAC_MGMT_PROBE_REQ || mHdr->fc.subType == SIR_MAC_MGMT_PROBE_RSP )
1455 {
1456 vos_spin_lock_release( &pMac->sys.lock );
Katya Nigamfdf5a522015-02-03 14:38:55 +05301457 limLog( pMac, LOGW,
1458 FL ( "Dropping probe req, probe resp or beacon" ));
Katya Nigam53799202014-12-18 15:59:38 +05301459 vos_pkt_return_packet(pVosPkt);
1460 return VOS_STATUS_SUCCESS;
1461 }
1462 }
1463 pMac->sys.gSysBbtPendingMgmtCount++;
1464 vos_spin_lock_release( &pMac->sys.lock );
1465
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1467 &msg,
1468 mHdr->fc.type,
1469 mHdr->fc.subType ))
1470 {
1471 vos_pkt_return_packet(pVosPkt);
Abhishek Singh5d765712015-03-12 14:04:16 +05301472
1473 /* Decrement gSysBbtPendingMgmtCount if packet
1474 * is dropped before posting to LIM
1475 */
1476 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001478 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 return VOS_STATUS_E_FAILURE;
1480 }
1481
1482 return VOS_STATUS_SUCCESS;
1483}
1484
1485// ---------------------------------------------------------------------------
1486/**
1487 * peRegisterTLHandle
1488 *
1489 * FUNCTION:
1490 * Registers the Handler which, process the Management frames from TL
1491 *
1492 * LOGIC:
1493 *
1494 * ASSUMPTIONS:
1495 *
1496 * NOTE:
1497 *
1498 * @return None
1499 */
1500
1501void peRegisterTLHandle(tpAniSirGlobal pMac)
1502{
1503 v_PVOID_t pvosGCTx;
1504 VOS_STATUS retStatus;
1505
1506 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1507
1508 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1509
1510 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001511 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001512
1513}
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515
1516/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 * limIsSystemInScanState()
1518 *
1519 *FUNCTION:
1520 * This function is called by various MAC software modules to
1521 * determine if System is in Scan/Learn state
1522 *
1523 *LOGIC:
1524 * NA
1525 *
1526 *ASSUMPTIONS:
1527 * NA
1528 *
1529 *NOTE:
1530 *
1531 * @param pMac - Pointer to Global MAC structure
1532 * @return true - System is in Scan/Learn state
1533 * false - System is NOT in Scan/Learn state
1534 */
1535
1536tANI_U8
1537limIsSystemInScanState(tpAniSirGlobal pMac)
1538{
1539 switch (pMac->lim.gLimSmeState)
1540 {
1541 case eLIM_SME_CHANNEL_SCAN_STATE:
1542 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1543 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1544 case eLIM_SME_WT_SCAN_STATE:
1545 // System is in Learn mode
1546 return true;
1547
1548 default:
1549 // System is NOT in Learn mode
1550 return false;
1551 }
1552} /*** end limIsSystemInScanState() ***/
1553
1554
1555
1556/**
1557 * limIsSystemInActiveState()
1558 *
1559 *FUNCTION:
1560 * This function is called by various MAC software modules to
1561 * determine if System is in Active/Wakeup state
1562 *
1563 *LOGIC:
1564 * NA
1565 *
1566 *ASSUMPTIONS:
1567 * NA
1568 *
1569 *NOTE:
1570 *
1571 * @param pMac - Pointer to Global MAC structure
1572 * @return true - System is in Active state
1573 * false - System is not in Active state
1574 */
1575
1576tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1577{
1578 switch (pMac->pmm.gPmmState)
1579 {
1580 case ePMM_STATE_BMPS_WAKEUP:
1581 case ePMM_STATE_IMPS_WAKEUP:
1582 case ePMM_STATE_READY:
1583 // System is in Active mode
1584 return true;
1585 default:
1586 return false;
1587 // System is NOT in Active mode
1588 }
1589}
1590
1591
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
1594
1595/**
1596*\brief limReceivedHBHandler()
1597*
1598* This function is called by schBeaconProcess() upon
1599* receiving a Beacon on STA. This also gets called upon
1600* receiving Probe Response after heat beat failure is
1601* detected.
1602*
1603* param pMac - global mac structure
1604* param channel - channel number indicated in Beacon, Probe Response
1605* return - none
1606*/
1607
1608
1609void
1610limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1611{
1612 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1613 psessionEntry->LimRxedBeaconCntDuringHB++;
1614
1615 pMac->pmm.inMissedBeaconScenario = FALSE;
1616} /*** end limReceivedHBHandler() ***/
1617
1618
1619
1620#if 0
1621void limResetHBPktCount(tpPESession psessionEntry)
1622{
1623 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1624}
1625#endif
1626
1627
1628/*
1629 * limProcessWdsInfo()
1630 *
1631 *FUNCTION:
1632 * This function is called from schBeaconProcess in BP
1633 *
1634 *PARAMS:
1635 * @param pMac - Pointer to Global MAC structure
1636 * @param propIEInfo - proprietary IE info
1637 *
1638 *LOGIC:
1639 *
1640 *ASSUMPTIONS:
1641 * NA
1642 *
1643 *NOTE:
1644 *
1645 *
1646 *RETURNS:
1647 *
1648 */
1649
1650void limProcessWdsInfo(tpAniSirGlobal pMac,
1651 tSirPropIEStruct propIEInfo)
1652{
Jeff Johnson295189b2012-06-20 16:38:30 -07001653}
1654
1655
1656
1657/**
1658 * limInitWdsInfoParams()
1659 *
1660 *FUNCTION:
1661 * This function is called while processing
1662 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1663 * ind/set related parameters.
1664 *
1665 *LOGIC:
1666 *
1667 *ASSUMPTIONS:
1668 *
1669 *NOTE:
1670 *
1671 * @param pMac Pointer to Global MAC structure
1672 * @return None
1673 */
1674
1675void
1676limInitWdsInfoParams(tpAniSirGlobal pMac)
1677{
1678 pMac->lim.gLimWdsInfo.wdsLength = 0;
1679 pMac->lim.gLimNumWdsInfoInd = 0;
1680 pMac->lim.gLimNumWdsInfoSet = 0;
1681} /*** limInitWdsInfoParams() ***/
1682
1683
1684/** -------------------------------------------------------------
1685\fn limUpdateOverlapStaParam
1686\brief Updates overlap cache and param data structure
1687\param tpAniSirGlobal pMac
1688\param tSirMacAddr bssId
1689\param tpLimProtStaParams pStaParams
1690\return None
1691 -------------------------------------------------------------*/
1692void
1693limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1694{
1695 int i;
1696 if (!pStaParams->numSta)
1697 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301698 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1699 bssId,
1700 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 pMac->lim.protStaOverlapCache[0].active = true;
1702
1703 pStaParams->numSta = 1;
1704
1705 return;
1706 }
1707
1708 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1709 {
1710 if (pMac->lim.protStaOverlapCache[i].active)
1711 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301712 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 bssId,
1714 sizeof(tSirMacAddr))) {
1715 return; }
1716 }
1717 else
1718 break;
1719 }
1720
1721 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1722 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301723 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 }
1725 else
1726 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301727 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1728 bssId,
1729 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 pMac->lim.protStaOverlapCache[i].active = true;
1731
1732 pStaParams->numSta++;
1733 }
1734}
1735
1736
1737/**
1738 * limHandleIBSScoalescing()
1739 *
1740 *FUNCTION:
1741 * This function is called upon receiving Beacon/Probe Response
1742 * while operating in IBSS mode.
1743 *
1744 *LOGIC:
1745 *
1746 *ASSUMPTIONS:
1747 *
1748 *NOTE:
1749 *
1750 * @param pMac - Pointer to Global MAC structure
1751 * @param pBeacon - Parsed Beacon Frame structure
1752 * @param pRxPacketInfo - Pointer to RX packet info structure
1753 *
1754 * @return Status whether to process or ignore received Beacon Frame
1755 */
1756
1757tSirRetStatus
1758limHandleIBSScoalescing(
1759 tpAniSirGlobal pMac,
1760 tpSchBeaconStruct pBeacon,
1761 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1762{
1763 tpSirMacMgmtHdr pHdr;
1764 tSirRetStatus retCode;
1765
1766 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001767 if ( (!pBeacon->capabilityInfo.ibss) ||
Abhishek Singhd5c31272014-03-07 14:46:50 +05301768 ( psessionEntry->privacy !=
1769 (tANI_U8)pBeacon->capabilityInfo.privacy ) ||
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001770 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1771 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 /* Received SSID does not match => Ignore received Beacon frame. */
1773 retCode = eSIR_LIM_IGNORE_BEACON;
1774 else
1775 {
1776 tANI_U32 ieLen;
1777 tANI_U16 tsfLater;
1778 tANI_U8 *pIEs;
1779 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1780 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1781 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
Abhishek Singh127a8442014-12-15 17:31:27 +05301782 limLog(pMac, LOG1, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1784 }
1785 return retCode;
1786} /*** end limHandleIBSScoalescing() ***/
1787
Abhishek Singh5fef4042014-11-25 18:33:00 +05301788tAniBool limEncTypeMatched(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,
1789 tpPESession pSession)
1790{
1791 if (!pBeacon || !pSession)
1792 return eSIR_FALSE;
1793
1794 limLog(pMac, LOG1,
1795 FL("Beacon/Probe:: Privacy :%d WPA Present:%d RSN Present: %d"),
1796 pBeacon->capabilityInfo.privacy, pBeacon->wpaPresent,
1797 pBeacon->rsnPresent);
1798 limLog(pMac, LOG1,
Abhishek Singheef5c992016-01-27 13:41:54 +05301799 FL("pSession:: Privacy :%d EncyptionType: %d WPS %d OSEN %d"),
Abhishek Singh5fef4042014-11-25 18:33:00 +05301800 SIR_MAC_GET_PRIVACY(pSession->limCurrentBssCaps),
Abhishek Singheef5c992016-01-27 13:41:54 +05301801 pSession->encryptType, pSession->bWPSAssociation,
1802 pSession->bOSENAssociation);
Abhishek Singh5fef4042014-11-25 18:33:00 +05301803
1804 /* This is handled by sending probe req due to IOT issues so return TRUE
1805 */
1806 if ( (pBeacon->capabilityInfo.privacy) !=
1807 SIR_MAC_GET_PRIVACY(pSession->limCurrentBssCaps))
1808 {
1809 limLog(pMac, LOG1, FL("Return for Privacy bit miss match, As "
1810 "for this driver need to send the probe request to handle"
1811 " IOT issues "));
1812 return eSIR_TRUE;
1813 }
1814
1815 /*Open*/
1816 if( (pBeacon->capabilityInfo.privacy == 0) &&
1817 (pSession->encryptType == eSIR_ED_NONE))
1818 return eSIR_TRUE;
1819
1820 /* WEP */
1821 if ( (pBeacon->capabilityInfo.privacy == 1) && (pBeacon->wpaPresent == 0) &&
1822 (pBeacon->rsnPresent == 0) &&
Abhishek Singh31dfa3c2014-12-12 17:25:19 +05301823 ( ( pSession->encryptType == eSIR_ED_WEP40 ) ||
1824 ( pSession->encryptType == eSIR_ED_WEP104 )
1825#ifdef FEATURE_WLAN_WAPI
1826 || ( pSession->encryptType == eSIR_ED_WPI )
1827#endif
1828 ))
Abhishek Singh5fef4042014-11-25 18:33:00 +05301829 return eSIR_TRUE;
1830
1831 /* WPA OR RSN*/
1832 if ( (pBeacon->capabilityInfo.privacy == 1) &&
1833 ( (pBeacon->wpaPresent == 1) ||
1834 ( pBeacon->rsnPresent == 1)) &&
1835 ( (pSession->encryptType == eSIR_ED_TKIP) ||
1836 (pSession->encryptType == eSIR_ED_CCMP) ||
1837 (pSession->encryptType == eSIR_ED_AES_128_CMAC)))
1838 return eSIR_TRUE;
1839
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301840 /* For HS2.0, RSN ie is not present
1841 * in beacon. Therefore no need to
1842 * check for security type in case
1843 * OSEN session.
Abhishek Singheef5c992016-01-27 13:41:54 +05301844 * For WPS registration session no need to detect
1845 * security mismatch as it wont match and
1846 * driver may end up sending probe request without
1847 * WPS IE during WPS registartion process.
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301848 */
1849 /*TODO: AP capability mismatch
1850 * is not checked here because
1851 * no logic for beacon parsing
1852 * is avilable for HS2.0.
1853 */
Abhishek Singheef5c992016-01-27 13:41:54 +05301854 if (pSession->bOSENAssociation ||
1855 pSession->bWPSAssociation)
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301856 return eSIR_TRUE;
1857
Abhishek Singh5fef4042014-11-25 18:33:00 +05301858 return eSIR_FALSE;
1859}
Jeff Johnson295189b2012-06-20 16:38:30 -07001860
1861
1862/**
1863 * limDetectChangeInApCapabilities()
1864 *
1865 *FUNCTION:
1866 * This function is called while SCH is processing
1867 * received Beacon from AP on STA to detect any
1868 * change in AP's capabilities. If there any change
1869 * is detected, Roaming is informed of such change
1870 * so that it can trigger reassociation.
1871 *
1872 *LOGIC:
1873 *
1874 *ASSUMPTIONS:
1875 *
1876 *NOTE:
1877 * Notification is enabled for STA product only since
1878 * it is not a requirement on BP side.
1879 *
1880 * @param pMac Pointer to Global MAC structure
1881 * @param pBeacon Pointer to parsed Beacon structure
1882 * @return None
1883 */
1884
1885void
1886limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1887 tpSirProbeRespBeacon pBeacon,
1888 tpPESession psessionEntry)
1889{
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 tANI_U8 len;
1891 tSirSmeApNewCaps apNewCaps;
1892 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301893 tSirRetStatus status = eSIR_SUCCESS;
Abhishek Singh5fef4042014-11-25 18:33:00 +05301894 tAniBool securityCapsMatched = eSIR_TRUE;
1895
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1897 newChannel = (tANI_U8) pBeacon->channelNumber;
1898
Abhishek Singh5fef4042014-11-25 18:33:00 +05301899 securityCapsMatched = limEncTypeMatched(pMac, pBeacon, psessionEntry);
1900
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301901 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
Abhishek Singh4f8446a2014-05-22 14:07:31 +05301902 ( ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1903 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ||
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301904 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1905 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1906 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1907 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1908 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1909 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1910 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1911 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
Abhishek Singh5fef4042014-11-25 18:33:00 +05301912 ( newChannel != psessionEntry->currentOperChannel ) ||
1913 (eSIR_FALSE == securityCapsMatched)
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301914 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301915 {
Abhishek Singha9325f72015-01-05 11:49:23 +05301916 if ( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301917 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301918 /* If Beacon capabilities is not matching with the current capability,
1919 * then send unicast probe request to AP and take decision after
1920 * receiving probe response */
1921 if ( true == psessionEntry->fIgnoreCapsChange )
1922 {
1923 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1924 return;
1925 }
1926 psessionEntry->fWaitForProbeRsp = true;
1927 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1928 "sending directed probe request.. "));
1929 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1930 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1931 psessionEntry->dot11mode, 0, NULL);
1932
1933 if ( eSIR_SUCCESS != status )
1934 {
1935 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1936 psessionEntry->fWaitForProbeRsp = false;
1937 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301938 return;
1939 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 /**
1941 * BSS capabilities have changed.
1942 * Inform Roaming.
1943 */
1944 len = sizeof(tSirMacCapabilityInfo) +
1945 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1946 3 * sizeof(tANI_U8) + // reserved fields
1947 pBeacon->ssId.length + 1;
1948
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301949 vos_mem_copy(apNewCaps.bssId,
1950 psessionEntry->bssId,
1951 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 if (newChannel != psessionEntry->currentOperChannel)
1953 {
1954 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001955 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 psessionEntry->currentOperChannel, newChannel);)
1957 return;
1958 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301959
1960 /**
1961 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1962 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1963 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1964 * the privacy bit is set in Probe and association responses.
1965 * Due to this anomaly, we detect a change in
1966 * AP capabilities when we receive a beacon after association and
1967 * disconnect from the AP. The following check makes sure that we can
1968 * connect to such APs
1969 */
1970 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1971 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1972 {
1973 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001974 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301975 return;
1976 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 else
1978 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301979 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1980 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 pBeacon->ssId.length + 1);
1982
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301983 psessionEntry->fIgnoreCapsChange = false;
1984 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 psessionEntry->limSentCapsChangeNtf = true;
1986 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1987 (tANI_U32 *) &apNewCaps,
1988 len, psessionEntry->smeSessionId);
1989 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301990 else if ( true == psessionEntry->fWaitForProbeRsp )
1991 {
1992 /* Only for probe response frames and matching capabilities the control
1993 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1994 * will be false, the control will not come here*/
1995
1996 limLog(pMac, LOG1, FL("capabilities in probe response are"
1997 "matching with the current setting,"
1998 "Ignoring subsequent capability"
1999 "mismatch"));
2000 psessionEntry->fIgnoreCapsChange = true;
2001 psessionEntry->fWaitForProbeRsp = false;
2002 }
2003
Jeff Johnson295189b2012-06-20 16:38:30 -07002004} /*** limDetectChangeInApCapabilities() ***/
2005
2006
2007
2008
2009// ---------------------------------------------------------------------
2010/**
2011 * limUpdateShortSlot
2012 *
2013 * FUNCTION:
2014 * Enable/Disable short slot
2015 *
2016 * LOGIC:
2017 *
2018 * ASSUMPTIONS:
2019 *
2020 * NOTE:
2021 *
2022 * @param enable Flag to enable/disable short slot
2023 * @return None
2024 */
2025
2026tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
2027{
2028
2029 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07002030 tANI_U32 nShortSlot;
2031 tANI_U32 val = 0;
2032 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002033
Jeff Johnsone7245742012-09-05 17:12:55 -07002034 // Check Admin mode first. If it is disabled just return
2035 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
2036 != eSIR_SUCCESS)
2037 {
2038 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002039 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002040 return eSIR_FAILURE;
2041 }
2042 if (val == false)
2043 return eSIR_SUCCESS;
2044
2045 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
2046 limGetPhyMode(pMac, &phyMode, psessionEntry);
2047 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
2048 return eSIR_SUCCESS;
2049
2050 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002051
2052 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
2053 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
2054 // if no erp present, use short slot based on current ap caps
2055
2056 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
2057
2058 //Resolution : always use the shortSlot setting the capability info to decide slot time.
2059 // The difference between the earlier implementation and the new one is only Case4.
2060 /*
2061 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
2062 Case1 1 1 1 1 //AP should not advertise this combination.
2063 Case2 1 1 0 0
2064 Case3 1 0 1 1
2065 Case4 1 0 0 0
2066 Case5 0 1 1 1
2067 Case6 0 1 0 0
2068 Case7 0 0 1 1
2069 Case8 0 0 0 0
2070 */
2071 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
2072
Jeff Johnsone7245742012-09-05 17:12:55 -07002073 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 {
2075 // Short slot time capability of AP has changed. Adopt to it.
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302076 limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07002078 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
2080 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 }
2082 return eSIR_SUCCESS;
2083}
2084
2085
Jeff Johnson295189b2012-06-20 16:38:30 -07002086
2087
Jeff Johnson295189b2012-06-20 16:38:30 -07002088
Jeff Johnson295189b2012-06-20 16:38:30 -07002089
2090
2091/** -----------------------------------------------------------------
2092 \brief limHandleLowRssiInd() - handles low rssi indication
2093
2094 This function process the SIR_HAL_LOW_RSSI_IND message from
2095 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
2096
2097 \param pMac - global mac structure
2098
2099 \return
2100
2101 \sa
2102 ----------------------------------------------------------------- */
2103void limHandleLowRssiInd(tpAniSirGlobal pMac)
2104{
2105#if 0 //RSSI related indications will now go to TL and not PE
2106 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2107 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2108 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2109 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002110 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
2112 }
2113 else
2114 {
2115 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002116 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 pMac->pmm.gPmmState);
2118 }
2119 return;
2120#endif
2121}
2122
2123
2124/** -----------------------------------------------------------------
2125 \brief limHandleBmpsStatusInd() - handles BMPS status indication
2126
2127 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
2128 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2129 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
2130
2131 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
2132 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
2133 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
2134 This message can also come from FW anytime after we have entered BMPS.
2135 This means we should handle it in WoWL and UAPSD states as well
2136
2137 \param pMac - global mac structure
2138 \return - none
2139 \sa
2140 ----------------------------------------------------------------- */
2141void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2142{
2143 switch(pMac->pmm.gPmmState)
2144 {
2145 case ePMM_STATE_BMPS_SLEEP:
2146 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2147 case ePMM_STATE_UAPSD_SLEEP:
2148 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2149 case ePMM_STATE_WOWLAN:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302150 limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2152 break;
2153
2154 default:
2155 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002156 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 pMac->pmm.gPmmState);
2158 break;
2159 }
2160 return;
2161}
2162
2163
2164/** -----------------------------------------------------------------
2165 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2166
2167 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2168 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2169 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2170
2171 \param pMac - global mac structure
2172 \return - none
2173 \sa
2174 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002175void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002176{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002177#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2178 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2179 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2180 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2181 if (psessionEntry == NULL)
2182 {
2183 limLog(pMac, LOGE,
2184 FL("session does not exist for given BSSIdx:%d"),
2185 pSirMissedBeaconInd->bssIdx);
2186 return;
2187 }
2188#endif
Gupta, Kapil2fc8ca22016-02-19 12:22:17 +05302189 if (pMac->pmm.inMissedBeaconScenario == TRUE) {
2190 limLog(pMac, LOGW,
2191 FL("beacon miss handling is already going on for BSSIdx:%d"),
2192 pSirMissedBeaconInd->bssIdx);
2193 return;
2194 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2196 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2197 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2198 {
2199 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302200 PELOGE(limLog(pMac, LOGE,
2201 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2203 }
Yathish9f22e662012-12-10 14:21:35 -08002204/* ACTIVE_MODE_HB_OFFLOAD */
2205#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2206 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2207 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2208 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2209 {
2210 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002211 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002212 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002213 }
2214#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 else
2216 {
2217 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002218 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 pMac->pmm.gPmmState);
2220 }
2221 return;
2222}
2223
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05302224
2225void limUpdateLostLinkParams(tpAniSirGlobal pMac,
2226 tpPESession psessionEntry, tANI_U8 *pRxPacketInfo)
2227{
2228 tpSirSmeLostLinkParamsInd pSmeLostLinkParams;
2229 tSirMsgQ mmhMsg;
2230 if (NULL == pRxPacketInfo)
2231 {
2232 return;
2233 }
2234 pSmeLostLinkParams =
2235 (tpSirSmeLostLinkParamsInd)vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05302236 if (NULL == pSmeLostLinkParams)
2237 {
2238 limLog(pMac, LOGP,
2239 FL("Failed to alloc mem of size %zu for tSirSmeLostLinkParamsInd"),
2240 sizeof(*pSmeLostLinkParams));
2241 return;
2242 }
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05302243 vos_mem_set(pSmeLostLinkParams, sizeof(tSirSmeLostLinkParamsInd), 0);
2244 pSmeLostLinkParams->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
2245 pSmeLostLinkParams->length = sizeof(tSirSmeLostLinkParamsInd);
2246 pSmeLostLinkParams->sessionId = psessionEntry->smeSessionId;
2247 pSmeLostLinkParams->info.bssIdx = psessionEntry->bssIdx;
2248
2249 /*
2250 * Since FW adds 100 to RSSI, here also we are adding 100 so that
2251 * HDD has common logic to subtract 100 from RSSI received
2252 */
2253 pSmeLostLinkParams->info.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo) + 100;
2254 vos_mem_copy(pSmeLostLinkParams->info.selfMacAddr,
2255 psessionEntry->selfMacAddr,
2256 sizeof(tSirMacAddr));
2257 pSmeLostLinkParams->info.lastDataRate = 0;
2258 pSmeLostLinkParams->info.linkFlCnt = 0;
2259 pSmeLostLinkParams->info.linkFlTx = 0;
2260 pSmeLostLinkParams->info.rsvd1 = 0;
2261 pSmeLostLinkParams->info.rsvd2 = 0;
2262
2263 mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
2264 mmhMsg.bodyptr = pSmeLostLinkParams;
2265 mmhMsg.bodyval = 0;
2266 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2267}
2268
2269/** -----------------------------------------------------------------
2270 \brief limProcessLostLinkParamsInd() - handles lost link params indication
2271
2272 This function process the SIR_HAL_LOST_LINK_PARAMS_IND message from HAL,
2273
2274 \param pMac - global mac structure
2275 \return - none
2276 \sa
2277 ----------------------------------------------------------------- */
2278
2279void limProcessLostLinkParamsInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2280{
2281 tpSirSmeLostLinkParamsInd pSmeLostLinkParamsInd;
2282 tpSirSmeLostLinkParamsInd pLostLInkParamsInd = (tpSirSmeLostLinkParamsInd)pMsg->bodyptr;
2283 tpPESession psessionEntry ;
2284 tSirMsgQ mmhMsg;
2285
2286 if (NULL == pLostLInkParamsInd)
2287 {
2288 limLog(pMac, LOGE,
2289 FL("pLostLInkParamsInd is NULL"));
2290 return;
2291 }
2292
2293 psessionEntry = peFindSessionByBssIdx(pMac,pLostLInkParamsInd->info.bssIdx);
2294 if (psessionEntry == NULL)
2295 {
2296 limLog(pMac, LOGE,
2297 FL("session does not exist for bdssIdx : %d"),
2298 pLostLInkParamsInd->info.bssIdx);
2299
2300 return;
2301 }
2302 pSmeLostLinkParamsInd = vos_mem_malloc(sizeof(tSirSmeLostLinkParamsInd));
2303 if (pSmeLostLinkParamsInd == NULL)
2304 {
2305 limLog(pMac, LOGP,
2306 FL("memory allocate failed for eWNI_SME_LOST_LINK_PARAMD_IND"));
2307 return;
2308 }
2309 pSmeLostLinkParamsInd->messageType = eWNI_SME_LOST_LINK_PARAMS_IND;
2310 pSmeLostLinkParamsInd->length = sizeof(tSirSmeLostLinkParamsInd);
2311 pSmeLostLinkParamsInd->sessionId = psessionEntry->smeSessionId;
2312 pSmeLostLinkParamsInd->info.bssIdx = pLostLInkParamsInd->info.bssIdx;
2313 pSmeLostLinkParamsInd->info.rssi = pLostLInkParamsInd->info.rssi;
2314 vos_mem_copy(pSmeLostLinkParamsInd->info.selfMacAddr,
2315 pLostLInkParamsInd->info.selfMacAddr,
2316 sizeof(tSirMacAddr));
2317 pSmeLostLinkParamsInd->info.linkFlCnt = pLostLInkParamsInd->info.linkFlCnt;
2318 pSmeLostLinkParamsInd->info.linkFlTx = pLostLInkParamsInd->info.linkFlTx;
2319 pSmeLostLinkParamsInd->info.lastDataRate = pLostLInkParamsInd->info.lastDataRate;
2320 pSmeLostLinkParamsInd->info.rsvd1 = pLostLInkParamsInd->info.rsvd1;
2321 pSmeLostLinkParamsInd->info.rsvd2 = pLostLInkParamsInd->info.rsvd2;
2322
2323 mmhMsg.type = eWNI_SME_LOST_LINK_PARAMS_IND;
2324 mmhMsg.bodyptr = pSmeLostLinkParamsInd;
2325 mmhMsg.bodyval = 0;
2326 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2327 return;
2328}
2329
Jeff Johnson295189b2012-06-20 16:38:30 -07002330/** -----------------------------------------------------------------
2331 \brief limMicFailureInd() - handles mic failure indication
2332
2333 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2334
2335 \param pMac - global mac structure
2336 \return - none
2337 \sa
2338 ----------------------------------------------------------------- */
2339void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2340{
2341 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2342 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2343 tSirMsgQ mmhMsg;
2344 tpPESession psessionEntry ;
2345 tANI_U8 sessionId;
2346
2347 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2348 {
2349 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002350 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 return;
2352 }
2353
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302354 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2355 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 {
2357 // Log error
2358 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002359 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 return;
2361 }
2362
2363 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
Sunkad, Anand Ningappabf1650a2016-02-08 12:08:13 +05302364 pSirSmeMicFailureInd->length = sizeof(*pSirSmeMicFailureInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2366
2367 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302368 pSirMicFailureInd->bssId,
2369 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002370
2371 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302372 pSirMicFailureInd->info.srcMacAddr,
2373 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002374
2375 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302376 pSirMicFailureInd->info.taMacAddr,
2377 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002378
2379 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302380 pSirMicFailureInd->info.dstMacAddr,
2381 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002382
2383 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302384 pSirMicFailureInd->info.rxMacAddr,
2385 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002386
2387 pSirSmeMicFailureInd->info.multicast =
2388 pSirMicFailureInd->info.multicast;
2389
2390 pSirSmeMicFailureInd->info.keyId=
2391 pSirMicFailureInd->info.keyId;
2392
2393 pSirSmeMicFailureInd->info.IV1=
2394 pSirMicFailureInd->info.IV1;
2395
2396 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302397 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002398
2399 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2400 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2401 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302402 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2404 return;
2405}
2406
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +05302407#ifdef WLAN_FEATURE_11W
2408/** --------------------------------------------------------------------
2409 * lim_is_assoc_req_for_drop()- function to decides to drop assoc\reassoc
2410 * frames.
2411 * @mac: pointer to global mac structure
2412 * @rx_pkt_info: rx packet meta information
2413 *
2414 * This function is called before enqueuing the frame to PE queue to
2415 * drop flooded assoc/reassoc frames getting into PE Queue.
2416 *
2417 * Return: true for dropping the frame otherwise false
2418----------------------------------------------------------------------*/
2419
2420bool lim_is_assoc_req_for_drop(tpAniSirGlobal pMac, uint8_t *rx_pkt_info)
2421{
2422 tANI_U8 session_id;
2423 tANI_U16 aid;
2424 tpPESession session_entry;
2425 tpSirMacMgmtHdr pMacHdr;
2426 tpDphHashNode sta_ds;
2427
2428 pMacHdr = WDA_GET_RX_MAC_HEADER(rx_pkt_info);
2429 session_entry = peFindSessionByBssid(pMac, pMacHdr->bssId, &session_id);
2430 if (!session_entry)
2431 {
2432 PELOG1(limLog(pMac, LOG1,
2433 FL("session does not exist for given STA [%pM]"),
2434 pMacHdr->sa););
2435 return false;
2436 }
2437 sta_ds = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
2438 &session_entry->dph.dphHashTable);
2439 if (!sta_ds)
2440 {
2441 PELOG1(limLog(pMac, LOG1, FL("pStaDs is NULL")););
2442 return false;
2443 }
2444
2445 if (!sta_ds->rmfEnabled)
2446 return false;
2447
2448 if (sta_ds->pmfSaQueryState == DPH_SA_QUERY_IN_PROGRESS)
2449 return true;
2450
2451 if (sta_ds->last_assoc_received_time &&
2452 ((vos_timer_get_system_time() -
2453 sta_ds->last_assoc_received_time) < 1000))
2454 return true;
2455
2456 sta_ds->last_assoc_received_time = vos_timer_get_system_time();
2457 return false;
2458}
2459#endif
2460
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302461/** ----------------------------------------------------------------------
2462 *\brief limIsDeauthDiassocForDrop()..decides to drop deauth\diassoc frames.
2463 *This function is called before enqueuing the frame to PE queue.
2464 *This prevents deauth/diassoc frames getting into PE Queue.
Jeff Johnson295189b2012-06-20 16:38:30 -07002465
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302466------------------------------------------------------------------------ */
2467
2468
2469boolean limIsDeauthDiassocForDrop(tpAniSirGlobal pMac,
2470 tANI_U8 *pRxPacketInfo)
2471{
2472 tANI_U8 sessionId;
2473 tANI_U16 aid;
2474 tpPESession psessionEntry;
2475 tpSirMacMgmtHdr pMacHdr;
2476 tpDphHashNode pStaDs;
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302477 eHalStatus lock_status = eHAL_STATUS_SUCCESS;
2478 boolean ret = FALSE;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302479
2480 pMacHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2481 psessionEntry = peFindSessionByBssid(pMac,pMacHdr->bssId,&sessionId);
2482 if (!psessionEntry)
2483 {
2484 PELOG1(sysLog(pMac, LOG1,
2485 FL("session does not exist for given STA [%pM]"),
2486 pMacHdr->sa););
2487 return TRUE;
2488 }
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302489
2490 lock_status = pe_AcquireGlobalLock(&pMac->lim);
2491 if (lock_status != eHAL_STATUS_SUCCESS)
2492 {
2493 limLog(pMac, LOGE, FL("pe_AcquireGlobalLock error"));
2494 return TRUE;
2495 }
2496
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302497 pStaDs = dphLookupHashEntry(pMac, pMacHdr->sa, &aid,
2498 &psessionEntry->dph.dphHashTable);
2499 if (!pStaDs)
2500 {
2501 PELOG1(sysLog(pMac, LOG1,FL("pStaDs is NULL")););
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302502 ret = TRUE;
2503 goto end;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302504 }
2505#ifdef WLAN_FEATURE_11W
2506 if (psessionEntry->limRmfEnabled)
2507 {
2508 if ((WDA_GET_RX_DPU_FEEDBACK(pRxPacketInfo) &
2509 DPU_FEEDBACK_UNPROTECTED_ERROR))
2510 {
2511 /* It may be possible that deauth/diassoc frames from a spoofy
2512 * AP is received. So if all further deauth/diassoc frmaes are
2513 * dropped, then it may result in lossing deauth/diassoc frames
2514 * from genuine AP. So process all deauth/diassoc frames with
2515 * a time difference of 1 sec.
2516 */
2517 if (vos_timer_get_system_time() - pStaDs->last_unprot_deauth_disassoc < 1000)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302518 {
2519 ret = TRUE;
2520 goto end;
2521 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302522 pStaDs->last_unprot_deauth_disassoc =
2523 vos_timer_get_system_time();
2524 }
2525/* PMF enabed, Management frames are protected */
2526 else
2527 {
2528 if (pStaDs->proct_deauh_disassoc_cnt)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302529 {
2530 ret = TRUE;
2531 goto end;
2532 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302533 else
2534 pStaDs->proct_deauh_disassoc_cnt++;
2535 }
2536 }
2537 else
2538#endif
2539/* PMF disabled */
2540 {
2541 if (pStaDs->isDisassocDeauthInProgress)
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302542 {
2543 ret = TRUE;
2544 goto end;
2545 }
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302546 else
2547 pStaDs->isDisassocDeauthInProgress++;
2548 }
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +05302549
2550end:
2551 pe_ReleaseGlobalLock(&pMac->lim);
2552 return ret;
Sushant Kaushikefe08fa2015-07-06 14:54:09 +05302553}
Jeff Johnson295189b2012-06-20 16:38:30 -07002554/** -----------------------------------------------------------------
2555 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2556
2557 This function is called before enqueuing the frame to PE queue for further processing.
2558 This prevents unnecessary frames getting into PE Queue and drops them right away.
2559 Frames will be droped in the following scenarios:
2560
2561 - In Scan State, drop the frames which are not marked as scan frames
2562 - In non-Scan state, drop the frames which are marked as scan frames.
2563 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2564 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2565
2566 \param pMac - global mac structure
2567 \return - none
2568 \sa
2569 ----------------------------------------------------------------- */
2570
2571tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2572{
2573 tANI_U32 framelen;
2574 tANI_U8 *pBody;
2575 tSirMacCapabilityInfo capabilityInfo;
2576
2577 /*
2578 *
2579 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2580 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2581 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2582 * other than beacons or probe responses in scan state.
2583 */
2584 if( (subType == SIR_MAC_MGMT_BEACON) ||
2585 (subType == SIR_MAC_MGMT_PROBE_RSP))
2586 {
2587 if(pMac->pmm.inMissedBeaconScenario)
2588 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002589 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2590 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 }
2592 if (limIsSystemInScanState(pMac))
2593 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002594 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002596#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2597 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2598 {
2599 return eMGMT_DROP_NO_DROP;
2600 }
2601#endif
Dino Mycle7a76e662014-06-10 11:36:34 +05302602#ifdef WLAN_FEATURE_EXTSCAN
2603 else if (WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
2604 {
2605 return eMGMT_DROP_NO_DROP;
2606 }
2607#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2609 {
2610 return eMGMT_DROP_SCAN_MODE_FRAME;
2611 }
2612 }
2613
2614 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2615 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2616
2617 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2618 * beacons from an infrastructure network
2619 */
2620 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2621 if(!capabilityInfo.ibss)
2622 return eMGMT_DROP_NO_DROP;
2623#if 0
2624 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2625 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2626 return eMGMT_DROP_NO_DROP;
2627#endif
2628
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +05302629#ifdef WLAN_FEATURE_11W
2630 if ((subType == SIR_MAC_MGMT_ASSOC_REQ ||
2631 subType == SIR_MAC_MGMT_REASSOC_REQ) &&
2632 lim_is_assoc_req_for_drop(pMac, pRxPacketInfo))
2633 return eMGMT_DROP_SPURIOUS_FRAME;
2634#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2636 if( (subType == SIR_MAC_MGMT_BEACON) ||
2637 (subType == SIR_MAC_MGMT_PROBE_RSP))
2638 {
2639 //drop the frame if length is less than 12
2640 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2641 return eMGMT_DROP_INVALID_SIZE;
2642
2643 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2644
2645 //This can be enhanced to even check the SSID before deciding to enque the frame.
2646 if(capabilityInfo.ess)
2647 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2648 }
2649 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2650 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2651 {
2652 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2653 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2654 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2655 }
2656
2657 return eMGMT_DROP_NO_DROP;
2658}
2659
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002660eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2661{
2662 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002664 if(psPe)
2665 {
2666 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2667 {
2668 status = eHAL_STATUS_SUCCESS;
2669 }
2670 }
2671 return (status);
2672}
2673eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2674{
2675 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2676 if(psPe)
2677 {
2678 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2679 {
2680 status = eHAL_STATUS_SUCCESS;
2681 }
2682 }
2683 return (status);
2684}