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