blob: e0fd4acb635c4528ef94dac1f9609005bba46af9 [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
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
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800393#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700394 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
Rashmi Ramannac7744532013-10-06 16:49:08 +0530636 if (eSIR_SUCCESS !=
637 wlan_cfgGetInt(pMac, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
638 (tANI_U32 *)&pMac->lim.gDebugP2pRemainOnChannel))
639 {
640 limLog( pMac, LOGE,
641 "%s: Couldn't get WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL value",
642 __func__);
643 pMac->lim.gDebugP2pRemainOnChannel = 0;
644 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 return eSIR_SUCCESS;
646}
Jeff Johnson295189b2012-06-20 16:38:30 -0700647
648/*
649 limStart
650 This function is to replace the __limProcessSmeStartReq since there is no
651 eWNI_SME_START_REQ post to PE.
652*/
653tSirRetStatus limStart(tpAniSirGlobal pMac)
654{
655 tSirResultCodes retCode = eSIR_SUCCESS;
656
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700657 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700658
659 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
660 {
661 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
662
Jeff Johnsone7245742012-09-05 17:12:55 -0700663 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700664
665 // By default do not return after first scan match
666 pMac->lim.gLimReturnAfterFirstMatch = 0;
667
668 // Initialize MLM state machine
669 limInitMlm(pMac);
670
671 // By default return unique scan results
672 pMac->lim.gLimReturnUniqueResults = true;
673 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700674#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
675 pMac->lim.gLimSmeLfrScanResultLength = 0;
676#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 }
678 else
679 {
680 /**
681 * Should not have received eWNI_SME_START_REQ in states
682 * other than OFFLINE. Return response to host and
683 * log error
684 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700685 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 retCode = eSIR_FAILURE;
687 }
688
689 return retCode;
690}
691
692/**
693 * limInitialize()
694 *
695 *FUNCTION:
696 * This function is called from LIM thread entry function.
697 * LIM related global data structures are initialized in this function.
698 *
699 *LOGIC:
700 * NA
701 *
702 *ASSUMPTIONS:
703 * NA
704 *
705 *NOTE:
706 * NA
707 *
708 * @param pMac - Pointer to global MAC structure
709 * @return None
710 */
711
712tSirRetStatus
713limInitialize(tpAniSirGlobal pMac)
714{
715 tSirRetStatus status = eSIR_SUCCESS;
716
717 __limInitAssocVars(pMac);
718 __limInitVars(pMac);
719 __limInitStates(pMac);
720 __limInitStatsVars(pMac);
721 __limInitBssVars(pMac);
722 __limInitScanVars(pMac);
723 __limInitHTVars(pMac);
724 __limInitTitanVars(pMac);
725
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 status = limStart(pMac);
727 if(eSIR_SUCCESS != status)
728 {
729 return status;
730 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700731
732 /*
733 * MLM will be intitalized when 'START' request comes from SME.
734 * limInitMlm calls limCreateTimers, which actually relies on
735 * CFG to be downloaded. So it should not be called as part of
736 * peStart, as CFG download is happening after peStart.
737 */
738 //limInitMlm(pMac);
739 // Initializations for maintaining peers in IBSS
740 limIbssInit(pMac);
741
742 pmmInitialize(pMac);
743
744
745#if defined WLAN_FEATURE_VOWIFI
746 rrmInitialize(pMac);
747#endif
748#if defined WLAN_FEATURE_VOWIFI_11R
749 limFTOpen(pMac);
750#endif
751
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700753
754#if 0
755
756 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
757 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
758 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
759
760 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
761 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
762
763 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
764 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
765 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
766
767 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
768
769 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
770
771 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
772 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
773
774 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
775
776
777 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
778
779 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
780#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700781
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 //Initialize the configurations needed by PE
783 if( eSIR_FAILURE == __limInitConfig(pMac))
784 {
785 //We need to undo everything in limStart
786 limCleanupMlm(pMac);
787 return eSIR_FAILURE;
788 }
789
790 //initialize the TSPEC admission control table.
791 //Note that this was initially done after resume notification from HAL.
792 //Now, DAL is started before PE so this can be done here
793 limAdmitControlInit(pMac);
794 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700795
796 return status;
797
798} /*** end limInitialize() ***/
799
800
801
802/**
803 * limCleanup()
804 *
805 *FUNCTION:
806 * This function is called upon reset or persona change
807 * to cleanup LIM state
808 *
809 *LOGIC:
810 * NA
811 *
812 *ASSUMPTIONS:
813 * NA
814 *
815 *NOTE:
816 * NA
817 *
818 * @param pMac - Pointer to Global MAC structure
819 * @return None
820 */
821
822void
823limCleanup(tpAniSirGlobal pMac)
824{
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 v_PVOID_t pvosGCTx;
826 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700827
Jeff Johnson295189b2012-06-20 16:38:30 -0700828//Before destroying the list making sure all the nodes have been deleted.
829//Which should be the normal case, but a memory leak has been reported.
830
831 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
832
833 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
834 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
835 {
836 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
837 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
838
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530839 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 }
841
842 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700843
844 limCleanupMlm(pMac);
845 limCleanupLmm(pMac);
846
847 // free up preAuth table
848 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
849 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530850 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
852 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
853 }
854
855 if(NULL != pMac->lim.pDialogueTokenHead)
856 {
857 limDeleteDialogueTokenList(pMac);
858 }
859
860 if(NULL != pMac->lim.pDialogueTokenTail)
861 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530862 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 pMac->lim.pDialogueTokenTail = NULL;
864 }
865
866 # if 0
867 if (pMac->lim.gpLimStartBssReq != NULL)
868 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530869 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 pMac->lim.gpLimStartBssReq = NULL;
871 }
872 #endif
873
874 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
875 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530876 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 pMac->lim.gpLimMlmSetKeysReq = NULL;
878 }
879
880 #if 0
881 if (pMac->lim.gpLimJoinReq != NULL)
882 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530883 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 pMac->lim.gpLimJoinReq = NULL;
885 }
886 #endif
887
888 if (pMac->lim.gpLimMlmAuthReq != NULL)
889 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530890 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 pMac->lim.gpLimMlmAuthReq = NULL;
892 }
893
Jeff Johnsone7245742012-09-05 17:12:55 -0700894#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 if (pMac->lim.gpLimMlmJoinReq != NULL)
896 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530897 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 pMac->lim.gpLimMlmJoinReq = NULL;
899 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700900#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700901
902 #if 0
903 if (pMac->lim.gpLimReassocReq != NULL)
904 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530905 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 pMac->lim.gpLimReassocReq = NULL;
907 }
908 #endif
909
910 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
911 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530912 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
914 }
915
Viral Modid440e682013-03-06 02:25:31 -0800916 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800917 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530918 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800919 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800920 }
Viral Modid86bde22012-12-10 13:09:21 -0800921
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 if (pMac->lim.gpLimMlmScanReq != NULL)
923 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530924 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 pMac->lim.gpLimMlmScanReq = NULL;
926 }
927
928#if 0
929 if(NULL != pMac->lim.beacon)
930 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530931 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 pMac->lim.beacon = NULL;
933 }
934#endif
935 #if 0
936 if(NULL != pMac->lim.assocReq)
937 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530938 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 pMac->lim.assocReq= NULL;
940 }
941 #endif
942
943#if 0
944 if(NULL != pMac->lim.assocRsp)
945 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530946 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 pMac->lim.assocRsp= NULL;
948 }
949#endif
950 // Now, finally reset the deferred message queue pointers
951 limResetDeferredMsgQ(pMac);
952
Jeff Johnson295189b2012-06-20 16:38:30 -0700953
954 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
955 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
956
957 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700958 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700959
960#if defined WLAN_FEATURE_VOWIFI
961 rrmCleanup(pMac);
962#endif
963#if defined WLAN_FEATURE_VOWIFI_11R
964 limFTCleanup(pMac);
965#endif
966
967} /*** end limCleanup() ***/
968
969
970/** -------------------------------------------------------------
971\fn peOpen
972\brief will be called in Open sequence from macOpen
973\param tpAniSirGlobal pMac
974\param tHalOpenParameters *pHalOpenParam
975\return tSirRetStatus
976 -------------------------------------------------------------*/
977
978tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
979{
980 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
981 pMac->lim.maxStation = pMacOpenParam->maxStation;
982
983 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
984 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700985 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 return eSIR_FAILURE;
987 }
988
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530989 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
990 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700992 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 return eSIR_FAILURE;
994 }
995
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800996#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530997 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
998 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001000 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 return eSIR_FAILURE;
1002 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001003#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301004 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
1005 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001007 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 return eSIR_FAILURE;
1009 }
1010
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301011 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001012
1013
1014 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301015 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1016 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001018 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 return eSIR_FAILURE;
1020 }
1021
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301022 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1023 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001025 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 return eSIR_FAILURE;
1027 }
1028 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301029 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1030 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001032 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 return eSIR_FAILURE;
1034 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301035 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001036
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001037 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001038 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001040 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1041 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001042 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001043 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1044 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1045 vos_mem_free(pMac->lim.gpSession);
1046 pMac->lim.gpSession = NULL;
1047 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1048 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001049 return eSIR_FAILURE;
1050 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001051 pMac->lim.deauthMsgCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001052
1053 /*
1054 * peOpen is successful by now, so it is right time to initialize
1055 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1056 * then nothing will be logged for PE module.
1057 */
1058#ifdef LIM_TRACE_RECORD
1059 MTRACE(limTraceInit(pMac));
1060#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 return eSIR_SUCCESS;
1062}
1063
1064/** -------------------------------------------------------------
1065\fn peClose
1066\brief will be called in close sequence from macClose
1067\param tpAniSirGlobal pMac
1068\return tSirRetStatus
1069 -------------------------------------------------------------*/
1070
1071tSirRetStatus peClose(tpAniSirGlobal pMac)
1072{
1073 tANI_U8 i;
1074
1075 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1076 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001077
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 for(i =0; i < pMac->lim.maxBssId; i++)
1079 {
1080 if(pMac->lim.gpSession[i].valid == TRUE)
1081 {
1082 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1083 }
1084 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301085 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001086 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001087#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301088 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001089 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001090#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001091
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301092 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 pMac->lim.gpSession = NULL;
1094 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301095 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301097 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1099 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301100 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001102 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1103 {
1104 return eSIR_FAILURE;
1105 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 return eSIR_SUCCESS;
1107}
1108
1109/** -------------------------------------------------------------
1110\fn peStart
1111\brief will be called in start sequence from macStart
1112\param tpAniSirGlobal pMac
1113\return none
1114 -------------------------------------------------------------*/
1115
1116tSirRetStatus peStart(tpAniSirGlobal pMac)
1117{
1118 tSirRetStatus status = eSIR_SUCCESS;
1119
1120 status = limInitialize(pMac);
1121#if defined(ANI_LOGDUMP)
1122 limDumpInit(pMac);
1123#endif //#if defined(ANI_LOGDUMP)
1124
1125 return status;
1126}
1127
1128/** -------------------------------------------------------------
1129\fn peStop
1130\brief will be called in stop sequence from macStop
1131\param tpAniSirGlobal pMac
1132\return none
1133 -------------------------------------------------------------*/
1134
1135void peStop(tpAniSirGlobal pMac)
1136{
1137 limCleanup(pMac);
1138 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1139 return;
1140}
1141
1142/** -------------------------------------------------------------
1143\fn peFreeMsg
1144\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1145\ to free a given PE message on the TX and MC thread.
1146\ This happens when there are messages pending in the PE
1147\ queue when system is being stopped and reset.
1148\param tpAniSirGlobal pMac
1149\param tSirMsgQ pMsg
1150\return none
1151-----------------------------------------------------------------*/
1152v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1153{
1154 if (pMsg != NULL)
1155 {
1156 if (NULL != pMsg->bodyptr)
1157 {
1158 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1159 {
1160 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1161 }
1162 else
1163 {
1164 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1165 }
1166 }
1167 pMsg->bodyptr = 0;
1168 pMsg->bodyval = 0;
1169 pMsg->type = 0;
1170 }
1171 return;
1172}
1173
1174
1175/**
1176 * The function checks if a particular timer should be allowed
1177 * into LIM while device is sleeping
1178 */
1179tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1180{
1181 tANI_U8 retStatus = TRUE;
1182
1183 if(!limIsSystemInActiveState(pMac))
1184 {
1185 switch(pMsg->type)
1186 {
1187 /* Don't allow following timer messages if in sleep */
1188 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1189 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1190 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1191 retStatus = FALSE;
1192 break;
1193 /* May allow following timer messages in sleep mode */
1194 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1195
1196 /* Safe to allow as of today, this triggers background scan
1197 * which will not be started if the device is in power-save mode
1198 * might need to block in the future if we decide to implement
1199 * spectrum management
1200 */
1201 case SIR_LIM_QUIET_TIMEOUT:
1202
1203 /* Safe to allow as of today, this triggers background scan
1204 * which will not be started if the device is in power-save mode
1205 * might need to block in the future if we decide to implement
1206 * spectrum management
1207 */
1208 case SIR_LIM_QUIET_BSS_TIMEOUT:
1209
1210 /* Safe to allow this timermessage, triggers background scan
1211 * which is blocked in sleep mode
1212 */
1213 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1214
1215 /* Safe to allow this timer, since, while in IMPS this timer will not
1216 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1217 * when heart-beat control is handled back to PE, device would have
1218 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1219 */
1220 case SIR_LIM_HEART_BEAT_TIMEOUT:
1221 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1222
1223 /* Safe to allow, PE is not handling this message as of now. May need
1224 * to block it, basically, free the buffer and restart the timer
1225 */
1226 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1227 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001228 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1230 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1231 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1232 retStatus = TRUE;
1233 break;
1234
1235 /* by default allow rest of messages */
1236 default:
1237 retStatus = TRUE;
1238 break;
1239
1240
1241 }
1242 }
1243
1244 return retStatus;
1245
1246}
1247
1248
1249
1250/**
1251 * limPostMsgApi()
1252 *
1253 *FUNCTION:
1254 * This function is called from other thread while posting a
1255 * message to LIM message Queue gSirLimMsgQ.
1256 *
1257 *LOGIC:
1258 * NA
1259 *
1260 *ASSUMPTIONS:
1261 * NA
1262 *
1263 *NOTE:
1264 * NA
1265 *
1266 * @param pMac - Pointer to Global MAC structure
1267 * @param pMsg - Pointer to the message structure
1268 * @return None
1269 */
1270
1271tANI_U32
1272limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1273{
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1275
1276
Jeff Johnson295189b2012-06-20 16:38:30 -07001277} /*** end limPostMsgApi() ***/
1278
1279
1280/*--------------------------------------------------------------------------
1281
1282 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1283
1284 This function can be called by legacy code to post message to voss queues OR
1285 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1286 for dispatching it later.
1287
1288 \param pMac - Pointer to Global MAC structure
1289 \param pMsg - Pointer to the message structure
1290
1291 \return tANI_U32 - TX_SUCCESS for success.
1292
1293 --------------------------------------------------------------------------*/
1294
1295tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1296{
1297 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1298}
1299
1300/*--------------------------------------------------------------------------
1301
1302 \brief peProcessMessages() - Message Processor for PE
1303
1304 Voss calls this function to dispatch the message to PE
1305
1306 \param pMac - Pointer to Global MAC structure
1307 \param pMsg - Pointer to the message structure
1308
1309 \return tANI_U32 - TX_SUCCESS for success.
1310
1311 --------------------------------------------------------------------------*/
1312
1313tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1314{
1315 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1316 {
1317 return eSIR_SUCCESS;
1318 }
1319 /**
1320 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1321 * for all the other cases post it to LIM
1322 */
1323 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1324 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1325 else
1326 limMessageProcessor(pMac, pMsg);
1327 return eSIR_SUCCESS;
1328}
1329
1330
Jeff Johnson295189b2012-06-20 16:38:30 -07001331
1332// ---------------------------------------------------------------------------
1333/**
1334 * peHandleMgmtFrame
1335 *
1336 * FUNCTION:
1337 * Process the Management frames from TL
1338 *
1339 * LOGIC:
1340 *
1341 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1342 *
1343 * NOTE:
1344 *
1345 * @param pvosGCtx Global Vos Context
1346 * @param vossBuff Packet
1347 * @return None
1348 */
1349
1350VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1351{
1352 tpAniSirGlobal pMac;
1353 tpSirMacMgmtHdr mHdr;
1354 tSirMsgQ msg;
1355 vos_pkt_t *pVosPkt;
1356 VOS_STATUS vosStatus;
1357 v_U8_t *pRxPacketInfo;
1358
1359 pVosPkt = (vos_pkt_t *)vosBuff;
1360 if (NULL == pVosPkt)
1361 {
1362 return VOS_STATUS_E_FAILURE;
1363 }
1364
1365 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1366 if (NULL == pMac)
1367 {
1368 // cannot log a failure without a valid pMac
1369 vos_pkt_return_packet(pVosPkt);
1370 return VOS_STATUS_E_FAILURE;
1371 }
1372
1373 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1374
1375 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1376 {
1377 vos_pkt_return_packet(pVosPkt);
1378 return VOS_STATUS_E_FAILURE;
1379 }
1380
1381
1382 //
1383 // The MPDU header is now present at a certain "offset" in
1384 // the BD and is specified in the BD itself
1385 //
1386 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1387 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1388 {
1389 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001390 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001391 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001392
Jeff Johnsone7245742012-09-05 17:12:55 -07001393 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1395 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1396 }
1397
1398
1399 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1400 msg.type = SIR_BB_XPORT_MGMT_MSG;
1401 msg.bodyptr = vosBuff;
1402 msg.bodyval = 0;
1403
1404 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1405 &msg,
1406 mHdr->fc.type,
1407 mHdr->fc.subType ))
1408 {
1409 vos_pkt_return_packet(pVosPkt);
1410 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001411 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 return VOS_STATUS_E_FAILURE;
1413 }
1414
1415 return VOS_STATUS_SUCCESS;
1416}
1417
1418// ---------------------------------------------------------------------------
1419/**
1420 * peRegisterTLHandle
1421 *
1422 * FUNCTION:
1423 * Registers the Handler which, process the Management frames from TL
1424 *
1425 * LOGIC:
1426 *
1427 * ASSUMPTIONS:
1428 *
1429 * NOTE:
1430 *
1431 * @return None
1432 */
1433
1434void peRegisterTLHandle(tpAniSirGlobal pMac)
1435{
1436 v_PVOID_t pvosGCTx;
1437 VOS_STATUS retStatus;
1438
1439 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1440
1441 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1442
1443 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001444 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001445
1446}
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
1448
1449/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 * limIsSystemInScanState()
1451 *
1452 *FUNCTION:
1453 * This function is called by various MAC software modules to
1454 * determine if System is in Scan/Learn state
1455 *
1456 *LOGIC:
1457 * NA
1458 *
1459 *ASSUMPTIONS:
1460 * NA
1461 *
1462 *NOTE:
1463 *
1464 * @param pMac - Pointer to Global MAC structure
1465 * @return true - System is in Scan/Learn state
1466 * false - System is NOT in Scan/Learn state
1467 */
1468
1469tANI_U8
1470limIsSystemInScanState(tpAniSirGlobal pMac)
1471{
1472 switch (pMac->lim.gLimSmeState)
1473 {
1474 case eLIM_SME_CHANNEL_SCAN_STATE:
1475 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1476 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1477 case eLIM_SME_WT_SCAN_STATE:
1478 // System is in Learn mode
1479 return true;
1480
1481 default:
1482 // System is NOT in Learn mode
1483 return false;
1484 }
1485} /*** end limIsSystemInScanState() ***/
1486
1487
1488
1489/**
1490 * limIsSystemInActiveState()
1491 *
1492 *FUNCTION:
1493 * This function is called by various MAC software modules to
1494 * determine if System is in Active/Wakeup state
1495 *
1496 *LOGIC:
1497 * NA
1498 *
1499 *ASSUMPTIONS:
1500 * NA
1501 *
1502 *NOTE:
1503 *
1504 * @param pMac - Pointer to Global MAC structure
1505 * @return true - System is in Active state
1506 * false - System is not in Active state
1507 */
1508
1509tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1510{
1511 switch (pMac->pmm.gPmmState)
1512 {
1513 case ePMM_STATE_BMPS_WAKEUP:
1514 case ePMM_STATE_IMPS_WAKEUP:
1515 case ePMM_STATE_READY:
1516 // System is in Active mode
1517 return true;
1518 default:
1519 return false;
1520 // System is NOT in Active mode
1521 }
1522}
1523
1524
Jeff Johnson295189b2012-06-20 16:38:30 -07001525
Jeff Johnson295189b2012-06-20 16:38:30 -07001526
1527
1528/**
1529*\brief limReceivedHBHandler()
1530*
1531* This function is called by schBeaconProcess() upon
1532* receiving a Beacon on STA. This also gets called upon
1533* receiving Probe Response after heat beat failure is
1534* detected.
1535*
1536* param pMac - global mac structure
1537* param channel - channel number indicated in Beacon, Probe Response
1538* return - none
1539*/
1540
1541
1542void
1543limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1544{
1545 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1546 psessionEntry->LimRxedBeaconCntDuringHB++;
1547
1548 pMac->pmm.inMissedBeaconScenario = FALSE;
1549} /*** end limReceivedHBHandler() ***/
1550
1551
1552
1553#if 0
1554void limResetHBPktCount(tpPESession psessionEntry)
1555{
1556 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1557}
1558#endif
1559
1560
1561/*
1562 * limProcessWdsInfo()
1563 *
1564 *FUNCTION:
1565 * This function is called from schBeaconProcess in BP
1566 *
1567 *PARAMS:
1568 * @param pMac - Pointer to Global MAC structure
1569 * @param propIEInfo - proprietary IE info
1570 *
1571 *LOGIC:
1572 *
1573 *ASSUMPTIONS:
1574 * NA
1575 *
1576 *NOTE:
1577 *
1578 *
1579 *RETURNS:
1580 *
1581 */
1582
1583void limProcessWdsInfo(tpAniSirGlobal pMac,
1584 tSirPropIEStruct propIEInfo)
1585{
Jeff Johnson295189b2012-06-20 16:38:30 -07001586}
1587
1588
1589
1590/**
1591 * limInitWdsInfoParams()
1592 *
1593 *FUNCTION:
1594 * This function is called while processing
1595 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1596 * ind/set related parameters.
1597 *
1598 *LOGIC:
1599 *
1600 *ASSUMPTIONS:
1601 *
1602 *NOTE:
1603 *
1604 * @param pMac Pointer to Global MAC structure
1605 * @return None
1606 */
1607
1608void
1609limInitWdsInfoParams(tpAniSirGlobal pMac)
1610{
1611 pMac->lim.gLimWdsInfo.wdsLength = 0;
1612 pMac->lim.gLimNumWdsInfoInd = 0;
1613 pMac->lim.gLimNumWdsInfoSet = 0;
1614} /*** limInitWdsInfoParams() ***/
1615
1616
1617/** -------------------------------------------------------------
1618\fn limUpdateOverlapStaParam
1619\brief Updates overlap cache and param data structure
1620\param tpAniSirGlobal pMac
1621\param tSirMacAddr bssId
1622\param tpLimProtStaParams pStaParams
1623\return None
1624 -------------------------------------------------------------*/
1625void
1626limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1627{
1628 int i;
1629 if (!pStaParams->numSta)
1630 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301631 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1632 bssId,
1633 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 pMac->lim.protStaOverlapCache[0].active = true;
1635
1636 pStaParams->numSta = 1;
1637
1638 return;
1639 }
1640
1641 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1642 {
1643 if (pMac->lim.protStaOverlapCache[i].active)
1644 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301645 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 bssId,
1647 sizeof(tSirMacAddr))) {
1648 return; }
1649 }
1650 else
1651 break;
1652 }
1653
1654 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1655 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301656 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001657 }
1658 else
1659 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301660 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1661 bssId,
1662 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001663 pMac->lim.protStaOverlapCache[i].active = true;
1664
1665 pStaParams->numSta++;
1666 }
1667}
1668
1669
1670/**
1671 * limHandleIBSScoalescing()
1672 *
1673 *FUNCTION:
1674 * This function is called upon receiving Beacon/Probe Response
1675 * while operating in IBSS mode.
1676 *
1677 *LOGIC:
1678 *
1679 *ASSUMPTIONS:
1680 *
1681 *NOTE:
1682 *
1683 * @param pMac - Pointer to Global MAC structure
1684 * @param pBeacon - Parsed Beacon Frame structure
1685 * @param pRxPacketInfo - Pointer to RX packet info structure
1686 *
1687 * @return Status whether to process or ignore received Beacon Frame
1688 */
1689
1690tSirRetStatus
1691limHandleIBSScoalescing(
1692 tpAniSirGlobal pMac,
1693 tpSchBeaconStruct pBeacon,
1694 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1695{
1696 tpSirMacMgmtHdr pHdr;
1697 tSirRetStatus retCode;
1698
1699 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001700 if ( (!pBeacon->capabilityInfo.ibss) ||
Abhishek Singhd5c31272014-03-07 14:46:50 +05301701 ( psessionEntry->privacy !=
1702 (tANI_U8)pBeacon->capabilityInfo.privacy ) ||
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001703 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1704 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 /* Received SSID does not match => Ignore received Beacon frame. */
1706 retCode = eSIR_LIM_IGNORE_BEACON;
1707 else
1708 {
1709 tANI_U32 ieLen;
1710 tANI_U16 tsfLater;
1711 tANI_U8 *pIEs;
1712 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1713 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1714 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1715 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1716 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1717 }
1718 return retCode;
1719} /*** end limHandleIBSScoalescing() ***/
1720
1721
1722
1723/**
1724 * limDetectChangeInApCapabilities()
1725 *
1726 *FUNCTION:
1727 * This function is called while SCH is processing
1728 * received Beacon from AP on STA to detect any
1729 * change in AP's capabilities. If there any change
1730 * is detected, Roaming is informed of such change
1731 * so that it can trigger reassociation.
1732 *
1733 *LOGIC:
1734 *
1735 *ASSUMPTIONS:
1736 *
1737 *NOTE:
1738 * Notification is enabled for STA product only since
1739 * it is not a requirement on BP side.
1740 *
1741 * @param pMac Pointer to Global MAC structure
1742 * @param pBeacon Pointer to parsed Beacon structure
1743 * @return None
1744 */
1745
1746void
1747limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1748 tpSirProbeRespBeacon pBeacon,
1749 tpPESession psessionEntry)
1750{
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 tANI_U8 len;
1752 tSirSmeApNewCaps apNewCaps;
1753 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301754 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1756 newChannel = (tANI_U8) pBeacon->channelNumber;
1757
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301758 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
1759 ( ( ( limIsNullSsid(&pBeacon->ssId) ) ||
1760 ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1761 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ) ||
1762 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1763 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1764 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1765 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1766 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1767 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1768 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1769 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1770 ( newChannel != psessionEntry->currentOperChannel )
1771 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301772 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301773 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301774 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301775 /* If Beacon capabilities is not matching with the current capability,
1776 * then send unicast probe request to AP and take decision after
1777 * receiving probe response */
1778 if ( true == psessionEntry->fIgnoreCapsChange )
1779 {
1780 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1781 return;
1782 }
1783 psessionEntry->fWaitForProbeRsp = true;
1784 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1785 "sending directed probe request.. "));
1786 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1787 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1788 psessionEntry->dot11mode, 0, NULL);
1789
1790 if ( eSIR_SUCCESS != status )
1791 {
1792 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1793 psessionEntry->fWaitForProbeRsp = false;
1794 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301795 return;
1796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 /**
1798 * BSS capabilities have changed.
1799 * Inform Roaming.
1800 */
1801 len = sizeof(tSirMacCapabilityInfo) +
1802 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1803 3 * sizeof(tANI_U8) + // reserved fields
1804 pBeacon->ssId.length + 1;
1805
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301806 vos_mem_copy(apNewCaps.bssId,
1807 psessionEntry->bssId,
1808 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001809 if (newChannel != psessionEntry->currentOperChannel)
1810 {
1811 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001812 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 psessionEntry->currentOperChannel, newChannel);)
1814 return;
1815 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301816
1817 /**
1818 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1819 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1820 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1821 * the privacy bit is set in Probe and association responses.
1822 * Due to this anomaly, we detect a change in
1823 * AP capabilities when we receive a beacon after association and
1824 * disconnect from the AP. The following check makes sure that we can
1825 * connect to such APs
1826 */
1827 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1828 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1829 {
1830 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001831 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301832 return;
1833 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 else
1835 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301836 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1837 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 pBeacon->ssId.length + 1);
1839
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301840 psessionEntry->fIgnoreCapsChange = false;
1841 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 psessionEntry->limSentCapsChangeNtf = true;
1843 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1844 (tANI_U32 *) &apNewCaps,
1845 len, psessionEntry->smeSessionId);
1846 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301847 else if ( true == psessionEntry->fWaitForProbeRsp )
1848 {
1849 /* Only for probe response frames and matching capabilities the control
1850 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1851 * will be false, the control will not come here*/
1852
1853 limLog(pMac, LOG1, FL("capabilities in probe response are"
1854 "matching with the current setting,"
1855 "Ignoring subsequent capability"
1856 "mismatch"));
1857 psessionEntry->fIgnoreCapsChange = true;
1858 psessionEntry->fWaitForProbeRsp = false;
1859 }
1860
Jeff Johnson295189b2012-06-20 16:38:30 -07001861} /*** limDetectChangeInApCapabilities() ***/
1862
1863
1864
1865
1866// ---------------------------------------------------------------------
1867/**
1868 * limUpdateShortSlot
1869 *
1870 * FUNCTION:
1871 * Enable/Disable short slot
1872 *
1873 * LOGIC:
1874 *
1875 * ASSUMPTIONS:
1876 *
1877 * NOTE:
1878 *
1879 * @param enable Flag to enable/disable short slot
1880 * @return None
1881 */
1882
1883tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1884{
1885
1886 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001887 tANI_U32 nShortSlot;
1888 tANI_U32 val = 0;
1889 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001890
Jeff Johnsone7245742012-09-05 17:12:55 -07001891 // Check Admin mode first. If it is disabled just return
1892 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1893 != eSIR_SUCCESS)
1894 {
1895 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001896 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001897 return eSIR_FAILURE;
1898 }
1899 if (val == false)
1900 return eSIR_SUCCESS;
1901
1902 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1903 limGetPhyMode(pMac, &phyMode, psessionEntry);
1904 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1905 return eSIR_SUCCESS;
1906
1907 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001908
1909 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1910 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1911 // if no erp present, use short slot based on current ap caps
1912
1913 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1914
1915 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1916 // The difference between the earlier implementation and the new one is only Case4.
1917 /*
1918 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1919 Case1 1 1 1 1 //AP should not advertise this combination.
1920 Case2 1 1 0 0
1921 Case3 1 0 1 1
1922 Case4 1 0 0 0
1923 Case5 0 1 1 1
1924 Case6 0 1 0 0
1925 Case7 0 0 1 1
1926 Case8 0 0 0 0
1927 */
1928 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1929
Jeff Johnsone7245742012-09-05 17:12:55 -07001930 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 {
1932 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001933 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001935 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1937 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 }
1939 return eSIR_SUCCESS;
1940}
1941
1942
Jeff Johnson295189b2012-06-20 16:38:30 -07001943
1944
Jeff Johnson295189b2012-06-20 16:38:30 -07001945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946
1947
1948/** -----------------------------------------------------------------
1949 \brief limHandleLowRssiInd() - handles low rssi indication
1950
1951 This function process the SIR_HAL_LOW_RSSI_IND message from
1952 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1953
1954 \param pMac - global mac structure
1955
1956 \return
1957
1958 \sa
1959 ----------------------------------------------------------------- */
1960void limHandleLowRssiInd(tpAniSirGlobal pMac)
1961{
1962#if 0 //RSSI related indications will now go to TL and not PE
1963 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1964 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1965 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1966 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001967 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1969 }
1970 else
1971 {
1972 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001973 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 pMac->pmm.gPmmState);
1975 }
1976 return;
1977#endif
1978}
1979
1980
1981/** -----------------------------------------------------------------
1982 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1983
1984 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1985 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1986 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1987
1988 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1989 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1990 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1991 This message can also come from FW anytime after we have entered BMPS.
1992 This means we should handle it in WoWL and UAPSD states as well
1993
1994 \param pMac - global mac structure
1995 \return - none
1996 \sa
1997 ----------------------------------------------------------------- */
1998void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1999{
2000 switch(pMac->pmm.gPmmState)
2001 {
2002 case ePMM_STATE_BMPS_SLEEP:
2003 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2004 case ePMM_STATE_UAPSD_SLEEP:
2005 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2006 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002007 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2009 break;
2010
2011 default:
2012 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002013 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 pMac->pmm.gPmmState);
2015 break;
2016 }
2017 return;
2018}
2019
2020
2021/** -----------------------------------------------------------------
2022 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2023
2024 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2025 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2026 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2027
2028 \param pMac - global mac structure
2029 \return - none
2030 \sa
2031 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002032void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002033{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002034#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2035 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2036 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2037 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2038 if (psessionEntry == NULL)
2039 {
2040 limLog(pMac, LOGE,
2041 FL("session does not exist for given BSSIdx:%d"),
2042 pSirMissedBeaconInd->bssIdx);
2043 return;
2044 }
2045#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2047 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2048 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2049 {
2050 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302051 PELOGE(limLog(pMac, LOGE,
2052 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2054 }
Yathish9f22e662012-12-10 14:21:35 -08002055/* ACTIVE_MODE_HB_OFFLOAD */
2056#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2057 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2058 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2059 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2060 {
2061 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002062 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002063 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002064 }
2065#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 else
2067 {
2068 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002069 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 pMac->pmm.gPmmState);
2071 }
2072 return;
2073}
2074
2075/** -----------------------------------------------------------------
2076 \brief limMicFailureInd() - handles mic failure indication
2077
2078 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2079
2080 \param pMac - global mac structure
2081 \return - none
2082 \sa
2083 ----------------------------------------------------------------- */
2084void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2085{
2086 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2087 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2088 tSirMsgQ mmhMsg;
2089 tpPESession psessionEntry ;
2090 tANI_U8 sessionId;
2091
2092 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2093 {
2094 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002095 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 return;
2097 }
2098
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302099 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2100 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 {
2102 // Log error
2103 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002104 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 return;
2106 }
2107
2108 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2109 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2110 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2111
2112 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302113 pSirMicFailureInd->bssId,
2114 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002115
2116 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302117 pSirMicFailureInd->info.srcMacAddr,
2118 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002119
2120 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302121 pSirMicFailureInd->info.taMacAddr,
2122 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002123
2124 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302125 pSirMicFailureInd->info.dstMacAddr,
2126 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002127
2128 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302129 pSirMicFailureInd->info.rxMacAddr,
2130 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002131
2132 pSirSmeMicFailureInd->info.multicast =
2133 pSirMicFailureInd->info.multicast;
2134
2135 pSirSmeMicFailureInd->info.keyId=
2136 pSirMicFailureInd->info.keyId;
2137
2138 pSirSmeMicFailureInd->info.IV1=
2139 pSirMicFailureInd->info.IV1;
2140
2141 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302142 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002143
2144 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2145 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2146 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002147 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2149 return;
2150}
2151
2152
2153/** -----------------------------------------------------------------
2154 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2155
2156 This function is called before enqueuing the frame to PE queue for further processing.
2157 This prevents unnecessary frames getting into PE Queue and drops them right away.
2158 Frames will be droped in the following scenarios:
2159
2160 - In Scan State, drop the frames which are not marked as scan frames
2161 - In non-Scan state, drop the frames which are marked as scan frames.
2162 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2163 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2164
2165 \param pMac - global mac structure
2166 \return - none
2167 \sa
2168 ----------------------------------------------------------------- */
2169
2170tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2171{
2172 tANI_U32 framelen;
2173 tANI_U8 *pBody;
2174 tSirMacCapabilityInfo capabilityInfo;
2175
2176 /*
2177 *
2178 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2179 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2180 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2181 * other than beacons or probe responses in scan state.
2182 */
2183 if( (subType == SIR_MAC_MGMT_BEACON) ||
2184 (subType == SIR_MAC_MGMT_PROBE_RSP))
2185 {
2186 if(pMac->pmm.inMissedBeaconScenario)
2187 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002188 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2189 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 }
2191 if (limIsSystemInScanState(pMac))
2192 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002193 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002195#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2196 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2197 {
2198 return eMGMT_DROP_NO_DROP;
2199 }
2200#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2202 {
2203 return eMGMT_DROP_SCAN_MODE_FRAME;
2204 }
2205 }
2206
2207 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2208 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2209
2210 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2211 * beacons from an infrastructure network
2212 */
2213 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2214 if(!capabilityInfo.ibss)
2215 return eMGMT_DROP_NO_DROP;
2216#if 0
2217 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2218 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2219 return eMGMT_DROP_NO_DROP;
2220#endif
2221
2222 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2223 if( (subType == SIR_MAC_MGMT_BEACON) ||
2224 (subType == SIR_MAC_MGMT_PROBE_RSP))
2225 {
2226 //drop the frame if length is less than 12
2227 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2228 return eMGMT_DROP_INVALID_SIZE;
2229
2230 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2231
2232 //This can be enhanced to even check the SSID before deciding to enque the frame.
2233 if(capabilityInfo.ess)
2234 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2235 }
2236 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2237 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2238 {
2239 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2240 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2241 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2242 }
2243
2244 return eMGMT_DROP_NO_DROP;
2245}
2246
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002247eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2248{
2249 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002250
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002251 if(psPe)
2252 {
2253 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2254 {
2255 status = eHAL_STATUS_SUCCESS;
2256 }
2257 }
2258 return (status);
2259}
2260eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2261{
2262 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2263 if(psPe)
2264 {
2265 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2266 {
2267 status = eHAL_STATUS_SUCCESS;
2268 }
2269 }
2270 return (status);
2271}