blob: da397e1acc9fefc16dc78ba88ffc63093344809d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limApi.cc contains the functions that are
45 * exported by LIM to other modules.
46 *
47 * Author: Chandra Modumudi
48 * Date: 02/11/02
49 * History:-
50 * Date Modified by Modification Information
51 * --------------------------------------------------------------------
52 *
53 */
54#include "palTypes.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include "wniCfgSta.h"
56#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "sirCommon.h"
58#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60
61#include "schApi.h"
62#include "utilsApi.h"
63#include "limApi.h"
64#include "limGlobal.h"
65#include "limTypes.h"
66#include "limUtils.h"
67#include "limAssocUtils.h"
68#include "limPropExtsUtils.h"
69#include "limSerDesUtils.h"
70#include "limIbssPeerMgmt.h"
71#include "limAdmitControl.h"
72#include "pmmApi.h"
73#include "logDump.h"
74#include "limSendSmeRspMessages.h"
75#include "wmmApsd.h"
76#include "limTrace.h"
77#include "limSession.h"
78#include "wlan_qct_wda.h"
79
80#if defined WLAN_FEATURE_VOWIFI
81#include "rrmApi.h"
82#endif
83
84#include <limFT.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070085#include "vos_types.h"
86#include "vos_packet.h"
87#include "wlan_qct_tl.h"
88#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070089
90
91static void __limInitScanVars(tpAniSirGlobal pMac)
92{
93 pMac->lim.gLimUseScanModeForLearnMode = 1;
94
95 pMac->lim.gLimSystemInScanLearnMode = 0;
96
97 // Scan related globals on STA
98 pMac->lim.gLimReturnAfterFirstMatch = 0;
99 pMac->lim.gLim24Band11dScanDone = 0;
100 pMac->lim.gLim50Band11dScanDone = 0;
101 pMac->lim.gLimReturnUniqueResults = 0;
102
103 // Background Scan related globals on STA
104 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
105 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
106 pMac->lim.gLimNumOfForcedBkgndScan = 0;
107 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
108 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
109 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -0800110 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
112 pMac->lim.gLimCurrentScanChannelId = 0;
113 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid440e682013-03-06 02:25:31 -0800114 pMac->lim.gDeferMsgTypeForNOA = 0;
115 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700116 pMac->lim.gLimMlmScanResultLength = 0;
117 pMac->lim.gLimSmeScanResultLength = 0;
118
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530119 vos_mem_set(pMac->lim.gLimCachedScanHashTable,
120 sizeof(pMac->lim.gLimCachedScanHashTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700121
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700122#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
123
124 pMac->lim.gLimMlmLfrScanResultLength = 0;
125 pMac->lim.gLimSmeLfrScanResultLength = 0;
126
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530127 vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
128 sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700129#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 pMac->lim.gLimBackgroundScanChannelId = 0;
131 pMac->lim.gLimBackgroundScanStarted = 0;
132 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
133 pMac->lim.gLimRestoreCBCount = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530134 vos_mem_set(pMac->lim.gLimLegacyBssidList,
135 sizeof(pMac->lim.gLimLegacyBssidList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700136
137 /* Fill in default values */
138 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
139
Jeff Johnson295189b2012-06-20 16:38:30 -0700140
141 // abort scan is used to abort an on-going scan
142 pMac->lim.abortScan = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530143 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
144 vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
146//WLAN_SUSPEND_LINK Related
147 pMac->lim.gpLimSuspendCallback = NULL;
148 pMac->lim.gpLimResumeCallback = NULL;
149//end WLAN_SUSPEND_LINK Related
150}
151
152
153static void __limInitBssVars(tpAniSirGlobal pMac)
154{
155
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530156 vos_mem_set((void*)pMac->lim.gpSession,
157 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700158
159
160 //pMac->lim.gpLimStartBssReq = NULL;
161
Jeff Johnson295189b2012-06-20 16:38:30 -0700162
163
164
165/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
166#if 0
167
168 // Place holder for BSS description that we're
169 // currently joined with
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530170 vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530172 vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 pMac->lim.gLimCurrentBssCaps = 0;
174 QosCaps is a bit map of various qos capabilities - see defn above
175 pMac->lim.gLimCurrentBssQosCaps = 0;
176 pMac->lim.gLimCurrentBssPropCap = 0;
177 pMac->lim.gLimSentCapsChangeNtf = 0;
178
179 // Place holder for BSS description that
180 // we're currently Reassociating
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530181 vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 pMac->lim.gLimReassocChannelId = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530183 vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 pMac->lim.gLimReassocBssCaps = 0;
185 pMac->lim.gLimReassocBssQosCaps = 0;
186 pMac->lim.gLimReassocBssPropCap = 0;
187 #endif
188
189 /* This is for testing purposes only, be default should always be off */
190 pMac->lim.gLimForceNoPropIE = 0;
191
192 // pMac->lim.gLimBssIdx = 0;
193
194 pMac->lim.gpLimMlmSetKeysReq = NULL;
195 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
196 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
197
198}
199
200
201static void __limInitStatsVars(tpAniSirGlobal pMac)
202{
203 pMac->lim.gLimNumBeaconsRcvd = 0;
204 pMac->lim.gLimNumBeaconsIgnored = 0;
205
206 pMac->lim.gLimNumDeferredMsgs = 0;
207
208 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800209 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
211
212 /// This indicates number of RXed Beacons during HB period
213 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
214
215 // Heart-Beat interval value
216 pMac->lim.gLimHeartBeatCount = 0;
217
218 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530219 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
220 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700221
222#ifdef WLAN_DEBUG
223 // Debug counters
224 pMac->lim.numTot = 0;
225 pMac->lim.numBbt = 0;
226 pMac->lim.numProtErr = 0;
227 pMac->lim.numLearn = 0;
228 pMac->lim.numLearnIgnore = 0;
229 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530230 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 pMac->lim.gLimNumAssocReqDropInvldState = 0;
232 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
233 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
234 pMac->lim.gLimNumReassocReqDropInvldState = 0;
235 pMac->lim.gLimNumHashMissIgnored = 0;
236 pMac->lim.gLimUnexpBcnCnt = 0;
237 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
238 pMac->lim.gLimNumLinkEsts = 0;
239 pMac->lim.gLimNumRxCleanup = 0;
240 pMac->lim.gLim11bStaAssocRejectCount = 0;
241#endif
242}
243
244
245
246static void __limInitStates(tpAniSirGlobal pMac)
247{
248 // Counts Heartbeat failures
249 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
250 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
251 pMac->lim.gLimHBfailureCntInOtherStates = 0;
252 pMac->lim.gLimRspReqd = 0;
253 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
254
255 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700256 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
258
259 /// Previous MLM State
260 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
261
262#ifdef GEN4_SCAN
263 // LIM to HAL SCAN Management Message Interface states
264 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
265#endif // GEN4_SCAN
266
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700268 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700270 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700271
272 /**
273 * By default assume 'unknown' role. This will be updated
274 * when SME_START_BSS_REQ is received.
275 */
276
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530277 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
278 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
279 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
280 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
281 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
282 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700283
284 pMac->lim.gLimPhyMode = 0;
285 pMac->lim.scanStartTime = 0; // used to measure scan time
286
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530287 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 pMac->lim.ackPolicy = 0;
289
290#if 0 /* Moving all these to session specific elements */
291 pMac->lim.gLimQosEnabled = 0; //11E
292 pMac->lim.gLimWmeEnabled = 0; //WME
293 pMac->lim.gLimWsmEnabled = 0; //WSM
294 pMac->lim.gLimHcfEnabled = 0;
295 pMac->lim.gLim11dEnabled = 0;
296#endif
297
298 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
299}
300
301static void __limInitVars(tpAniSirGlobal pMac)
302{
303
Jeff Johnson295189b2012-06-20 16:38:30 -0700304
305 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
307 // WDS info
308 pMac->lim.gLimNumWdsInfoInd = 0;
309 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530310 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 /* initialize some parameters */
312 limInitWdsInfoParams(pMac);
313
314 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530315 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530318 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 pMac->lim.gLimAddtsSent = 0;
320 pMac->lim.gLimAddtsRspTimerCount = 0;
321
322 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530323 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530325 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
327
Jeff Johnsone7245742012-09-05 17:12:55 -0700328#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
331 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 // WMM Related Flag
334 pMac->lim.gUapsdEnable = 0;
335 pMac->lim.gUapsdPerAcBitmask = 0;
336 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
337 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
338
339 // QoS-AC Downgrade: Initially, no AC is admitted
340 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
341 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
342
343 //dialogue token List head/tail for Action frames request sent.
344 pMac->lim.pDialogueTokenHead = NULL;
345 pMac->lim.pDialogueTokenTail = NULL;
346
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530347 vos_mem_set(&pMac->lim.tspecInfo,
348 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700349
350 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530351 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700352
353 pMac->lim.gLastBeaconDtimCount = 0;
354 pMac->lim.gLastBeaconDtimPeriod = 0;
355
356 //Scan in Power Save Flag
357 pMac->lim.gScanInPowersave = 0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800358 pMac->lim.probeCounter = 0;
359 pMac->lim.maxProbe = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700360}
361
362static void __limInitAssocVars(tpAniSirGlobal pMac)
363{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800364 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800365#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530366 vos_mem_set(pMac->lim.gpLimAIDpool,
367 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 pMac->lim.freeAidHead = 0;
369 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800370#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800371 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
372 {
373 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
374 }
375 pMac->lim.gLimAssocStaLimit = val;
Ravi Joshi0fc681b2013-09-11 16:46:07 -0700376 pMac->lim.gLimIbssStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
378 // Place holder for current authentication request
379 // being handled
380 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700381 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700382
383 /// MAC level Pre-authentication related globals
384 pMac->lim.gLimPreAuthChannelNumber = 0;
385 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530386 vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 pMac->lim.gLimNumPreAuthContexts = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530388 vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
390 // Placed holder to deauth reason
391 pMac->lim.gLimDeauthReasonCode = 0;
392
393 // Place holder for Pre-authentication node list
394 pMac->lim.pLimPreAuthList = NULL;
395
396 // Send Disassociate frame threshold parameters
397 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
398 pMac->lim.gLimDisassocFrameCredit = 0;
399
400 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530401 vos_mem_set(pMac->lim.protStaOverlapCache,
402 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
403 vos_mem_set(pMac->lim.protStaCache,
404 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700405
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700406#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
407 pMac->lim.pSessionEntry = NULL;
408 pMac->lim.reAssocRetryAttempt = 0;
409#endif
410
Jeff Johnson295189b2012-06-20 16:38:30 -0700411}
412
413
414static void __limInitTitanVars(tpAniSirGlobal pMac)
415{
Jeff Johnsone7245742012-09-05 17:12:55 -0700416#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530417 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700419 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
420#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 // Debug workaround for BEACON's
422 // State change triggered by "dump 222"
423 pMac->lim.gLimScanOverride = 1;
424 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 pMac->lim.gLimTitanStaCount = 0;
426 pMac->lim.gLimBlockNonTitanSta = 0;
427}
428
429static void __limInitHTVars(tpAniSirGlobal pMac)
430{
431 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 pMac->lim.gHTShortGI40Mhz = 0;
434 pMac->lim.gHTShortGI20Mhz = 0;
435 pMac->lim.gHTMaxAmsduLength = 0;
436 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
437 pMac->lim.gHTPSMPSupport = 0;
438 pMac->lim.gHTLsigTXOPProtection = 0;
439 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
440 pMac->lim.gHTAMpduDensity = 0;
441
442 pMac->lim.gMaxAmsduSizeEnabled = false;
443 pMac->lim.gHTMaxRxAMpduFactor = 0;
444 pMac->lim.gHTServiceIntervalGranularity = 0;
445 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
447 pMac->lim.gHTPCOActive = 0;
448
449 pMac->lim.gHTPCOPhase = 0;
450 pMac->lim.gHTSecondaryBeacon = 0;
451 pMac->lim.gHTDualCTSProtection = 0;
452 pMac->lim.gHTSTBCBasicMCS = 0;
453 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
454}
455
Jeff Johnson295189b2012-06-20 16:38:30 -0700456static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
457{
Jeff Johnsone7245742012-09-05 17:12:55 -0700458 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 tANI_U16 val16;
460 tANI_U8 val8;
461 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
462 tSirMacHTInfoField1 *pHTInfoField1;
463 tpSirPowerSaveCfg pPowerSaveConfig;
464 tSirMacHTParametersInfo *pAmpduParamInfo;
465
466 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700467 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
468 * and they will be used throughout when there is no session
469 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
472 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700473 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 return eSIR_FAILURE;
475 }
476
477 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
478 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 return eSIR_FAILURE;
481 }
482 val16 = ( tANI_U16 ) val1;
483 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
484
485 //channel bonding mode could be set to anything from 0 to 4(Titan had these
486 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
487 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
488 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
489 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
490 != eSIR_SUCCESS)
491 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700492 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 return eSIR_FAILURE;
494 }
495
496 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
497 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700498 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 return eSIR_FAILURE;
500 }
501
502 val8 = ( tANI_U8 ) val1;
503 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
504 pHTInfoField1->recommendedTxWidthSet =
505 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
507 != eSIR_SUCCESS)
508 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700509 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 return eSIR_FAILURE;
511 }
512
513 /* WNI_CFG_HEART_BEAT_THRESHOLD */
514
515 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
516 eSIR_SUCCESS )
517 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700518 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 return eSIR_FAILURE;
520 }
521 if(!val1)
522 {
523 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
524 pMac->sys.gSysEnableLinkMonitorMode = 0;
525 }
526 else
527 {
528 //No need to activate the timer during init time.
529 pMac->sys.gSysEnableLinkMonitorMode = 1;
530 }
531
532 /* WNI_CFG_SHORT_GI_20MHZ */
533
534 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
535 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700536 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 return eSIR_FAILURE;
538 }
539 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
540 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700541 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 return eSIR_FAILURE;
543 }
544 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
545 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700546 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 return eSIR_FAILURE;
548 }
549
550 val16 = ( tANI_U16 ) val1;
551 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
552 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
553 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
554
555 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
556 eSIR_SUCCESS)
557 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700558 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 return eSIR_FAILURE;
560 }
561
562 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
563
564 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
565 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700566 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 return eSIR_FAILURE;
568 }
569 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
570 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700571 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 return eSIR_FAILURE;
573 }
574 val16 = ( tANI_U16 ) val1;
575 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
576 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
577 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
578 eSIR_SUCCESS)
579 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700580 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 return eSIR_FAILURE;
582 }
583
584 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
585 limHandleCFGparamUpdate do we want to update this? */
586 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
587 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530588 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 return eSIR_FAILURE;
590 }
591
Jeff Johnson295189b2012-06-20 16:38:30 -0700592 /* WNI_CFG_MAX_PS_POLL */
593
594 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530595 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
596 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 {
598 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700599 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 return eSIR_FAILURE;
601 }
602
603 /* This context should be valid if power-save configuration message has been
604 * already dispatched during initialization process. Re-using the present
605 * configuration mask
606 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530607 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
609 /* Note: it is okay to do this since DAL/HAL is alrady started */
610 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
611 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700612 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 return eSIR_FAILURE;
614 }
615
616 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
617
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700619 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700621
622 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
623
624 /* This was initially done after resume notification from HAL. Now, DAL is
625 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700626 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800627 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
628 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700629 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800630 return eSIR_FAILURE;
631 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530632#ifdef FEATURE_WLAN_TDLS
633 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
634 {
635 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
636 return eSIR_FAILURE;
637 }
638 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
639 {
640 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
641 return eSIR_FAILURE;
642 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530643 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
644 {
645 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
646 return eSIR_FAILURE;
647 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530648#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 return eSIR_SUCCESS;
650}
Jeff Johnson295189b2012-06-20 16:38:30 -0700651
652/*
653 limStart
654 This function is to replace the __limProcessSmeStartReq since there is no
655 eWNI_SME_START_REQ post to PE.
656*/
657tSirRetStatus limStart(tpAniSirGlobal pMac)
658{
659 tSirResultCodes retCode = eSIR_SUCCESS;
660
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700661 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700662
663 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
664 {
665 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
666
Jeff Johnsone7245742012-09-05 17:12:55 -0700667 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700668
669 // By default do not return after first scan match
670 pMac->lim.gLimReturnAfterFirstMatch = 0;
671
672 // Initialize MLM state machine
673 limInitMlm(pMac);
674
675 // By default return unique scan results
676 pMac->lim.gLimReturnUniqueResults = true;
677 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700678#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
679 pMac->lim.gLimSmeLfrScanResultLength = 0;
680#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 }
682 else
683 {
684 /**
685 * Should not have received eWNI_SME_START_REQ in states
686 * other than OFFLINE. Return response to host and
687 * log error
688 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700689 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 retCode = eSIR_FAILURE;
691 }
692
693 return retCode;
694}
695
696/**
697 * limInitialize()
698 *
699 *FUNCTION:
700 * This function is called from LIM thread entry function.
701 * LIM related global data structures are initialized in this function.
702 *
703 *LOGIC:
704 * NA
705 *
706 *ASSUMPTIONS:
707 * NA
708 *
709 *NOTE:
710 * NA
711 *
712 * @param pMac - Pointer to global MAC structure
713 * @return None
714 */
715
716tSirRetStatus
717limInitialize(tpAniSirGlobal pMac)
718{
719 tSirRetStatus status = eSIR_SUCCESS;
720
721 __limInitAssocVars(pMac);
722 __limInitVars(pMac);
723 __limInitStates(pMac);
724 __limInitStatsVars(pMac);
725 __limInitBssVars(pMac);
726 __limInitScanVars(pMac);
727 __limInitHTVars(pMac);
728 __limInitTitanVars(pMac);
729
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 status = limStart(pMac);
731 if(eSIR_SUCCESS != status)
732 {
733 return status;
734 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700735
736 /*
737 * MLM will be intitalized when 'START' request comes from SME.
738 * limInitMlm calls limCreateTimers, which actually relies on
739 * CFG to be downloaded. So it should not be called as part of
740 * peStart, as CFG download is happening after peStart.
741 */
742 //limInitMlm(pMac);
743 // Initializations for maintaining peers in IBSS
744 limIbssInit(pMac);
745
746 pmmInitialize(pMac);
747
748
749#if defined WLAN_FEATURE_VOWIFI
750 rrmInitialize(pMac);
751#endif
752#if defined WLAN_FEATURE_VOWIFI_11R
753 limFTOpen(pMac);
754#endif
755
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700757
758#if 0
759
760 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
761 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
762 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
763
764 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
765 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
766
767 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
768 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
769 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
770
771 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
772
773 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
774
775 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
776 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
777
778 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
779
780
781 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
782
783 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
784#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700785
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 //Initialize the configurations needed by PE
787 if( eSIR_FAILURE == __limInitConfig(pMac))
788 {
789 //We need to undo everything in limStart
790 limCleanupMlm(pMac);
791 return eSIR_FAILURE;
792 }
793
794 //initialize the TSPEC admission control table.
795 //Note that this was initially done after resume notification from HAL.
796 //Now, DAL is started before PE so this can be done here
797 limAdmitControlInit(pMac);
798 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700799
800 return status;
801
802} /*** end limInitialize() ***/
803
804
805
806/**
807 * limCleanup()
808 *
809 *FUNCTION:
810 * This function is called upon reset or persona change
811 * to cleanup LIM state
812 *
813 *LOGIC:
814 * NA
815 *
816 *ASSUMPTIONS:
817 * NA
818 *
819 *NOTE:
820 * NA
821 *
822 * @param pMac - Pointer to Global MAC structure
823 * @return None
824 */
825
826void
827limCleanup(tpAniSirGlobal pMac)
828{
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 v_PVOID_t pvosGCTx;
830 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700831
Jeff Johnson295189b2012-06-20 16:38:30 -0700832//Before destroying the list making sure all the nodes have been deleted.
833//Which should be the normal case, but a memory leak has been reported.
834
835 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
836
837 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
838 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
839 {
840 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
841 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
842
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530843 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 }
845
846 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700847
848 limCleanupMlm(pMac);
849 limCleanupLmm(pMac);
850
851 // free up preAuth table
852 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
853 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530854 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
856 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
857 }
858
859 if(NULL != pMac->lim.pDialogueTokenHead)
860 {
861 limDeleteDialogueTokenList(pMac);
862 }
863
864 if(NULL != pMac->lim.pDialogueTokenTail)
865 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530866 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 pMac->lim.pDialogueTokenTail = NULL;
868 }
869
870 # if 0
871 if (pMac->lim.gpLimStartBssReq != NULL)
872 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530873 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 pMac->lim.gpLimStartBssReq = NULL;
875 }
876 #endif
877
878 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
879 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530880 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pMac->lim.gpLimMlmSetKeysReq = NULL;
882 }
883
884 #if 0
885 if (pMac->lim.gpLimJoinReq != NULL)
886 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530887 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 pMac->lim.gpLimJoinReq = NULL;
889 }
890 #endif
891
892 if (pMac->lim.gpLimMlmAuthReq != NULL)
893 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530894 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 pMac->lim.gpLimMlmAuthReq = NULL;
896 }
897
Jeff Johnsone7245742012-09-05 17:12:55 -0700898#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 if (pMac->lim.gpLimMlmJoinReq != NULL)
900 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530901 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700902 pMac->lim.gpLimMlmJoinReq = NULL;
903 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700904#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700905
906 #if 0
907 if (pMac->lim.gpLimReassocReq != NULL)
908 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530909 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 pMac->lim.gpLimReassocReq = NULL;
911 }
912 #endif
913
914 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
915 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530916 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
918 }
919
Viral Modid440e682013-03-06 02:25:31 -0800920 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800921 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530922 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800923 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800924 }
Viral Modid86bde22012-12-10 13:09:21 -0800925
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 if (pMac->lim.gpLimMlmScanReq != NULL)
927 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530928 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 pMac->lim.gpLimMlmScanReq = NULL;
930 }
931
932#if 0
933 if(NULL != pMac->lim.beacon)
934 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530935 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 pMac->lim.beacon = NULL;
937 }
938#endif
939 #if 0
940 if(NULL != pMac->lim.assocReq)
941 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530942 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 pMac->lim.assocReq= NULL;
944 }
945 #endif
946
947#if 0
948 if(NULL != pMac->lim.assocRsp)
949 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530950 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 pMac->lim.assocRsp= NULL;
952 }
953#endif
954 // Now, finally reset the deferred message queue pointers
955 limResetDeferredMsgQ(pMac);
956
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
958 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
959 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
960
961 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700962 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700963
964#if defined WLAN_FEATURE_VOWIFI
965 rrmCleanup(pMac);
966#endif
967#if defined WLAN_FEATURE_VOWIFI_11R
968 limFTCleanup(pMac);
969#endif
970
971} /*** end limCleanup() ***/
972
973
974/** -------------------------------------------------------------
975\fn peOpen
976\brief will be called in Open sequence from macOpen
977\param tpAniSirGlobal pMac
978\param tHalOpenParameters *pHalOpenParam
979\return tSirRetStatus
980 -------------------------------------------------------------*/
981
982tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
983{
984 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
985 pMac->lim.maxStation = pMacOpenParam->maxStation;
986
987 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
988 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700989 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 return eSIR_FAILURE;
991 }
992
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530993 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
994 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700996 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 return eSIR_FAILURE;
998 }
999
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001000#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301001 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
1002 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001004 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 return eSIR_FAILURE;
1006 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001007#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301008 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
1009 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001011 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 return eSIR_FAILURE;
1013 }
1014
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301015 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001016
1017
1018 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301019 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1020 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001022 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 return eSIR_FAILURE;
1024 }
1025
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301026 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1027 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001029 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 return eSIR_FAILURE;
1031 }
1032 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301033 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1034 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001036 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
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!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001047 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1048 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1049 vos_mem_free(pMac->lim.gpSession);
1050 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;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001056
1057 /*
1058 * peOpen is successful by now, so it is right time to initialize
1059 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1060 * then nothing will be logged for PE module.
1061 */
1062#ifdef LIM_TRACE_RECORD
1063 MTRACE(limTraceInit(pMac));
1064#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 return eSIR_SUCCESS;
1066}
1067
1068/** -------------------------------------------------------------
1069\fn peClose
1070\brief will be called in close sequence from macClose
1071\param tpAniSirGlobal pMac
1072\return tSirRetStatus
1073 -------------------------------------------------------------*/
1074
1075tSirRetStatus peClose(tpAniSirGlobal pMac)
1076{
1077 tANI_U8 i;
1078
1079 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1080 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001081
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 for(i =0; i < pMac->lim.maxBssId; i++)
1083 {
1084 if(pMac->lim.gpSession[i].valid == TRUE)
1085 {
1086 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1087 }
1088 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301089 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001090 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001091#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301092 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001093 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001094#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001095
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301096 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 pMac->lim.gpSession = NULL;
1098 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301099 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301101 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1103 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301104 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001106 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1107 {
1108 return eSIR_FAILURE;
1109 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 return eSIR_SUCCESS;
1111}
1112
1113/** -------------------------------------------------------------
1114\fn peStart
1115\brief will be called in start sequence from macStart
1116\param tpAniSirGlobal pMac
1117\return none
1118 -------------------------------------------------------------*/
1119
1120tSirRetStatus peStart(tpAniSirGlobal pMac)
1121{
1122 tSirRetStatus status = eSIR_SUCCESS;
1123
1124 status = limInitialize(pMac);
1125#if defined(ANI_LOGDUMP)
1126 limDumpInit(pMac);
1127#endif //#if defined(ANI_LOGDUMP)
1128
1129 return status;
1130}
1131
1132/** -------------------------------------------------------------
1133\fn peStop
1134\brief will be called in stop sequence from macStop
1135\param tpAniSirGlobal pMac
1136\return none
1137 -------------------------------------------------------------*/
1138
1139void peStop(tpAniSirGlobal pMac)
1140{
1141 limCleanup(pMac);
1142 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1143 return;
1144}
1145
1146/** -------------------------------------------------------------
1147\fn peFreeMsg
1148\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1149\ to free a given PE message on the TX and MC thread.
1150\ This happens when there are messages pending in the PE
1151\ queue when system is being stopped and reset.
1152\param tpAniSirGlobal pMac
1153\param tSirMsgQ pMsg
1154\return none
1155-----------------------------------------------------------------*/
1156v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1157{
1158 if (pMsg != NULL)
1159 {
1160 if (NULL != pMsg->bodyptr)
1161 {
1162 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1163 {
1164 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1165 }
1166 else
1167 {
1168 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1169 }
1170 }
1171 pMsg->bodyptr = 0;
1172 pMsg->bodyval = 0;
1173 pMsg->type = 0;
1174 }
1175 return;
1176}
1177
1178
1179/**
1180 * The function checks if a particular timer should be allowed
1181 * into LIM while device is sleeping
1182 */
1183tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1184{
1185 tANI_U8 retStatus = TRUE;
1186
1187 if(!limIsSystemInActiveState(pMac))
1188 {
1189 switch(pMsg->type)
1190 {
1191 /* Don't allow following timer messages if in sleep */
1192 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1193 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1194 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1195 retStatus = FALSE;
1196 break;
1197 /* May allow following timer messages in sleep mode */
1198 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1199
1200 /* Safe to allow as of today, this triggers background scan
1201 * which will not be started if the device is in power-save mode
1202 * might need to block in the future if we decide to implement
1203 * spectrum management
1204 */
1205 case SIR_LIM_QUIET_TIMEOUT:
1206
1207 /* Safe to allow as of today, this triggers background scan
1208 * which will not be started if the device is in power-save mode
1209 * might need to block in the future if we decide to implement
1210 * spectrum management
1211 */
1212 case SIR_LIM_QUIET_BSS_TIMEOUT:
1213
1214 /* Safe to allow this timermessage, triggers background scan
1215 * which is blocked in sleep mode
1216 */
1217 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1218
1219 /* Safe to allow this timer, since, while in IMPS this timer will not
1220 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1221 * when heart-beat control is handled back to PE, device would have
1222 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1223 */
1224 case SIR_LIM_HEART_BEAT_TIMEOUT:
1225 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1226
1227 /* Safe to allow, PE is not handling this message as of now. May need
1228 * to block it, basically, free the buffer and restart the timer
1229 */
1230 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1231 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001232 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1234 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1235 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1236 retStatus = TRUE;
1237 break;
1238
1239 /* by default allow rest of messages */
1240 default:
1241 retStatus = TRUE;
1242 break;
1243
1244
1245 }
1246 }
1247
1248 return retStatus;
1249
1250}
1251
1252
1253
1254/**
1255 * limPostMsgApi()
1256 *
1257 *FUNCTION:
1258 * This function is called from other thread while posting a
1259 * message to LIM message Queue gSirLimMsgQ.
1260 *
1261 *LOGIC:
1262 * NA
1263 *
1264 *ASSUMPTIONS:
1265 * NA
1266 *
1267 *NOTE:
1268 * NA
1269 *
1270 * @param pMac - Pointer to Global MAC structure
1271 * @param pMsg - Pointer to the message structure
1272 * @return None
1273 */
1274
1275tANI_U32
1276limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1277{
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1279
1280
Jeff Johnson295189b2012-06-20 16:38:30 -07001281} /*** end limPostMsgApi() ***/
1282
1283
1284/*--------------------------------------------------------------------------
1285
1286 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1287
1288 This function can be called by legacy code to post message to voss queues OR
1289 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1290 for dispatching it later.
1291
1292 \param pMac - Pointer to Global MAC structure
1293 \param pMsg - Pointer to the message structure
1294
1295 \return tANI_U32 - TX_SUCCESS for success.
1296
1297 --------------------------------------------------------------------------*/
1298
1299tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1300{
1301 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1302}
1303
1304/*--------------------------------------------------------------------------
1305
1306 \brief peProcessMessages() - Message Processor for PE
1307
1308 Voss calls this function to dispatch the message to PE
1309
1310 \param pMac - Pointer to Global MAC structure
1311 \param pMsg - Pointer to the message structure
1312
1313 \return tANI_U32 - TX_SUCCESS for success.
1314
1315 --------------------------------------------------------------------------*/
1316
1317tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1318{
1319 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1320 {
1321 return eSIR_SUCCESS;
1322 }
1323 /**
1324 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1325 * for all the other cases post it to LIM
1326 */
1327 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1328 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1329 else
1330 limMessageProcessor(pMac, pMsg);
1331 return eSIR_SUCCESS;
1332}
1333
1334
Jeff Johnson295189b2012-06-20 16:38:30 -07001335
1336// ---------------------------------------------------------------------------
1337/**
1338 * peHandleMgmtFrame
1339 *
1340 * FUNCTION:
1341 * Process the Management frames from TL
1342 *
1343 * LOGIC:
1344 *
1345 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1346 *
1347 * NOTE:
1348 *
1349 * @param pvosGCtx Global Vos Context
1350 * @param vossBuff Packet
1351 * @return None
1352 */
1353
1354VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1355{
1356 tpAniSirGlobal pMac;
1357 tpSirMacMgmtHdr mHdr;
1358 tSirMsgQ msg;
1359 vos_pkt_t *pVosPkt;
1360 VOS_STATUS vosStatus;
1361 v_U8_t *pRxPacketInfo;
1362
1363 pVosPkt = (vos_pkt_t *)vosBuff;
1364 if (NULL == pVosPkt)
1365 {
1366 return VOS_STATUS_E_FAILURE;
1367 }
1368
1369 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1370 if (NULL == pMac)
1371 {
1372 // cannot log a failure without a valid pMac
1373 vos_pkt_return_packet(pVosPkt);
1374 return VOS_STATUS_E_FAILURE;
1375 }
1376
1377 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1378
1379 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1380 {
1381 vos_pkt_return_packet(pVosPkt);
1382 return VOS_STATUS_E_FAILURE;
1383 }
1384
1385
1386 //
1387 // The MPDU header is now present at a certain "offset" in
1388 // the BD and is specified in the BD itself
1389 //
1390 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1391 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1392 {
1393 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001394 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001395 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001396
Jeff Johnsone7245742012-09-05 17:12:55 -07001397 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1399 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1400 }
1401
1402
1403 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1404 msg.type = SIR_BB_XPORT_MGMT_MSG;
1405 msg.bodyptr = vosBuff;
1406 msg.bodyval = 0;
1407
1408 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1409 &msg,
1410 mHdr->fc.type,
1411 mHdr->fc.subType ))
1412 {
1413 vos_pkt_return_packet(pVosPkt);
1414 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001415 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 return VOS_STATUS_E_FAILURE;
1417 }
1418
1419 return VOS_STATUS_SUCCESS;
1420}
1421
1422// ---------------------------------------------------------------------------
1423/**
1424 * peRegisterTLHandle
1425 *
1426 * FUNCTION:
1427 * Registers the Handler which, process the Management frames from TL
1428 *
1429 * LOGIC:
1430 *
1431 * ASSUMPTIONS:
1432 *
1433 * NOTE:
1434 *
1435 * @return None
1436 */
1437
1438void peRegisterTLHandle(tpAniSirGlobal pMac)
1439{
1440 v_PVOID_t pvosGCTx;
1441 VOS_STATUS retStatus;
1442
1443 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1444
1445 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1446
1447 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001448 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001449
1450}
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
1452
1453/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 * limIsSystemInScanState()
1455 *
1456 *FUNCTION:
1457 * This function is called by various MAC software modules to
1458 * determine if System is in Scan/Learn state
1459 *
1460 *LOGIC:
1461 * NA
1462 *
1463 *ASSUMPTIONS:
1464 * NA
1465 *
1466 *NOTE:
1467 *
1468 * @param pMac - Pointer to Global MAC structure
1469 * @return true - System is in Scan/Learn state
1470 * false - System is NOT in Scan/Learn state
1471 */
1472
1473tANI_U8
1474limIsSystemInScanState(tpAniSirGlobal pMac)
1475{
1476 switch (pMac->lim.gLimSmeState)
1477 {
1478 case eLIM_SME_CHANNEL_SCAN_STATE:
1479 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1480 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1481 case eLIM_SME_WT_SCAN_STATE:
1482 // System is in Learn mode
1483 return true;
1484
1485 default:
1486 // System is NOT in Learn mode
1487 return false;
1488 }
1489} /*** end limIsSystemInScanState() ***/
1490
1491
1492
1493/**
1494 * limIsSystemInActiveState()
1495 *
1496 *FUNCTION:
1497 * This function is called by various MAC software modules to
1498 * determine if System is in Active/Wakeup state
1499 *
1500 *LOGIC:
1501 * NA
1502 *
1503 *ASSUMPTIONS:
1504 * NA
1505 *
1506 *NOTE:
1507 *
1508 * @param pMac - Pointer to Global MAC structure
1509 * @return true - System is in Active state
1510 * false - System is not in Active state
1511 */
1512
1513tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1514{
1515 switch (pMac->pmm.gPmmState)
1516 {
1517 case ePMM_STATE_BMPS_WAKEUP:
1518 case ePMM_STATE_IMPS_WAKEUP:
1519 case ePMM_STATE_READY:
1520 // System is in Active mode
1521 return true;
1522 default:
1523 return false;
1524 // System is NOT in Active mode
1525 }
1526}
1527
1528
Jeff Johnson295189b2012-06-20 16:38:30 -07001529
Jeff Johnson295189b2012-06-20 16:38:30 -07001530
1531
1532/**
1533*\brief limReceivedHBHandler()
1534*
1535* This function is called by schBeaconProcess() upon
1536* receiving a Beacon on STA. This also gets called upon
1537* receiving Probe Response after heat beat failure is
1538* detected.
1539*
1540* param pMac - global mac structure
1541* param channel - channel number indicated in Beacon, Probe Response
1542* return - none
1543*/
1544
1545
1546void
1547limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1548{
1549 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1550 psessionEntry->LimRxedBeaconCntDuringHB++;
1551
1552 pMac->pmm.inMissedBeaconScenario = FALSE;
1553} /*** end limReceivedHBHandler() ***/
1554
1555
1556
1557#if 0
1558void limResetHBPktCount(tpPESession psessionEntry)
1559{
1560 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1561}
1562#endif
1563
1564
1565/*
1566 * limProcessWdsInfo()
1567 *
1568 *FUNCTION:
1569 * This function is called from schBeaconProcess in BP
1570 *
1571 *PARAMS:
1572 * @param pMac - Pointer to Global MAC structure
1573 * @param propIEInfo - proprietary IE info
1574 *
1575 *LOGIC:
1576 *
1577 *ASSUMPTIONS:
1578 * NA
1579 *
1580 *NOTE:
1581 *
1582 *
1583 *RETURNS:
1584 *
1585 */
1586
1587void limProcessWdsInfo(tpAniSirGlobal pMac,
1588 tSirPropIEStruct propIEInfo)
1589{
Jeff Johnson295189b2012-06-20 16:38:30 -07001590}
1591
1592
1593
1594/**
1595 * limInitWdsInfoParams()
1596 *
1597 *FUNCTION:
1598 * This function is called while processing
1599 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1600 * ind/set related parameters.
1601 *
1602 *LOGIC:
1603 *
1604 *ASSUMPTIONS:
1605 *
1606 *NOTE:
1607 *
1608 * @param pMac Pointer to Global MAC structure
1609 * @return None
1610 */
1611
1612void
1613limInitWdsInfoParams(tpAniSirGlobal pMac)
1614{
1615 pMac->lim.gLimWdsInfo.wdsLength = 0;
1616 pMac->lim.gLimNumWdsInfoInd = 0;
1617 pMac->lim.gLimNumWdsInfoSet = 0;
1618} /*** limInitWdsInfoParams() ***/
1619
1620
1621/** -------------------------------------------------------------
1622\fn limUpdateOverlapStaParam
1623\brief Updates overlap cache and param data structure
1624\param tpAniSirGlobal pMac
1625\param tSirMacAddr bssId
1626\param tpLimProtStaParams pStaParams
1627\return None
1628 -------------------------------------------------------------*/
1629void
1630limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1631{
1632 int i;
1633 if (!pStaParams->numSta)
1634 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301635 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1636 bssId,
1637 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 pMac->lim.protStaOverlapCache[0].active = true;
1639
1640 pStaParams->numSta = 1;
1641
1642 return;
1643 }
1644
1645 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1646 {
1647 if (pMac->lim.protStaOverlapCache[i].active)
1648 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301649 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 bssId,
1651 sizeof(tSirMacAddr))) {
1652 return; }
1653 }
1654 else
1655 break;
1656 }
1657
1658 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1659 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301660 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 }
1662 else
1663 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301664 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1665 bssId,
1666 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 pMac->lim.protStaOverlapCache[i].active = true;
1668
1669 pStaParams->numSta++;
1670 }
1671}
1672
1673
1674/**
1675 * limHandleIBSScoalescing()
1676 *
1677 *FUNCTION:
1678 * This function is called upon receiving Beacon/Probe Response
1679 * while operating in IBSS mode.
1680 *
1681 *LOGIC:
1682 *
1683 *ASSUMPTIONS:
1684 *
1685 *NOTE:
1686 *
1687 * @param pMac - Pointer to Global MAC structure
1688 * @param pBeacon - Parsed Beacon Frame structure
1689 * @param pRxPacketInfo - Pointer to RX packet info structure
1690 *
1691 * @return Status whether to process or ignore received Beacon Frame
1692 */
1693
1694tSirRetStatus
1695limHandleIBSScoalescing(
1696 tpAniSirGlobal pMac,
1697 tpSchBeaconStruct pBeacon,
1698 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1699{
1700 tpSirMacMgmtHdr pHdr;
1701 tSirRetStatus retCode;
1702
1703 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001704 if ( (!pBeacon->capabilityInfo.ibss) ||
1705 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1706 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 /* Received SSID does not match => Ignore received Beacon frame. */
1708 retCode = eSIR_LIM_IGNORE_BEACON;
1709 else
1710 {
1711 tANI_U32 ieLen;
1712 tANI_U16 tsfLater;
1713 tANI_U8 *pIEs;
1714 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1715 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1716 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1717 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1718 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1719 }
1720 return retCode;
1721} /*** end limHandleIBSScoalescing() ***/
1722
1723
1724
1725/**
1726 * limDetectChangeInApCapabilities()
1727 *
1728 *FUNCTION:
1729 * This function is called while SCH is processing
1730 * received Beacon from AP on STA to detect any
1731 * change in AP's capabilities. If there any change
1732 * is detected, Roaming is informed of such change
1733 * so that it can trigger reassociation.
1734 *
1735 *LOGIC:
1736 *
1737 *ASSUMPTIONS:
1738 *
1739 *NOTE:
1740 * Notification is enabled for STA product only since
1741 * it is not a requirement on BP side.
1742 *
1743 * @param pMac Pointer to Global MAC structure
1744 * @param pBeacon Pointer to parsed Beacon structure
1745 * @return None
1746 */
1747
1748void
1749limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1750 tpSirProbeRespBeacon pBeacon,
1751 tpPESession psessionEntry)
1752{
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 tANI_U8 len;
1754 tSirSmeApNewCaps apNewCaps;
1755 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301756 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001757 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1758 newChannel = (tANI_U8) pBeacon->channelNumber;
1759
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301760 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
1761 ( ( ( limIsNullSsid(&pBeacon->ssId) ) ||
1762 ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1763 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ) ||
1764 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1765 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1766 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1767 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1768 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1769 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1770 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1771 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1772 ( newChannel != psessionEntry->currentOperChannel )
1773 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301774 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301775 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301776 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301777 /* If Beacon capabilities is not matching with the current capability,
1778 * then send unicast probe request to AP and take decision after
1779 * receiving probe response */
1780 if ( true == psessionEntry->fIgnoreCapsChange )
1781 {
1782 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1783 return;
1784 }
1785 psessionEntry->fWaitForProbeRsp = true;
1786 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1787 "sending directed probe request.. "));
1788 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1789 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1790 psessionEntry->dot11mode, 0, NULL);
1791
1792 if ( eSIR_SUCCESS != status )
1793 {
1794 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1795 psessionEntry->fWaitForProbeRsp = false;
1796 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301797 return;
1798 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 /**
1800 * BSS capabilities have changed.
1801 * Inform Roaming.
1802 */
1803 len = sizeof(tSirMacCapabilityInfo) +
1804 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1805 3 * sizeof(tANI_U8) + // reserved fields
1806 pBeacon->ssId.length + 1;
1807
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301808 vos_mem_copy(apNewCaps.bssId,
1809 psessionEntry->bssId,
1810 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 if (newChannel != psessionEntry->currentOperChannel)
1812 {
1813 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001814 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 psessionEntry->currentOperChannel, newChannel);)
1816 return;
1817 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301818
1819 /**
1820 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1821 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1822 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1823 * the privacy bit is set in Probe and association responses.
1824 * Due to this anomaly, we detect a change in
1825 * AP capabilities when we receive a beacon after association and
1826 * disconnect from the AP. The following check makes sure that we can
1827 * connect to such APs
1828 */
1829 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1830 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1831 {
1832 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001833 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301834 return;
1835 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 else
1837 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301838 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1839 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 pBeacon->ssId.length + 1);
1841
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301842 psessionEntry->fIgnoreCapsChange = false;
1843 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001844 psessionEntry->limSentCapsChangeNtf = true;
1845 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1846 (tANI_U32 *) &apNewCaps,
1847 len, psessionEntry->smeSessionId);
1848 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301849 else if ( true == psessionEntry->fWaitForProbeRsp )
1850 {
1851 /* Only for probe response frames and matching capabilities the control
1852 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1853 * will be false, the control will not come here*/
1854
1855 limLog(pMac, LOG1, FL("capabilities in probe response are"
1856 "matching with the current setting,"
1857 "Ignoring subsequent capability"
1858 "mismatch"));
1859 psessionEntry->fIgnoreCapsChange = true;
1860 psessionEntry->fWaitForProbeRsp = false;
1861 }
1862
Jeff Johnson295189b2012-06-20 16:38:30 -07001863} /*** limDetectChangeInApCapabilities() ***/
1864
1865
1866
1867
1868// ---------------------------------------------------------------------
1869/**
1870 * limUpdateShortSlot
1871 *
1872 * FUNCTION:
1873 * Enable/Disable short slot
1874 *
1875 * LOGIC:
1876 *
1877 * ASSUMPTIONS:
1878 *
1879 * NOTE:
1880 *
1881 * @param enable Flag to enable/disable short slot
1882 * @return None
1883 */
1884
1885tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1886{
1887
1888 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001889 tANI_U32 nShortSlot;
1890 tANI_U32 val = 0;
1891 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001892
Jeff Johnsone7245742012-09-05 17:12:55 -07001893 // Check Admin mode first. If it is disabled just return
1894 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1895 != eSIR_SUCCESS)
1896 {
1897 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001898 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001899 return eSIR_FAILURE;
1900 }
1901 if (val == false)
1902 return eSIR_SUCCESS;
1903
1904 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1905 limGetPhyMode(pMac, &phyMode, psessionEntry);
1906 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1907 return eSIR_SUCCESS;
1908
1909 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001910
1911 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1912 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1913 // if no erp present, use short slot based on current ap caps
1914
1915 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1916
1917 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1918 // The difference between the earlier implementation and the new one is only Case4.
1919 /*
1920 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1921 Case1 1 1 1 1 //AP should not advertise this combination.
1922 Case2 1 1 0 0
1923 Case3 1 0 1 1
1924 Case4 1 0 0 0
1925 Case5 0 1 1 1
1926 Case6 0 1 0 0
1927 Case7 0 0 1 1
1928 Case8 0 0 0 0
1929 */
1930 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1931
Jeff Johnsone7245742012-09-05 17:12:55 -07001932 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 {
1934 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001935 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001937 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1939 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 }
1941 return eSIR_SUCCESS;
1942}
1943
1944
Jeff Johnson295189b2012-06-20 16:38:30 -07001945
1946
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
Jeff Johnson295189b2012-06-20 16:38:30 -07001948
1949
1950/** -----------------------------------------------------------------
1951 \brief limHandleLowRssiInd() - handles low rssi indication
1952
1953 This function process the SIR_HAL_LOW_RSSI_IND message from
1954 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1955
1956 \param pMac - global mac structure
1957
1958 \return
1959
1960 \sa
1961 ----------------------------------------------------------------- */
1962void limHandleLowRssiInd(tpAniSirGlobal pMac)
1963{
1964#if 0 //RSSI related indications will now go to TL and not PE
1965 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1966 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1967 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1968 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001969 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1971 }
1972 else
1973 {
1974 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001975 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 pMac->pmm.gPmmState);
1977 }
1978 return;
1979#endif
1980}
1981
1982
1983/** -----------------------------------------------------------------
1984 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1985
1986 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1987 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1988 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1989
1990 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1991 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1992 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1993 This message can also come from FW anytime after we have entered BMPS.
1994 This means we should handle it in WoWL and UAPSD states as well
1995
1996 \param pMac - global mac structure
1997 \return - none
1998 \sa
1999 ----------------------------------------------------------------- */
2000void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2001{
2002 switch(pMac->pmm.gPmmState)
2003 {
2004 case ePMM_STATE_BMPS_SLEEP:
2005 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2006 case ePMM_STATE_UAPSD_SLEEP:
2007 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2008 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002009 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2011 break;
2012
2013 default:
2014 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002015 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 pMac->pmm.gPmmState);
2017 break;
2018 }
2019 return;
2020}
2021
2022
2023/** -----------------------------------------------------------------
2024 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2025
2026 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2027 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2028 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2029
2030 \param pMac - global mac structure
2031 \return - none
2032 \sa
2033 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002034void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002035{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002036#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2037 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2038 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2039 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2040 if (psessionEntry == NULL)
2041 {
2042 limLog(pMac, LOGE,
2043 FL("session does not exist for given BSSIdx:%d"),
2044 pSirMissedBeaconInd->bssIdx);
2045 return;
2046 }
2047#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2049 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2050 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2051 {
2052 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302053 PELOGE(limLog(pMac, LOGE,
2054 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2056 }
Yathish9f22e662012-12-10 14:21:35 -08002057/* ACTIVE_MODE_HB_OFFLOAD */
2058#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2059 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2060 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2061 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2062 {
2063 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002064 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002065 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002066 }
2067#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 else
2069 {
2070 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002071 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 pMac->pmm.gPmmState);
2073 }
2074 return;
2075}
2076
2077/** -----------------------------------------------------------------
2078 \brief limMicFailureInd() - handles mic failure indication
2079
2080 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2081
2082 \param pMac - global mac structure
2083 \return - none
2084 \sa
2085 ----------------------------------------------------------------- */
2086void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2087{
2088 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2089 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2090 tSirMsgQ mmhMsg;
2091 tpPESession psessionEntry ;
2092 tANI_U8 sessionId;
2093
2094 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2095 {
2096 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002097 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 return;
2099 }
2100
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302101 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2102 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 {
2104 // Log error
2105 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002106 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 return;
2108 }
2109
2110 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2111 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2112 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2113
2114 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302115 pSirMicFailureInd->bssId,
2116 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002117
2118 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302119 pSirMicFailureInd->info.srcMacAddr,
2120 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
2122 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302123 pSirMicFailureInd->info.taMacAddr,
2124 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002125
2126 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302127 pSirMicFailureInd->info.dstMacAddr,
2128 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002129
2130 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302131 pSirMicFailureInd->info.rxMacAddr,
2132 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002133
2134 pSirSmeMicFailureInd->info.multicast =
2135 pSirMicFailureInd->info.multicast;
2136
2137 pSirSmeMicFailureInd->info.keyId=
2138 pSirMicFailureInd->info.keyId;
2139
2140 pSirSmeMicFailureInd->info.IV1=
2141 pSirMicFailureInd->info.IV1;
2142
2143 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302144 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002145
2146 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2147 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2148 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002149 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2151 return;
2152}
2153
2154
2155/** -----------------------------------------------------------------
2156 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2157
2158 This function is called before enqueuing the frame to PE queue for further processing.
2159 This prevents unnecessary frames getting into PE Queue and drops them right away.
2160 Frames will be droped in the following scenarios:
2161
2162 - In Scan State, drop the frames which are not marked as scan frames
2163 - In non-Scan state, drop the frames which are marked as scan frames.
2164 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2165 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2166
2167 \param pMac - global mac structure
2168 \return - none
2169 \sa
2170 ----------------------------------------------------------------- */
2171
2172tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2173{
2174 tANI_U32 framelen;
2175 tANI_U8 *pBody;
2176 tSirMacCapabilityInfo capabilityInfo;
2177
2178 /*
2179 *
2180 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2181 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2182 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2183 * other than beacons or probe responses in scan state.
2184 */
2185 if( (subType == SIR_MAC_MGMT_BEACON) ||
2186 (subType == SIR_MAC_MGMT_PROBE_RSP))
2187 {
2188 if(pMac->pmm.inMissedBeaconScenario)
2189 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002190 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2191 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 }
2193 if (limIsSystemInScanState(pMac))
2194 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002195 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002197#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2198 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2199 {
2200 return eMGMT_DROP_NO_DROP;
2201 }
2202#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2204 {
2205 return eMGMT_DROP_SCAN_MODE_FRAME;
2206 }
2207 }
2208
2209 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2210 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2211
2212 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2213 * beacons from an infrastructure network
2214 */
2215 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2216 if(!capabilityInfo.ibss)
2217 return eMGMT_DROP_NO_DROP;
2218#if 0
2219 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2220 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2221 return eMGMT_DROP_NO_DROP;
2222#endif
2223
2224 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2225 if( (subType == SIR_MAC_MGMT_BEACON) ||
2226 (subType == SIR_MAC_MGMT_PROBE_RSP))
2227 {
2228 //drop the frame if length is less than 12
2229 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2230 return eMGMT_DROP_INVALID_SIZE;
2231
2232 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2233
2234 //This can be enhanced to even check the SSID before deciding to enque the frame.
2235 if(capabilityInfo.ess)
2236 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2237 }
2238 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2239 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2240 {
2241 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2242 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2243 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2244 }
2245
2246 return eMGMT_DROP_NO_DROP;
2247}
2248
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002249eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2250{
2251 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002252
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002253 if(psPe)
2254 {
2255 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2256 {
2257 status = eHAL_STATUS_SUCCESS;
2258 }
2259 }
2260 return (status);
2261}
2262eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2263{
2264 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2265 if(psPe)
2266 {
2267 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2268 {
2269 status = eHAL_STATUS_SUCCESS;
2270 }
2271 }
2272 return (status);
2273}