blob: df47b38e93aad23669e1473a200e2c1999d7bd36 [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
Abhishek Singhde51a412014-05-20 19:17:26 +0530205 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[0],
206 sizeof(tSirMacAddr));
207 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[1],
208 sizeof(tSirMacAddr));
209 pMac->lim.gLimHeartBeatApMacIndex = 0;
210
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 // Statistics to keep track of no. beacons rcvd in heart beat interval
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530212 vos_mem_set(pMac->lim.gLimHeartBeatBeaconStats,
213 sizeof(pMac->lim.gLimHeartBeatBeaconStats), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700214
215#ifdef WLAN_DEBUG
216 // Debug counters
217 pMac->lim.numTot = 0;
218 pMac->lim.numBbt = 0;
219 pMac->lim.numProtErr = 0;
220 pMac->lim.numLearn = 0;
221 pMac->lim.numLearnIgnore = 0;
222 pMac->lim.numSme = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530223 vos_mem_set(pMac->lim.numMAC, sizeof(pMac->lim.numMAC), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 pMac->lim.gLimNumAssocReqDropInvldState = 0;
225 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
226 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
227 pMac->lim.gLimNumReassocReqDropInvldState = 0;
228 pMac->lim.gLimNumHashMissIgnored = 0;
229 pMac->lim.gLimUnexpBcnCnt = 0;
230 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
231 pMac->lim.gLimNumLinkEsts = 0;
232 pMac->lim.gLimNumRxCleanup = 0;
233 pMac->lim.gLim11bStaAssocRejectCount = 0;
234#endif
235}
236
237
238
239static void __limInitStates(tpAniSirGlobal pMac)
240{
241 // Counts Heartbeat failures
242 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
243 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
244 pMac->lim.gLimHBfailureCntInOtherStates = 0;
245 pMac->lim.gLimRspReqd = 0;
246 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
247
248 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700249 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
251
252 /// Previous MLM State
253 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
254
255#ifdef GEN4_SCAN
256 // LIM to HAL SCAN Management Message Interface states
257 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
258#endif // GEN4_SCAN
259
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700261 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700263 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700264
265 /**
266 * By default assume 'unknown' role. This will be updated
267 * when SME_START_BSS_REQ is received.
268 */
269
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530270 vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0);
271 vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0);
272 vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0);
273 vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0);
274 vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0);
275 vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700276
277 pMac->lim.gLimPhyMode = 0;
278 pMac->lim.scanStartTime = 0; // used to measure scan time
279
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530280 vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 pMac->lim.ackPolicy = 0;
282
283#if 0 /* Moving all these to session specific elements */
284 pMac->lim.gLimQosEnabled = 0; //11E
285 pMac->lim.gLimWmeEnabled = 0; //WME
286 pMac->lim.gLimWsmEnabled = 0; //WSM
287 pMac->lim.gLimHcfEnabled = 0;
288 pMac->lim.gLim11dEnabled = 0;
289#endif
290
291 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
292}
293
294static void __limInitVars(tpAniSirGlobal pMac)
295{
296
Jeff Johnson295189b2012-06-20 16:38:30 -0700297
298 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700299
300 // WDS info
301 pMac->lim.gLimNumWdsInfoInd = 0;
302 pMac->lim.gLimNumWdsInfoSet = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530303 vos_mem_set(&pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 /* initialize some parameters */
305 limInitWdsInfoParams(pMac);
306
307 // Deferred Queue Paramters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530308 vos_mem_set(&pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700309
310 // addts request if any - only one can be outstanding at any time
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530311 vos_mem_set(&pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq) , 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 pMac->lim.gLimAddtsSent = 0;
313 pMac->lim.gLimAddtsRspTimerCount = 0;
314
315 //protection related config cache
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530316 vos_mem_set(&pMac->lim.cfgProtection, sizeof(tCfgProtection), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 pMac->lim.gLimProtectionControl = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530318 vos_mem_set(&pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
320
Jeff Johnsone7245742012-09-05 17:12:55 -0700321#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
324 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700325#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 // WMM Related Flag
327 pMac->lim.gUapsdEnable = 0;
328 pMac->lim.gUapsdPerAcBitmask = 0;
329 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
330 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
331
332 // QoS-AC Downgrade: Initially, no AC is admitted
333 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
334 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
335
336 //dialogue token List head/tail for Action frames request sent.
337 pMac->lim.pDialogueTokenHead = NULL;
338 pMac->lim.pDialogueTokenTail = NULL;
339
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530340 vos_mem_set(&pMac->lim.tspecInfo,
341 sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700342
343 // admission control policy information
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530344 vos_mem_set(&pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700345
346 pMac->lim.gLastBeaconDtimCount = 0;
347 pMac->lim.gLastBeaconDtimPeriod = 0;
348
349 //Scan in Power Save Flag
350 pMac->lim.gScanInPowersave = 0;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -0800351 pMac->lim.probeCounter = 0;
352 pMac->lim.maxProbe = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700353}
354
355static void __limInitAssocVars(tpAniSirGlobal pMac)
356{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800357 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800358#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530359 vos_mem_set(pMac->lim.gpLimAIDpool,
360 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 pMac->lim.freeAidHead = 0;
362 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800363#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800364 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
365 {
366 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
367 }
368 pMac->lim.gLimAssocStaLimit = val;
Ravi Joshi0fc681b2013-09-11 16:46:07 -0700369 pMac->lim.gLimIbssStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700370
371 // Place holder for current authentication request
372 // being handled
373 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700374 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700375
376 /// MAC level Pre-authentication related globals
377 pMac->lim.gLimPreAuthChannelNumber = 0;
378 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530379 vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 pMac->lim.gLimNumPreAuthContexts = 0;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530381 vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700382
383 // Placed holder to deauth reason
384 pMac->lim.gLimDeauthReasonCode = 0;
385
386 // Place holder for Pre-authentication node list
387 pMac->lim.pLimPreAuthList = NULL;
388
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 //One cache for each overlap and associated case.
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530390 vos_mem_set(pMac->lim.protStaOverlapCache,
391 sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0);
392 vos_mem_set(pMac->lim.protStaCache,
393 sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700394
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800395#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700396 pMac->lim.pSessionEntry = NULL;
397 pMac->lim.reAssocRetryAttempt = 0;
398#endif
399
Jeff Johnson295189b2012-06-20 16:38:30 -0700400}
401
402
403static void __limInitTitanVars(tpAniSirGlobal pMac)
404{
Jeff Johnsone7245742012-09-05 17:12:55 -0700405#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530406 vos_mem_set(&pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700408 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
409#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 // Debug workaround for BEACON's
411 // State change triggered by "dump 222"
412 pMac->lim.gLimScanOverride = 1;
413 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 pMac->lim.gLimTitanStaCount = 0;
415 pMac->lim.gLimBlockNonTitanSta = 0;
416}
417
418static void __limInitHTVars(tpAniSirGlobal pMac)
419{
420 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700422 pMac->lim.gHTShortGI40Mhz = 0;
423 pMac->lim.gHTShortGI20Mhz = 0;
424 pMac->lim.gHTMaxAmsduLength = 0;
425 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
426 pMac->lim.gHTPSMPSupport = 0;
427 pMac->lim.gHTLsigTXOPProtection = 0;
428 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
429 pMac->lim.gHTAMpduDensity = 0;
430
431 pMac->lim.gMaxAmsduSizeEnabled = false;
432 pMac->lim.gHTMaxRxAMpduFactor = 0;
433 pMac->lim.gHTServiceIntervalGranularity = 0;
434 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
436 pMac->lim.gHTPCOActive = 0;
437
438 pMac->lim.gHTPCOPhase = 0;
439 pMac->lim.gHTSecondaryBeacon = 0;
440 pMac->lim.gHTDualCTSProtection = 0;
441 pMac->lim.gHTSTBCBasicMCS = 0;
442 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
443}
444
Jeff Johnson295189b2012-06-20 16:38:30 -0700445static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
446{
Jeff Johnsone7245742012-09-05 17:12:55 -0700447 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 tANI_U16 val16;
449 tANI_U8 val8;
450 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
451 tSirMacHTInfoField1 *pHTInfoField1;
452 tpSirPowerSaveCfg pPowerSaveConfig;
453 tSirMacHTParametersInfo *pAmpduParamInfo;
454
455 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700456 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
457 * and they will be used throughout when there is no session
458 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700459
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
461 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700462 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return eSIR_FAILURE;
464 }
465
466 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
467 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700468 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 return eSIR_FAILURE;
470 }
471 val16 = ( tANI_U16 ) val1;
472 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
473
474 //channel bonding mode could be set to anything from 0 to 4(Titan had these
475 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
476 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
477 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
478 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
479 != eSIR_SUCCESS)
480 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700481 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 return eSIR_FAILURE;
483 }
484
485 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
486 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700487 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 return eSIR_FAILURE;
489 }
490
491 val8 = ( tANI_U8 ) val1;
492 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
493 pHTInfoField1->recommendedTxWidthSet =
494 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
496 != eSIR_SUCCESS)
497 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700498 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 return eSIR_FAILURE;
500 }
501
502 /* WNI_CFG_HEART_BEAT_THRESHOLD */
503
504 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
505 eSIR_SUCCESS )
506 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700507 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 return eSIR_FAILURE;
509 }
510 if(!val1)
511 {
512 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
513 pMac->sys.gSysEnableLinkMonitorMode = 0;
514 }
515 else
516 {
517 //No need to activate the timer during init time.
518 pMac->sys.gSysEnableLinkMonitorMode = 1;
519 }
520
521 /* WNI_CFG_SHORT_GI_20MHZ */
522
523 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
524 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700525 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 return eSIR_FAILURE;
527 }
528 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
529 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 return eSIR_FAILURE;
532 }
533 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
534 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700535 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 return eSIR_FAILURE;
537 }
538
539 val16 = ( tANI_U16 ) val1;
540 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
541 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
542 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
543
544 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
545 eSIR_SUCCESS)
546 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700547 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 return eSIR_FAILURE;
549 }
550
551 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
552
553 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
554 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700555 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 return eSIR_FAILURE;
557 }
558 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
559 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700560 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 return eSIR_FAILURE;
562 }
563 val16 = ( tANI_U16 ) val1;
564 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
565 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
566 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
567 eSIR_SUCCESS)
568 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700569 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 return eSIR_FAILURE;
571 }
572
573 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
574 limHandleCFGparamUpdate do we want to update this? */
575 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
576 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +0530577 limLog(pMac, LOGE, FL("cfg get short preamble failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 return eSIR_FAILURE;
579 }
580
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 /* WNI_CFG_MAX_PS_POLL */
582
583 /* Allocate and fill in power save configuration. */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530584 pPowerSaveConfig = vos_mem_malloc(sizeof(tSirPowerSaveCfg));
585 if (NULL == pPowerSaveConfig)
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 {
587 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700588 "configuration"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 return eSIR_FAILURE;
590 }
591
592 /* This context should be valid if power-save configuration message has been
593 * already dispatched during initialization process. Re-using the present
594 * configuration mask
595 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530596 vos_mem_copy(pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg, sizeof(tSirPowerSaveCfg));
Jeff Johnson295189b2012-06-20 16:38:30 -0700597
598 /* Note: it is okay to do this since DAL/HAL is alrady started */
599 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
600 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700601 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 return eSIR_FAILURE;
603 }
604
605 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
606
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700608 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700610
611 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
612
613 /* This was initially done after resume notification from HAL. Now, DAL is
614 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800616 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
617 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700618 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed"));
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800619 return eSIR_FAILURE;
620 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530621#ifdef FEATURE_WLAN_TDLS
622 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_BUF_STA_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSBufStaEnabled) != eSIR_SUCCESS)
623 {
624 limLog(pMac, LOGP, FL("cfg get LimTDLSBufStaEnabled failed"));
625 return eSIR_FAILURE;
626 }
627 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_QOS_WMM_UAPSD_MASK,(tANI_U32 *) &pMac->lim.gLimTDLSUapsdMask) != eSIR_SUCCESS)
628 {
629 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
630 return eSIR_FAILURE;
631 }
Naresh Jayaramf73f3762014-02-04 16:13:20 +0530632 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_OFF_CHANNEL_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSOffChannelEnabled) != eSIR_SUCCESS)
633 {
634 limLog(pMac, LOGP, FL("cfg get LimTDLSUapsdMask failed"));
635 return eSIR_FAILURE;
636 }
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530637
638 if(wlan_cfgGetInt(pMac, WNI_CFG_TDLS_WMM_MODE_ENABLED,(tANI_U32 *) &pMac->lim.gLimTDLSWmmMode) != eSIR_SUCCESS)
639 {
640 limLog(pMac, LOGP, FL("cfg get LimTDLSWmmMode failed"));
641 return eSIR_FAILURE;
642 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530643#endif
Pradeep Reddy POTTETIa9c80d52014-05-09 18:05:29 +0530644
Rashmi Ramannac7744532013-10-06 16:49:08 +0530645 if (eSIR_SUCCESS !=
646 wlan_cfgGetInt(pMac, WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL,
647 (tANI_U32 *)&pMac->lim.gDebugP2pRemainOnChannel))
648 {
649 limLog( pMac, LOGE,
650 "%s: Couldn't get WNI_CFG_DEBUG_P2P_REMAIN_ON_CHANNEL value",
651 __func__);
652 pMac->lim.gDebugP2pRemainOnChannel = 0;
653 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 return eSIR_SUCCESS;
655}
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657/*
658 limStart
659 This function is to replace the __limProcessSmeStartReq since there is no
660 eWNI_SME_START_REQ post to PE.
661*/
662tSirRetStatus limStart(tpAniSirGlobal pMac)
663{
664 tSirResultCodes retCode = eSIR_SUCCESS;
665
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700666 PELOG1(limLog(pMac, LOG1, FL(" enter"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700667
668 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
669 {
670 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
671
Jeff Johnsone7245742012-09-05 17:12:55 -0700672 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700673
674 // By default do not return after first scan match
675 pMac->lim.gLimReturnAfterFirstMatch = 0;
676
677 // Initialize MLM state machine
678 limInitMlm(pMac);
679
680 // By default return unique scan results
681 pMac->lim.gLimReturnUniqueResults = true;
682 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700683#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
684 pMac->lim.gLimSmeLfrScanResultLength = 0;
685#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 }
687 else
688 {
689 /**
690 * Should not have received eWNI_SME_START_REQ in states
691 * other than OFFLINE. Return response to host and
692 * log error
693 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700694 limLog(pMac, LOGE, FL("Invalid SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 retCode = eSIR_FAILURE;
696 }
697
698 return retCode;
699}
700
701/**
702 * limInitialize()
703 *
704 *FUNCTION:
705 * This function is called from LIM thread entry function.
706 * LIM related global data structures are initialized in this function.
707 *
708 *LOGIC:
709 * NA
710 *
711 *ASSUMPTIONS:
712 * NA
713 *
714 *NOTE:
715 * NA
716 *
717 * @param pMac - Pointer to global MAC structure
718 * @return None
719 */
720
721tSirRetStatus
722limInitialize(tpAniSirGlobal pMac)
723{
724 tSirRetStatus status = eSIR_SUCCESS;
725
726 __limInitAssocVars(pMac);
727 __limInitVars(pMac);
728 __limInitStates(pMac);
729 __limInitStatsVars(pMac);
730 __limInitBssVars(pMac);
731 __limInitScanVars(pMac);
732 __limInitHTVars(pMac);
733 __limInitTitanVars(pMac);
734
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 status = limStart(pMac);
736 if(eSIR_SUCCESS != status)
737 {
738 return status;
739 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
741 /*
742 * MLM will be intitalized when 'START' request comes from SME.
743 * limInitMlm calls limCreateTimers, which actually relies on
744 * CFG to be downloaded. So it should not be called as part of
745 * peStart, as CFG download is happening after peStart.
746 */
747 //limInitMlm(pMac);
748 // Initializations for maintaining peers in IBSS
749 limIbssInit(pMac);
750
751 pmmInitialize(pMac);
752
753
754#if defined WLAN_FEATURE_VOWIFI
755 rrmInitialize(pMac);
756#endif
757#if defined WLAN_FEATURE_VOWIFI_11R
758 limFTOpen(pMac);
759#endif
760
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700762
763#if 0
764
765 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
766 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
767 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
768
769 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
770 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
771
772 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
773 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
774 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
775
776 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
777
778 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
779
780 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
781 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
782
783 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
784
785
786 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
787
788 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
789#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700790
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 //Initialize the configurations needed by PE
792 if( eSIR_FAILURE == __limInitConfig(pMac))
793 {
794 //We need to undo everything in limStart
795 limCleanupMlm(pMac);
796 return eSIR_FAILURE;
797 }
798
799 //initialize the TSPEC admission control table.
800 //Note that this was initially done after resume notification from HAL.
801 //Now, DAL is started before PE so this can be done here
802 limAdmitControlInit(pMac);
803 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700804
805 return status;
806
807} /*** end limInitialize() ***/
808
809
810
811/**
812 * limCleanup()
813 *
814 *FUNCTION:
815 * This function is called upon reset or persona change
816 * to cleanup LIM state
817 *
818 *LOGIC:
819 * NA
820 *
821 *ASSUMPTIONS:
822 * NA
823 *
824 *NOTE:
825 * NA
826 *
827 * @param pMac - Pointer to Global MAC structure
828 * @return None
829 */
830
831void
832limCleanup(tpAniSirGlobal pMac)
833{
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 v_PVOID_t pvosGCTx;
835 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700836
Jeff Johnson295189b2012-06-20 16:38:30 -0700837//Before destroying the list making sure all the nodes have been deleted.
838//Which should be the normal case, but a memory leak has been reported.
839
840 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
841
842 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
843 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
844 {
845 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
846 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
847
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530848 vos_mem_free(pLimMgmtRegistration);
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 }
850
851 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700852
853 limCleanupMlm(pMac);
854 limCleanupLmm(pMac);
855
856 // free up preAuth table
857 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
858 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530859 vos_mem_free(pMac->lim.gLimPreAuthTimerTable.pTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
861 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
862 }
863
864 if(NULL != pMac->lim.pDialogueTokenHead)
865 {
866 limDeleteDialogueTokenList(pMac);
867 }
868
869 if(NULL != pMac->lim.pDialogueTokenTail)
870 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530871 vos_mem_free(pMac->lim.pDialogueTokenTail);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 pMac->lim.pDialogueTokenTail = NULL;
873 }
874
875 # if 0
876 if (pMac->lim.gpLimStartBssReq != NULL)
877 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530878 vos_mem_free(pMac->lim.gpLimStartBssReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 pMac->lim.gpLimStartBssReq = NULL;
880 }
881 #endif
882
883 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
884 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530885 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 pMac->lim.gpLimMlmSetKeysReq = NULL;
887 }
888
889 #if 0
890 if (pMac->lim.gpLimJoinReq != NULL)
891 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530892 vos_mem_free(pMac->lim.gpLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 pMac->lim.gpLimJoinReq = NULL;
894 }
895 #endif
896
897 if (pMac->lim.gpLimMlmAuthReq != NULL)
898 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530899 vos_mem_free(pMac->lim.gpLimMlmAuthReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 pMac->lim.gpLimMlmAuthReq = NULL;
901 }
902
Jeff Johnsone7245742012-09-05 17:12:55 -0700903#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 if (pMac->lim.gpLimMlmJoinReq != NULL)
905 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530906 vos_mem_free(pMac->lim.gpLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 pMac->lim.gpLimMlmJoinReq = NULL;
908 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700909#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700910
911 #if 0
912 if (pMac->lim.gpLimReassocReq != NULL)
913 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530914 vos_mem_free(pMac->lim.gpLimReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915 pMac->lim.gpLimReassocReq = NULL;
916 }
917 #endif
918
919 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
920 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530921 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
923 }
924
Viral Modid440e682013-03-06 02:25:31 -0800925 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
Viral Modid86bde22012-12-10 13:09:21 -0800926 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530927 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -0800928 pMac->lim.gpDefdSmeMsgForNOA = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800929 }
Viral Modid86bde22012-12-10 13:09:21 -0800930
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 if (pMac->lim.gpLimMlmScanReq != NULL)
932 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530933 vos_mem_free(pMac->lim.gpLimMlmScanReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 pMac->lim.gpLimMlmScanReq = NULL;
935 }
936
937#if 0
938 if(NULL != pMac->lim.beacon)
939 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530940 vos_mem_free((void*) pMac->lim.beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 pMac->lim.beacon = NULL;
942 }
943#endif
944 #if 0
945 if(NULL != pMac->lim.assocReq)
946 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530947 vos_mem_free((void*) pMac->lim.assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 pMac->lim.assocReq= NULL;
949 }
950 #endif
951
952#if 0
953 if(NULL != pMac->lim.assocRsp)
954 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530955 vos_mem_free((void*) pMac->lim.assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 pMac->lim.assocRsp= NULL;
957 }
958#endif
959 // Now, finally reset the deferred message queue pointers
960 limResetDeferredMsgQ(pMac);
961
Jeff Johnson295189b2012-06-20 16:38:30 -0700962
963 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
964 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
965
966 if ( retStatus != VOS_STATUS_SUCCESS )
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700967 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out..."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700968
969#if defined WLAN_FEATURE_VOWIFI
970 rrmCleanup(pMac);
971#endif
972#if defined WLAN_FEATURE_VOWIFI_11R
973 limFTCleanup(pMac);
974#endif
975
976} /*** end limCleanup() ***/
977
978
979/** -------------------------------------------------------------
980\fn peOpen
981\brief will be called in Open sequence from macOpen
982\param tpAniSirGlobal pMac
983\param tHalOpenParameters *pHalOpenParam
984\return tSirRetStatus
985 -------------------------------------------------------------*/
986
987tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
988{
Kaushik, Sushant16def7c2014-06-17 14:20:49 +0530989 if (eDRIVER_TYPE_MFG == pMacOpenParam->driverType)
990 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
992 pMac->lim.maxStation = pMacOpenParam->maxStation;
993
994 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
995 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700996 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 return eSIR_FAILURE;
998 }
999
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301000 pMac->lim.limTimers.gpLimCnfWaitTimer = vos_mem_malloc(sizeof(TX_TIMER) * pMac->lim.maxStation);
1001 if (NULL == pMac->lim.limTimers.gpLimCnfWaitTimer)
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001003 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 return eSIR_FAILURE;
1005 }
1006
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001007#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301008 pMac->lim.gpLimAIDpool = vos_mem_malloc(sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
1009 if (NULL == pMac->lim.gpLimAIDpool)
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001011 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 return eSIR_FAILURE;
1013 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001014#endif
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301015 pMac->lim.gpSession = vos_mem_malloc(sizeof(tPESession)* pMac->lim.maxBssId);
1016 if (NULL == pMac->lim.gpSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001018 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 vos_mem_set(pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001023
1024
1025 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301026 pMac->dph.dphHashTable.pHashTable = vos_mem_malloc(sizeof(tpDphHashNode)*pMac->lim.maxStation);
1027 if (NULL == pMac->dph.dphHashTable.pHashTable)
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001029 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 return eSIR_FAILURE;
1031 }
1032
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301033 pMac->dph.dphHashTable.pDphNodeArray = vos_mem_malloc(sizeof(tDphHashNode)*pMac->lim.maxStation);
1034 if (NULL == pMac->dph.dphHashTable.pDphNodeArray)
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001036 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 return eSIR_FAILURE;
1038 }
1039 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301040 pMac->pmm.gPmmTim.pTim = vos_mem_malloc(sizeof(tANI_U8)*pMac->lim.maxStation);
1041 if (NULL == pMac->pmm.gPmmTim.pTim)
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001043 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return eSIR_FAILURE;
1045 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301046 vos_mem_set(pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001047
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001048 pMac->lim.mgmtFrameSessionId = 0xff;
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001049 pMac->lim.deferredMsgCnt = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001050
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001051 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1052 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001053 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!"));)
Leela Venkata Kiran Kumar Reddy Chiralabcf1b8b2013-12-16 17:13:52 -08001054 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
1055 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
1056 vos_mem_free(pMac->lim.gpSession);
1057 pMac->lim.gpSession = NULL;
1058 vos_mem_free(pMac->pmm.gPmmTim.pTim);
1059 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001060 return eSIR_FAILURE;
1061 }
Venkata Prathyusha Kuntupalli22ba5982013-04-24 13:09:20 -07001062 pMac->lim.deauthMsgCnt = 0;
Leela Venkata Kiran Kumar Reddy Chirala57af2692013-04-10 22:39:51 -07001063
1064 /*
1065 * peOpen is successful by now, so it is right time to initialize
1066 * MTRACE for PE module. if LIM_TRACE_RECORD is not defined in build file
1067 * then nothing will be logged for PE module.
1068 */
1069#ifdef LIM_TRACE_RECORD
1070 MTRACE(limTraceInit(pMac));
1071#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 return eSIR_SUCCESS;
1073}
1074
1075/** -------------------------------------------------------------
1076\fn peClose
1077\brief will be called in close sequence from macClose
1078\param tpAniSirGlobal pMac
1079\return tSirRetStatus
1080 -------------------------------------------------------------*/
1081
1082tSirRetStatus peClose(tpAniSirGlobal pMac)
1083{
1084 tANI_U8 i;
1085
1086 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1087 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001088
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 for(i =0; i < pMac->lim.maxBssId; i++)
1090 {
1091 if(pMac->lim.gpSession[i].valid == TRUE)
1092 {
1093 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1094 }
1095 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301096 vos_mem_free(pMac->lim.limTimers.gpLimCnfWaitTimer);
Jeff Johnsone7245742012-09-05 17:12:55 -07001097 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001098#if 0
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301099 vos_mem_free(pMac->lim.gpLimAIDpool);
Jeff Johnsone7245742012-09-05 17:12:55 -07001100 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001101#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001102
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301103 vos_mem_free(pMac->lim.gpSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 pMac->lim.gpSession = NULL;
1105 /*
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301106 vos_mem_free(pMac->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 pMac->dph.dphHashTable.pHashTable = NULL;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301108 vos_mem_free(pMac->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1110 */
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301111 vos_mem_free(pMac->pmm.gPmmTim.pTim);
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001113 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1114 {
1115 return eSIR_FAILURE;
1116 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001117 return eSIR_SUCCESS;
1118}
1119
1120/** -------------------------------------------------------------
1121\fn peStart
1122\brief will be called in start sequence from macStart
1123\param tpAniSirGlobal pMac
1124\return none
1125 -------------------------------------------------------------*/
1126
1127tSirRetStatus peStart(tpAniSirGlobal pMac)
1128{
1129 tSirRetStatus status = eSIR_SUCCESS;
1130
1131 status = limInitialize(pMac);
1132#if defined(ANI_LOGDUMP)
1133 limDumpInit(pMac);
1134#endif //#if defined(ANI_LOGDUMP)
1135
1136 return status;
1137}
1138
1139/** -------------------------------------------------------------
1140\fn peStop
1141\brief will be called in stop sequence from macStop
1142\param tpAniSirGlobal pMac
1143\return none
1144 -------------------------------------------------------------*/
1145
1146void peStop(tpAniSirGlobal pMac)
1147{
1148 limCleanup(pMac);
1149 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1150 return;
1151}
1152
1153/** -------------------------------------------------------------
1154\fn peFreeMsg
1155\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1156\ to free a given PE message on the TX and MC thread.
1157\ This happens when there are messages pending in the PE
1158\ queue when system is being stopped and reset.
1159\param tpAniSirGlobal pMac
1160\param tSirMsgQ pMsg
1161\return none
1162-----------------------------------------------------------------*/
1163v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1164{
1165 if (pMsg != NULL)
1166 {
1167 if (NULL != pMsg->bodyptr)
1168 {
1169 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1170 {
1171 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1172 }
1173 else
1174 {
1175 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1176 }
1177 }
1178 pMsg->bodyptr = 0;
1179 pMsg->bodyval = 0;
1180 pMsg->type = 0;
1181 }
1182 return;
1183}
1184
1185
1186/**
1187 * The function checks if a particular timer should be allowed
1188 * into LIM while device is sleeping
1189 */
1190tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1191{
1192 tANI_U8 retStatus = TRUE;
1193
1194 if(!limIsSystemInActiveState(pMac))
1195 {
1196 switch(pMsg->type)
1197 {
1198 /* Don't allow following timer messages if in sleep */
1199 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1200 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1201 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1202 retStatus = FALSE;
1203 break;
1204 /* May allow following timer messages in sleep mode */
Jeff Johnson295189b2012-06-20 16:38:30 -07001205
1206 /* Safe to allow as of today, this triggers background scan
1207 * which will not be started if the device is in power-save mode
1208 * might need to block in the future if we decide to implement
1209 * spectrum management
1210 */
1211 case SIR_LIM_QUIET_TIMEOUT:
1212
1213 /* Safe to allow as of today, this triggers background scan
1214 * which will not be started if the device is in power-save mode
1215 * might need to block in the future if we decide to implement
1216 * spectrum management
1217 */
1218 case SIR_LIM_QUIET_BSS_TIMEOUT:
1219
1220 /* Safe to allow this timermessage, triggers background scan
1221 * which is blocked in sleep mode
1222 */
1223 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1224
1225 /* Safe to allow this timer, since, while in IMPS this timer will not
1226 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1227 * when heart-beat control is handled back to PE, device would have
1228 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1229 */
1230 case SIR_LIM_HEART_BEAT_TIMEOUT:
1231 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1232
1233 /* Safe to allow, PE is not handling this message as of now. May need
1234 * to block it, basically, free the buffer and restart the timer
1235 */
1236 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1237 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001238 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1240 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1241 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1242 retStatus = TRUE;
1243 break;
1244
1245 /* by default allow rest of messages */
1246 default:
1247 retStatus = TRUE;
1248 break;
1249
1250
1251 }
1252 }
1253
1254 return retStatus;
1255
1256}
1257
1258
1259
1260/**
1261 * limPostMsgApi()
1262 *
1263 *FUNCTION:
1264 * This function is called from other thread while posting a
1265 * message to LIM message Queue gSirLimMsgQ.
1266 *
1267 *LOGIC:
1268 * NA
1269 *
1270 *ASSUMPTIONS:
1271 * NA
1272 *
1273 *NOTE:
1274 * NA
1275 *
1276 * @param pMac - Pointer to Global MAC structure
1277 * @param pMsg - Pointer to the message structure
1278 * @return None
1279 */
1280
1281tANI_U32
1282limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1283{
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1285
1286
Jeff Johnson295189b2012-06-20 16:38:30 -07001287} /*** end limPostMsgApi() ***/
1288
1289
1290/*--------------------------------------------------------------------------
1291
1292 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1293
1294 This function can be called by legacy code to post message to voss queues OR
1295 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1296 for dispatching it later.
1297
1298 \param pMac - Pointer to Global MAC structure
1299 \param pMsg - Pointer to the message structure
1300
1301 \return tANI_U32 - TX_SUCCESS for success.
1302
1303 --------------------------------------------------------------------------*/
1304
1305tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1306{
1307 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1308}
1309
1310/*--------------------------------------------------------------------------
1311
1312 \brief peProcessMessages() - Message Processor for PE
1313
1314 Voss calls this function to dispatch the message to PE
1315
1316 \param pMac - Pointer to Global MAC structure
1317 \param pMsg - Pointer to the message structure
1318
1319 \return tANI_U32 - TX_SUCCESS for success.
1320
1321 --------------------------------------------------------------------------*/
1322
1323tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1324{
1325 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1326 {
1327 return eSIR_SUCCESS;
1328 }
1329 /**
1330 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1331 * for all the other cases post it to LIM
1332 */
1333 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1334 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1335 else
1336 limMessageProcessor(pMac, pMsg);
1337 return eSIR_SUCCESS;
1338}
1339
1340
Jeff Johnson295189b2012-06-20 16:38:30 -07001341
1342// ---------------------------------------------------------------------------
1343/**
1344 * peHandleMgmtFrame
1345 *
1346 * FUNCTION:
1347 * Process the Management frames from TL
1348 *
1349 * LOGIC:
1350 *
1351 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1352 *
1353 * NOTE:
1354 *
1355 * @param pvosGCtx Global Vos Context
1356 * @param vossBuff Packet
1357 * @return None
1358 */
1359
1360VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1361{
1362 tpAniSirGlobal pMac;
1363 tpSirMacMgmtHdr mHdr;
1364 tSirMsgQ msg;
1365 vos_pkt_t *pVosPkt;
1366 VOS_STATUS vosStatus;
1367 v_U8_t *pRxPacketInfo;
1368
1369 pVosPkt = (vos_pkt_t *)vosBuff;
1370 if (NULL == pVosPkt)
1371 {
1372 return VOS_STATUS_E_FAILURE;
1373 }
1374
1375 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1376 if (NULL == pMac)
1377 {
1378 // cannot log a failure without a valid pMac
1379 vos_pkt_return_packet(pVosPkt);
1380 return VOS_STATUS_E_FAILURE;
1381 }
1382
1383 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1384
1385 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1386 {
1387 vos_pkt_return_packet(pVosPkt);
1388 return VOS_STATUS_E_FAILURE;
1389 }
1390
1391
1392 //
1393 // The MPDU header is now present at a certain "offset" in
1394 // the BD and is specified in the BD itself
1395 //
1396 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1397 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1398 {
1399 PELOG1(limLog( pMac, LOG1,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001400 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001401 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001402
Jeff Johnsone7245742012-09-05 17:12:55 -07001403 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001404 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1405 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1406 }
1407
1408
1409 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1410 msg.type = SIR_BB_XPORT_MGMT_MSG;
1411 msg.bodyptr = vosBuff;
1412 msg.bodyval = 0;
1413
1414 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1415 &msg,
1416 mHdr->fc.type,
1417 mHdr->fc.subType ))
1418 {
1419 vos_pkt_return_packet(pVosPkt);
1420 limLog( pMac, LOGW,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001421 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 return VOS_STATUS_E_FAILURE;
1423 }
1424
1425 return VOS_STATUS_SUCCESS;
1426}
1427
1428// ---------------------------------------------------------------------------
1429/**
1430 * peRegisterTLHandle
1431 *
1432 * FUNCTION:
1433 * Registers the Handler which, process the Management frames from TL
1434 *
1435 * LOGIC:
1436 *
1437 * ASSUMPTIONS:
1438 *
1439 * NOTE:
1440 *
1441 * @return None
1442 */
1443
1444void peRegisterTLHandle(tpAniSirGlobal pMac)
1445{
1446 v_PVOID_t pvosGCTx;
1447 VOS_STATUS retStatus;
1448
1449 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1450
1451 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1452
1453 if (retStatus != VOS_STATUS_SUCCESS)
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001454 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out..."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001455
1456}
Jeff Johnson295189b2012-06-20 16:38:30 -07001457
1458
1459/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 * limIsSystemInScanState()
1461 *
1462 *FUNCTION:
1463 * This function is called by various MAC software modules to
1464 * determine if System is in Scan/Learn state
1465 *
1466 *LOGIC:
1467 * NA
1468 *
1469 *ASSUMPTIONS:
1470 * NA
1471 *
1472 *NOTE:
1473 *
1474 * @param pMac - Pointer to Global MAC structure
1475 * @return true - System is in Scan/Learn state
1476 * false - System is NOT in Scan/Learn state
1477 */
1478
1479tANI_U8
1480limIsSystemInScanState(tpAniSirGlobal pMac)
1481{
1482 switch (pMac->lim.gLimSmeState)
1483 {
1484 case eLIM_SME_CHANNEL_SCAN_STATE:
1485 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1486 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1487 case eLIM_SME_WT_SCAN_STATE:
1488 // System is in Learn mode
1489 return true;
1490
1491 default:
1492 // System is NOT in Learn mode
1493 return false;
1494 }
1495} /*** end limIsSystemInScanState() ***/
1496
1497
1498
1499/**
1500 * limIsSystemInActiveState()
1501 *
1502 *FUNCTION:
1503 * This function is called by various MAC software modules to
1504 * determine if System is in Active/Wakeup state
1505 *
1506 *LOGIC:
1507 * NA
1508 *
1509 *ASSUMPTIONS:
1510 * NA
1511 *
1512 *NOTE:
1513 *
1514 * @param pMac - Pointer to Global MAC structure
1515 * @return true - System is in Active state
1516 * false - System is not in Active state
1517 */
1518
1519tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1520{
1521 switch (pMac->pmm.gPmmState)
1522 {
1523 case ePMM_STATE_BMPS_WAKEUP:
1524 case ePMM_STATE_IMPS_WAKEUP:
1525 case ePMM_STATE_READY:
1526 // System is in Active mode
1527 return true;
1528 default:
1529 return false;
1530 // System is NOT in Active mode
1531 }
1532}
1533
1534
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
Jeff Johnson295189b2012-06-20 16:38:30 -07001536
1537
1538/**
1539*\brief limReceivedHBHandler()
1540*
1541* This function is called by schBeaconProcess() upon
1542* receiving a Beacon on STA. This also gets called upon
1543* receiving Probe Response after heat beat failure is
1544* detected.
1545*
1546* param pMac - global mac structure
1547* param channel - channel number indicated in Beacon, Probe Response
1548* return - none
1549*/
1550
1551
1552void
1553limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1554{
1555 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1556 psessionEntry->LimRxedBeaconCntDuringHB++;
1557
1558 pMac->pmm.inMissedBeaconScenario = FALSE;
1559} /*** end limReceivedHBHandler() ***/
1560
1561
1562
1563#if 0
1564void limResetHBPktCount(tpPESession psessionEntry)
1565{
1566 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1567}
1568#endif
1569
1570
1571/*
1572 * limProcessWdsInfo()
1573 *
1574 *FUNCTION:
1575 * This function is called from schBeaconProcess in BP
1576 *
1577 *PARAMS:
1578 * @param pMac - Pointer to Global MAC structure
1579 * @param propIEInfo - proprietary IE info
1580 *
1581 *LOGIC:
1582 *
1583 *ASSUMPTIONS:
1584 * NA
1585 *
1586 *NOTE:
1587 *
1588 *
1589 *RETURNS:
1590 *
1591 */
1592
1593void limProcessWdsInfo(tpAniSirGlobal pMac,
1594 tSirPropIEStruct propIEInfo)
1595{
Jeff Johnson295189b2012-06-20 16:38:30 -07001596}
1597
1598
1599
1600/**
1601 * limInitWdsInfoParams()
1602 *
1603 *FUNCTION:
1604 * This function is called while processing
1605 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1606 * ind/set related parameters.
1607 *
1608 *LOGIC:
1609 *
1610 *ASSUMPTIONS:
1611 *
1612 *NOTE:
1613 *
1614 * @param pMac Pointer to Global MAC structure
1615 * @return None
1616 */
1617
1618void
1619limInitWdsInfoParams(tpAniSirGlobal pMac)
1620{
1621 pMac->lim.gLimWdsInfo.wdsLength = 0;
1622 pMac->lim.gLimNumWdsInfoInd = 0;
1623 pMac->lim.gLimNumWdsInfoSet = 0;
1624} /*** limInitWdsInfoParams() ***/
1625
1626
1627/** -------------------------------------------------------------
1628\fn limUpdateOverlapStaParam
1629\brief Updates overlap cache and param data structure
1630\param tpAniSirGlobal pMac
1631\param tSirMacAddr bssId
1632\param tpLimProtStaParams pStaParams
1633\return None
1634 -------------------------------------------------------------*/
1635void
1636limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1637{
1638 int i;
1639 if (!pStaParams->numSta)
1640 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301641 vos_mem_copy(pMac->lim.protStaOverlapCache[0].addr,
1642 bssId,
1643 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 pMac->lim.protStaOverlapCache[0].active = true;
1645
1646 pStaParams->numSta = 1;
1647
1648 return;
1649 }
1650
1651 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1652 {
1653 if (pMac->lim.protStaOverlapCache[i].active)
1654 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301655 if (vos_mem_compare( pMac->lim.protStaOverlapCache[i].addr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 bssId,
1657 sizeof(tSirMacAddr))) {
1658 return; }
1659 }
1660 else
1661 break;
1662 }
1663
1664 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1665 {
Shake M Subhani5d80fda2013-12-09 17:28:23 +05301666 PELOG1(limLog(pMac, LOGW, FL("Overlap cache is full"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 }
1668 else
1669 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301670 vos_mem_copy(pMac->lim.protStaOverlapCache[i].addr,
1671 bssId,
1672 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 pMac->lim.protStaOverlapCache[i].active = true;
1674
1675 pStaParams->numSta++;
1676 }
1677}
1678
1679
1680/**
1681 * limHandleIBSScoalescing()
1682 *
1683 *FUNCTION:
1684 * This function is called upon receiving Beacon/Probe Response
1685 * while operating in IBSS mode.
1686 *
1687 *LOGIC:
1688 *
1689 *ASSUMPTIONS:
1690 *
1691 *NOTE:
1692 *
1693 * @param pMac - Pointer to Global MAC structure
1694 * @param pBeacon - Parsed Beacon Frame structure
1695 * @param pRxPacketInfo - Pointer to RX packet info structure
1696 *
1697 * @return Status whether to process or ignore received Beacon Frame
1698 */
1699
1700tSirRetStatus
1701limHandleIBSScoalescing(
1702 tpAniSirGlobal pMac,
1703 tpSchBeaconStruct pBeacon,
1704 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1705{
1706 tpSirMacMgmtHdr pHdr;
1707 tSirRetStatus retCode;
1708
1709 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001710 if ( (!pBeacon->capabilityInfo.ibss) ||
Abhishek Singhd5c31272014-03-07 14:46:50 +05301711 ( psessionEntry->privacy !=
1712 (tANI_U8)pBeacon->capabilityInfo.privacy ) ||
Ravi Joshi2c83c7e2013-10-29 10:21:08 -07001713 (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) ||
1714 (psessionEntry->currentOperChannel != pBeacon->channelNumber) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 /* Received SSID does not match => Ignore received Beacon frame. */
1716 retCode = eSIR_LIM_IGNORE_BEACON;
1717 else
1718 {
1719 tANI_U32 ieLen;
1720 tANI_U16 tsfLater;
1721 tANI_U8 *pIEs;
1722 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1723 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1724 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1725 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1726 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1727 }
1728 return retCode;
1729} /*** end limHandleIBSScoalescing() ***/
1730
1731
1732
1733/**
1734 * limDetectChangeInApCapabilities()
1735 *
1736 *FUNCTION:
1737 * This function is called while SCH is processing
1738 * received Beacon from AP on STA to detect any
1739 * change in AP's capabilities. If there any change
1740 * is detected, Roaming is informed of such change
1741 * so that it can trigger reassociation.
1742 *
1743 *LOGIC:
1744 *
1745 *ASSUMPTIONS:
1746 *
1747 *NOTE:
1748 * Notification is enabled for STA product only since
1749 * it is not a requirement on BP side.
1750 *
1751 * @param pMac Pointer to Global MAC structure
1752 * @param pBeacon Pointer to parsed Beacon structure
1753 * @return None
1754 */
1755
1756void
1757limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1758 tpSirProbeRespBeacon pBeacon,
1759 tpPESession psessionEntry)
1760{
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 tANI_U8 len;
1762 tSirSmeApNewCaps apNewCaps;
1763 tANI_U8 newChannel;
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301764 tSirRetStatus status = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1766 newChannel = (tANI_U8) pBeacon->channelNumber;
1767
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301768 if ( ( false == psessionEntry->limSentCapsChangeNtf ) &&
Abhishek Singh4f8446a2014-05-22 14:07:31 +05301769 ( ( ( !limIsNullSsid(&pBeacon->ssId) ) &&
1770 ( false == limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) ) ) ||
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301771 ( (SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) !=
1772 SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps) ) ||
1773 ( SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) !=
1774 SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps) ) ||
1775 ( SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) !=
1776 SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps) ) ||
1777 ( SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) !=
1778 SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps) ) ||
1779 ( newChannel != psessionEntry->currentOperChannel )
1780 ) ) )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301781 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301782 if( false == psessionEntry->fWaitForProbeRsp )
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301783 {
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301784 /* If Beacon capabilities is not matching with the current capability,
1785 * then send unicast probe request to AP and take decision after
1786 * receiving probe response */
1787 if ( true == psessionEntry->fIgnoreCapsChange )
1788 {
1789 limLog(pMac, LOGW, FL("Ignoring the Capability change as it is false alarm"));
1790 return;
1791 }
1792 psessionEntry->fWaitForProbeRsp = true;
1793 limLog(pMac, LOGW, FL("AP capabilities are not matching,"
1794 "sending directed probe request.. "));
1795 status = limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId, psessionEntry->bssId,
1796 psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
1797 psessionEntry->dot11mode, 0, NULL);
1798
1799 if ( eSIR_SUCCESS != status )
1800 {
1801 limLog(pMac, LOGE, FL("send ProbeReq failed"));
1802 psessionEntry->fWaitForProbeRsp = false;
1803 }
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301804 return;
1805 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 /**
1807 * BSS capabilities have changed.
1808 * Inform Roaming.
1809 */
1810 len = sizeof(tSirMacCapabilityInfo) +
1811 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1812 3 * sizeof(tANI_U8) + // reserved fields
1813 pBeacon->ssId.length + 1;
1814
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301815 vos_mem_copy(apNewCaps.bssId,
1816 psessionEntry->bssId,
1817 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 if (newChannel != psessionEntry->currentOperChannel)
1819 {
1820 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001821 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 psessionEntry->currentOperChannel, newChannel);)
1823 return;
1824 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301825
1826 /**
1827 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1828 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1829 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1830 * the privacy bit is set in Probe and association responses.
1831 * Due to this anomaly, we detect a change in
1832 * AP capabilities when we receive a beacon after association and
1833 * disconnect from the AP. The following check makes sure that we can
1834 * connect to such APs
1835 */
1836 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1837 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1838 {
1839 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001840 " but WPA or RSN IE present, Ignore Beacon!"));)
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301841 return;
1842 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 else
1844 apNewCaps.channelId = psessionEntry->currentOperChannel;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301845 vos_mem_copy((tANI_U8 *) &apNewCaps.ssId,
1846 (tANI_U8 *) &pBeacon->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 pBeacon->ssId.length + 1);
1848
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +05301849 psessionEntry->fIgnoreCapsChange = false;
1850 psessionEntry->fWaitForProbeRsp = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 psessionEntry->limSentCapsChangeNtf = true;
1852 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1853 (tANI_U32 *) &apNewCaps,
1854 len, psessionEntry->smeSessionId);
1855 }
Abhishek Singh4136e4e2013-12-15 11:56:29 +05301856 else if ( true == psessionEntry->fWaitForProbeRsp )
1857 {
1858 /* Only for probe response frames and matching capabilities the control
1859 * will come here. If beacon is with broadcast ssid then fWaitForProbeRsp
1860 * will be false, the control will not come here*/
1861
1862 limLog(pMac, LOG1, FL("capabilities in probe response are"
1863 "matching with the current setting,"
1864 "Ignoring subsequent capability"
1865 "mismatch"));
1866 psessionEntry->fIgnoreCapsChange = true;
1867 psessionEntry->fWaitForProbeRsp = false;
1868 }
1869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870} /*** limDetectChangeInApCapabilities() ***/
1871
1872
1873
1874
1875// ---------------------------------------------------------------------
1876/**
1877 * limUpdateShortSlot
1878 *
1879 * FUNCTION:
1880 * Enable/Disable short slot
1881 *
1882 * LOGIC:
1883 *
1884 * ASSUMPTIONS:
1885 *
1886 * NOTE:
1887 *
1888 * @param enable Flag to enable/disable short slot
1889 * @return None
1890 */
1891
1892tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1893{
1894
1895 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001896 tANI_U32 nShortSlot;
1897 tANI_U32 val = 0;
1898 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001899
Jeff Johnsone7245742012-09-05 17:12:55 -07001900 // Check Admin mode first. If it is disabled just return
1901 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1902 != eSIR_SUCCESS)
1903 {
1904 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001905 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001906 return eSIR_FAILURE;
1907 }
1908 if (val == false)
1909 return eSIR_SUCCESS;
1910
1911 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1912 limGetPhyMode(pMac, &phyMode, psessionEntry);
1913 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1914 return eSIR_SUCCESS;
1915
1916 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001917
1918 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1919 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1920 // if no erp present, use short slot based on current ap caps
1921
1922 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1923
1924 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1925 // The difference between the earlier implementation and the new one is only Case4.
1926 /*
1927 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1928 Case1 1 1 1 1 //AP should not advertise this combination.
1929 Case2 1 1 0 0
1930 Case3 1 0 1 1
1931 Case4 1 0 0 0
1932 Case5 0 1 1 1
1933 Case6 0 1 0 0
1934 Case7 0 0 1 1
1935 Case8 0 0 0 0
1936 */
1937 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1938
Jeff Johnsone7245742012-09-05 17:12:55 -07001939 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 {
1941 // Short slot time capability of AP has changed. Adopt to it.
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001942 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d"), nShortSlot);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1946 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 }
1948 return eSIR_SUCCESS;
1949}
1950
1951
Jeff Johnson295189b2012-06-20 16:38:30 -07001952
1953
Jeff Johnson295189b2012-06-20 16:38:30 -07001954
Jeff Johnson295189b2012-06-20 16:38:30 -07001955
1956
1957/** -----------------------------------------------------------------
1958 \brief limHandleLowRssiInd() - handles low rssi indication
1959
1960 This function process the SIR_HAL_LOW_RSSI_IND message from
1961 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1962
1963 \param pMac - global mac structure
1964
1965 \return
1966
1967 \sa
1968 ----------------------------------------------------------------- */
1969void limHandleLowRssiInd(tpAniSirGlobal pMac)
1970{
1971#if 0 //RSSI related indications will now go to TL and not PE
1972 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1973 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1974 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1975 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001976 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1978 }
1979 else
1980 {
1981 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001982 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 pMac->pmm.gPmmState);
1984 }
1985 return;
1986#endif
1987}
1988
1989
1990/** -----------------------------------------------------------------
1991 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1992
1993 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1994 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1995 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1996
1997 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1998 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1999 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
2000 This message can also come from FW anytime after we have entered BMPS.
2001 This means we should handle it in WoWL and UAPSD states as well
2002
2003 \param pMac - global mac structure
2004 \return - none
2005 \sa
2006 ----------------------------------------------------------------- */
2007void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2008{
2009 switch(pMac->pmm.gPmmState)
2010 {
2011 case ePMM_STATE_BMPS_SLEEP:
2012 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2013 case ePMM_STATE_UAPSD_SLEEP:
2014 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2015 case ePMM_STATE_WOWLAN:
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002016 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2018 break;
2019
2020 default:
2021 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002022 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 pMac->pmm.gPmmState);
2024 break;
2025 }
2026 return;
2027}
2028
2029
2030/** -----------------------------------------------------------------
2031 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2032
2033 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2034 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2035 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2036
2037 \param pMac - global mac structure
2038 \return - none
2039 \sa
2040 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002041void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002042{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002043#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2044 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
2045 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
2046 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
2047 if (psessionEntry == NULL)
2048 {
2049 limLog(pMac, LOGE,
2050 FL("session does not exist for given BSSIdx:%d"),
2051 pSirMissedBeaconInd->bssIdx);
2052 return;
2053 }
2054#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2056 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2057 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2058 {
2059 pMac->pmm.inMissedBeaconScenario = TRUE;
Madan Mohan Koyyalamudi1a30a552013-09-17 21:20:07 +05302060 PELOGE(limLog(pMac, LOGE,
2061 FL("Sending EXIT_BMPS_IND to SME due to Missed beacon from FW"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2063 }
Yathish9f22e662012-12-10 14:21:35 -08002064/* ACTIVE_MODE_HB_OFFLOAD */
2065#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2066 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2067 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2068 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2069 {
2070 pMac->pmm.inMissedBeaconScenario = TRUE;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002071 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002072 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002073 }
2074#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 else
2076 {
2077 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002078 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 pMac->pmm.gPmmState);
2080 }
2081 return;
2082}
2083
2084/** -----------------------------------------------------------------
2085 \brief limMicFailureInd() - handles mic failure indication
2086
2087 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2088
2089 \param pMac - global mac structure
2090 \return - none
2091 \sa
2092 ----------------------------------------------------------------- */
2093void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2094{
2095 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2096 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2097 tSirMsgQ mmhMsg;
2098 tpPESession psessionEntry ;
2099 tANI_U8 sessionId;
2100
2101 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2102 {
2103 limLog(pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002104 FL("session does not exist for given BSSId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 return;
2106 }
2107
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302108 pSirSmeMicFailureInd = vos_mem_malloc(sizeof(tSirSmeMicFailureInd));
2109 if (NULL == pSirSmeMicFailureInd)
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 {
2111 // Log error
2112 limLog(pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07002113 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 return;
2115 }
2116
2117 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2118 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2119 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2120
2121 vos_mem_copy(pSirSmeMicFailureInd->bssId,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302122 pSirMicFailureInd->bssId,
2123 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002124
2125 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302126 pSirMicFailureInd->info.srcMacAddr,
2127 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002128
2129 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302130 pSirMicFailureInd->info.taMacAddr,
2131 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002132
2133 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302134 pSirMicFailureInd->info.dstMacAddr,
2135 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002136
2137 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302138 pSirMicFailureInd->info.rxMacAddr,
2139 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002140
2141 pSirSmeMicFailureInd->info.multicast =
2142 pSirMicFailureInd->info.multicast;
2143
2144 pSirSmeMicFailureInd->info.keyId=
2145 pSirMicFailureInd->info.keyId;
2146
2147 pSirSmeMicFailureInd->info.IV1=
2148 pSirMicFailureInd->info.IV1;
2149
2150 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05302151 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07002152
2153 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2154 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2155 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002156 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2158 return;
2159}
2160
2161
2162/** -----------------------------------------------------------------
2163 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2164
2165 This function is called before enqueuing the frame to PE queue for further processing.
2166 This prevents unnecessary frames getting into PE Queue and drops them right away.
2167 Frames will be droped in the following scenarios:
2168
2169 - In Scan State, drop the frames which are not marked as scan frames
2170 - In non-Scan state, drop the frames which are marked as scan frames.
2171 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2172 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2173
2174 \param pMac - global mac structure
2175 \return - none
2176 \sa
2177 ----------------------------------------------------------------- */
2178
2179tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2180{
2181 tANI_U32 framelen;
2182 tANI_U8 *pBody;
2183 tSirMacCapabilityInfo capabilityInfo;
2184
2185 /*
2186 *
2187 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2188 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2189 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2190 * other than beacons or probe responses in scan state.
2191 */
2192 if( (subType == SIR_MAC_MGMT_BEACON) ||
2193 (subType == SIR_MAC_MGMT_PROBE_RSP))
2194 {
2195 if(pMac->pmm.inMissedBeaconScenario)
2196 {
Leela Venkata Kiran Kumar Reddy Chiralaf3fe6302013-03-18 12:32:14 -07002197 MTRACE(macTrace(pMac, TRACE_CODE_INFO_LOG, 0, eLOG_NODROP_MISSED_BEACON_SCENARIO));
2198 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 }
2200 if (limIsSystemInScanState(pMac))
2201 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002202 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002204#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2205 else if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
2206 {
2207 return eMGMT_DROP_NO_DROP;
2208 }
2209#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2211 {
2212 return eMGMT_DROP_SCAN_MODE_FRAME;
2213 }
2214 }
2215
2216 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2217 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2218
2219 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2220 * beacons from an infrastructure network
2221 */
2222 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2223 if(!capabilityInfo.ibss)
2224 return eMGMT_DROP_NO_DROP;
2225#if 0
2226 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2227 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2228 return eMGMT_DROP_NO_DROP;
2229#endif
2230
2231 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2232 if( (subType == SIR_MAC_MGMT_BEACON) ||
2233 (subType == SIR_MAC_MGMT_PROBE_RSP))
2234 {
2235 //drop the frame if length is less than 12
2236 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2237 return eMGMT_DROP_INVALID_SIZE;
2238
2239 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2240
2241 //This can be enhanced to even check the SSID before deciding to enque the frame.
2242 if(capabilityInfo.ess)
2243 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2244 }
2245 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2246 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2247 {
2248 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2249 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2250 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2251 }
2252
2253 return eMGMT_DROP_NO_DROP;
2254}
2255
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002256eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2257{
2258 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002259
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002260 if(psPe)
2261 {
2262 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2263 {
2264 status = eHAL_STATUS_SUCCESS;
2265 }
2266 }
2267 return (status);
2268}
2269eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2270{
2271 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2272 if(psPe)
2273 {
2274 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2275 {
2276 status = eHAL_STATUS_SUCCESS;
2277 }
2278 }
2279 return (status);
2280}