blob: 490a5e4dc20e6a05e3bc2ff3e13bb4d35dc4e59f [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limApi.cc contains the functions that are
45 * exported by LIM to other modules.
46 *
47 * Author: Chandra Modumudi
48 * Date: 02/11/02
49 * History:-
50 * Date Modified by Modification Information
51 * --------------------------------------------------------------------
52 *
53 */
54#include "palTypes.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include "wniCfgSta.h"
56#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "sirCommon.h"
58#include "sirDebug.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60
61#include "schApi.h"
62#include "utilsApi.h"
63#include "limApi.h"
64#include "limGlobal.h"
65#include "limTypes.h"
66#include "limUtils.h"
67#include "limAssocUtils.h"
68#include "limPropExtsUtils.h"
69#include "limSerDesUtils.h"
70#include "limIbssPeerMgmt.h"
71#include "limAdmitControl.h"
72#include "pmmApi.h"
73#include "logDump.h"
74#include "limSendSmeRspMessages.h"
75#include "wmmApsd.h"
76#include "limTrace.h"
77#include "limSession.h"
78#include "wlan_qct_wda.h"
79
80#if defined WLAN_FEATURE_VOWIFI
81#include "rrmApi.h"
82#endif
83
84#include <limFT.h>
Jeff Johnson295189b2012-06-20 16:38:30 -070085#include "vos_types.h"
86#include "vos_packet.h"
87#include "wlan_qct_tl.h"
88#include "sysStartup.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070089
90
91static void __limInitScanVars(tpAniSirGlobal pMac)
92{
93 pMac->lim.gLimUseScanModeForLearnMode = 1;
94
95 pMac->lim.gLimSystemInScanLearnMode = 0;
96
97 // Scan related globals on STA
98 pMac->lim.gLimReturnAfterFirstMatch = 0;
99 pMac->lim.gLim24Band11dScanDone = 0;
100 pMac->lim.gLim50Band11dScanDone = 0;
101 pMac->lim.gLimReturnUniqueResults = 0;
102
103 // Background Scan related globals on STA
104 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
105 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
106 pMac->lim.gLimNumOfForcedBkgndScan = 0;
107 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
108 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
109 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
Jeff Johnson92751692013-03-06 16:00:33 -0800110 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
112 pMac->lim.gLimCurrentScanChannelId = 0;
113 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800114 pMac->lim.gpLimSmeScanReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700115 pMac->lim.gLimMlmScanResultLength = 0;
116 pMac->lim.gLimSmeScanResultLength = 0;
117
118 palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
119 sizeof(pMac->lim.gLimCachedScanHashTable));
120
Jeff Johnson295189b2012-06-20 16:38:30 -0700121 pMac->lim.gLimBackgroundScanChannelId = 0;
122 pMac->lim.gLimBackgroundScanStarted = 0;
123 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
124 pMac->lim.gLimRestoreCBCount = 0;
125 palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700126
127 /* Fill in default values */
128 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
129
Jeff Johnson295189b2012-06-20 16:38:30 -0700130
131 // abort scan is used to abort an on-going scan
132 pMac->lim.abortScan = 0;
133 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
134
135//WLAN_SUSPEND_LINK Related
136 pMac->lim.gpLimSuspendCallback = NULL;
137 pMac->lim.gpLimResumeCallback = NULL;
138//end WLAN_SUSPEND_LINK Related
139}
140
141
142static void __limInitBssVars(tpAniSirGlobal pMac)
143{
144
145 palZeroMemory(pMac->hHdd, (void*)pMac->lim.gpSession, sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
146
147
148 //pMac->lim.gpLimStartBssReq = NULL;
149
Jeff Johnson295189b2012-06-20 16:38:30 -0700150
151
152
153/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
154#if 0
155
156 // Place holder for BSS description that we're
157 // currently joined with
158 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
159 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
160 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
161 pMac->lim.gLimCurrentBssCaps = 0;
162 QosCaps is a bit map of various qos capabilities - see defn above
163 pMac->lim.gLimCurrentBssQosCaps = 0;
164 pMac->lim.gLimCurrentBssPropCap = 0;
165 pMac->lim.gLimSentCapsChangeNtf = 0;
166
167 // Place holder for BSS description that
168 // we're currently Reassociating
169 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
170 pMac->lim.gLimReassocChannelId = 0;
171 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
172 pMac->lim.gLimReassocBssCaps = 0;
173 pMac->lim.gLimReassocBssQosCaps = 0;
174 pMac->lim.gLimReassocBssPropCap = 0;
175 #endif
176
177 /* This is for testing purposes only, be default should always be off */
178 pMac->lim.gLimForceNoPropIE = 0;
179
180 // pMac->lim.gLimBssIdx = 0;
181
182 pMac->lim.gpLimMlmSetKeysReq = NULL;
183 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
184 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
185
186}
187
188
189static void __limInitStatsVars(tpAniSirGlobal pMac)
190{
191 pMac->lim.gLimNumBeaconsRcvd = 0;
192 pMac->lim.gLimNumBeaconsIgnored = 0;
193
194 pMac->lim.gLimNumDeferredMsgs = 0;
195
196 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800197 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
199
200 /// This indicates number of RXed Beacons during HB period
201 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
202
203 // Heart-Beat interval value
204 pMac->lim.gLimHeartBeatCount = 0;
205
206 // Statistics to keep track of no. beacons rcvd in heart beat interval
207 palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
208
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;
217 palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
218 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
264 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
265 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
266 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
267 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
268 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
269 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
270
271 pMac->lim.gLimPhyMode = 0;
272 pMac->lim.scanStartTime = 0; // used to measure scan time
273
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
275 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;
297 palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
298 /* initialize some parameters */
299 limInitWdsInfoParams(pMac);
300
301 // Deferred Queue Paramters
302 palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
303
304 // addts request if any - only one can be outstanding at any time
305 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
306 pMac->lim.gLimAddtsSent = 0;
307 pMac->lim.gLimAddtsRspTimerCount = 0;
308
309 //protection related config cache
310 palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
311 pMac->lim.gLimProtectionControl = 0;
312 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
313 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
334 palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
335
336 // admission control policy information
337 palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
338
339 pMac->lim.gLastBeaconDtimCount = 0;
340 pMac->lim.gLastBeaconDtimPeriod = 0;
341
342 //Scan in Power Save Flag
343 pMac->lim.gScanInPowersave = 0;
344}
345
346static void __limInitAssocVars(tpAniSirGlobal pMac)
347{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800348 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800349#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
351 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
352 pMac->lim.freeAidHead = 0;
353 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800354#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800355 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
356 {
357 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
358 }
359 pMac->lim.gLimAssocStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700360
361 // Place holder for current authentication request
362 // being handled
363 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700364 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 /// MAC level Pre-authentication related globals
367 pMac->lim.gLimPreAuthChannelNumber = 0;
368 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
369 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
370 pMac->lim.gLimNumPreAuthContexts = 0;
371 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
372
373 // Placed holder to deauth reason
374 pMac->lim.gLimDeauthReasonCode = 0;
375
376 // Place holder for Pre-authentication node list
377 pMac->lim.pLimPreAuthList = NULL;
378
379 // Send Disassociate frame threshold parameters
380 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
381 pMac->lim.gLimDisassocFrameCredit = 0;
382
383 //One cache for each overlap and associated case.
384 palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
385 palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
386
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700387#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
388 pMac->lim.pSessionEntry = NULL;
389 pMac->lim.reAssocRetryAttempt = 0;
390#endif
391
Jeff Johnson295189b2012-06-20 16:38:30 -0700392}
393
394
395static void __limInitTitanVars(tpAniSirGlobal pMac)
396{
Jeff Johnsone7245742012-09-05 17:12:55 -0700397#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700400 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
401#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 // Debug workaround for BEACON's
403 // State change triggered by "dump 222"
404 pMac->lim.gLimScanOverride = 1;
405 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 pMac->lim.gLimTitanStaCount = 0;
407 pMac->lim.gLimBlockNonTitanSta = 0;
408}
409
410static void __limInitHTVars(tpAniSirGlobal pMac)
411{
412 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 pMac->lim.gHTShortGI40Mhz = 0;
415 pMac->lim.gHTShortGI20Mhz = 0;
416 pMac->lim.gHTMaxAmsduLength = 0;
417 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
418 pMac->lim.gHTPSMPSupport = 0;
419 pMac->lim.gHTLsigTXOPProtection = 0;
420 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
421 pMac->lim.gHTAMpduDensity = 0;
422
423 pMac->lim.gMaxAmsduSizeEnabled = false;
424 pMac->lim.gHTMaxRxAMpduFactor = 0;
425 pMac->lim.gHTServiceIntervalGranularity = 0;
426 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
428 pMac->lim.gHTPCOActive = 0;
429
430 pMac->lim.gHTPCOPhase = 0;
431 pMac->lim.gHTSecondaryBeacon = 0;
432 pMac->lim.gHTDualCTSProtection = 0;
433 pMac->lim.gHTSTBCBasicMCS = 0;
434 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
435}
436
Jeff Johnson295189b2012-06-20 16:38:30 -0700437static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
438{
Jeff Johnsone7245742012-09-05 17:12:55 -0700439 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 tANI_U16 val16;
441 tANI_U8 val8;
442 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
443 tSirMacHTInfoField1 *pHTInfoField1;
444 tpSirPowerSaveCfg pPowerSaveConfig;
445 tSirMacHTParametersInfo *pAmpduParamInfo;
446
447 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700448 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
449 * and they will be used throughout when there is no session
450 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700451
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
453 {
454 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
455 return eSIR_FAILURE;
456 }
457
458 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
459 {
460 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
461 return eSIR_FAILURE;
462 }
463 val16 = ( tANI_U16 ) val1;
464 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
465
466 //channel bonding mode could be set to anything from 0 to 4(Titan had these
467 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
468 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
469 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
470 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
471 != eSIR_SUCCESS)
472 {
473 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
474 return eSIR_FAILURE;
475 }
476
477 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
478 {
479 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
480 return eSIR_FAILURE;
481 }
482
483 val8 = ( tANI_U8 ) val1;
484 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
485 pHTInfoField1->recommendedTxWidthSet =
486 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
488 != eSIR_SUCCESS)
489 {
490 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
491 return eSIR_FAILURE;
492 }
493
494 /* WNI_CFG_HEART_BEAT_THRESHOLD */
495
496 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
497 eSIR_SUCCESS )
498 {
499 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
500 return eSIR_FAILURE;
501 }
502 if(!val1)
503 {
504 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
505 pMac->sys.gSysEnableLinkMonitorMode = 0;
506 }
507 else
508 {
509 //No need to activate the timer during init time.
510 pMac->sys.gSysEnableLinkMonitorMode = 1;
511 }
512
513 /* WNI_CFG_SHORT_GI_20MHZ */
514
515 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
516 {
517 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
518 return eSIR_FAILURE;
519 }
520 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
521 {
522 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
523 return eSIR_FAILURE;
524 }
525 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
526 {
527 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
528 return eSIR_FAILURE;
529 }
530
531 val16 = ( tANI_U16 ) val1;
532 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
533 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
534 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
535
536 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
537 eSIR_SUCCESS)
538 {
539 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
540 return eSIR_FAILURE;
541 }
542
543 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
544
545 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
546 {
547 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
548 return eSIR_FAILURE;
549 }
550 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
551 {
552 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
553 return eSIR_FAILURE;
554 }
555 val16 = ( tANI_U16 ) val1;
556 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
557 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
558 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
559 eSIR_SUCCESS)
560 {
561 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
562 return eSIR_FAILURE;
563 }
564
565 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
566 limHandleCFGparamUpdate do we want to update this? */
567 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
568 {
569 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
570 return eSIR_FAILURE;
571 }
572
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 /* WNI_CFG_MAX_PS_POLL */
574
575 /* Allocate and fill in power save configuration. */
576 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
577 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
578 {
579 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
580 "configuration\n"));)
581 return eSIR_FAILURE;
582 }
583
584 /* This context should be valid if power-save configuration message has been
585 * already dispatched during initialization process. Re-using the present
586 * configuration mask
587 */
588 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
589 sizeof(tSirPowerSaveCfg));
590
591 /* Note: it is okay to do this since DAL/HAL is alrady started */
592 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
593 {
594 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
595 return eSIR_FAILURE;
596 }
597
598 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
599
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 PELOG1(limLog(pMac, LOG1,
601 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
602 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700603
604 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
605
606 /* This was initially done after resume notification from HAL. Now, DAL is
607 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700608 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800609 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
610 {
611 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed\n"));
612 return eSIR_FAILURE;
613 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
615 return eSIR_SUCCESS;
616}
Jeff Johnson295189b2012-06-20 16:38:30 -0700617
618/*
619 limStart
620 This function is to replace the __limProcessSmeStartReq since there is no
621 eWNI_SME_START_REQ post to PE.
622*/
623tSirRetStatus limStart(tpAniSirGlobal pMac)
624{
625 tSirResultCodes retCode = eSIR_SUCCESS;
626
627 PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
628
629 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
630 {
631 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
632
Jeff Johnsone7245742012-09-05 17:12:55 -0700633 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700634
635 // By default do not return after first scan match
636 pMac->lim.gLimReturnAfterFirstMatch = 0;
637
638 // Initialize MLM state machine
639 limInitMlm(pMac);
640
641 // By default return unique scan results
642 pMac->lim.gLimReturnUniqueResults = true;
643 pMac->lim.gLimSmeScanResultLength = 0;
644 }
645 else
646 {
647 /**
648 * Should not have received eWNI_SME_START_REQ in states
649 * other than OFFLINE. Return response to host and
650 * log error
651 */
652 limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
653 retCode = eSIR_FAILURE;
654 }
655
656 return retCode;
657}
658
659/**
660 * limInitialize()
661 *
662 *FUNCTION:
663 * This function is called from LIM thread entry function.
664 * LIM related global data structures are initialized in this function.
665 *
666 *LOGIC:
667 * NA
668 *
669 *ASSUMPTIONS:
670 * NA
671 *
672 *NOTE:
673 * NA
674 *
675 * @param pMac - Pointer to global MAC structure
676 * @return None
677 */
678
679tSirRetStatus
680limInitialize(tpAniSirGlobal pMac)
681{
682 tSirRetStatus status = eSIR_SUCCESS;
683
684 __limInitAssocVars(pMac);
685 __limInitVars(pMac);
686 __limInitStates(pMac);
687 __limInitStatsVars(pMac);
688 __limInitBssVars(pMac);
689 __limInitScanVars(pMac);
690 __limInitHTVars(pMac);
691 __limInitTitanVars(pMac);
692
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 status = limStart(pMac);
694 if(eSIR_SUCCESS != status)
695 {
696 return status;
697 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700698
699 /*
700 * MLM will be intitalized when 'START' request comes from SME.
701 * limInitMlm calls limCreateTimers, which actually relies on
702 * CFG to be downloaded. So it should not be called as part of
703 * peStart, as CFG download is happening after peStart.
704 */
705 //limInitMlm(pMac);
706 // Initializations for maintaining peers in IBSS
707 limIbssInit(pMac);
708
709 pmmInitialize(pMac);
710
711
712#if defined WLAN_FEATURE_VOWIFI
713 rrmInitialize(pMac);
714#endif
715#if defined WLAN_FEATURE_VOWIFI_11R
716 limFTOpen(pMac);
717#endif
718
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700720
721#if 0
722
723 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
724 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
725 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
726
727 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
728 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
729
730 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
731 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
732 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
733
734 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
735
736 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
737
738 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
739 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
740
741 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
742
743
744 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
745
746 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
747#endif
748 MTRACE(limTraceInit(pMac));
749
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 //Initialize the configurations needed by PE
751 if( eSIR_FAILURE == __limInitConfig(pMac))
752 {
753 //We need to undo everything in limStart
754 limCleanupMlm(pMac);
755 return eSIR_FAILURE;
756 }
757
758 //initialize the TSPEC admission control table.
759 //Note that this was initially done after resume notification from HAL.
760 //Now, DAL is started before PE so this can be done here
761 limAdmitControlInit(pMac);
762 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700763
764 return status;
765
766} /*** end limInitialize() ***/
767
768
769
770/**
771 * limCleanup()
772 *
773 *FUNCTION:
774 * This function is called upon reset or persona change
775 * to cleanup LIM state
776 *
777 *LOGIC:
778 * NA
779 *
780 *ASSUMPTIONS:
781 * NA
782 *
783 *NOTE:
784 * NA
785 *
786 * @param pMac - Pointer to Global MAC structure
787 * @return None
788 */
789
790void
791limCleanup(tpAniSirGlobal pMac)
792{
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 v_PVOID_t pvosGCTx;
794 VOS_STATUS retStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -0700795
Jeff Johnson295189b2012-06-20 16:38:30 -0700796//Before destroying the list making sure all the nodes have been deleted.
797//Which should be the normal case, but a memory leak has been reported.
798
799 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
800
801 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
802 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
803 {
804 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
805 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
806
807 palFreeMemory(pMac, pLimMgmtRegistration);
808 }
809
810 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700811
812 limCleanupMlm(pMac);
813 limCleanupLmm(pMac);
814
815 // free up preAuth table
816 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
817 {
818 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
819 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
820 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
821 }
822
823 if(NULL != pMac->lim.pDialogueTokenHead)
824 {
825 limDeleteDialogueTokenList(pMac);
826 }
827
828 if(NULL != pMac->lim.pDialogueTokenTail)
829 {
830 palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
831 pMac->lim.pDialogueTokenTail = NULL;
832 }
833
834 # if 0
835 if (pMac->lim.gpLimStartBssReq != NULL)
836 {
837 palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
838 pMac->lim.gpLimStartBssReq = NULL;
839 }
840 #endif
841
842 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
843 {
844 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
845 pMac->lim.gpLimMlmSetKeysReq = NULL;
846 }
847
848 #if 0
849 if (pMac->lim.gpLimJoinReq != NULL)
850 {
851 palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
852 pMac->lim.gpLimJoinReq = NULL;
853 }
854 #endif
855
856 if (pMac->lim.gpLimMlmAuthReq != NULL)
857 {
858 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
859 pMac->lim.gpLimMlmAuthReq = NULL;
860 }
861
Jeff Johnsone7245742012-09-05 17:12:55 -0700862#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 if (pMac->lim.gpLimMlmJoinReq != NULL)
864 {
865 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
866 pMac->lim.gpLimMlmJoinReq = NULL;
867 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700868#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700869
870 #if 0
871 if (pMac->lim.gpLimReassocReq != NULL)
872 {
873 palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
874 pMac->lim.gpLimReassocReq = NULL;
875 }
876 #endif
877
878 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
879 {
880 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
881 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
882 }
883
Viral Modid86bde22012-12-10 13:09:21 -0800884 if (pMac->lim.gpLimSmeScanReq != NULL)
885 {
886 palFreeMemory(pMac->hHdd, pMac->lim.gpLimSmeScanReq);
887 pMac->lim.gpLimSmeScanReq = NULL;
888 }
Viral Modid86bde22012-12-10 13:09:21 -0800889
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 if (pMac->lim.gpLimMlmScanReq != NULL)
891 {
892 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
893 pMac->lim.gpLimMlmScanReq = NULL;
894 }
895
896#if 0
897 if(NULL != pMac->lim.beacon)
898 {
899 palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
900 pMac->lim.beacon = NULL;
901 }
902#endif
903 #if 0
904 if(NULL != pMac->lim.assocReq)
905 {
906 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
907 pMac->lim.assocReq= NULL;
908 }
909 #endif
910
911#if 0
912 if(NULL != pMac->lim.assocRsp)
913 {
914 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
915 pMac->lim.assocRsp= NULL;
916 }
917#endif
918 // Now, finally reset the deferred message queue pointers
919 limResetDeferredMsgQ(pMac);
920
Jeff Johnson295189b2012-06-20 16:38:30 -0700921
922 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
923 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
924
925 if ( retStatus != VOS_STATUS_SUCCESS )
926 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700927
928#if defined WLAN_FEATURE_VOWIFI
929 rrmCleanup(pMac);
930#endif
931#if defined WLAN_FEATURE_VOWIFI_11R
932 limFTCleanup(pMac);
933#endif
934
935} /*** end limCleanup() ***/
936
937
938/** -------------------------------------------------------------
939\fn peOpen
940\brief will be called in Open sequence from macOpen
941\param tpAniSirGlobal pMac
942\param tHalOpenParameters *pHalOpenParam
943\return tSirRetStatus
944 -------------------------------------------------------------*/
945
946tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
947{
948 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
949 pMac->lim.maxStation = pMacOpenParam->maxStation;
950
951 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
952 {
953 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
954 return eSIR_FAILURE;
955 }
956
957 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
958 (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
959 {
960 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
961 return eSIR_FAILURE;
962 }
963
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800964#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700965 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
966 (void **) &pMac->lim.gpLimAIDpool,
967 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
968 {
969 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
970 return eSIR_FAILURE;
971 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800972#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
974 (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
975 {
976 limLog(pMac, LOGE, FL("memory allocate failed!\n"));
977 return eSIR_FAILURE;
978 }
979
980 palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
981
982
983 /*
984 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
985 (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
986 {
987 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
988 return eSIR_FAILURE;
989 }
990
991 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
992 (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
993 {
994 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
995 return eSIR_FAILURE;
996 }
997 */
998
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1000 (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
1001 {
1002 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
1003 return eSIR_FAILURE;
1004 }
1005 palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -07001006
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001007 pMac->lim.mgmtFrameSessionId = 0xff;
Jeff Johnson295189b2012-06-20 16:38:30 -07001008
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001009 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1010 {
1011 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!\n"));)
1012 return eSIR_FAILURE;
1013 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 return eSIR_SUCCESS;
1015}
1016
1017/** -------------------------------------------------------------
1018\fn peClose
1019\brief will be called in close sequence from macClose
1020\param tpAniSirGlobal pMac
1021\return tSirRetStatus
1022 -------------------------------------------------------------*/
1023
1024tSirRetStatus peClose(tpAniSirGlobal pMac)
1025{
1026 tANI_U8 i;
1027
1028 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1029 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001030
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 for(i =0; i < pMac->lim.maxBssId; i++)
1032 {
1033 if(pMac->lim.gpSession[i].valid == TRUE)
1034 {
1035 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1036 }
1037 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001038 palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
1039 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001040#if 0
Jeff Johnsone7245742012-09-05 17:12:55 -07001041 palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
1042 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001043#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001044
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
1046 pMac->lim.gpSession = NULL;
1047 /*
1048 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
1049 pMac->dph.dphHashTable.pHashTable = NULL;
1050 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
1051 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1052 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
1054 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001055 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1056 {
1057 return eSIR_FAILURE;
1058 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 return eSIR_SUCCESS;
1060}
1061
1062/** -------------------------------------------------------------
1063\fn peStart
1064\brief will be called in start sequence from macStart
1065\param tpAniSirGlobal pMac
1066\return none
1067 -------------------------------------------------------------*/
1068
1069tSirRetStatus peStart(tpAniSirGlobal pMac)
1070{
1071 tSirRetStatus status = eSIR_SUCCESS;
1072
1073 status = limInitialize(pMac);
1074#if defined(ANI_LOGDUMP)
1075 limDumpInit(pMac);
1076#endif //#if defined(ANI_LOGDUMP)
1077
1078 return status;
1079}
1080
1081/** -------------------------------------------------------------
1082\fn peStop
1083\brief will be called in stop sequence from macStop
1084\param tpAniSirGlobal pMac
1085\return none
1086 -------------------------------------------------------------*/
1087
1088void peStop(tpAniSirGlobal pMac)
1089{
1090 limCleanup(pMac);
1091 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1092 return;
1093}
1094
1095/** -------------------------------------------------------------
1096\fn peFreeMsg
1097\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1098\ to free a given PE message on the TX and MC thread.
1099\ This happens when there are messages pending in the PE
1100\ queue when system is being stopped and reset.
1101\param tpAniSirGlobal pMac
1102\param tSirMsgQ pMsg
1103\return none
1104-----------------------------------------------------------------*/
1105v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1106{
1107 if (pMsg != NULL)
1108 {
1109 if (NULL != pMsg->bodyptr)
1110 {
1111 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1112 {
1113 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1114 }
1115 else
1116 {
1117 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1118 }
1119 }
1120 pMsg->bodyptr = 0;
1121 pMsg->bodyval = 0;
1122 pMsg->type = 0;
1123 }
1124 return;
1125}
1126
1127
1128/**
1129 * The function checks if a particular timer should be allowed
1130 * into LIM while device is sleeping
1131 */
1132tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1133{
1134 tANI_U8 retStatus = TRUE;
1135
1136 if(!limIsSystemInActiveState(pMac))
1137 {
1138 switch(pMsg->type)
1139 {
1140 /* Don't allow following timer messages if in sleep */
1141 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1142 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1143 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1144 retStatus = FALSE;
1145 break;
1146 /* May allow following timer messages in sleep mode */
1147 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1148
1149 /* Safe to allow as of today, this triggers background scan
1150 * which will not be started if the device is in power-save mode
1151 * might need to block in the future if we decide to implement
1152 * spectrum management
1153 */
1154 case SIR_LIM_QUIET_TIMEOUT:
1155
1156 /* Safe to allow as of today, this triggers background scan
1157 * which will not be started if the device is in power-save mode
1158 * might need to block in the future if we decide to implement
1159 * spectrum management
1160 */
1161 case SIR_LIM_QUIET_BSS_TIMEOUT:
1162
1163 /* Safe to allow this timermessage, triggers background scan
1164 * which is blocked in sleep mode
1165 */
1166 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1167
1168 /* Safe to allow this timer, since, while in IMPS this timer will not
1169 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1170 * when heart-beat control is handled back to PE, device would have
1171 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1172 */
1173 case SIR_LIM_HEART_BEAT_TIMEOUT:
1174 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1175
1176 /* Safe to allow, PE is not handling this message as of now. May need
1177 * to block it, basically, free the buffer and restart the timer
1178 */
1179 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1180 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001181 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1183 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1184 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1185 retStatus = TRUE;
1186 break;
1187
1188 /* by default allow rest of messages */
1189 default:
1190 retStatus = TRUE;
1191 break;
1192
1193
1194 }
1195 }
1196
1197 return retStatus;
1198
1199}
1200
1201
1202
1203/**
1204 * limPostMsgApi()
1205 *
1206 *FUNCTION:
1207 * This function is called from other thread while posting a
1208 * message to LIM message Queue gSirLimMsgQ.
1209 *
1210 *LOGIC:
1211 * NA
1212 *
1213 *ASSUMPTIONS:
1214 * NA
1215 *
1216 *NOTE:
1217 * NA
1218 *
1219 * @param pMac - Pointer to Global MAC structure
1220 * @param pMsg - Pointer to the message structure
1221 * @return None
1222 */
1223
1224tANI_U32
1225limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1226{
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1228
1229
Jeff Johnson295189b2012-06-20 16:38:30 -07001230} /*** end limPostMsgApi() ***/
1231
1232
1233/*--------------------------------------------------------------------------
1234
1235 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1236
1237 This function can be called by legacy code to post message to voss queues OR
1238 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1239 for dispatching it later.
1240
1241 \param pMac - Pointer to Global MAC structure
1242 \param pMsg - Pointer to the message structure
1243
1244 \return tANI_U32 - TX_SUCCESS for success.
1245
1246 --------------------------------------------------------------------------*/
1247
1248tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1249{
1250 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1251}
1252
1253/*--------------------------------------------------------------------------
1254
1255 \brief peProcessMessages() - Message Processor for PE
1256
1257 Voss calls this function to dispatch the message to PE
1258
1259 \param pMac - Pointer to Global MAC structure
1260 \param pMsg - Pointer to the message structure
1261
1262 \return tANI_U32 - TX_SUCCESS for success.
1263
1264 --------------------------------------------------------------------------*/
1265
1266tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1267{
1268 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1269 {
1270 return eSIR_SUCCESS;
1271 }
1272 /**
1273 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1274 * for all the other cases post it to LIM
1275 */
1276 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1277 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1278 else
1279 limMessageProcessor(pMac, pMsg);
1280 return eSIR_SUCCESS;
1281}
1282
1283
Jeff Johnson295189b2012-06-20 16:38:30 -07001284
1285// ---------------------------------------------------------------------------
1286/**
1287 * peHandleMgmtFrame
1288 *
1289 * FUNCTION:
1290 * Process the Management frames from TL
1291 *
1292 * LOGIC:
1293 *
1294 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1295 *
1296 * NOTE:
1297 *
1298 * @param pvosGCtx Global Vos Context
1299 * @param vossBuff Packet
1300 * @return None
1301 */
1302
1303VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1304{
1305 tpAniSirGlobal pMac;
1306 tpSirMacMgmtHdr mHdr;
1307 tSirMsgQ msg;
1308 vos_pkt_t *pVosPkt;
1309 VOS_STATUS vosStatus;
1310 v_U8_t *pRxPacketInfo;
1311
1312 pVosPkt = (vos_pkt_t *)vosBuff;
1313 if (NULL == pVosPkt)
1314 {
1315 return VOS_STATUS_E_FAILURE;
1316 }
1317
1318 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1319 if (NULL == pMac)
1320 {
1321 // cannot log a failure without a valid pMac
1322 vos_pkt_return_packet(pVosPkt);
1323 return VOS_STATUS_E_FAILURE;
1324 }
1325
1326 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1327
1328 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1329 {
1330 vos_pkt_return_packet(pVosPkt);
1331 return VOS_STATUS_E_FAILURE;
1332 }
1333
1334
1335 //
1336 // The MPDU header is now present at a certain "offset" in
1337 // the BD and is specified in the BD itself
1338 //
1339 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1340 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1341 {
1342 PELOG1(limLog( pMac, LOG1,
1343 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001344 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001345
Jeff Johnsone7245742012-09-05 17:12:55 -07001346 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1348 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1349 }
1350
1351
1352 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1353 msg.type = SIR_BB_XPORT_MGMT_MSG;
1354 msg.bodyptr = vosBuff;
1355 msg.bodyval = 0;
1356
1357 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1358 &msg,
1359 mHdr->fc.type,
1360 mHdr->fc.subType ))
1361 {
1362 vos_pkt_return_packet(pVosPkt);
1363 limLog( pMac, LOGW,
1364 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
1365 return VOS_STATUS_E_FAILURE;
1366 }
1367
1368 return VOS_STATUS_SUCCESS;
1369}
1370
1371// ---------------------------------------------------------------------------
1372/**
1373 * peRegisterTLHandle
1374 *
1375 * FUNCTION:
1376 * Registers the Handler which, process the Management frames from TL
1377 *
1378 * LOGIC:
1379 *
1380 * ASSUMPTIONS:
1381 *
1382 * NOTE:
1383 *
1384 * @return None
1385 */
1386
1387void peRegisterTLHandle(tpAniSirGlobal pMac)
1388{
1389 v_PVOID_t pvosGCTx;
1390 VOS_STATUS retStatus;
1391
1392 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1393
1394 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1395
1396 if (retStatus != VOS_STATUS_SUCCESS)
1397 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
1398
1399}
Jeff Johnson295189b2012-06-20 16:38:30 -07001400
1401
1402/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 * limIsSystemInScanState()
1404 *
1405 *FUNCTION:
1406 * This function is called by various MAC software modules to
1407 * determine if System is in Scan/Learn state
1408 *
1409 *LOGIC:
1410 * NA
1411 *
1412 *ASSUMPTIONS:
1413 * NA
1414 *
1415 *NOTE:
1416 *
1417 * @param pMac - Pointer to Global MAC structure
1418 * @return true - System is in Scan/Learn state
1419 * false - System is NOT in Scan/Learn state
1420 */
1421
1422tANI_U8
1423limIsSystemInScanState(tpAniSirGlobal pMac)
1424{
1425 switch (pMac->lim.gLimSmeState)
1426 {
1427 case eLIM_SME_CHANNEL_SCAN_STATE:
1428 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1429 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1430 case eLIM_SME_WT_SCAN_STATE:
1431 // System is in Learn mode
1432 return true;
1433
1434 default:
1435 // System is NOT in Learn mode
1436 return false;
1437 }
1438} /*** end limIsSystemInScanState() ***/
1439
1440
1441
1442/**
1443 * limIsSystemInActiveState()
1444 *
1445 *FUNCTION:
1446 * This function is called by various MAC software modules to
1447 * determine if System is in Active/Wakeup state
1448 *
1449 *LOGIC:
1450 * NA
1451 *
1452 *ASSUMPTIONS:
1453 * NA
1454 *
1455 *NOTE:
1456 *
1457 * @param pMac - Pointer to Global MAC structure
1458 * @return true - System is in Active state
1459 * false - System is not in Active state
1460 */
1461
1462tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1463{
1464 switch (pMac->pmm.gPmmState)
1465 {
1466 case ePMM_STATE_BMPS_WAKEUP:
1467 case ePMM_STATE_IMPS_WAKEUP:
1468 case ePMM_STATE_READY:
1469 // System is in Active mode
1470 return true;
1471 default:
1472 return false;
1473 // System is NOT in Active mode
1474 }
1475}
1476
1477
Jeff Johnson295189b2012-06-20 16:38:30 -07001478
Jeff Johnson295189b2012-06-20 16:38:30 -07001479
1480
1481/**
1482*\brief limReceivedHBHandler()
1483*
1484* This function is called by schBeaconProcess() upon
1485* receiving a Beacon on STA. This also gets called upon
1486* receiving Probe Response after heat beat failure is
1487* detected.
1488*
1489* param pMac - global mac structure
1490* param channel - channel number indicated in Beacon, Probe Response
1491* return - none
1492*/
1493
1494
1495void
1496limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1497{
1498 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1499 psessionEntry->LimRxedBeaconCntDuringHB++;
1500
1501 pMac->pmm.inMissedBeaconScenario = FALSE;
1502} /*** end limReceivedHBHandler() ***/
1503
1504
1505
1506#if 0
1507void limResetHBPktCount(tpPESession psessionEntry)
1508{
1509 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1510}
1511#endif
1512
1513
1514/*
1515 * limProcessWdsInfo()
1516 *
1517 *FUNCTION:
1518 * This function is called from schBeaconProcess in BP
1519 *
1520 *PARAMS:
1521 * @param pMac - Pointer to Global MAC structure
1522 * @param propIEInfo - proprietary IE info
1523 *
1524 *LOGIC:
1525 *
1526 *ASSUMPTIONS:
1527 * NA
1528 *
1529 *NOTE:
1530 *
1531 *
1532 *RETURNS:
1533 *
1534 */
1535
1536void limProcessWdsInfo(tpAniSirGlobal pMac,
1537 tSirPropIEStruct propIEInfo)
1538{
Jeff Johnson295189b2012-06-20 16:38:30 -07001539}
1540
1541
1542
1543/**
1544 * limInitWdsInfoParams()
1545 *
1546 *FUNCTION:
1547 * This function is called while processing
1548 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1549 * ind/set related parameters.
1550 *
1551 *LOGIC:
1552 *
1553 *ASSUMPTIONS:
1554 *
1555 *NOTE:
1556 *
1557 * @param pMac Pointer to Global MAC structure
1558 * @return None
1559 */
1560
1561void
1562limInitWdsInfoParams(tpAniSirGlobal pMac)
1563{
1564 pMac->lim.gLimWdsInfo.wdsLength = 0;
1565 pMac->lim.gLimNumWdsInfoInd = 0;
1566 pMac->lim.gLimNumWdsInfoSet = 0;
1567} /*** limInitWdsInfoParams() ***/
1568
1569
1570/** -------------------------------------------------------------
1571\fn limUpdateOverlapStaParam
1572\brief Updates overlap cache and param data structure
1573\param tpAniSirGlobal pMac
1574\param tSirMacAddr bssId
1575\param tpLimProtStaParams pStaParams
1576\return None
1577 -------------------------------------------------------------*/
1578void
1579limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1580{
1581 int i;
1582 if (!pStaParams->numSta)
1583 {
1584 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
1585 bssId,
1586 sizeof(tSirMacAddr));
1587 pMac->lim.protStaOverlapCache[0].active = true;
1588
1589 pStaParams->numSta = 1;
1590
1591 return;
1592 }
1593
1594 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1595 {
1596 if (pMac->lim.protStaOverlapCache[i].active)
1597 {
1598 if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
1599 bssId,
1600 sizeof(tSirMacAddr))) {
1601 return; }
1602 }
1603 else
1604 break;
1605 }
1606
1607 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1608 {
1609 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
1610 }
1611 else
1612 {
1613 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
1614 bssId,
1615 sizeof(tSirMacAddr));
1616 pMac->lim.protStaOverlapCache[i].active = true;
1617
1618 pStaParams->numSta++;
1619 }
1620}
1621
1622
1623/**
1624 * limHandleIBSScoalescing()
1625 *
1626 *FUNCTION:
1627 * This function is called upon receiving Beacon/Probe Response
1628 * while operating in IBSS mode.
1629 *
1630 *LOGIC:
1631 *
1632 *ASSUMPTIONS:
1633 *
1634 *NOTE:
1635 *
1636 * @param pMac - Pointer to Global MAC structure
1637 * @param pBeacon - Parsed Beacon Frame structure
1638 * @param pRxPacketInfo - Pointer to RX packet info structure
1639 *
1640 * @return Status whether to process or ignore received Beacon Frame
1641 */
1642
1643tSirRetStatus
1644limHandleIBSScoalescing(
1645 tpAniSirGlobal pMac,
1646 tpSchBeaconStruct pBeacon,
1647 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1648{
1649 tpSirMacMgmtHdr pHdr;
1650 tSirRetStatus retCode;
1651
1652 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1653 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
1654 /* Received SSID does not match => Ignore received Beacon frame. */
1655 retCode = eSIR_LIM_IGNORE_BEACON;
1656 else
1657 {
1658 tANI_U32 ieLen;
1659 tANI_U16 tsfLater;
1660 tANI_U8 *pIEs;
1661 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1662 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1663 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1664 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1665 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1666 }
1667 return retCode;
1668} /*** end limHandleIBSScoalescing() ***/
1669
1670
1671
1672/**
1673 * limDetectChangeInApCapabilities()
1674 *
1675 *FUNCTION:
1676 * This function is called while SCH is processing
1677 * received Beacon from AP on STA to detect any
1678 * change in AP's capabilities. If there any change
1679 * is detected, Roaming is informed of such change
1680 * so that it can trigger reassociation.
1681 *
1682 *LOGIC:
1683 *
1684 *ASSUMPTIONS:
1685 *
1686 *NOTE:
1687 * Notification is enabled for STA product only since
1688 * it is not a requirement on BP side.
1689 *
1690 * @param pMac Pointer to Global MAC structure
1691 * @param pBeacon Pointer to parsed Beacon structure
1692 * @return None
1693 */
1694
1695void
1696limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1697 tpSirProbeRespBeacon pBeacon,
1698 tpPESession psessionEntry)
1699{
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 tANI_U8 len;
1701 tSirSmeApNewCaps apNewCaps;
1702 tANI_U8 newChannel;
1703 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1704 newChannel = (tANI_U8) pBeacon->channelNumber;
1705
1706 if ((psessionEntry->limSentCapsChangeNtf == false) &&
1707 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
1708 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
1709 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
1710 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
1711 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
1712 (newChannel != psessionEntry->currentOperChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 )))
1714 {
1715
1716 /**
1717 * BSS capabilities have changed.
1718 * Inform Roaming.
1719 */
1720 len = sizeof(tSirMacCapabilityInfo) +
1721 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1722 3 * sizeof(tANI_U8) + // reserved fields
1723 pBeacon->ssId.length + 1;
1724
1725 palCopyMemory( pMac->hHdd, apNewCaps.bssId,
1726 psessionEntry->bssId,
1727 sizeof(tSirMacAddr));
1728 if (newChannel != psessionEntry->currentOperChannel)
1729 {
1730 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
1731 "Ignoring beacon!\n"),
1732 psessionEntry->currentOperChannel, newChannel);)
1733 return;
1734 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301735
1736 /**
1737 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1738 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1739 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1740 * the privacy bit is set in Probe and association responses.
1741 * Due to this anomaly, we detect a change in
1742 * AP capabilities when we receive a beacon after association and
1743 * disconnect from the AP. The following check makes sure that we can
1744 * connect to such APs
1745 */
1746 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1747 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1748 {
1749 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
1750 " but WPA or RSN IE present, Ignore Beacon!\n"));)
1751 return;
1752 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 else
1754 apNewCaps.channelId = psessionEntry->currentOperChannel;
1755 palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
1756 (tANI_U8 *) &pBeacon->ssId,
1757 pBeacon->ssId.length + 1);
1758
1759 psessionEntry->limSentCapsChangeNtf = true;
1760 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1761 (tANI_U32 *) &apNewCaps,
1762 len, psessionEntry->smeSessionId);
1763 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001764} /*** limDetectChangeInApCapabilities() ***/
1765
1766
1767
1768
1769// ---------------------------------------------------------------------
1770/**
1771 * limUpdateShortSlot
1772 *
1773 * FUNCTION:
1774 * Enable/Disable short slot
1775 *
1776 * LOGIC:
1777 *
1778 * ASSUMPTIONS:
1779 *
1780 * NOTE:
1781 *
1782 * @param enable Flag to enable/disable short slot
1783 * @return None
1784 */
1785
1786tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1787{
1788
1789 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001790 tANI_U32 nShortSlot;
1791 tANI_U32 val = 0;
1792 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001793
Jeff Johnsone7245742012-09-05 17:12:55 -07001794 // Check Admin mode first. If it is disabled just return
1795 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1796 != eSIR_SUCCESS)
1797 {
1798 limLog(pMac, LOGP,
1799 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
1800 return eSIR_FAILURE;
1801 }
1802 if (val == false)
1803 return eSIR_SUCCESS;
1804
1805 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1806 limGetPhyMode(pMac, &phyMode, psessionEntry);
1807 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1808 return eSIR_SUCCESS;
1809
1810 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001811
1812 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1813 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1814 // if no erp present, use short slot based on current ap caps
1815
1816 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1817
1818 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1819 // The difference between the earlier implementation and the new one is only Case4.
1820 /*
1821 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1822 Case1 1 1 1 1 //AP should not advertise this combination.
1823 Case2 1 1 0 0
1824 Case3 1 0 1 1
1825 Case4 1 0 0 0
1826 Case5 0 1 1 1
1827 Case6 0 1 0 0
1828 Case7 0 0 1 1
1829 Case8 0 0 0 0
1830 */
1831 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1832
Jeff Johnsone7245742012-09-05 17:12:55 -07001833 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 {
1835 // Short slot time capability of AP has changed. Adopt to it.
1836 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
1837 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001838 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1840 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 }
1842 return eSIR_SUCCESS;
1843}
1844
1845
Jeff Johnson295189b2012-06-20 16:38:30 -07001846
1847
Jeff Johnson295189b2012-06-20 16:38:30 -07001848
Jeff Johnson295189b2012-06-20 16:38:30 -07001849
1850
1851/** -----------------------------------------------------------------
1852 \brief limHandleLowRssiInd() - handles low rssi indication
1853
1854 This function process the SIR_HAL_LOW_RSSI_IND message from
1855 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1856
1857 \param pMac - global mac structure
1858
1859 \return
1860
1861 \sa
1862 ----------------------------------------------------------------- */
1863void limHandleLowRssiInd(tpAniSirGlobal pMac)
1864{
1865#if 0 //RSSI related indications will now go to TL and not PE
1866 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1867 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1868 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1869 {
1870 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
1871 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1872 }
1873 else
1874 {
1875 limLog(pMac, LOGE,
1876 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
1877 pMac->pmm.gPmmState);
1878 }
1879 return;
1880#endif
1881}
1882
1883
1884/** -----------------------------------------------------------------
1885 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1886
1887 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1888 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1889 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1890
1891 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1892 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1893 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1894 This message can also come from FW anytime after we have entered BMPS.
1895 This means we should handle it in WoWL and UAPSD states as well
1896
1897 \param pMac - global mac structure
1898 \return - none
1899 \sa
1900 ----------------------------------------------------------------- */
1901void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1902{
1903 switch(pMac->pmm.gPmmState)
1904 {
1905 case ePMM_STATE_BMPS_SLEEP:
1906 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1907 case ePMM_STATE_UAPSD_SLEEP:
1908 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
1909 case ePMM_STATE_WOWLAN:
1910 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1911 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
1912 break;
1913
1914 default:
1915 limLog(pMac, LOGE,
1916 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
1917 pMac->pmm.gPmmState);
1918 break;
1919 }
1920 return;
1921}
1922
1923
1924/** -----------------------------------------------------------------
1925 \brief limHandleMissedBeaconInd() - handles missed beacon indication
1926
1927 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
1928 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1929 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
1930
1931 \param pMac - global mac structure
1932 \return - none
1933 \sa
1934 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001935void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07001936{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001937#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1938 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
1939 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
1940 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
1941 if (psessionEntry == NULL)
1942 {
1943 limLog(pMac, LOGE,
1944 FL("session does not exist for given BSSIdx:%d"),
1945 pSirMissedBeaconInd->bssIdx);
1946 return;
1947 }
1948#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1950 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1951 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1952 {
1953 pMac->pmm.inMissedBeaconScenario = TRUE;
1954 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1955 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
1956 }
Yathish9f22e662012-12-10 14:21:35 -08001957/* ACTIVE_MODE_HB_OFFLOAD */
1958#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1959 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
1960 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
1961 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1962 {
1963 pMac->pmm.inMissedBeaconScenario = TRUE;
1964 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure\n"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001965 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08001966 }
1967#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 else
1969 {
1970 limLog(pMac, LOGE,
1971 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
1972 pMac->pmm.gPmmState);
1973 }
1974 return;
1975}
1976
1977/** -----------------------------------------------------------------
1978 \brief limMicFailureInd() - handles mic failure indication
1979
1980 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
1981
1982 \param pMac - global mac structure
1983 \return - none
1984 \sa
1985 ----------------------------------------------------------------- */
1986void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1987{
1988 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
1989 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
1990 tSirMsgQ mmhMsg;
1991 tpPESession psessionEntry ;
1992 tANI_U8 sessionId;
1993
1994 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
1995 {
1996 limLog(pMac, LOGE,
1997 FL("session does not exist for given BSSId\n"));
1998 return;
1999 }
2000
2001 if (eHAL_STATUS_SUCCESS !=
2002 palAllocateMemory(pMac->hHdd,
2003 (void **) &pSirSmeMicFailureInd,
2004 sizeof(tSirSmeMicFailureInd)))
2005 {
2006 // Log error
2007 limLog(pMac, LOGP,
2008 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
2009 return;
2010 }
2011
2012 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2013 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2014 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2015
2016 vos_mem_copy(pSirSmeMicFailureInd->bssId,
2017 pSirMicFailureInd->bssId,
2018 sizeof(tSirMacAddr));
2019
2020 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
2021 pSirMicFailureInd->info.srcMacAddr,
2022 sizeof(tSirMacAddr));
2023
2024 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
2025 pSirMicFailureInd->info.taMacAddr,
2026 sizeof(tSirMacAddr));
2027
2028 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
2029 pSirMicFailureInd->info.dstMacAddr,
2030 sizeof(tSirMacAddr));
2031
2032 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
2033 pSirMicFailureInd->info.rxMacAddr,
2034 sizeof(tSirMacAddr));
2035
2036 pSirSmeMicFailureInd->info.multicast =
2037 pSirMicFailureInd->info.multicast;
2038
2039 pSirSmeMicFailureInd->info.keyId=
2040 pSirMicFailureInd->info.keyId;
2041
2042 pSirSmeMicFailureInd->info.IV1=
2043 pSirMicFailureInd->info.IV1;
2044
2045 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
2046 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
2047
2048 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2049 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2050 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002051 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2053 return;
2054}
2055
2056
2057/** -----------------------------------------------------------------
2058 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2059
2060 This function is called before enqueuing the frame to PE queue for further processing.
2061 This prevents unnecessary frames getting into PE Queue and drops them right away.
2062 Frames will be droped in the following scenarios:
2063
2064 - In Scan State, drop the frames which are not marked as scan frames
2065 - In non-Scan state, drop the frames which are marked as scan frames.
2066 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2067 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2068
2069 \param pMac - global mac structure
2070 \return - none
2071 \sa
2072 ----------------------------------------------------------------- */
2073
2074tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2075{
2076 tANI_U32 framelen;
2077 tANI_U8 *pBody;
2078 tSirMacCapabilityInfo capabilityInfo;
2079
2080 /*
2081 *
2082 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2083 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2084 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2085 * other than beacons or probe responses in scan state.
2086 */
2087 if( (subType == SIR_MAC_MGMT_BEACON) ||
2088 (subType == SIR_MAC_MGMT_PROBE_RSP))
2089 {
2090 if(pMac->pmm.inMissedBeaconScenario)
2091 {
Jeff Johnsonab79c8d2012-12-10 14:30:13 -08002092 PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon scenario"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 return eMGMT_DROP_NO_DROP;
2094 }
2095 if (limIsSystemInScanState(pMac))
2096 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002097 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 }
2099 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2100 {
2101 return eMGMT_DROP_SCAN_MODE_FRAME;
2102 }
2103 }
2104
2105 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2106 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2107
2108 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2109 * beacons from an infrastructure network
2110 */
2111 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2112 if(!capabilityInfo.ibss)
2113 return eMGMT_DROP_NO_DROP;
2114#if 0
2115 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2116 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2117 return eMGMT_DROP_NO_DROP;
2118#endif
2119
2120 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2121 if( (subType == SIR_MAC_MGMT_BEACON) ||
2122 (subType == SIR_MAC_MGMT_PROBE_RSP))
2123 {
2124 //drop the frame if length is less than 12
2125 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2126 return eMGMT_DROP_INVALID_SIZE;
2127
2128 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2129
2130 //This can be enhanced to even check the SSID before deciding to enque the frame.
2131 if(capabilityInfo.ess)
2132 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2133 }
2134 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2135 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2136 {
2137 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2138 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2139 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2140 }
2141
2142 return eMGMT_DROP_NO_DROP;
2143}
2144
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002145eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2146{
2147 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002149 if(psPe)
2150 {
2151 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2152 {
2153 status = eHAL_STATUS_SUCCESS;
2154 }
2155 }
2156 return (status);
2157}
2158eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2159{
2160 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2161 if(psPe)
2162 {
2163 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2164 {
2165 status = eHAL_STATUS_SUCCESS;
2166 }
2167 }
2168 return (status);
2169}