blob: 83bc6020449104ee71a61569cdadc4f9221cb517 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 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/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080024 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam842dad02014-02-18 18:44:02 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam842dad02014-02-18 18:44:02 -080028
29
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080030/*
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * This file limApi.cc contains the functions that are
32 * exported by LIM to other modules.
33 *
34 * Author: Chandra Modumudi
35 * Date: 02/11/02
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41#include "palTypes.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070042#include "wniCfgSta.h"
43#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "sirCommon.h"
45#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046#include "cfgApi.h"
47
48#include "schApi.h"
49#include "utilsApi.h"
50#include "limApi.h"
51#include "limGlobal.h"
52#include "limTypes.h"
53#include "limUtils.h"
54#include "limAssocUtils.h"
55#include "limPropExtsUtils.h"
56#include "limSerDesUtils.h"
57#include "limIbssPeerMgmt.h"
58#include "limAdmitControl.h"
59#include "pmmApi.h"
60#include "logDump.h"
61#include "limSendSmeRspMessages.h"
62#include "wmmApsd.h"
63#include "limTrace.h"
64#include "limSession.h"
65#include "wlan_qct_wda.h"
66
67#if defined WLAN_FEATURE_VOWIFI
68#include "rrmApi.h"
69#endif
70
71#include <limFT.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070072#include "vos_types.h"
73#include "vos_packet.h"
74#include "wlan_qct_tl.h"
75#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076
77
78static void __limInitScanVars(tpAniSirGlobal pMac)
79{
80 pMac->lim.gLimUseScanModeForLearnMode = 1;
81
82 pMac->lim.gLimSystemInScanLearnMode = 0;
83
84 // Scan related globals on STA
85 pMac->lim.gLimReturnAfterFirstMatch = 0;
86 pMac->lim.gLim24Band11dScanDone = 0;
87 pMac->lim.gLim50Band11dScanDone = 0;
88 pMac->lim.gLimReturnUniqueResults = 0;
89
90 // Background Scan related globals on STA
91 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
92 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
93 pMac->lim.gLimNumOfForcedBkgndScan = 0;
94 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
95 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
96 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -080097 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -070098
99 pMac->lim.gLimCurrentScanChannelId = 0;
100 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid440e682013-03-06 02:25:31 -0800101 pMac->lim.gDeferMsgTypeForNOA = 0;
102 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700103 pMac->lim.gLimMlmScanResultLength = 0;
104 pMac->lim.gLimSmeScanResultLength = 0;
105
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530106 vos_mem_set(pMac->lim.gLimCachedScanHashTable,
107 sizeof(pMac->lim.gLimCachedScanHashTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700108
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700109#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
110
111 pMac->lim.gLimMlmLfrScanResultLength = 0;
112 pMac->lim.gLimSmeLfrScanResultLength = 0;
113
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530114 vos_mem_set(pMac->lim.gLimCachedLfrScanHashTable,
115 sizeof(pMac->lim.gLimCachedLfrScanHashTable), 0);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700116#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 pMac->lim.gLimBackgroundScanChannelId = 0;
118 pMac->lim.gLimBackgroundScanStarted = 0;
119 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
120 pMac->lim.gLimRestoreCBCount = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530121 vos_mem_set(pMac->lim.gLimLegacyBssidList,
122 sizeof(pMac->lim.gLimLegacyBssidList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700123
124 /* Fill in default values */
125 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
126
Jeff Johnson295189b2012-06-20 16:38:30 -0700127
128 // abort scan is used to abort an on-going scan
129 pMac->lim.abortScan = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530130 vos_mem_set(&pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo), 0);
131 vos_mem_set(&pMac->lim.dfschannelList, sizeof(tSirDFSChannelList), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700132
133//WLAN_SUSPEND_LINK Related
134 pMac->lim.gpLimSuspendCallback = NULL;
135 pMac->lim.gpLimResumeCallback = NULL;
136//end WLAN_SUSPEND_LINK Related
137}
138
139
140static void __limInitBssVars(tpAniSirGlobal pMac)
141{
142
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530143 vos_mem_set((void*)pMac->lim.gpSession,
144 sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
146
147 //pMac->lim.gpLimStartBssReq = NULL;
148
Jeff Johnson295189b2012-06-20 16:38:30 -0700149
150
151
152/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
153#if 0
154
155 // Place holder for BSS description that we're
156 // currently joined with
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530157 vos_mem_set(&pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700158 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530159 vos_mem_set(&pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700160 pMac->lim.gLimCurrentBssCaps = 0;
161 QosCaps is a bit map of various qos capabilities - see defn above
162 pMac->lim.gLimCurrentBssQosCaps = 0;
163 pMac->lim.gLimCurrentBssPropCap = 0;
164 pMac->lim.gLimSentCapsChangeNtf = 0;
165
166 // Place holder for BSS description that
167 // we're currently Reassociating
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530168 vos_mem_set(&pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700169 pMac->lim.gLimReassocChannelId = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530170 vos_mem_set(&pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 pMac->lim.gLimReassocBssCaps = 0;
172 pMac->lim.gLimReassocBssQosCaps = 0;
173 pMac->lim.gLimReassocBssPropCap = 0;
174 #endif
175
176 /* This is for testing purposes only, be default should always be off */
177 pMac->lim.gLimForceNoPropIE = 0;
178
179 // pMac->lim.gLimBssIdx = 0;
180
181 pMac->lim.gpLimMlmSetKeysReq = NULL;
182 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
183 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
184
185}
186
187
188static void __limInitStatsVars(tpAniSirGlobal pMac)
189{
190 pMac->lim.gLimNumBeaconsRcvd = 0;
191 pMac->lim.gLimNumBeaconsIgnored = 0;
192
193 pMac->lim.gLimNumDeferredMsgs = 0;
194
195 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800196 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
198
199 /// This indicates number of RXed Beacons during HB period
200 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
201
202 // Heart-Beat interval value
203 pMac->lim.gLimHeartBeatCount = 0;
204
205 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530206 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
207 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700208
209#ifdef WLAN_DEBUG
210 // Debug counters
211 pMac->lim.numTot = 0;
212 pMac->lim.numBbt = 0;
213 pMac->lim.numProtErr = 0;
214 pMac->lim.numLearn = 0;
215 pMac->lim.numLearnIgnore = 0;
216 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530217 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700218 pMac->lim.gLimNumAssocReqDropInvldState = 0;
219 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
220 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
221 pMac->lim.gLimNumReassocReqDropInvldState = 0;
222 pMac->lim.gLimNumHashMissIgnored = 0;
223 pMac->lim.gLimUnexpBcnCnt = 0;
224 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
225 pMac->lim.gLimNumLinkEsts = 0;
226 pMac->lim.gLimNumRxCleanup = 0;
227 pMac->lim.gLim11bStaAssocRejectCount = 0;
228#endif
229}
230
231
232
233static void __limInitStates(tpAniSirGlobal pMac)
234{
235 // Counts Heartbeat failures
236 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
237 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
238 pMac->lim.gLimHBfailureCntInOtherStates = 0;
239 pMac->lim.gLimRspReqd = 0;
240 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
241
242 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700243 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700244 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
245
246 /// Previous MLM State
247 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
248
249#ifdef GEN4_SCAN
250 // LIM to HAL SCAN Management Message Interface states
251 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
252#endif // GEN4_SCAN
253
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700255 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700257 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700258
259 /**
260 * By default assume 'unknown' role. This will be updated
261 * when SME_START_BSS_REQ is received.
262 */
263
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530264 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
265 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
266 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
267 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
268 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
269 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700270
271 pMac->lim.gLimPhyMode = 0;
272 pMac->lim.scanStartTime = 0; // used to measure scan time
273
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530274 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 pMac->lim.ackPolicy = 0;
276
277#if 0 /* Moving all these to session specific elements */
278 pMac->lim.gLimQosEnabled = 0; //11E
279 pMac->lim.gLimWmeEnabled = 0; //WME
280 pMac->lim.gLimWsmEnabled = 0; //WSM
281 pMac->lim.gLimHcfEnabled = 0;
282 pMac->lim.gLim11dEnabled = 0;
283#endif
284
285 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
286}
287
288static void __limInitVars(tpAniSirGlobal pMac)
289{
290
Jeff Johnson295189b2012-06-20 16:38:30 -0700291
292 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700293
294 // WDS info
295 pMac->lim.gLimNumWdsInfoInd = 0;
296 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530297 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 /* initialize some parameters */
299 limInitWdsInfoParams(pMac);
300
301 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530302 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700303
304 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530305 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 pMac->lim.gLimAddtsSent = 0;
307 pMac->lim.gLimAddtsRspTimerCount = 0;
308
309 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530310 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530312 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
314
Jeff Johnsone7245742012-09-05 17:12:55 -0700315#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
318 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700319#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 // WMM Related Flag
321 pMac->lim.gUapsdEnable = 0;
322 pMac->lim.gUapsdPerAcBitmask = 0;
323 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
324 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
325
326 // QoS-AC Downgrade: Initially, no AC is admitted
327 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
328 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
329
330 //dialogue token List head/tail for Action frames request sent.
331 pMac->lim.pDialogueTokenHead = NULL;
332 pMac->lim.pDialogueTokenTail = NULL;
333
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530334 vos_mem_set(&pMac->lim.tspecInfo,
335 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700336
337 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530338 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700339
340 pMac->lim.gLastBeaconDtimCount = 0;
341 pMac->lim.gLastBeaconDtimPeriod = 0;
342
343 //Scan in Power Save Flag
344 pMac->lim.gScanInPowersave = 0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800345 pMac->lim.probeCounter = 0;
346 pMac->lim.maxProbe = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700347}
348
349static void __limInitAssocVars(tpAniSirGlobal pMac)
350{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800351 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800352#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530353 vos_mem_set(pMac->lim.gpLimAIDpool,
354 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 pMac->lim.freeAidHead = 0;
356 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800357#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800358 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
359 {
360 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
361 }
362 pMac->lim.gLimAssocStaLimit = val;
Ravi Joshi0fc681b2013-09-11 16:46:07 -0700363 pMac->lim.gLimIbssStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 // Place holder for current authentication request
366 // being handled
367 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700368 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700369
370 /// MAC level Pre-authentication related globals
371 pMac->lim.gLimPreAuthChannelNumber = 0;
372 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530373 vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 pMac->lim.gLimNumPreAuthContexts = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530375 vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 // Placed holder to deauth reason
378 pMac->lim.gLimDeauthReasonCode = 0;
379
380 // Place holder for Pre-authentication node list
381 pMac->lim.pLimPreAuthList = NULL;
382
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530384 vos_mem_set(pMac->lim.protStaOverlapCache,
385 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
386 vos_mem_set(pMac->lim.protStaCache,
387 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700388
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800389#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700390 pMac->lim.pSessionEntry = NULL;
391 pMac->lim.reAssocRetryAttempt = 0;
392#endif
393
Jeff Johnson295189b2012-06-20 16:38:30 -0700394}
395
396
397static void __limInitTitanVars(tpAniSirGlobal pMac)
398{
Jeff Johnsone7245742012-09-05 17:12:55 -0700399#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530400 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700402 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
403#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 // Debug workaround for BEACON's
405 // State change triggered by "dump 222"
406 pMac->lim.gLimScanOverride = 1;
407 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 pMac->lim.gLimTitanStaCount = 0;
409 pMac->lim.gLimBlockNonTitanSta = 0;
410}
411
412static void __limInitHTVars(tpAniSirGlobal pMac)
413{
414 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 pMac->lim.gHTShortGI40Mhz = 0;
417 pMac->lim.gHTShortGI20Mhz = 0;
418 pMac->lim.gHTMaxAmsduLength = 0;
419 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
420 pMac->lim.gHTPSMPSupport = 0;
421 pMac->lim.gHTLsigTXOPProtection = 0;
422 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
423 pMac->lim.gHTAMpduDensity = 0;
424
425 pMac->lim.gMaxAmsduSizeEnabled = false;
426 pMac->lim.gHTMaxRxAMpduFactor = 0;
427 pMac->lim.gHTServiceIntervalGranularity = 0;
428 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
430 pMac->lim.gHTPCOActive = 0;
431
432 pMac->lim.gHTPCOPhase = 0;
433 pMac->lim.gHTSecondaryBeacon = 0;
434 pMac->lim.gHTDualCTSProtection = 0;
435 pMac->lim.gHTSTBCBasicMCS = 0;
436 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
437}
438
Jeff Johnson295189b2012-06-20 16:38:30 -0700439static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
440{
Jeff Johnsone7245742012-09-05 17:12:55 -0700441 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 tANI_U16 val16;
443 tANI_U8 val8;
444 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
445 tSirMacHTInfoField1 *pHTInfoField1;
446 tpSirPowerSaveCfg pPowerSaveConfig;
447 tSirMacHTParametersInfo *pAmpduParamInfo;
448
449 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700450 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
451 * and they will be used throughout when there is no session
452 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
455 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700456 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 return eSIR_FAILURE;
458 }
459
460 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
461 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700462 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return eSIR_FAILURE;
464 }
465 val16 = ( tANI_U16 ) val1;
466 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
467
468 //channel bonding mode could be set to anything from 0 to 4(Titan had these
469 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
470 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
471 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
472 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
473 != eSIR_SUCCESS)
474 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700475 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 return eSIR_FAILURE;
477 }
478
479 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
480 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700481 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 return eSIR_FAILURE;
483 }
484
485 val8 = ( tANI_U8 ) val1;
486 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
487 pHTInfoField1->recommendedTxWidthSet =
488 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
490 != eSIR_SUCCESS)
491 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700492 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 return eSIR_FAILURE;
494 }
495
496 /* WNI_CFG_HEART_BEAT_THRESHOLD */
497
498 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
499 eSIR_SUCCESS )
500 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700501 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 return eSIR_FAILURE;
503 }
504 if(!val1)
505 {
506 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
507 pMac->sys.gSysEnableLinkMonitorMode = 0;
508 }
509 else
510 {
511 //No need to activate the timer during init time.
512 pMac->sys.gSysEnableLinkMonitorMode = 1;
513 }
514
515 /* WNI_CFG_SHORT_GI_20MHZ */
516
517 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
518 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700519 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 return eSIR_FAILURE;
521 }
522 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
523 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700524 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 return eSIR_FAILURE;
526 }
527 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
528 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700529 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 return eSIR_FAILURE;
531 }
532
533 val16 = ( tANI_U16 ) val1;
534 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
535 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
536 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
537
538 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
539 eSIR_SUCCESS)
540 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700541 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 return eSIR_FAILURE;
543 }
544
545 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
546
547 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
548 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700549 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 return eSIR_FAILURE;
551 }
552 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
553 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700554 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 return eSIR_FAILURE;
556 }
557 val16 = ( tANI_U16 ) val1;
558 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
559 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
560 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
561 eSIR_SUCCESS)
562 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700563 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 return eSIR_FAILURE;
565 }
566
567 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
568 limHandleCFGparamUpdate do we want to update this? */
569 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
570 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530571 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 return eSIR_FAILURE;
573 }
574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 /* WNI_CFG_MAX_PS_POLL */
576
577 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530578 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
579 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 {
581 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700582 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 return eSIR_FAILURE;
584 }
585
586 /* This context should be valid if power-save configuration message has been
587 * already dispatched during initialization process. Re-using the present
588 * configuration mask
589 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530590 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
592 /* Note: it is okay to do this since DAL/HAL is alrady started */
593 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
594 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700595 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 return eSIR_FAILURE;
597 }
598
599 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700602 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700604
605 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
606
607 /* This was initially done after resume notification from HAL. Now, DAL is
608 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700609 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800610 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
611 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700612 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800613 return eSIR_FAILURE;
614 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530615#ifdef FEATURE_WLAN_TDLS
616 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
617 {
618 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
619 return eSIR_FAILURE;
620 }
621 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
622 {
623 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
624 return eSIR_FAILURE;
625 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530626 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
627 {
628 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
629 return eSIR_FAILURE;
630 }
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530631
632 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_WMM_MODE_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSWmmMode) != eSIR_SUCCESS)
633 {
634 limLog(pMac, LOGP, FL("cfg get LimTDLSWmmMode failed"));
635 return eSIR_FAILURE;
636 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530637#endif
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530638
Rashmi Ramannac7744532013-10-06 16:49:08 +0530639 if (eSIR_SUCCESS !=
640 wlan_cfgGetInt(pMac, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
641 (tANI_U32 *)&pMac->lim.gDebugP2pRemainOnChannel))
642 {
643 limLog( pMac, LOGE,
644 "%s: Couldn't get WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL value",
645 __func__);
646 pMac->lim.gDebugP2pRemainOnChannel = 0;
647 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 return eSIR_SUCCESS;
649}
Jeff Johnson295189b2012-06-20 16:38:30 -0700650
651/*
652 limStart
653 This function is to replace the __limProcessSmeStartReq since there is no
654 eWNI_SME_START_REQ post to PE.
655*/
656tSirRetStatus limStart(tpAniSirGlobal pMac)
657{
658 tSirResultCodes retCode = eSIR_SUCCESS;
659
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700660 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
663 {
664 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
665
Jeff Johnsone7245742012-09-05 17:12:55 -0700666 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700667
668 // By default do not return after first scan match
669 pMac->lim.gLimReturnAfterFirstMatch = 0;
670
671 // Initialize MLM state machine
672 limInitMlm(pMac);
673
674 // By default return unique scan results
675 pMac->lim.gLimReturnUniqueResults = true;
676 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700677#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
678 pMac->lim.gLimSmeLfrScanResultLength = 0;
679#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 }
681 else
682 {
683 /**
684 * Should not have received eWNI_SME_START_REQ in states
685 * other than OFFLINE. Return response to host and
686 * log error
687 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700688 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 retCode = eSIR_FAILURE;
690 }
691
692 return retCode;
693}
694
695/**
696 * limInitialize()
697 *
698 *FUNCTION:
699 * This function is called from LIM thread entry function.
700 * LIM related global data structures are initialized in this function.
701 *
702 *LOGIC:
703 * NA
704 *
705 *ASSUMPTIONS:
706 * NA
707 *
708 *NOTE:
709 * NA
710 *
711 * @param pMac - Pointer to global MAC structure
712 * @return None
713 */
714
715tSirRetStatus
716limInitialize(tpAniSirGlobal pMac)
717{
718 tSirRetStatus status = eSIR_SUCCESS;
719
720 __limInitAssocVars(pMac);
721 __limInitVars(pMac);
722 __limInitStates(pMac);
723 __limInitStatsVars(pMac);
724 __limInitBssVars(pMac);
725 __limInitScanVars(pMac);
726 __limInitHTVars(pMac);
727 __limInitTitanVars(pMac);
728
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 status = limStart(pMac);
730 if(eSIR_SUCCESS != status)
731 {
732 return status;
733 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
735 /*
736 * MLM will be intitalized when 'START' request comes from SME.
737 * limInitMlm calls limCreateTimers, which actually relies on
738 * CFG to be downloaded. So it should not be called as part of
739 * peStart, as CFG download is happening after peStart.
740 */
741 //limInitMlm(pMac);
742 // Initializations for maintaining peers in IBSS
743 limIbssInit(pMac);
744
745 pmmInitialize(pMac);
746
747
748#if defined WLAN_FEATURE_VOWIFI
749 rrmInitialize(pMac);
750#endif
751#if defined WLAN_FEATURE_VOWIFI_11R
752 limFTOpen(pMac);
753#endif
754
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700756
757#if 0
758
759 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
760 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
761 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
762
763 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
764 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
765
766 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
767 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
768 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
769
770 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
771
772 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
773
774 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
775 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
776
777 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
778
779
780 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
781
782 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
783#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700784
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 //Initialize the configurations needed by PE
786 if( eSIR_FAILURE == __limInitConfig(pMac))
787 {
788 //We need to undo everything in limStart
789 limCleanupMlm(pMac);
790 return eSIR_FAILURE;
791 }
792
793 //initialize the TSPEC admission control table.
794 //Note that this was initially done after resume notification from HAL.
795 //Now, DAL is started before PE so this can be done here
796 limAdmitControlInit(pMac);
797 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700798
799 return status;
800
801} /*** end limInitialize() ***/
802
803
804
805/**
806 * limCleanup()
807 *
808 *FUNCTION:
809 * This function is called upon reset or persona change
810 * to cleanup LIM state
811 *
812 *LOGIC:
813 * NA
814 *
815 *ASSUMPTIONS:
816 * NA
817 *
818 *NOTE:
819 * NA
820 *
821 * @param pMac - Pointer to Global MAC structure
822 * @return None
823 */
824
825void
826limCleanup(tpAniSirGlobal pMac)
827{
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 v_PVOID_t pvosGCTx;
829 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700830
Jeff Johnson295189b2012-06-20 16:38:30 -0700831//Before destroying the list making sure all the nodes have been deleted.
832//Which should be the normal case, but a memory leak has been reported.
833
834 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
835
836 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
837 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
838 {
839 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
840 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
841
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530842 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 }
844
845 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700846
847 limCleanupMlm(pMac);
848 limCleanupLmm(pMac);
849
850 // free up preAuth table
851 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
852 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530853 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
855 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
856 }
857
858 if(NULL != pMac->lim.pDialogueTokenHead)
859 {
860 limDeleteDialogueTokenList(pMac);
861 }
862
863 if(NULL != pMac->lim.pDialogueTokenTail)
864 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530865 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 pMac->lim.pDialogueTokenTail = NULL;
867 }
868
869 # if 0
870 if (pMac->lim.gpLimStartBssReq != NULL)
871 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530872 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 pMac->lim.gpLimStartBssReq = NULL;
874 }
875 #endif
876
877 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
878 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530879 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 pMac->lim.gpLimMlmSetKeysReq = NULL;
881 }
882
883 #if 0
884 if (pMac->lim.gpLimJoinReq != NULL)
885 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530886 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 pMac->lim.gpLimJoinReq = NULL;
888 }
889 #endif
890
891 if (pMac->lim.gpLimMlmAuthReq != NULL)
892 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530893 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 pMac->lim.gpLimMlmAuthReq = NULL;
895 }
896
Jeff Johnsone7245742012-09-05 17:12:55 -0700897#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 if (pMac->lim.gpLimMlmJoinReq != NULL)
899 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530900 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 pMac->lim.gpLimMlmJoinReq = NULL;
902 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700903#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700904
905 #if 0
906 if (pMac->lim.gpLimReassocReq != NULL)
907 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530908 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 pMac->lim.gpLimReassocReq = NULL;
910 }
911 #endif
912
913 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
914 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530915 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
917 }
918
Viral Modid440e682013-03-06 02:25:31 -0800919 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800920 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530921 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800922 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800923 }
Viral Modid86bde22012-12-10 13:09:21 -0800924
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 if (pMac->lim.gpLimMlmScanReq != NULL)
926 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530927 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 pMac->lim.gpLimMlmScanReq = NULL;
929 }
930
931#if 0
932 if(NULL != pMac->lim.beacon)
933 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530934 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 pMac->lim.beacon = NULL;
936 }
937#endif
938 #if 0
939 if(NULL != pMac->lim.assocReq)
940 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530941 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 pMac->lim.assocReq= NULL;
943 }
944 #endif
945
946#if 0
947 if(NULL != pMac->lim.assocRsp)
948 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530949 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 pMac->lim.assocRsp= NULL;
951 }
952#endif
953 // Now, finally reset the deferred message queue pointers
954 limResetDeferredMsgQ(pMac);
955
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
957 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
958 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
959
960 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700961 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700962
963#if defined WLAN_FEATURE_VOWIFI
964 rrmCleanup(pMac);
965#endif
966#if defined WLAN_FEATURE_VOWIFI_11R
967 limFTCleanup(pMac);
968#endif
969
970} /*** end limCleanup() ***/
971
972
973/** -------------------------------------------------------------
974\fn peOpen
975\brief will be called in Open sequence from macOpen
976\param tpAniSirGlobal pMac
977\param tHalOpenParameters *pHalOpenParam
978\return tSirRetStatus
979 -------------------------------------------------------------*/
980
981tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
982{
983 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
984 pMac->lim.maxStation = pMacOpenParam->maxStation;
985
986 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
987 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700988 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 return eSIR_FAILURE;
990 }
991
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530992 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
993 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700995 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 return eSIR_FAILURE;
997 }
998
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800999#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301000 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
1001 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001003 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 return eSIR_FAILURE;
1005 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001006#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301007 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
1008 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001010 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 return eSIR_FAILURE;
1012 }
1013
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301014 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001015
1016
1017 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301018 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1019 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001021 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 return eSIR_FAILURE;
1023 }
1024
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301025 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1026 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001028 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 return eSIR_FAILURE;
1030 }
1031 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301032 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1033 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001035 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 return eSIR_FAILURE;
1037 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301038 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001040 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001041 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001042
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001043 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1044 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001045 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001046 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1047 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1048 vos_mem_free(pMac->lim.gpSession);
1049 pMac->lim.gpSession = NULL;
1050 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1051 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001052 return eSIR_FAILURE;
1053 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001054 pMac->lim.deauthMsgCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001055
1056 /*
1057 * peOpen is successful by now, so it is right time to initialize
1058 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1059 * then nothing will be logged for PE module.
1060 */
1061#ifdef LIM_TRACE_RECORD
1062 MTRACE(limTraceInit(pMac));
1063#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 return eSIR_SUCCESS;
1065}
1066
1067/** -------------------------------------------------------------
1068\fn peClose
1069\brief will be called in close sequence from macClose
1070\param tpAniSirGlobal pMac
1071\return tSirRetStatus
1072 -------------------------------------------------------------*/
1073
1074tSirRetStatus peClose(tpAniSirGlobal pMac)
1075{
1076 tANI_U8 i;
1077
1078 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1079 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001080
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 for(i =0; i < pMac->lim.maxBssId; i++)
1082 {
1083 if(pMac->lim.gpSession[i].valid == TRUE)
1084 {
1085 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1086 }
1087 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301088 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001089 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001090#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301091 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001092 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001093#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001094
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301095 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 pMac->lim.gpSession = NULL;
1097 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301098 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301100 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1102 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301103 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001105 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1106 {
1107 return eSIR_FAILURE;
1108 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 return eSIR_SUCCESS;
1110}
1111
1112/** -------------------------------------------------------------
1113\fn peStart
1114\brief will be called in start sequence from macStart
1115\param tpAniSirGlobal pMac
1116\return none
1117 -------------------------------------------------------------*/
1118
1119tSirRetStatus peStart(tpAniSirGlobal pMac)
1120{
1121 tSirRetStatus status = eSIR_SUCCESS;
1122
1123 status = limInitialize(pMac);
1124#if defined(ANI_LOGDUMP)
1125 limDumpInit(pMac);
1126#endif //#if defined(ANI_LOGDUMP)
1127
1128 return status;
1129}
1130
1131/** -------------------------------------------------------------
1132\fn peStop
1133\brief will be called in stop sequence from macStop
1134\param tpAniSirGlobal pMac
1135\return none
1136 -------------------------------------------------------------*/
1137
1138void peStop(tpAniSirGlobal pMac)
1139{
1140 limCleanup(pMac);
1141 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1142 return;
1143}
1144
1145/** -------------------------------------------------------------
1146\fn peFreeMsg
1147\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1148\ to free a given PE message on the TX and MC thread.
1149\ This happens when there are messages pending in the PE
1150\ queue when system is being stopped and reset.
1151\param tpAniSirGlobal pMac
1152\param tSirMsgQ pMsg
1153\return none
1154-----------------------------------------------------------------*/
1155v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1156{
1157 if (pMsg != NULL)
1158 {
1159 if (NULL != pMsg->bodyptr)
1160 {
1161 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1162 {
1163 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1164 }
1165 else
1166 {
1167 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1168 }
1169 }
1170 pMsg->bodyptr = 0;
1171 pMsg->bodyval = 0;
1172 pMsg->type = 0;
1173 }
1174 return;
1175}
1176
1177
1178/**
1179 * The function checks if a particular timer should be allowed
1180 * into LIM while device is sleeping
1181 */
1182tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1183{
1184 tANI_U8 retStatus = TRUE;
1185
1186 if(!limIsSystemInActiveState(pMac))
1187 {
1188 switch(pMsg->type)
1189 {
1190 /* Don't allow following timer messages if in sleep */
1191 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1192 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1193 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1194 retStatus = FALSE;
1195 break;
1196 /* May allow following timer messages in sleep mode */
Jeff Johnson295189b2012-06-20 16:38:30 -07001197
1198 /* Safe to allow as of today, this triggers background scan
1199 * which will not be started if the device is in power-save mode
1200 * might need to block in the future if we decide to implement
1201 * spectrum management
1202 */
1203 case SIR_LIM_QUIET_TIMEOUT:
1204
1205 /* Safe to allow as of today, this triggers background scan
1206 * which will not be started if the device is in power-save mode
1207 * might need to block in the future if we decide to implement
1208 * spectrum management
1209 */
1210 case SIR_LIM_QUIET_BSS_TIMEOUT:
1211
1212 /* Safe to allow this timermessage, triggers background scan
1213 * which is blocked in sleep mode
1214 */
1215 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1216
1217 /* Safe to allow this timer, since, while in IMPS this timer will not
1218 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1219 * when heart-beat control is handled back to PE, device would have
1220 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1221 */
1222 case SIR_LIM_HEART_BEAT_TIMEOUT:
1223 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1224
1225 /* Safe to allow, PE is not handling this message as of now. May need
1226 * to block it, basically, free the buffer and restart the timer
1227 */
1228 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1229 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001230 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1232 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1233 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1234 retStatus = TRUE;
1235 break;
1236
1237 /* by default allow rest of messages */
1238 default:
1239 retStatus = TRUE;
1240 break;
1241
1242
1243 }
1244 }
1245
1246 return retStatus;
1247
1248}
1249
1250
1251
1252/**
1253 * limPostMsgApi()
1254 *
1255 *FUNCTION:
1256 * This function is called from other thread while posting a
1257 * message to LIM message Queue gSirLimMsgQ.
1258 *
1259 *LOGIC:
1260 * NA
1261 *
1262 *ASSUMPTIONS:
1263 * NA
1264 *
1265 *NOTE:
1266 * NA
1267 *
1268 * @param pMac - Pointer to Global MAC structure
1269 * @param pMsg - Pointer to the message structure
1270 * @return None
1271 */
1272
1273tANI_U32
1274limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1275{
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1277
1278
Jeff Johnson295189b2012-06-20 16:38:30 -07001279} /*** end limPostMsgApi() ***/
1280
1281
1282/*--------------------------------------------------------------------------
1283
1284 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1285
1286 This function can be called by legacy code to post message to voss queues OR
1287 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1288 for dispatching it later.
1289
1290 \param pMac - Pointer to Global MAC structure
1291 \param pMsg - Pointer to the message structure
1292
1293 \return tANI_U32 - TX_SUCCESS for success.
1294
1295 --------------------------------------------------------------------------*/
1296
1297tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1298{
1299 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1300}
1301
1302/*--------------------------------------------------------------------------
1303
1304 \brief peProcessMessages() - Message Processor for PE
1305
1306 Voss calls this function to dispatch the message to PE
1307
1308 \param pMac - Pointer to Global MAC structure
1309 \param pMsg - Pointer to the message structure
1310
1311 \return tANI_U32 - TX_SUCCESS for success.
1312
1313 --------------------------------------------------------------------------*/
1314
1315tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1316{
1317 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1318 {
1319 return eSIR_SUCCESS;
1320 }
1321 /**
1322 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1323 * for all the other cases post it to LIM
1324 */
1325 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1326 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1327 else
1328 limMessageProcessor(pMac, pMsg);
1329 return eSIR_SUCCESS;
1330}
1331
1332
Jeff Johnson295189b2012-06-20 16:38:30 -07001333
1334// ---------------------------------------------------------------------------
1335/**
1336 * peHandleMgmtFrame
1337 *
1338 * FUNCTION:
1339 * Process the Management frames from TL
1340 *
1341 * LOGIC:
1342 *
1343 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1344 *
1345 * NOTE:
1346 *
1347 * @param pvosGCtx Global Vos Context
1348 * @param vossBuff Packet
1349 * @return None
1350 */
1351
1352VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1353{
1354 tpAniSirGlobal pMac;
1355 tpSirMacMgmtHdr mHdr;
1356 tSirMsgQ msg;
1357 vos_pkt_t *pVosPkt;
1358 VOS_STATUS vosStatus;
1359 v_U8_t *pRxPacketInfo;
1360
1361 pVosPkt = (vos_pkt_t *)vosBuff;
1362 if (NULL == pVosPkt)
1363 {
1364 return VOS_STATUS_E_FAILURE;
1365 }
1366
1367 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1368 if (NULL == pMac)
1369 {
1370 // cannot log a failure without a valid pMac
1371 vos_pkt_return_packet(pVosPkt);
1372 return VOS_STATUS_E_FAILURE;
1373 }
1374
1375 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1376
1377 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1378 {
1379 vos_pkt_return_packet(pVosPkt);
1380 return VOS_STATUS_E_FAILURE;
1381 }
1382
1383
1384 //
1385 // The MPDU header is now present at a certain "offset" in
1386 // the BD and is specified in the BD itself
1387 //
1388 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1389 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1390 {
1391 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001392 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001393 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001394
Jeff Johnsone7245742012-09-05 17:12:55 -07001395 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1397 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1398 }
1399
1400
1401 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1402 msg.type = SIR_BB_XPORT_MGMT_MSG;
1403 msg.bodyptr = vosBuff;
1404 msg.bodyval = 0;
1405
1406 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1407 &msg,
1408 mHdr->fc.type,
1409 mHdr->fc.subType ))
1410 {
1411 vos_pkt_return_packet(pVosPkt);
1412 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001413 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 return VOS_STATUS_E_FAILURE;
1415 }
1416
1417 return VOS_STATUS_SUCCESS;
1418}
1419
1420// ---------------------------------------------------------------------------
1421/**
1422 * peRegisterTLHandle
1423 *
1424 * FUNCTION:
1425 * Registers the Handler which, process the Management frames from TL
1426 *
1427 * LOGIC:
1428 *
1429 * ASSUMPTIONS:
1430 *
1431 * NOTE:
1432 *
1433 * @return None
1434 */
1435
1436void peRegisterTLHandle(tpAniSirGlobal pMac)
1437{
1438 v_PVOID_t pvosGCTx;
1439 VOS_STATUS retStatus;
1440
1441 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1442
1443 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1444
1445 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001446 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
1448}
Jeff Johnson295189b2012-06-20 16:38:30 -07001449
1450
1451/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001452 * limIsSystemInScanState()
1453 *
1454 *FUNCTION:
1455 * This function is called by various MAC software modules to
1456 * determine if System is in Scan/Learn state
1457 *
1458 *LOGIC:
1459 * NA
1460 *
1461 *ASSUMPTIONS:
1462 * NA
1463 *
1464 *NOTE:
1465 *
1466 * @param pMac - Pointer to Global MAC structure
1467 * @return true - System is in Scan/Learn state
1468 * false - System is NOT in Scan/Learn state
1469 */
1470
1471tANI_U8
1472limIsSystemInScanState(tpAniSirGlobal pMac)
1473{
1474 switch (pMac->lim.gLimSmeState)
1475 {
1476 case eLIM_SME_CHANNEL_SCAN_STATE:
1477 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1478 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1479 case eLIM_SME_WT_SCAN_STATE:
1480 // System is in Learn mode
1481 return true;
1482
1483 default:
1484 // System is NOT in Learn mode
1485 return false;
1486 }
1487} /*** end limIsSystemInScanState() ***/
1488
1489
1490
1491/**
1492 * limIsSystemInActiveState()
1493 *
1494 *FUNCTION:
1495 * This function is called by various MAC software modules to
1496 * determine if System is in Active/Wakeup state
1497 *
1498 *LOGIC:
1499 * NA
1500 *
1501 *ASSUMPTIONS:
1502 * NA
1503 *
1504 *NOTE:
1505 *
1506 * @param pMac - Pointer to Global MAC structure
1507 * @return true - System is in Active state
1508 * false - System is not in Active state
1509 */
1510
1511tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1512{
1513 switch (pMac->pmm.gPmmState)
1514 {
1515 case ePMM_STATE_BMPS_WAKEUP:
1516 case ePMM_STATE_IMPS_WAKEUP:
1517 case ePMM_STATE_READY:
1518 // System is in Active mode
1519 return true;
1520 default:
1521 return false;
1522 // System is NOT in Active mode
1523 }
1524}
1525
1526
Jeff Johnson295189b2012-06-20 16:38:30 -07001527
Jeff Johnson295189b2012-06-20 16:38:30 -07001528
1529
1530/**
1531*\brief limReceivedHBHandler()
1532*
1533* This function is called by schBeaconProcess() upon
1534* receiving a Beacon on STA. This also gets called upon
1535* receiving Probe Response after heat beat failure is
1536* detected.
1537*
1538* param pMac - global mac structure
1539* param channel - channel number indicated in Beacon, Probe Response
1540* return - none
1541*/
1542
1543
1544void
1545limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1546{
1547 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1548 psessionEntry->LimRxedBeaconCntDuringHB++;
1549
1550 pMac->pmm.inMissedBeaconScenario = FALSE;
1551} /*** end limReceivedHBHandler() ***/
1552
1553
1554
1555#if 0
1556void limResetHBPktCount(tpPESession psessionEntry)
1557{
1558 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1559}
1560#endif
1561
1562
1563/*
1564 * limProcessWdsInfo()
1565 *
1566 *FUNCTION:
1567 * This function is called from schBeaconProcess in BP
1568 *
1569 *PARAMS:
1570 * @param pMac - Pointer to Global MAC structure
1571 * @param propIEInfo - proprietary IE info
1572 *
1573 *LOGIC:
1574 *
1575 *ASSUMPTIONS:
1576 * NA
1577 *
1578 *NOTE:
1579 *
1580 *
1581 *RETURNS:
1582 *
1583 */
1584
1585void limProcessWdsInfo(tpAniSirGlobal pMac,
1586 tSirPropIEStruct propIEInfo)
1587{
Jeff Johnson295189b2012-06-20 16:38:30 -07001588}
1589
1590
1591
1592/**
1593 * limInitWdsInfoParams()
1594 *
1595 *FUNCTION:
1596 * This function is called while processing
1597 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1598 * ind/set related parameters.
1599 *
1600 *LOGIC:
1601 *
1602 *ASSUMPTIONS:
1603 *
1604 *NOTE:
1605 *
1606 * @param pMac Pointer to Global MAC structure
1607 * @return None
1608 */
1609
1610void
1611limInitWdsInfoParams(tpAniSirGlobal pMac)
1612{
1613 pMac->lim.gLimWdsInfo.wdsLength = 0;
1614 pMac->lim.gLimNumWdsInfoInd = 0;
1615 pMac->lim.gLimNumWdsInfoSet = 0;
1616} /*** limInitWdsInfoParams() ***/
1617
1618
1619/** -------------------------------------------------------------
1620\fn limUpdateOverlapStaParam
1621\brief Updates overlap cache and param data structure
1622\param tpAniSirGlobal pMac
1623\param tSirMacAddr bssId
1624\param tpLimProtStaParams pStaParams
1625\return None
1626 -------------------------------------------------------------*/
1627void
1628limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1629{
1630 int i;
1631 if (!pStaParams->numSta)
1632 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301633 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1634 bssId,
1635 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 pMac->lim.protStaOverlapCache[0].active = true;
1637
1638 pStaParams->numSta = 1;
1639
1640 return;
1641 }
1642
1643 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1644 {
1645 if (pMac->lim.protStaOverlapCache[i].active)
1646 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301647 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 bssId,
1649 sizeof(tSirMacAddr))) {
1650 return; }
1651 }
1652 else
1653 break;
1654 }
1655
1656 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1657 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301658 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 }
1660 else
1661 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301662 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1663 bssId,
1664 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 pMac->lim.protStaOverlapCache[i].active = true;
1666
1667 pStaParams->numSta++;
1668 }
1669}
1670
1671
1672/**
1673 * limHandleIBSScoalescing()
1674 *
1675 *FUNCTION:
1676 * This function is called upon receiving Beacon/Probe Response
1677 * while operating in IBSS mode.
1678 *
1679 *LOGIC:
1680 *
1681 *ASSUMPTIONS:
1682 *
1683 *NOTE:
1684 *
1685 * @param pMac - Pointer to Global MAC structure
1686 * @param pBeacon - Parsed Beacon Frame structure
1687 * @param pRxPacketInfo - Pointer to RX packet info structure
1688 *
1689 * @return Status whether to process or ignore received Beacon Frame
1690 */
1691
1692tSirRetStatus
1693limHandleIBSScoalescing(
1694 tpAniSirGlobal pMac,
1695 tpSchBeaconStruct pBeacon,
1696 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1697{
1698 tpSirMacMgmtHdr pHdr;
1699 tSirRetStatus retCode;
1700
1701 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001702 if ( (!pBeacon->capabilityInfo.ibss) ||
Abhishek Singhd5c31272014-03-07 14:46:50 +05301703 ( psessionEntry->privacy !=
1704 (tANI_U8)pBeacon->capabilityInfo.privacy ) ||
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001705 (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 ) &&
Abhishek Singh4f8446a2014-05-22 14:07:31 +05301761 ( ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1762 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ||
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301763 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1764 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1765 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1766 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1767 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1768 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1769 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1770 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1771 ( newChannel != psessionEntry->currentOperChannel )
1772 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301773 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301774 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301775 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301776 /* If Beacon capabilities is not matching with the current capability,
1777 * then send unicast probe request to AP and take decision after
1778 * receiving probe response */
1779 if ( true == psessionEntry->fIgnoreCapsChange )
1780 {
1781 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1782 return;
1783 }
1784 psessionEntry->fWaitForProbeRsp = true;
1785 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1786 "sending directed probe request.. "));
1787 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1788 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1789 psessionEntry->dot11mode, 0, NULL);
1790
1791 if ( eSIR_SUCCESS != status )
1792 {
1793 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1794 psessionEntry->fWaitForProbeRsp = false;
1795 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301796 return;
1797 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 /**
1799 * BSS capabilities have changed.
1800 * Inform Roaming.
1801 */
1802 len = sizeof(tSirMacCapabilityInfo) +
1803 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1804 3 * sizeof(tANI_U8) + // reserved fields
1805 pBeacon->ssId.length + 1;
1806
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301807 vos_mem_copy(apNewCaps.bssId,
1808 psessionEntry->bssId,
1809 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 if (newChannel != psessionEntry->currentOperChannel)
1811 {
1812 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001813 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 psessionEntry->currentOperChannel, newChannel);)
1815 return;
1816 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301817
1818 /**
1819 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1820 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1821 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1822 * the privacy bit is set in Probe and association responses.
1823 * Due to this anomaly, we detect a change in
1824 * AP capabilities when we receive a beacon after association and
1825 * disconnect from the AP. The following check makes sure that we can
1826 * connect to such APs
1827 */
1828 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1829 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1830 {
1831 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001832 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301833 return;
1834 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 else
1836 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301837 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1838 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 pBeacon->ssId.length + 1);
1840
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301841 psessionEntry->fIgnoreCapsChange = false;
1842 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 psessionEntry->limSentCapsChangeNtf = true;
1844 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1845 (tANI_U32 *) &apNewCaps,
1846 len, psessionEntry->smeSessionId);
1847 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301848 else if ( true == psessionEntry->fWaitForProbeRsp )
1849 {
1850 /* Only for probe response frames and matching capabilities the control
1851 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1852 * will be false, the control will not come here*/
1853
1854 limLog(pMac, LOG1, FL("capabilities in probe response are"
1855 "matching with the current setting,"
1856 "Ignoring subsequent capability"
1857 "mismatch"));
1858 psessionEntry->fIgnoreCapsChange = true;
1859 psessionEntry->fWaitForProbeRsp = false;
1860 }
1861
Jeff Johnson295189b2012-06-20 16:38:30 -07001862} /*** limDetectChangeInApCapabilities() ***/
1863
1864
1865
1866
1867// ---------------------------------------------------------------------
1868/**
1869 * limUpdateShortSlot
1870 *
1871 * FUNCTION:
1872 * Enable/Disable short slot
1873 *
1874 * LOGIC:
1875 *
1876 * ASSUMPTIONS:
1877 *
1878 * NOTE:
1879 *
1880 * @param enable Flag to enable/disable short slot
1881 * @return None
1882 */
1883
1884tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1885{
1886
1887 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001888 tANI_U32 nShortSlot;
1889 tANI_U32 val = 0;
1890 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001891
Jeff Johnsone7245742012-09-05 17:12:55 -07001892 // Check Admin mode first. If it is disabled just return
1893 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1894 != eSIR_SUCCESS)
1895 {
1896 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001897 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001898 return eSIR_FAILURE;
1899 }
1900 if (val == false)
1901 return eSIR_SUCCESS;
1902
1903 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1904 limGetPhyMode(pMac, &phyMode, psessionEntry);
1905 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1906 return eSIR_SUCCESS;
1907
1908 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001909
1910 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1911 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1912 // if no erp present, use short slot based on current ap caps
1913
1914 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1915
1916 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1917 // The difference between the earlier implementation and the new one is only Case4.
1918 /*
1919 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1920 Case1 1 1 1 1 //AP should not advertise this combination.
1921 Case2 1 1 0 0
1922 Case3 1 0 1 1
1923 Case4 1 0 0 0
1924 Case5 0 1 1 1
1925 Case6 0 1 0 0
1926 Case7 0 0 1 1
1927 Case8 0 0 0 0
1928 */
1929 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1930
Jeff Johnsone7245742012-09-05 17:12:55 -07001931 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 {
1933 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001934 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001936 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1938 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 }
1940 return eSIR_SUCCESS;
1941}
1942
1943
Jeff Johnson295189b2012-06-20 16:38:30 -07001944
1945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
1948
1949/** -----------------------------------------------------------------
1950 \brief limHandleLowRssiInd() - handles low rssi indication
1951
1952 This function process the SIR_HAL_LOW_RSSI_IND message from
1953 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1954
1955 \param pMac - global mac structure
1956
1957 \return
1958
1959 \sa
1960 ----------------------------------------------------------------- */
1961void limHandleLowRssiInd(tpAniSirGlobal pMac)
1962{
1963#if 0 //RSSI related indications will now go to TL and not PE
1964 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1965 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1966 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1967 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001968 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1970 }
1971 else
1972 {
1973 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001974 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 pMac->pmm.gPmmState);
1976 }
1977 return;
1978#endif
1979}
1980
1981
1982/** -----------------------------------------------------------------
1983 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1984
1985 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1986 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1987 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1988
1989 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1990 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1991 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1992 This message can also come from FW anytime after we have entered BMPS.
1993 This means we should handle it in WoWL and UAPSD states as well
1994
1995 \param pMac - global mac structure
1996 \return - none
1997 \sa
1998 ----------------------------------------------------------------- */
1999void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2000{
2001 switch(pMac->pmm.gPmmState)
2002 {
2003 case ePMM_STATE_BMPS_SLEEP:
2004 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2005 case ePMM_STATE_UAPSD_SLEEP:
2006 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2007 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002008 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2010 break;
2011
2012 default:
2013 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002014 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 pMac->pmm.gPmmState);
2016 break;
2017 }
2018 return;
2019}
2020
2021
2022/** -----------------------------------------------------------------
2023 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2024
2025 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2026 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2027 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2028
2029 \param pMac - global mac structure
2030 \return - none
2031 \sa
2032 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002033void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002034{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002035#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2036 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2037 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2038 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2039 if (psessionEntry == NULL)
2040 {
2041 limLog(pMac, LOGE,
2042 FL("session does not exist for given BSSIdx:%d"),
2043 pSirMissedBeaconInd->bssIdx);
2044 return;
2045 }
2046#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2048 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2049 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2050 {
2051 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302052 PELOGE(limLog(pMac, LOGE,
2053 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2055 }
Yathish9f22e662012-12-10 14:21:35 -08002056/* ACTIVE_MODE_HB_OFFLOAD */
2057#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2058 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2059 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2060 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2061 {
2062 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002063 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002064 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002065 }
2066#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 else
2068 {
2069 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002070 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 pMac->pmm.gPmmState);
2072 }
2073 return;
2074}
2075
2076/** -----------------------------------------------------------------
2077 \brief limMicFailureInd() - handles mic failure indication
2078
2079 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2080
2081 \param pMac - global mac structure
2082 \return - none
2083 \sa
2084 ----------------------------------------------------------------- */
2085void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2086{
2087 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2088 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2089 tSirMsgQ mmhMsg;
2090 tpPESession psessionEntry ;
2091 tANI_U8 sessionId;
2092
2093 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2094 {
2095 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002096 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 return;
2098 }
2099
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302100 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2101 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 {
2103 // Log error
2104 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002105 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 return;
2107 }
2108
2109 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2110 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2111 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2112
2113 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302114 pSirMicFailureInd->bssId,
2115 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002116
2117 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302118 pSirMicFailureInd->info.srcMacAddr,
2119 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002120
2121 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302122 pSirMicFailureInd->info.taMacAddr,
2123 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002124
2125 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302126 pSirMicFailureInd->info.dstMacAddr,
2127 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002128
2129 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302130 pSirMicFailureInd->info.rxMacAddr,
2131 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002132
2133 pSirSmeMicFailureInd->info.multicast =
2134 pSirMicFailureInd->info.multicast;
2135
2136 pSirSmeMicFailureInd->info.keyId=
2137 pSirMicFailureInd->info.keyId;
2138
2139 pSirSmeMicFailureInd->info.IV1=
2140 pSirMicFailureInd->info.IV1;
2141
2142 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302143 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144
2145 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2146 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2147 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002148 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2150 return;
2151}
2152
2153
2154/** -----------------------------------------------------------------
2155 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2156
2157 This function is called before enqueuing the frame to PE queue for further processing.
2158 This prevents unnecessary frames getting into PE Queue and drops them right away.
2159 Frames will be droped in the following scenarios:
2160
2161 - In Scan State, drop the frames which are not marked as scan frames
2162 - In non-Scan state, drop the frames which are marked as scan frames.
2163 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2164 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2165
2166 \param pMac - global mac structure
2167 \return - none
2168 \sa
2169 ----------------------------------------------------------------- */
2170
2171tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2172{
2173 tANI_U32 framelen;
2174 tANI_U8 *pBody;
2175 tSirMacCapabilityInfo capabilityInfo;
2176
2177 /*
2178 *
2179 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2180 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2181 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2182 * other than beacons or probe responses in scan state.
2183 */
2184 if( (subType == SIR_MAC_MGMT_BEACON) ||
2185 (subType == SIR_MAC_MGMT_PROBE_RSP))
2186 {
2187 if(pMac->pmm.inMissedBeaconScenario)
2188 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002189 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2190 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192 if (limIsSystemInScanState(pMac))
2193 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002194 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002196#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2197 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2198 {
2199 return eMGMT_DROP_NO_DROP;
2200 }
2201#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2203 {
2204 return eMGMT_DROP_SCAN_MODE_FRAME;
2205 }
2206 }
2207
2208 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2209 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2210
2211 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2212 * beacons from an infrastructure network
2213 */
2214 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2215 if(!capabilityInfo.ibss)
2216 return eMGMT_DROP_NO_DROP;
2217#if 0
2218 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2219 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2220 return eMGMT_DROP_NO_DROP;
2221#endif
2222
2223 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2224 if( (subType == SIR_MAC_MGMT_BEACON) ||
2225 (subType == SIR_MAC_MGMT_PROBE_RSP))
2226 {
2227 //drop the frame if length is less than 12
2228 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2229 return eMGMT_DROP_INVALID_SIZE;
2230
2231 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2232
2233 //This can be enhanced to even check the SSID before deciding to enque the frame.
2234 if(capabilityInfo.ess)
2235 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2236 }
2237 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2238 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2239 {
2240 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2241 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2242 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2243 }
2244
2245 return eMGMT_DROP_NO_DROP;
2246}
2247
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002248eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2249{
2250 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002251
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002252 if(psPe)
2253 {
2254 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2255 {
2256 status = eHAL_STATUS_SUCCESS;
2257 }
2258 }
2259 return (status);
2260}
2261eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2262{
2263 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2264 if(psPe)
2265 {
2266 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2267 {
2268 status = eHAL_STATUS_SUCCESS;
2269 }
2270 }
2271 return (status);
2272}