blob: c7ac83b60d2c5b3a464540372c312bed27e6a263 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -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
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
24 * 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
383 // Send Disassociate frame threshold parameters
384 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
385 pMac->lim.gLimDisassocFrameCredit = 0;
386
387 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530388 vos_mem_set(pMac->lim.protStaOverlapCache,
389 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
390 vos_mem_set(pMac->lim.protStaCache,
391 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700392
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700393#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
394 pMac->lim.pSessionEntry = NULL;
395 pMac->lim.reAssocRetryAttempt = 0;
396#endif
397
Jeff Johnson295189b2012-06-20 16:38:30 -0700398}
399
400
401static void __limInitTitanVars(tpAniSirGlobal pMac)
402{
Jeff Johnsone7245742012-09-05 17:12:55 -0700403#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530404 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700406 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
407#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 // Debug workaround for BEACON's
409 // State change triggered by "dump 222"
410 pMac->lim.gLimScanOverride = 1;
411 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 pMac->lim.gLimTitanStaCount = 0;
413 pMac->lim.gLimBlockNonTitanSta = 0;
414}
415
416static void __limInitHTVars(tpAniSirGlobal pMac)
417{
418 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 pMac->lim.gHTShortGI40Mhz = 0;
421 pMac->lim.gHTShortGI20Mhz = 0;
422 pMac->lim.gHTMaxAmsduLength = 0;
423 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
424 pMac->lim.gHTPSMPSupport = 0;
425 pMac->lim.gHTLsigTXOPProtection = 0;
426 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
427 pMac->lim.gHTAMpduDensity = 0;
428
429 pMac->lim.gMaxAmsduSizeEnabled = false;
430 pMac->lim.gHTMaxRxAMpduFactor = 0;
431 pMac->lim.gHTServiceIntervalGranularity = 0;
432 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
434 pMac->lim.gHTPCOActive = 0;
435
436 pMac->lim.gHTPCOPhase = 0;
437 pMac->lim.gHTSecondaryBeacon = 0;
438 pMac->lim.gHTDualCTSProtection = 0;
439 pMac->lim.gHTSTBCBasicMCS = 0;
440 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
441}
442
Jeff Johnson295189b2012-06-20 16:38:30 -0700443static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
444{
Jeff Johnsone7245742012-09-05 17:12:55 -0700445 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 tANI_U16 val16;
447 tANI_U8 val8;
448 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
449 tSirMacHTInfoField1 *pHTInfoField1;
450 tpSirPowerSaveCfg pPowerSaveConfig;
451 tSirMacHTParametersInfo *pAmpduParamInfo;
452
453 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700454 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
455 * and they will be used throughout when there is no session
456 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
459 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700460 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 return eSIR_FAILURE;
462 }
463
464 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
465 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700466 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 return eSIR_FAILURE;
468 }
469 val16 = ( tANI_U16 ) val1;
470 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
471
472 //channel bonding mode could be set to anything from 0 to 4(Titan had these
473 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
474 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
475 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
476 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
477 != eSIR_SUCCESS)
478 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 return eSIR_FAILURE;
481 }
482
483 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
484 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700485 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 return eSIR_FAILURE;
487 }
488
489 val8 = ( tANI_U8 ) val1;
490 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
491 pHTInfoField1->recommendedTxWidthSet =
492 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
494 != eSIR_SUCCESS)
495 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700496 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 return eSIR_FAILURE;
498 }
499
500 /* WNI_CFG_HEART_BEAT_THRESHOLD */
501
502 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
503 eSIR_SUCCESS )
504 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700505 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 return eSIR_FAILURE;
507 }
508 if(!val1)
509 {
510 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
511 pMac->sys.gSysEnableLinkMonitorMode = 0;
512 }
513 else
514 {
515 //No need to activate the timer during init time.
516 pMac->sys.gSysEnableLinkMonitorMode = 1;
517 }
518
519 /* WNI_CFG_SHORT_GI_20MHZ */
520
521 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
522 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700523 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 return eSIR_FAILURE;
525 }
526 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
527 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700528 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 return eSIR_FAILURE;
530 }
531 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
532 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700533 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 return eSIR_FAILURE;
535 }
536
537 val16 = ( tANI_U16 ) val1;
538 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
539 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
540 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
541
542 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
543 eSIR_SUCCESS)
544 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700545 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 return eSIR_FAILURE;
547 }
548
549 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
550
551 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
552 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700553 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 return eSIR_FAILURE;
555 }
556 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
557 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700558 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 return eSIR_FAILURE;
560 }
561 val16 = ( tANI_U16 ) val1;
562 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
563 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
564 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
565 eSIR_SUCCESS)
566 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700567 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 return eSIR_FAILURE;
569 }
570
571 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
572 limHandleCFGparamUpdate do we want to update this? */
573 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
574 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530575 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 return eSIR_FAILURE;
577 }
578
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 /* WNI_CFG_MAX_PS_POLL */
580
581 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530582 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
583 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 {
585 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700586 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 return eSIR_FAILURE;
588 }
589
590 /* This context should be valid if power-save configuration message has been
591 * already dispatched during initialization process. Re-using the present
592 * configuration mask
593 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530594 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700595
596 /* Note: it is okay to do this since DAL/HAL is alrady started */
597 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
598 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700599 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 return eSIR_FAILURE;
601 }
602
603 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700606 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
609 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
610
611 /* This was initially done after resume notification from HAL. Now, DAL is
612 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700613 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800614 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
615 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700616 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800617 return eSIR_FAILURE;
618 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530619#ifdef FEATURE_WLAN_TDLS
620 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
621 {
622 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
623 return eSIR_FAILURE;
624 }
625 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
626 {
627 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
628 return eSIR_FAILURE;
629 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530630 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
631 {
632 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
633 return eSIR_FAILURE;
634 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530635#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 return eSIR_SUCCESS;
637}
Jeff Johnson295189b2012-06-20 16:38:30 -0700638
639/*
640 limStart
641 This function is to replace the __limProcessSmeStartReq since there is no
642 eWNI_SME_START_REQ post to PE.
643*/
644tSirRetStatus limStart(tpAniSirGlobal pMac)
645{
646 tSirResultCodes retCode = eSIR_SUCCESS;
647
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700648 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700649
650 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
651 {
652 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
653
Jeff Johnsone7245742012-09-05 17:12:55 -0700654 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700655
656 // By default do not return after first scan match
657 pMac->lim.gLimReturnAfterFirstMatch = 0;
658
659 // Initialize MLM state machine
660 limInitMlm(pMac);
661
662 // By default return unique scan results
663 pMac->lim.gLimReturnUniqueResults = true;
664 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700665#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
666 pMac->lim.gLimSmeLfrScanResultLength = 0;
667#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 }
669 else
670 {
671 /**
672 * Should not have received eWNI_SME_START_REQ in states
673 * other than OFFLINE. Return response to host and
674 * log error
675 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700676 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 retCode = eSIR_FAILURE;
678 }
679
680 return retCode;
681}
682
683/**
684 * limInitialize()
685 *
686 *FUNCTION:
687 * This function is called from LIM thread entry function.
688 * LIM related global data structures are initialized in this function.
689 *
690 *LOGIC:
691 * NA
692 *
693 *ASSUMPTIONS:
694 * NA
695 *
696 *NOTE:
697 * NA
698 *
699 * @param pMac - Pointer to global MAC structure
700 * @return None
701 */
702
703tSirRetStatus
704limInitialize(tpAniSirGlobal pMac)
705{
706 tSirRetStatus status = eSIR_SUCCESS;
707
708 __limInitAssocVars(pMac);
709 __limInitVars(pMac);
710 __limInitStates(pMac);
711 __limInitStatsVars(pMac);
712 __limInitBssVars(pMac);
713 __limInitScanVars(pMac);
714 __limInitHTVars(pMac);
715 __limInitTitanVars(pMac);
716
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 status = limStart(pMac);
718 if(eSIR_SUCCESS != status)
719 {
720 return status;
721 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700722
723 /*
724 * MLM will be intitalized when 'START' request comes from SME.
725 * limInitMlm calls limCreateTimers, which actually relies on
726 * CFG to be downloaded. So it should not be called as part of
727 * peStart, as CFG download is happening after peStart.
728 */
729 //limInitMlm(pMac);
730 // Initializations for maintaining peers in IBSS
731 limIbssInit(pMac);
732
733 pmmInitialize(pMac);
734
735
736#if defined WLAN_FEATURE_VOWIFI
737 rrmInitialize(pMac);
738#endif
739#if defined WLAN_FEATURE_VOWIFI_11R
740 limFTOpen(pMac);
741#endif
742
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700744
745#if 0
746
747 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
748 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
749 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
750
751 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
752 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
753
754 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
755 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
756 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
757
758 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
759
760 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
761
762 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
763 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
764
765 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
766
767
768 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
769
770 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
771#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700772
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 //Initialize the configurations needed by PE
774 if( eSIR_FAILURE == __limInitConfig(pMac))
775 {
776 //We need to undo everything in limStart
777 limCleanupMlm(pMac);
778 return eSIR_FAILURE;
779 }
780
781 //initialize the TSPEC admission control table.
782 //Note that this was initially done after resume notification from HAL.
783 //Now, DAL is started before PE so this can be done here
784 limAdmitControlInit(pMac);
785 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700786
787 return status;
788
789} /*** end limInitialize() ***/
790
791
792
793/**
794 * limCleanup()
795 *
796 *FUNCTION:
797 * This function is called upon reset or persona change
798 * to cleanup LIM state
799 *
800 *LOGIC:
801 * NA
802 *
803 *ASSUMPTIONS:
804 * NA
805 *
806 *NOTE:
807 * NA
808 *
809 * @param pMac - Pointer to Global MAC structure
810 * @return None
811 */
812
813void
814limCleanup(tpAniSirGlobal pMac)
815{
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 v_PVOID_t pvosGCTx;
817 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700818
Jeff Johnson295189b2012-06-20 16:38:30 -0700819//Before destroying the list making sure all the nodes have been deleted.
820//Which should be the normal case, but a memory leak has been reported.
821
822 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
823
824 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
825 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
826 {
827 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
828 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
829
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530830 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 }
832
833 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700834
835 limCleanupMlm(pMac);
836 limCleanupLmm(pMac);
837
838 // free up preAuth table
839 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
840 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530841 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
843 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
844 }
845
846 if(NULL != pMac->lim.pDialogueTokenHead)
847 {
848 limDeleteDialogueTokenList(pMac);
849 }
850
851 if(NULL != pMac->lim.pDialogueTokenTail)
852 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530853 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 pMac->lim.pDialogueTokenTail = NULL;
855 }
856
857 # if 0
858 if (pMac->lim.gpLimStartBssReq != NULL)
859 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530860 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 pMac->lim.gpLimStartBssReq = NULL;
862 }
863 #endif
864
865 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
866 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530867 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 pMac->lim.gpLimMlmSetKeysReq = NULL;
869 }
870
871 #if 0
872 if (pMac->lim.gpLimJoinReq != NULL)
873 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530874 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 pMac->lim.gpLimJoinReq = NULL;
876 }
877 #endif
878
879 if (pMac->lim.gpLimMlmAuthReq != NULL)
880 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530881 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700882 pMac->lim.gpLimMlmAuthReq = NULL;
883 }
884
Jeff Johnsone7245742012-09-05 17:12:55 -0700885#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 if (pMac->lim.gpLimMlmJoinReq != NULL)
887 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530888 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 pMac->lim.gpLimMlmJoinReq = NULL;
890 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700891#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700892
893 #if 0
894 if (pMac->lim.gpLimReassocReq != NULL)
895 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530896 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 pMac->lim.gpLimReassocReq = NULL;
898 }
899 #endif
900
901 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
902 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530903 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
905 }
906
Viral Modid440e682013-03-06 02:25:31 -0800907 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800908 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530909 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800910 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800911 }
Viral Modid86bde22012-12-10 13:09:21 -0800912
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 if (pMac->lim.gpLimMlmScanReq != NULL)
914 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530915 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 pMac->lim.gpLimMlmScanReq = NULL;
917 }
918
919#if 0
920 if(NULL != pMac->lim.beacon)
921 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530922 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 pMac->lim.beacon = NULL;
924 }
925#endif
926 #if 0
927 if(NULL != pMac->lim.assocReq)
928 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530929 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 pMac->lim.assocReq= NULL;
931 }
932 #endif
933
934#if 0
935 if(NULL != pMac->lim.assocRsp)
936 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530937 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 pMac->lim.assocRsp= NULL;
939 }
940#endif
941 // Now, finally reset the deferred message queue pointers
942 limResetDeferredMsgQ(pMac);
943
Jeff Johnson295189b2012-06-20 16:38:30 -0700944
945 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
946 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
947
948 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700949 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
951#if defined WLAN_FEATURE_VOWIFI
952 rrmCleanup(pMac);
953#endif
954#if defined WLAN_FEATURE_VOWIFI_11R
955 limFTCleanup(pMac);
956#endif
957
958} /*** end limCleanup() ***/
959
960
961/** -------------------------------------------------------------
962\fn peOpen
963\brief will be called in Open sequence from macOpen
964\param tpAniSirGlobal pMac
965\param tHalOpenParameters *pHalOpenParam
966\return tSirRetStatus
967 -------------------------------------------------------------*/
968
969tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
970{
971 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
972 pMac->lim.maxStation = pMacOpenParam->maxStation;
973
974 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
975 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700976 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700977 return eSIR_FAILURE;
978 }
979
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530980 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
981 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700983 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 return eSIR_FAILURE;
985 }
986
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800987#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530988 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
989 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700991 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 return eSIR_FAILURE;
993 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800994#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530995 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
996 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700998 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 return eSIR_FAILURE;
1000 }
1001
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301002 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001003
1004
1005 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301006 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1007 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001009 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 return eSIR_FAILURE;
1011 }
1012
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301013 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1014 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001016 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 return eSIR_FAILURE;
1018 }
1019 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301020 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1021 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001023 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 return eSIR_FAILURE;
1025 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301026 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001027
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001028 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001029 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001030
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001031 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1032 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001033 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001034 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1035 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1036 vos_mem_free(pMac->lim.gpSession);
1037 pMac->lim.gpSession = NULL;
1038 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1039 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001040 return eSIR_FAILURE;
1041 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001042 pMac->lim.deauthMsgCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001043
1044 /*
1045 * peOpen is successful by now, so it is right time to initialize
1046 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1047 * then nothing will be logged for PE module.
1048 */
1049#ifdef LIM_TRACE_RECORD
1050 MTRACE(limTraceInit(pMac));
1051#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 return eSIR_SUCCESS;
1053}
1054
1055/** -------------------------------------------------------------
1056\fn peClose
1057\brief will be called in close sequence from macClose
1058\param tpAniSirGlobal pMac
1059\return tSirRetStatus
1060 -------------------------------------------------------------*/
1061
1062tSirRetStatus peClose(tpAniSirGlobal pMac)
1063{
1064 tANI_U8 i;
1065
1066 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1067 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001068
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 for(i =0; i < pMac->lim.maxBssId; i++)
1070 {
1071 if(pMac->lim.gpSession[i].valid == TRUE)
1072 {
1073 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1074 }
1075 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301076 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001077 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001078#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301079 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001080 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001081#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001082
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301083 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 pMac->lim.gpSession = NULL;
1085 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301086 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301088 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1090 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301091 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001093 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1094 {
1095 return eSIR_FAILURE;
1096 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 return eSIR_SUCCESS;
1098}
1099
1100/** -------------------------------------------------------------
1101\fn peStart
1102\brief will be called in start sequence from macStart
1103\param tpAniSirGlobal pMac
1104\return none
1105 -------------------------------------------------------------*/
1106
1107tSirRetStatus peStart(tpAniSirGlobal pMac)
1108{
1109 tSirRetStatus status = eSIR_SUCCESS;
1110
1111 status = limInitialize(pMac);
1112#if defined(ANI_LOGDUMP)
1113 limDumpInit(pMac);
1114#endif //#if defined(ANI_LOGDUMP)
1115
1116 return status;
1117}
1118
1119/** -------------------------------------------------------------
1120\fn peStop
1121\brief will be called in stop sequence from macStop
1122\param tpAniSirGlobal pMac
1123\return none
1124 -------------------------------------------------------------*/
1125
1126void peStop(tpAniSirGlobal pMac)
1127{
1128 limCleanup(pMac);
1129 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1130 return;
1131}
1132
1133/** -------------------------------------------------------------
1134\fn peFreeMsg
1135\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1136\ to free a given PE message on the TX and MC thread.
1137\ This happens when there are messages pending in the PE
1138\ queue when system is being stopped and reset.
1139\param tpAniSirGlobal pMac
1140\param tSirMsgQ pMsg
1141\return none
1142-----------------------------------------------------------------*/
1143v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1144{
1145 if (pMsg != NULL)
1146 {
1147 if (NULL != pMsg->bodyptr)
1148 {
1149 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1150 {
1151 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1152 }
1153 else
1154 {
1155 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1156 }
1157 }
1158 pMsg->bodyptr = 0;
1159 pMsg->bodyval = 0;
1160 pMsg->type = 0;
1161 }
1162 return;
1163}
1164
1165
1166/**
1167 * The function checks if a particular timer should be allowed
1168 * into LIM while device is sleeping
1169 */
1170tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1171{
1172 tANI_U8 retStatus = TRUE;
1173
1174 if(!limIsSystemInActiveState(pMac))
1175 {
1176 switch(pMsg->type)
1177 {
1178 /* Don't allow following timer messages if in sleep */
1179 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1180 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1181 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1182 retStatus = FALSE;
1183 break;
1184 /* May allow following timer messages in sleep mode */
1185 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1186
1187 /* Safe to allow as of today, this triggers background scan
1188 * which will not be started if the device is in power-save mode
1189 * might need to block in the future if we decide to implement
1190 * spectrum management
1191 */
1192 case SIR_LIM_QUIET_TIMEOUT:
1193
1194 /* Safe to allow as of today, this triggers background scan
1195 * which will not be started if the device is in power-save mode
1196 * might need to block in the future if we decide to implement
1197 * spectrum management
1198 */
1199 case SIR_LIM_QUIET_BSS_TIMEOUT:
1200
1201 /* Safe to allow this timermessage, triggers background scan
1202 * which is blocked in sleep mode
1203 */
1204 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1205
1206 /* Safe to allow this timer, since, while in IMPS this timer will not
1207 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1208 * when heart-beat control is handled back to PE, device would have
1209 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1210 */
1211 case SIR_LIM_HEART_BEAT_TIMEOUT:
1212 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1213
1214 /* Safe to allow, PE is not handling this message as of now. May need
1215 * to block it, basically, free the buffer and restart the timer
1216 */
1217 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1218 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001219 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001220 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1221 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1222 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1223 retStatus = TRUE;
1224 break;
1225
1226 /* by default allow rest of messages */
1227 default:
1228 retStatus = TRUE;
1229 break;
1230
1231
1232 }
1233 }
1234
1235 return retStatus;
1236
1237}
1238
1239
1240
1241/**
1242 * limPostMsgApi()
1243 *
1244 *FUNCTION:
1245 * This function is called from other thread while posting a
1246 * message to LIM message Queue gSirLimMsgQ.
1247 *
1248 *LOGIC:
1249 * NA
1250 *
1251 *ASSUMPTIONS:
1252 * NA
1253 *
1254 *NOTE:
1255 * NA
1256 *
1257 * @param pMac - Pointer to Global MAC structure
1258 * @param pMsg - Pointer to the message structure
1259 * @return None
1260 */
1261
1262tANI_U32
1263limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1264{
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1266
1267
Jeff Johnson295189b2012-06-20 16:38:30 -07001268} /*** end limPostMsgApi() ***/
1269
1270
1271/*--------------------------------------------------------------------------
1272
1273 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1274
1275 This function can be called by legacy code to post message to voss queues OR
1276 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1277 for dispatching it later.
1278
1279 \param pMac - Pointer to Global MAC structure
1280 \param pMsg - Pointer to the message structure
1281
1282 \return tANI_U32 - TX_SUCCESS for success.
1283
1284 --------------------------------------------------------------------------*/
1285
1286tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1287{
1288 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1289}
1290
1291/*--------------------------------------------------------------------------
1292
1293 \brief peProcessMessages() - Message Processor for PE
1294
1295 Voss calls this function to dispatch the message to PE
1296
1297 \param pMac - Pointer to Global MAC structure
1298 \param pMsg - Pointer to the message structure
1299
1300 \return tANI_U32 - TX_SUCCESS for success.
1301
1302 --------------------------------------------------------------------------*/
1303
1304tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1305{
1306 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1307 {
1308 return eSIR_SUCCESS;
1309 }
1310 /**
1311 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1312 * for all the other cases post it to LIM
1313 */
1314 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1315 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1316 else
1317 limMessageProcessor(pMac, pMsg);
1318 return eSIR_SUCCESS;
1319}
1320
1321
Jeff Johnson295189b2012-06-20 16:38:30 -07001322
1323// ---------------------------------------------------------------------------
1324/**
1325 * peHandleMgmtFrame
1326 *
1327 * FUNCTION:
1328 * Process the Management frames from TL
1329 *
1330 * LOGIC:
1331 *
1332 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1333 *
1334 * NOTE:
1335 *
1336 * @param pvosGCtx Global Vos Context
1337 * @param vossBuff Packet
1338 * @return None
1339 */
1340
1341VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1342{
1343 tpAniSirGlobal pMac;
1344 tpSirMacMgmtHdr mHdr;
1345 tSirMsgQ msg;
1346 vos_pkt_t *pVosPkt;
1347 VOS_STATUS vosStatus;
1348 v_U8_t *pRxPacketInfo;
1349
1350 pVosPkt = (vos_pkt_t *)vosBuff;
1351 if (NULL == pVosPkt)
1352 {
1353 return VOS_STATUS_E_FAILURE;
1354 }
1355
1356 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1357 if (NULL == pMac)
1358 {
1359 // cannot log a failure without a valid pMac
1360 vos_pkt_return_packet(pVosPkt);
1361 return VOS_STATUS_E_FAILURE;
1362 }
1363
1364 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1365
1366 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1367 {
1368 vos_pkt_return_packet(pVosPkt);
1369 return VOS_STATUS_E_FAILURE;
1370 }
1371
1372
1373 //
1374 // The MPDU header is now present at a certain "offset" in
1375 // the BD and is specified in the BD itself
1376 //
1377 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1378 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1379 {
1380 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001381 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001382 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001383
Jeff Johnsone7245742012-09-05 17:12:55 -07001384 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1386 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1387 }
1388
1389
1390 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1391 msg.type = SIR_BB_XPORT_MGMT_MSG;
1392 msg.bodyptr = vosBuff;
1393 msg.bodyval = 0;
1394
1395 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1396 &msg,
1397 mHdr->fc.type,
1398 mHdr->fc.subType ))
1399 {
1400 vos_pkt_return_packet(pVosPkt);
1401 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001402 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 return VOS_STATUS_E_FAILURE;
1404 }
1405
1406 return VOS_STATUS_SUCCESS;
1407}
1408
1409// ---------------------------------------------------------------------------
1410/**
1411 * peRegisterTLHandle
1412 *
1413 * FUNCTION:
1414 * Registers the Handler which, process the Management frames from TL
1415 *
1416 * LOGIC:
1417 *
1418 * ASSUMPTIONS:
1419 *
1420 * NOTE:
1421 *
1422 * @return None
1423 */
1424
1425void peRegisterTLHandle(tpAniSirGlobal pMac)
1426{
1427 v_PVOID_t pvosGCTx;
1428 VOS_STATUS retStatus;
1429
1430 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1431
1432 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1433
1434 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001435 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001436
1437}
Jeff Johnson295189b2012-06-20 16:38:30 -07001438
1439
1440/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 * limIsSystemInScanState()
1442 *
1443 *FUNCTION:
1444 * This function is called by various MAC software modules to
1445 * determine if System is in Scan/Learn state
1446 *
1447 *LOGIC:
1448 * NA
1449 *
1450 *ASSUMPTIONS:
1451 * NA
1452 *
1453 *NOTE:
1454 *
1455 * @param pMac - Pointer to Global MAC structure
1456 * @return true - System is in Scan/Learn state
1457 * false - System is NOT in Scan/Learn state
1458 */
1459
1460tANI_U8
1461limIsSystemInScanState(tpAniSirGlobal pMac)
1462{
1463 switch (pMac->lim.gLimSmeState)
1464 {
1465 case eLIM_SME_CHANNEL_SCAN_STATE:
1466 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1467 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1468 case eLIM_SME_WT_SCAN_STATE:
1469 // System is in Learn mode
1470 return true;
1471
1472 default:
1473 // System is NOT in Learn mode
1474 return false;
1475 }
1476} /*** end limIsSystemInScanState() ***/
1477
1478
1479
1480/**
1481 * limIsSystemInActiveState()
1482 *
1483 *FUNCTION:
1484 * This function is called by various MAC software modules to
1485 * determine if System is in Active/Wakeup state
1486 *
1487 *LOGIC:
1488 * NA
1489 *
1490 *ASSUMPTIONS:
1491 * NA
1492 *
1493 *NOTE:
1494 *
1495 * @param pMac - Pointer to Global MAC structure
1496 * @return true - System is in Active state
1497 * false - System is not in Active state
1498 */
1499
1500tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1501{
1502 switch (pMac->pmm.gPmmState)
1503 {
1504 case ePMM_STATE_BMPS_WAKEUP:
1505 case ePMM_STATE_IMPS_WAKEUP:
1506 case ePMM_STATE_READY:
1507 // System is in Active mode
1508 return true;
1509 default:
1510 return false;
1511 // System is NOT in Active mode
1512 }
1513}
1514
1515
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
Jeff Johnson295189b2012-06-20 16:38:30 -07001517
1518
1519/**
1520*\brief limReceivedHBHandler()
1521*
1522* This function is called by schBeaconProcess() upon
1523* receiving a Beacon on STA. This also gets called upon
1524* receiving Probe Response after heat beat failure is
1525* detected.
1526*
1527* param pMac - global mac structure
1528* param channel - channel number indicated in Beacon, Probe Response
1529* return - none
1530*/
1531
1532
1533void
1534limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1535{
1536 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1537 psessionEntry->LimRxedBeaconCntDuringHB++;
1538
1539 pMac->pmm.inMissedBeaconScenario = FALSE;
1540} /*** end limReceivedHBHandler() ***/
1541
1542
1543
1544#if 0
1545void limResetHBPktCount(tpPESession psessionEntry)
1546{
1547 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1548}
1549#endif
1550
1551
1552/*
1553 * limProcessWdsInfo()
1554 *
1555 *FUNCTION:
1556 * This function is called from schBeaconProcess in BP
1557 *
1558 *PARAMS:
1559 * @param pMac - Pointer to Global MAC structure
1560 * @param propIEInfo - proprietary IE info
1561 *
1562 *LOGIC:
1563 *
1564 *ASSUMPTIONS:
1565 * NA
1566 *
1567 *NOTE:
1568 *
1569 *
1570 *RETURNS:
1571 *
1572 */
1573
1574void limProcessWdsInfo(tpAniSirGlobal pMac,
1575 tSirPropIEStruct propIEInfo)
1576{
Jeff Johnson295189b2012-06-20 16:38:30 -07001577}
1578
1579
1580
1581/**
1582 * limInitWdsInfoParams()
1583 *
1584 *FUNCTION:
1585 * This function is called while processing
1586 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1587 * ind/set related parameters.
1588 *
1589 *LOGIC:
1590 *
1591 *ASSUMPTIONS:
1592 *
1593 *NOTE:
1594 *
1595 * @param pMac Pointer to Global MAC structure
1596 * @return None
1597 */
1598
1599void
1600limInitWdsInfoParams(tpAniSirGlobal pMac)
1601{
1602 pMac->lim.gLimWdsInfo.wdsLength = 0;
1603 pMac->lim.gLimNumWdsInfoInd = 0;
1604 pMac->lim.gLimNumWdsInfoSet = 0;
1605} /*** limInitWdsInfoParams() ***/
1606
1607
1608/** -------------------------------------------------------------
1609\fn limUpdateOverlapStaParam
1610\brief Updates overlap cache and param data structure
1611\param tpAniSirGlobal pMac
1612\param tSirMacAddr bssId
1613\param tpLimProtStaParams pStaParams
1614\return None
1615 -------------------------------------------------------------*/
1616void
1617limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1618{
1619 int i;
1620 if (!pStaParams->numSta)
1621 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301622 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1623 bssId,
1624 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 pMac->lim.protStaOverlapCache[0].active = true;
1626
1627 pStaParams->numSta = 1;
1628
1629 return;
1630 }
1631
1632 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1633 {
1634 if (pMac->lim.protStaOverlapCache[i].active)
1635 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301636 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 bssId,
1638 sizeof(tSirMacAddr))) {
1639 return; }
1640 }
1641 else
1642 break;
1643 }
1644
1645 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1646 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301647 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 }
1649 else
1650 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301651 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1652 bssId,
1653 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 pMac->lim.protStaOverlapCache[i].active = true;
1655
1656 pStaParams->numSta++;
1657 }
1658}
1659
1660
1661/**
1662 * limHandleIBSScoalescing()
1663 *
1664 *FUNCTION:
1665 * This function is called upon receiving Beacon/Probe Response
1666 * while operating in IBSS mode.
1667 *
1668 *LOGIC:
1669 *
1670 *ASSUMPTIONS:
1671 *
1672 *NOTE:
1673 *
1674 * @param pMac - Pointer to Global MAC structure
1675 * @param pBeacon - Parsed Beacon Frame structure
1676 * @param pRxPacketInfo - Pointer to RX packet info structure
1677 *
1678 * @return Status whether to process or ignore received Beacon Frame
1679 */
1680
1681tSirRetStatus
1682limHandleIBSScoalescing(
1683 tpAniSirGlobal pMac,
1684 tpSchBeaconStruct pBeacon,
1685 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1686{
1687 tpSirMacMgmtHdr pHdr;
1688 tSirRetStatus retCode;
1689
1690 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001691 if ( (!pBeacon->capabilityInfo.ibss) ||
1692 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1693 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 /* Received SSID does not match => Ignore received Beacon frame. */
1695 retCode = eSIR_LIM_IGNORE_BEACON;
1696 else
1697 {
1698 tANI_U32 ieLen;
1699 tANI_U16 tsfLater;
1700 tANI_U8 *pIEs;
1701 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1702 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1703 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1704 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1705 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1706 }
1707 return retCode;
1708} /*** end limHandleIBSScoalescing() ***/
1709
1710
1711
1712/**
1713 * limDetectChangeInApCapabilities()
1714 *
1715 *FUNCTION:
1716 * This function is called while SCH is processing
1717 * received Beacon from AP on STA to detect any
1718 * change in AP's capabilities. If there any change
1719 * is detected, Roaming is informed of such change
1720 * so that it can trigger reassociation.
1721 *
1722 *LOGIC:
1723 *
1724 *ASSUMPTIONS:
1725 *
1726 *NOTE:
1727 * Notification is enabled for STA product only since
1728 * it is not a requirement on BP side.
1729 *
1730 * @param pMac Pointer to Global MAC structure
1731 * @param pBeacon Pointer to parsed Beacon structure
1732 * @return None
1733 */
1734
1735void
1736limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1737 tpSirProbeRespBeacon pBeacon,
1738 tpPESession psessionEntry)
1739{
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 tANI_U8 len;
1741 tSirSmeApNewCaps apNewCaps;
1742 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301743 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1745 newChannel = (tANI_U8) pBeacon->channelNumber;
1746
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301747 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
1748 ( ( ( limIsNullSsid(&pBeacon->ssId) ) ||
1749 ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1750 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ) ||
1751 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1752 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1753 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1754 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1755 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1756 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1757 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1758 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1759 ( newChannel != psessionEntry->currentOperChannel )
1760 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301761 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301762 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301763 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301764 /* If Beacon capabilities is not matching with the current capability,
1765 * then send unicast probe request to AP and take decision after
1766 * receiving probe response */
1767 if ( true == psessionEntry->fIgnoreCapsChange )
1768 {
1769 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1770 return;
1771 }
1772 psessionEntry->fWaitForProbeRsp = true;
1773 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1774 "sending directed probe request.. "));
1775 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1776 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1777 psessionEntry->dot11mode, 0, NULL);
1778
1779 if ( eSIR_SUCCESS != status )
1780 {
1781 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1782 psessionEntry->fWaitForProbeRsp = false;
1783 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301784 return;
1785 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 /**
1787 * BSS capabilities have changed.
1788 * Inform Roaming.
1789 */
1790 len = sizeof(tSirMacCapabilityInfo) +
1791 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1792 3 * sizeof(tANI_U8) + // reserved fields
1793 pBeacon->ssId.length + 1;
1794
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301795 vos_mem_copy(apNewCaps.bssId,
1796 psessionEntry->bssId,
1797 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 if (newChannel != psessionEntry->currentOperChannel)
1799 {
1800 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001801 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 psessionEntry->currentOperChannel, newChannel);)
1803 return;
1804 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301805
1806 /**
1807 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1808 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1809 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1810 * the privacy bit is set in Probe and association responses.
1811 * Due to this anomaly, we detect a change in
1812 * AP capabilities when we receive a beacon after association and
1813 * disconnect from the AP. The following check makes sure that we can
1814 * connect to such APs
1815 */
1816 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1817 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1818 {
1819 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001820 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301821 return;
1822 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 else
1824 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301825 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1826 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 pBeacon->ssId.length + 1);
1828
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301829 psessionEntry->fIgnoreCapsChange = false;
1830 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 psessionEntry->limSentCapsChangeNtf = true;
1832 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1833 (tANI_U32 *) &apNewCaps,
1834 len, psessionEntry->smeSessionId);
1835 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301836 else if ( true == psessionEntry->fWaitForProbeRsp )
1837 {
1838 /* Only for probe response frames and matching capabilities the control
1839 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1840 * will be false, the control will not come here*/
1841
1842 limLog(pMac, LOG1, FL("capabilities in probe response are"
1843 "matching with the current setting,"
1844 "Ignoring subsequent capability"
1845 "mismatch"));
1846 psessionEntry->fIgnoreCapsChange = true;
1847 psessionEntry->fWaitForProbeRsp = false;
1848 }
1849
Jeff Johnson295189b2012-06-20 16:38:30 -07001850} /*** limDetectChangeInApCapabilities() ***/
1851
1852
1853
1854
1855// ---------------------------------------------------------------------
1856/**
1857 * limUpdateShortSlot
1858 *
1859 * FUNCTION:
1860 * Enable/Disable short slot
1861 *
1862 * LOGIC:
1863 *
1864 * ASSUMPTIONS:
1865 *
1866 * NOTE:
1867 *
1868 * @param enable Flag to enable/disable short slot
1869 * @return None
1870 */
1871
1872tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1873{
1874
1875 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001876 tANI_U32 nShortSlot;
1877 tANI_U32 val = 0;
1878 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001879
Jeff Johnsone7245742012-09-05 17:12:55 -07001880 // Check Admin mode first. If it is disabled just return
1881 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1882 != eSIR_SUCCESS)
1883 {
1884 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001885 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001886 return eSIR_FAILURE;
1887 }
1888 if (val == false)
1889 return eSIR_SUCCESS;
1890
1891 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1892 limGetPhyMode(pMac, &phyMode, psessionEntry);
1893 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1894 return eSIR_SUCCESS;
1895
1896 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001897
1898 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1899 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1900 // if no erp present, use short slot based on current ap caps
1901
1902 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1903
1904 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1905 // The difference between the earlier implementation and the new one is only Case4.
1906 /*
1907 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1908 Case1 1 1 1 1 //AP should not advertise this combination.
1909 Case2 1 1 0 0
1910 Case3 1 0 1 1
1911 Case4 1 0 0 0
1912 Case5 0 1 1 1
1913 Case6 0 1 0 0
1914 Case7 0 0 1 1
1915 Case8 0 0 0 0
1916 */
1917 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1918
Jeff Johnsone7245742012-09-05 17:12:55 -07001919 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 {
1921 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001922 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001924 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1926 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 }
1928 return eSIR_SUCCESS;
1929}
1930
1931
Jeff Johnson295189b2012-06-20 16:38:30 -07001932
1933
Jeff Johnson295189b2012-06-20 16:38:30 -07001934
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
1936
1937/** -----------------------------------------------------------------
1938 \brief limHandleLowRssiInd() - handles low rssi indication
1939
1940 This function process the SIR_HAL_LOW_RSSI_IND message from
1941 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1942
1943 \param pMac - global mac structure
1944
1945 \return
1946
1947 \sa
1948 ----------------------------------------------------------------- */
1949void limHandleLowRssiInd(tpAniSirGlobal pMac)
1950{
1951#if 0 //RSSI related indications will now go to TL and not PE
1952 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1953 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1954 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1955 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001956 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1958 }
1959 else
1960 {
1961 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001962 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 pMac->pmm.gPmmState);
1964 }
1965 return;
1966#endif
1967}
1968
1969
1970/** -----------------------------------------------------------------
1971 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1972
1973 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1974 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1975 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1976
1977 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1978 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1979 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1980 This message can also come from FW anytime after we have entered BMPS.
1981 This means we should handle it in WoWL and UAPSD states as well
1982
1983 \param pMac - global mac structure
1984 \return - none
1985 \sa
1986 ----------------------------------------------------------------- */
1987void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1988{
1989 switch(pMac->pmm.gPmmState)
1990 {
1991 case ePMM_STATE_BMPS_SLEEP:
1992 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1993 case ePMM_STATE_UAPSD_SLEEP:
1994 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
1995 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001996 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
1998 break;
1999
2000 default:
2001 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002002 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 pMac->pmm.gPmmState);
2004 break;
2005 }
2006 return;
2007}
2008
2009
2010/** -----------------------------------------------------------------
2011 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2012
2013 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2014 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2015 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2016
2017 \param pMac - global mac structure
2018 \return - none
2019 \sa
2020 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002021void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002022{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002023#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2024 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2025 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2026 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2027 if (psessionEntry == NULL)
2028 {
2029 limLog(pMac, LOGE,
2030 FL("session does not exist for given BSSIdx:%d"),
2031 pSirMissedBeaconInd->bssIdx);
2032 return;
2033 }
2034#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2036 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2037 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2038 {
2039 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302040 PELOGE(limLog(pMac, LOGE,
2041 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2043 }
Yathish9f22e662012-12-10 14:21:35 -08002044/* ACTIVE_MODE_HB_OFFLOAD */
2045#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2046 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2047 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2048 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2049 {
2050 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002051 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002052 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002053 }
2054#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 else
2056 {
2057 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002058 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 pMac->pmm.gPmmState);
2060 }
2061 return;
2062}
2063
2064/** -----------------------------------------------------------------
2065 \brief limMicFailureInd() - handles mic failure indication
2066
2067 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2068
2069 \param pMac - global mac structure
2070 \return - none
2071 \sa
2072 ----------------------------------------------------------------- */
2073void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2074{
2075 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2076 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2077 tSirMsgQ mmhMsg;
2078 tpPESession psessionEntry ;
2079 tANI_U8 sessionId;
2080
2081 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2082 {
2083 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002084 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 return;
2086 }
2087
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302088 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2089 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 {
2091 // Log error
2092 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002093 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 return;
2095 }
2096
2097 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2098 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2099 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2100
2101 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302102 pSirMicFailureInd->bssId,
2103 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002104
2105 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302106 pSirMicFailureInd->info.srcMacAddr,
2107 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002108
2109 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302110 pSirMicFailureInd->info.taMacAddr,
2111 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002112
2113 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302114 pSirMicFailureInd->info.dstMacAddr,
2115 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002116
2117 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302118 pSirMicFailureInd->info.rxMacAddr,
2119 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002120
2121 pSirSmeMicFailureInd->info.multicast =
2122 pSirMicFailureInd->info.multicast;
2123
2124 pSirSmeMicFailureInd->info.keyId=
2125 pSirMicFailureInd->info.keyId;
2126
2127 pSirSmeMicFailureInd->info.IV1=
2128 pSirMicFailureInd->info.IV1;
2129
2130 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302131 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002132
2133 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2134 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2135 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002136 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2138 return;
2139}
2140
2141
2142/** -----------------------------------------------------------------
2143 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2144
2145 This function is called before enqueuing the frame to PE queue for further processing.
2146 This prevents unnecessary frames getting into PE Queue and drops them right away.
2147 Frames will be droped in the following scenarios:
2148
2149 - In Scan State, drop the frames which are not marked as scan frames
2150 - In non-Scan state, drop the frames which are marked as scan frames.
2151 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2152 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2153
2154 \param pMac - global mac structure
2155 \return - none
2156 \sa
2157 ----------------------------------------------------------------- */
2158
2159tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2160{
2161 tANI_U32 framelen;
2162 tANI_U8 *pBody;
2163 tSirMacCapabilityInfo capabilityInfo;
2164
2165 /*
2166 *
2167 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2168 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2169 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2170 * other than beacons or probe responses in scan state.
2171 */
2172 if( (subType == SIR_MAC_MGMT_BEACON) ||
2173 (subType == SIR_MAC_MGMT_PROBE_RSP))
2174 {
2175 if(pMac->pmm.inMissedBeaconScenario)
2176 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002177 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2178 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 }
2180 if (limIsSystemInScanState(pMac))
2181 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002182 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002184#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2185 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2186 {
2187 return eMGMT_DROP_NO_DROP;
2188 }
2189#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2191 {
2192 return eMGMT_DROP_SCAN_MODE_FRAME;
2193 }
2194 }
2195
2196 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2197 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2198
2199 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2200 * beacons from an infrastructure network
2201 */
2202 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2203 if(!capabilityInfo.ibss)
2204 return eMGMT_DROP_NO_DROP;
2205#if 0
2206 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2207 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2208 return eMGMT_DROP_NO_DROP;
2209#endif
2210
2211 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2212 if( (subType == SIR_MAC_MGMT_BEACON) ||
2213 (subType == SIR_MAC_MGMT_PROBE_RSP))
2214 {
2215 //drop the frame if length is less than 12
2216 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2217 return eMGMT_DROP_INVALID_SIZE;
2218
2219 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2220
2221 //This can be enhanced to even check the SSID before deciding to enque the frame.
2222 if(capabilityInfo.ess)
2223 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2224 }
2225 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2226 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2227 {
2228 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2229 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2230 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2231 }
2232
2233 return eMGMT_DROP_NO_DROP;
2234}
2235
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002236eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2237{
2238 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002240 if(psPe)
2241 {
2242 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2243 {
2244 status = eHAL_STATUS_SUCCESS;
2245 }
2246 }
2247 return (status);
2248}
2249eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2250{
2251 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2252 if(psPe)
2253 {
2254 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2255 {
2256 status = eHAL_STATUS_SUCCESS;
2257 }
2258 }
2259 return (status);
2260}