blob: 50078282a45a8fecd9c1a32f55a2cdbf5769fe1d [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>
85
86#ifdef VOSS_ENABLED
87#include "vos_types.h"
88#include "vos_packet.h"
89#include "wlan_qct_tl.h"
90#include "sysStartup.h"
91#endif
92
93
94static void __limInitScanVars(tpAniSirGlobal pMac)
95{
96 pMac->lim.gLimUseScanModeForLearnMode = 1;
97
98 pMac->lim.gLimSystemInScanLearnMode = 0;
99
100 // Scan related globals on STA
101 pMac->lim.gLimReturnAfterFirstMatch = 0;
102 pMac->lim.gLim24Band11dScanDone = 0;
103 pMac->lim.gLim50Band11dScanDone = 0;
104 pMac->lim.gLimReturnUniqueResults = 0;
105
106 // Background Scan related globals on STA
107 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
108 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
109 pMac->lim.gLimNumOfForcedBkgndScan = 0;
110 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
111 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
112 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
113 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
114
115 pMac->lim.gLimCurrentScanChannelId = 0;
116 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800117#ifdef WLAN_FEATURE_P2P
118 pMac->lim.gpLimSmeScanReq = NULL;
119#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700120 pMac->lim.gLimMlmScanResultLength = 0;
121 pMac->lim.gLimSmeScanResultLength = 0;
122
123 palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
124 sizeof(pMac->lim.gLimCachedScanHashTable));
125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 pMac->lim.gLimBackgroundScanChannelId = 0;
127 pMac->lim.gLimBackgroundScanStarted = 0;
128 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
129 pMac->lim.gLimRestoreCBCount = 0;
130 palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700131
132 /* Fill in default values */
133 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
134
Jeff Johnson295189b2012-06-20 16:38:30 -0700135
136 // abort scan is used to abort an on-going scan
137 pMac->lim.abortScan = 0;
138 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
139
140//WLAN_SUSPEND_LINK Related
141 pMac->lim.gpLimSuspendCallback = NULL;
142 pMac->lim.gpLimResumeCallback = NULL;
143//end WLAN_SUSPEND_LINK Related
144}
145
146
147static void __limInitBssVars(tpAniSirGlobal pMac)
148{
149
150 palZeroMemory(pMac->hHdd, (void*)pMac->lim.gpSession, sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
151
152
153 //pMac->lim.gpLimStartBssReq = NULL;
154
Jeff Johnson295189b2012-06-20 16:38:30 -0700155
156
157
158/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
159#if 0
160
161 // Place holder for BSS description that we're
162 // currently joined with
163 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
164 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
165 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
166 pMac->lim.gLimCurrentBssCaps = 0;
167 QosCaps is a bit map of various qos capabilities - see defn above
168 pMac->lim.gLimCurrentBssQosCaps = 0;
169 pMac->lim.gLimCurrentBssPropCap = 0;
170 pMac->lim.gLimSentCapsChangeNtf = 0;
171
172 // Place holder for BSS description that
173 // we're currently Reassociating
174 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
175 pMac->lim.gLimReassocChannelId = 0;
176 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
177 pMac->lim.gLimReassocBssCaps = 0;
178 pMac->lim.gLimReassocBssQosCaps = 0;
179 pMac->lim.gLimReassocBssPropCap = 0;
180 #endif
181
182 /* This is for testing purposes only, be default should always be off */
183 pMac->lim.gLimForceNoPropIE = 0;
184
185 // pMac->lim.gLimBssIdx = 0;
186
187 pMac->lim.gpLimMlmSetKeysReq = NULL;
188 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
189 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
190
191}
192
193
194static void __limInitStatsVars(tpAniSirGlobal pMac)
195{
196 pMac->lim.gLimNumBeaconsRcvd = 0;
197 pMac->lim.gLimNumBeaconsIgnored = 0;
198
199 pMac->lim.gLimNumDeferredMsgs = 0;
200
201 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800202 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700203 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
204
205 /// This indicates number of RXed Beacons during HB period
206 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
207
208 // Heart-Beat interval value
209 pMac->lim.gLimHeartBeatCount = 0;
210
211 // Statistics to keep track of no. beacons rcvd in heart beat interval
212 palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
213
214#ifdef WLAN_DEBUG
215 // Debug counters
216 pMac->lim.numTot = 0;
217 pMac->lim.numBbt = 0;
218 pMac->lim.numProtErr = 0;
219 pMac->lim.numLearn = 0;
220 pMac->lim.numLearnIgnore = 0;
221 pMac->lim.numSme = 0;
222 palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
223 pMac->lim.gLimNumAssocReqDropInvldState = 0;
224 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
225 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
226 pMac->lim.gLimNumReassocReqDropInvldState = 0;
227 pMac->lim.gLimNumHashMissIgnored = 0;
228 pMac->lim.gLimUnexpBcnCnt = 0;
229 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
230 pMac->lim.gLimNumLinkEsts = 0;
231 pMac->lim.gLimNumRxCleanup = 0;
232 pMac->lim.gLim11bStaAssocRejectCount = 0;
233#endif
234}
235
236
237
238static void __limInitStates(tpAniSirGlobal pMac)
239{
240 // Counts Heartbeat failures
241 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
242 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
243 pMac->lim.gLimHBfailureCntInOtherStates = 0;
244 pMac->lim.gLimRspReqd = 0;
245 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
246
247 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700248 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
250
251 /// Previous MLM State
252 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
253
254#ifdef GEN4_SCAN
255 // LIM to HAL SCAN Management Message Interface states
256 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
257#endif // GEN4_SCAN
258
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700260 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700262 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700263
264 /**
265 * By default assume 'unknown' role. This will be updated
266 * when SME_START_BSS_REQ is received.
267 */
268
269 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
270 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
271 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
272 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
273 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
274 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
275
276 pMac->lim.gLimPhyMode = 0;
277 pMac->lim.scanStartTime = 0; // used to measure scan time
278
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
280 pMac->lim.ackPolicy = 0;
281
282#if 0 /* Moving all these to session specific elements */
283 pMac->lim.gLimQosEnabled = 0; //11E
284 pMac->lim.gLimWmeEnabled = 0; //WME
285 pMac->lim.gLimWsmEnabled = 0; //WSM
286 pMac->lim.gLimHcfEnabled = 0;
287 pMac->lim.gLim11dEnabled = 0;
288#endif
289
290 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
291}
292
293static void __limInitVars(tpAniSirGlobal pMac)
294{
295
Jeff Johnson295189b2012-06-20 16:38:30 -0700296
297 // Place holder for Measurement Req/Rsp/Ind related info
Jeff Johnson295189b2012-06-20 16:38:30 -0700298
299 // WDS info
300 pMac->lim.gLimNumWdsInfoInd = 0;
301 pMac->lim.gLimNumWdsInfoSet = 0;
302 palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
303 /* initialize some parameters */
304 limInitWdsInfoParams(pMac);
305
306 // Deferred Queue Paramters
307 palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
308
309 // addts request if any - only one can be outstanding at any time
310 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
311 pMac->lim.gLimAddtsSent = 0;
312 pMac->lim.gLimAddtsRspTimerCount = 0;
313
314 //protection related config cache
315 palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
316 pMac->lim.gLimProtectionControl = 0;
317 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
318 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
319
Jeff Johnsone7245742012-09-05 17:12:55 -0700320#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
323 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700324#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 // WMM Related Flag
326 pMac->lim.gUapsdEnable = 0;
327 pMac->lim.gUapsdPerAcBitmask = 0;
328 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
329 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
330
331 // QoS-AC Downgrade: Initially, no AC is admitted
332 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
333 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
334
335 //dialogue token List head/tail for Action frames request sent.
336 pMac->lim.pDialogueTokenHead = NULL;
337 pMac->lim.pDialogueTokenTail = NULL;
338
339 palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
340
341 // admission control policy information
342 palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
343
344 pMac->lim.gLastBeaconDtimCount = 0;
345 pMac->lim.gLastBeaconDtimPeriod = 0;
346
347 //Scan in Power Save Flag
348 pMac->lim.gScanInPowersave = 0;
349}
350
351static void __limInitAssocVars(tpAniSirGlobal pMac)
352{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800353 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800354#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
356 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
357 pMac->lim.freeAidHead = 0;
358 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800359#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800360 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
361 {
362 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
363 }
364 pMac->lim.gLimAssocStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 // Place holder for current authentication request
367 // being handled
368 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700369 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700370
371 /// MAC level Pre-authentication related globals
372 pMac->lim.gLimPreAuthChannelNumber = 0;
373 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
374 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
375 pMac->lim.gLimNumPreAuthContexts = 0;
376 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
377
378 // Placed holder to deauth reason
379 pMac->lim.gLimDeauthReasonCode = 0;
380
381 // Place holder for Pre-authentication node list
382 pMac->lim.pLimPreAuthList = NULL;
383
384 // Send Disassociate frame threshold parameters
385 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
386 pMac->lim.gLimDisassocFrameCredit = 0;
387
388 //One cache for each overlap and associated case.
389 palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
390 palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
391
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700392#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
393 pMac->lim.pSessionEntry = NULL;
394 pMac->lim.reAssocRetryAttempt = 0;
395#endif
396
Jeff Johnson295189b2012-06-20 16:38:30 -0700397}
398
399
400static void __limInitTitanVars(tpAniSirGlobal pMac)
401{
Jeff Johnsone7245742012-09-05 17:12:55 -0700402#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700405 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
406#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 // Debug workaround for BEACON's
408 // State change triggered by "dump 222"
409 pMac->lim.gLimScanOverride = 1;
410 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 pMac->lim.gLimTitanStaCount = 0;
412 pMac->lim.gLimBlockNonTitanSta = 0;
413}
414
415static void __limInitHTVars(tpAniSirGlobal pMac)
416{
417 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 pMac->lim.gHTShortGI40Mhz = 0;
420 pMac->lim.gHTShortGI20Mhz = 0;
421 pMac->lim.gHTMaxAmsduLength = 0;
422 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
423 pMac->lim.gHTPSMPSupport = 0;
424 pMac->lim.gHTLsigTXOPProtection = 0;
425 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
426 pMac->lim.gHTAMpduDensity = 0;
427
428 pMac->lim.gMaxAmsduSizeEnabled = false;
429 pMac->lim.gHTMaxRxAMpduFactor = 0;
430 pMac->lim.gHTServiceIntervalGranularity = 0;
431 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
433 pMac->lim.gHTPCOActive = 0;
434
435 pMac->lim.gHTPCOPhase = 0;
436 pMac->lim.gHTSecondaryBeacon = 0;
437 pMac->lim.gHTDualCTSProtection = 0;
438 pMac->lim.gHTSTBCBasicMCS = 0;
439 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
440}
441
Jeff Johnson295189b2012-06-20 16:38:30 -0700442static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
443{
Jeff Johnsone7245742012-09-05 17:12:55 -0700444 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 tANI_U16 val16;
446 tANI_U8 val8;
447 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
448 tSirMacHTInfoField1 *pHTInfoField1;
449 tpSirPowerSaveCfg pPowerSaveConfig;
450 tSirMacHTParametersInfo *pAmpduParamInfo;
451
452 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700453 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
454 * and they will be used throughout when there is no session
455 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
458 {
459 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
460 return eSIR_FAILURE;
461 }
462
463 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
464 {
465 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
466 return eSIR_FAILURE;
467 }
468 val16 = ( tANI_U16 ) val1;
469 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
470
471 //channel bonding mode could be set to anything from 0 to 4(Titan had these
472 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
473 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
474 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
475 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
476 != eSIR_SUCCESS)
477 {
478 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
479 return eSIR_FAILURE;
480 }
481
482 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
483 {
484 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
485 return eSIR_FAILURE;
486 }
487
488 val8 = ( tANI_U8 ) val1;
489 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
490 pHTInfoField1->recommendedTxWidthSet =
491 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
493 != eSIR_SUCCESS)
494 {
495 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
496 return eSIR_FAILURE;
497 }
498
499 /* WNI_CFG_HEART_BEAT_THRESHOLD */
500
501 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
502 eSIR_SUCCESS )
503 {
504 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
505 return eSIR_FAILURE;
506 }
507 if(!val1)
508 {
509 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
510 pMac->sys.gSysEnableLinkMonitorMode = 0;
511 }
512 else
513 {
514 //No need to activate the timer during init time.
515 pMac->sys.gSysEnableLinkMonitorMode = 1;
516 }
517
518 /* WNI_CFG_SHORT_GI_20MHZ */
519
520 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
521 {
522 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
523 return eSIR_FAILURE;
524 }
525 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
526 {
527 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
528 return eSIR_FAILURE;
529 }
530 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
531 {
532 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
533 return eSIR_FAILURE;
534 }
535
536 val16 = ( tANI_U16 ) val1;
537 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
538 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
539 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
540
541 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
542 eSIR_SUCCESS)
543 {
544 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
545 return eSIR_FAILURE;
546 }
547
548 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
549
550 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
551 {
552 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
553 return eSIR_FAILURE;
554 }
555 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
556 {
557 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
558 return eSIR_FAILURE;
559 }
560 val16 = ( tANI_U16 ) val1;
561 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
562 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
563 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
564 eSIR_SUCCESS)
565 {
566 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
567 return eSIR_FAILURE;
568 }
569
570 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
571 limHandleCFGparamUpdate do we want to update this? */
572 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
573 {
574 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
575 return eSIR_FAILURE;
576 }
577
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 /* WNI_CFG_MAX_PS_POLL */
579
580 /* Allocate and fill in power save configuration. */
581 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
582 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
583 {
584 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
585 "configuration\n"));)
586 return eSIR_FAILURE;
587 }
588
589 /* This context should be valid if power-save configuration message has been
590 * already dispatched during initialization process. Re-using the present
591 * configuration mask
592 */
593 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
594 sizeof(tSirPowerSaveCfg));
595
596 /* Note: it is okay to do this since DAL/HAL is alrady started */
597 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
598 {
599 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
600 return eSIR_FAILURE;
601 }
602
603 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 PELOG1(limLog(pMac, LOG1,
606 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
607 pMac->lim.gLimBackgroundScanChannelId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
609 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
610
611 /* This was initially done after resume notification from HAL. Now, DAL is
612 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700613 handleHTCapabilityandHTInfo(pMac, NULL);
Leela V Kiran Kumar Reddy Chiralab1f7d342013-02-11 00:27:02 -0800614 if(wlan_cfgGetInt(pMac, WNI_CFG_DISABLE_LDPC_WITH_TXBF_AP,(tANI_U32 *) &pMac->lim.disableLDPCWithTxbfAP) != eSIR_SUCCESS)
615 {
616 limLog(pMac, LOGP, FL("cfg get disableLDPCWithTxbfAP failed\n"));
617 return eSIR_FAILURE;
618 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700619
620 return eSIR_SUCCESS;
621}
Jeff Johnson295189b2012-06-20 16:38:30 -0700622
623/*
624 limStart
625 This function is to replace the __limProcessSmeStartReq since there is no
626 eWNI_SME_START_REQ post to PE.
627*/
628tSirRetStatus limStart(tpAniSirGlobal pMac)
629{
630 tSirResultCodes retCode = eSIR_SUCCESS;
631
632 PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
633
634 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
635 {
636 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
637
Jeff Johnsone7245742012-09-05 17:12:55 -0700638 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700639
640 // By default do not return after first scan match
641 pMac->lim.gLimReturnAfterFirstMatch = 0;
642
643 // Initialize MLM state machine
644 limInitMlm(pMac);
645
646 // By default return unique scan results
647 pMac->lim.gLimReturnUniqueResults = true;
648 pMac->lim.gLimSmeScanResultLength = 0;
649 }
650 else
651 {
652 /**
653 * Should not have received eWNI_SME_START_REQ in states
654 * other than OFFLINE. Return response to host and
655 * log error
656 */
657 limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
658 retCode = eSIR_FAILURE;
659 }
660
661 return retCode;
662}
663
664/**
665 * limInitialize()
666 *
667 *FUNCTION:
668 * This function is called from LIM thread entry function.
669 * LIM related global data structures are initialized in this function.
670 *
671 *LOGIC:
672 * NA
673 *
674 *ASSUMPTIONS:
675 * NA
676 *
677 *NOTE:
678 * NA
679 *
680 * @param pMac - Pointer to global MAC structure
681 * @return None
682 */
683
684tSirRetStatus
685limInitialize(tpAniSirGlobal pMac)
686{
687 tSirRetStatus status = eSIR_SUCCESS;
688
689 __limInitAssocVars(pMac);
690 __limInitVars(pMac);
691 __limInitStates(pMac);
692 __limInitStatsVars(pMac);
693 __limInitBssVars(pMac);
694 __limInitScanVars(pMac);
695 __limInitHTVars(pMac);
696 __limInitTitanVars(pMac);
697
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 status = limStart(pMac);
699 if(eSIR_SUCCESS != status)
700 {
701 return status;
702 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700703
704 /*
705 * MLM will be intitalized when 'START' request comes from SME.
706 * limInitMlm calls limCreateTimers, which actually relies on
707 * CFG to be downloaded. So it should not be called as part of
708 * peStart, as CFG download is happening after peStart.
709 */
710 //limInitMlm(pMac);
711 // Initializations for maintaining peers in IBSS
712 limIbssInit(pMac);
713
714 pmmInitialize(pMac);
715
716
717#if defined WLAN_FEATURE_VOWIFI
718 rrmInitialize(pMac);
719#endif
720#if defined WLAN_FEATURE_VOWIFI_11R
721 limFTOpen(pMac);
722#endif
723
724#ifdef WLAN_FEATURE_P2P
725 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
726#endif
727
728#if 0
729
730 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
731 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
732 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
733
734 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
735 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
736
737 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
738 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
739 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
740
741 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
742
743 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
744
745 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
746 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
747
748 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
749
750
751 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
752
753 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
754#endif
755 MTRACE(limTraceInit(pMac));
756
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 //Initialize the configurations needed by PE
758 if( eSIR_FAILURE == __limInitConfig(pMac))
759 {
760 //We need to undo everything in limStart
761 limCleanupMlm(pMac);
762 return eSIR_FAILURE;
763 }
764
765 //initialize the TSPEC admission control table.
766 //Note that this was initially done after resume notification from HAL.
767 //Now, DAL is started before PE so this can be done here
768 limAdmitControlInit(pMac);
769 limRegisterHalIndCallBack(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700770
771 return status;
772
773} /*** end limInitialize() ***/
774
775
776
777/**
778 * limCleanup()
779 *
780 *FUNCTION:
781 * This function is called upon reset or persona change
782 * to cleanup LIM state
783 *
784 *LOGIC:
785 * NA
786 *
787 *ASSUMPTIONS:
788 * NA
789 *
790 *NOTE:
791 * NA
792 *
793 * @param pMac - Pointer to Global MAC structure
794 * @return None
795 */
796
797void
798limCleanup(tpAniSirGlobal pMac)
799{
800#ifdef VOSS_ENABLED
801 v_PVOID_t pvosGCTx;
802 VOS_STATUS retStatus;
803#endif
804
805#ifdef WLAN_FEATURE_P2P
806//Before destroying the list making sure all the nodes have been deleted.
807//Which should be the normal case, but a memory leak has been reported.
808
809 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
810
811 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
812 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
813 {
814 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
815 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
816
817 palFreeMemory(pMac, pLimMgmtRegistration);
818 }
819
820 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
821#endif
822
823 limCleanupMlm(pMac);
824 limCleanupLmm(pMac);
825
826 // free up preAuth table
827 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
828 {
829 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
830 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
831 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
832 }
833
834 if(NULL != pMac->lim.pDialogueTokenHead)
835 {
836 limDeleteDialogueTokenList(pMac);
837 }
838
839 if(NULL != pMac->lim.pDialogueTokenTail)
840 {
841 palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
842 pMac->lim.pDialogueTokenTail = NULL;
843 }
844
845 # if 0
846 if (pMac->lim.gpLimStartBssReq != NULL)
847 {
848 palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
849 pMac->lim.gpLimStartBssReq = NULL;
850 }
851 #endif
852
853 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
854 {
855 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
856 pMac->lim.gpLimMlmSetKeysReq = NULL;
857 }
858
859 #if 0
860 if (pMac->lim.gpLimJoinReq != NULL)
861 {
862 palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
863 pMac->lim.gpLimJoinReq = NULL;
864 }
865 #endif
866
867 if (pMac->lim.gpLimMlmAuthReq != NULL)
868 {
869 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
870 pMac->lim.gpLimMlmAuthReq = NULL;
871 }
872
Jeff Johnsone7245742012-09-05 17:12:55 -0700873#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 if (pMac->lim.gpLimMlmJoinReq != NULL)
875 {
876 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
877 pMac->lim.gpLimMlmJoinReq = NULL;
878 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700879#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700880
881 #if 0
882 if (pMac->lim.gpLimReassocReq != NULL)
883 {
884 palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
885 pMac->lim.gpLimReassocReq = NULL;
886 }
887 #endif
888
889 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
890 {
891 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
892 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
893 }
894
Viral Modid86bde22012-12-10 13:09:21 -0800895#ifdef WLAN_FEATURE_P2P
896 if (pMac->lim.gpLimSmeScanReq != NULL)
897 {
898 palFreeMemory(pMac->hHdd, pMac->lim.gpLimSmeScanReq);
899 pMac->lim.gpLimSmeScanReq = NULL;
900 }
901#endif
902
Jeff Johnson295189b2012-06-20 16:38:30 -0700903 if (pMac->lim.gpLimMlmScanReq != NULL)
904 {
905 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
906 pMac->lim.gpLimMlmScanReq = NULL;
907 }
908
909#if 0
910 if(NULL != pMac->lim.beacon)
911 {
912 palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
913 pMac->lim.beacon = NULL;
914 }
915#endif
916 #if 0
917 if(NULL != pMac->lim.assocReq)
918 {
919 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
920 pMac->lim.assocReq= NULL;
921 }
922 #endif
923
924#if 0
925 if(NULL != pMac->lim.assocRsp)
926 {
927 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
928 pMac->lim.assocRsp= NULL;
929 }
930#endif
931 // Now, finally reset the deferred message queue pointers
932 limResetDeferredMsgQ(pMac);
933
934#ifdef VOSS_ENABLED
935
936 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
937 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
938
939 if ( retStatus != VOS_STATUS_SUCCESS )
940 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
941#endif
942
943#if defined WLAN_FEATURE_VOWIFI
944 rrmCleanup(pMac);
945#endif
946#if defined WLAN_FEATURE_VOWIFI_11R
947 limFTCleanup(pMac);
948#endif
949
950} /*** end limCleanup() ***/
951
952
953/** -------------------------------------------------------------
954\fn peOpen
955\brief will be called in Open sequence from macOpen
956\param tpAniSirGlobal pMac
957\param tHalOpenParameters *pHalOpenParam
958\return tSirRetStatus
959 -------------------------------------------------------------*/
960
961tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
962{
963 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
964 pMac->lim.maxStation = pMacOpenParam->maxStation;
965
966 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
967 {
968 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
969 return eSIR_FAILURE;
970 }
971
972 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
973 (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
974 {
975 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
976 return eSIR_FAILURE;
977 }
978
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800979#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
981 (void **) &pMac->lim.gpLimAIDpool,
982 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
983 {
984 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
985 return eSIR_FAILURE;
986 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800987#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
989 (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
990 {
991 limLog(pMac, LOGE, FL("memory allocate failed!\n"));
992 return eSIR_FAILURE;
993 }
994
995 palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
996
997
998 /*
999 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1000 (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
1001 {
1002 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1003 return eSIR_FAILURE;
1004 }
1005
1006 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1007 (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
1008 {
1009 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1010 return eSIR_FAILURE;
1011 }
1012 */
1013
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1015 (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
1016 {
1017 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
1018 return eSIR_FAILURE;
1019 }
1020 palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
Jeff Johnson295189b2012-06-20 16:38:30 -07001021
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001022 pMac->lim.mgmtFrameSessionId = 0xff;
Jeff Johnson295189b2012-06-20 16:38:30 -07001023
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001024 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1025 {
1026 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!\n"));)
1027 return eSIR_FAILURE;
1028 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 return eSIR_SUCCESS;
1030}
1031
1032/** -------------------------------------------------------------
1033\fn peClose
1034\brief will be called in close sequence from macClose
1035\param tpAniSirGlobal pMac
1036\return tSirRetStatus
1037 -------------------------------------------------------------*/
1038
1039tSirRetStatus peClose(tpAniSirGlobal pMac)
1040{
1041 tANI_U8 i;
1042
1043 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1044 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001045
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 for(i =0; i < pMac->lim.maxBssId; i++)
1047 {
1048 if(pMac->lim.gpSession[i].valid == TRUE)
1049 {
1050 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1051 }
1052 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001053 palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
1054 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001055#if 0
Jeff Johnsone7245742012-09-05 17:12:55 -07001056 palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
1057 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001058#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001059
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
1061 pMac->lim.gpSession = NULL;
1062 /*
1063 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
1064 pMac->dph.dphHashTable.pHashTable = NULL;
1065 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
1066 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1067 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
1069 pMac->pmm.gPmmTim.pTim = NULL;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001070 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1071 {
1072 return eSIR_FAILURE;
1073 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 return eSIR_SUCCESS;
1075}
1076
1077/** -------------------------------------------------------------
1078\fn peStart
1079\brief will be called in start sequence from macStart
1080\param tpAniSirGlobal pMac
1081\return none
1082 -------------------------------------------------------------*/
1083
1084tSirRetStatus peStart(tpAniSirGlobal pMac)
1085{
1086 tSirRetStatus status = eSIR_SUCCESS;
1087
1088 status = limInitialize(pMac);
1089#if defined(ANI_LOGDUMP)
1090 limDumpInit(pMac);
1091#endif //#if defined(ANI_LOGDUMP)
1092
1093 return status;
1094}
1095
1096/** -------------------------------------------------------------
1097\fn peStop
1098\brief will be called in stop sequence from macStop
1099\param tpAniSirGlobal pMac
1100\return none
1101 -------------------------------------------------------------*/
1102
1103void peStop(tpAniSirGlobal pMac)
1104{
1105 limCleanup(pMac);
1106 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1107 return;
1108}
1109
1110/** -------------------------------------------------------------
1111\fn peFreeMsg
1112\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1113\ to free a given PE message on the TX and MC thread.
1114\ This happens when there are messages pending in the PE
1115\ queue when system is being stopped and reset.
1116\param tpAniSirGlobal pMac
1117\param tSirMsgQ pMsg
1118\return none
1119-----------------------------------------------------------------*/
1120v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1121{
1122 if (pMsg != NULL)
1123 {
1124 if (NULL != pMsg->bodyptr)
1125 {
1126 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1127 {
1128 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1129 }
1130 else
1131 {
1132 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1133 }
1134 }
1135 pMsg->bodyptr = 0;
1136 pMsg->bodyval = 0;
1137 pMsg->type = 0;
1138 }
1139 return;
1140}
1141
1142
1143/**
1144 * The function checks if a particular timer should be allowed
1145 * into LIM while device is sleeping
1146 */
1147tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1148{
1149 tANI_U8 retStatus = TRUE;
1150
1151 if(!limIsSystemInActiveState(pMac))
1152 {
1153 switch(pMsg->type)
1154 {
1155 /* Don't allow following timer messages if in sleep */
1156 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1157 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1158 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1159 retStatus = FALSE;
1160 break;
1161 /* May allow following timer messages in sleep mode */
1162 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1163
1164 /* Safe to allow as of today, this triggers background scan
1165 * which will not be started if the device is in power-save mode
1166 * might need to block in the future if we decide to implement
1167 * spectrum management
1168 */
1169 case SIR_LIM_QUIET_TIMEOUT:
1170
1171 /* Safe to allow as of today, this triggers background scan
1172 * which will not be started if the device is in power-save mode
1173 * might need to block in the future if we decide to implement
1174 * spectrum management
1175 */
1176 case SIR_LIM_QUIET_BSS_TIMEOUT:
1177
1178 /* Safe to allow this timermessage, triggers background scan
1179 * which is blocked in sleep mode
1180 */
1181 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1182
1183 /* Safe to allow this timer, since, while in IMPS this timer will not
1184 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1185 * when heart-beat control is handled back to PE, device would have
1186 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1187 */
1188 case SIR_LIM_HEART_BEAT_TIMEOUT:
1189 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1190
1191 /* Safe to allow, PE is not handling this message as of now. May need
1192 * to block it, basically, free the buffer and restart the timer
1193 */
1194 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1195 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001196 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1198 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1199 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1200 retStatus = TRUE;
1201 break;
1202
1203 /* by default allow rest of messages */
1204 default:
1205 retStatus = TRUE;
1206 break;
1207
1208
1209 }
1210 }
1211
1212 return retStatus;
1213
1214}
1215
1216
1217
1218/**
1219 * limPostMsgApi()
1220 *
1221 *FUNCTION:
1222 * This function is called from other thread while posting a
1223 * message to LIM message Queue gSirLimMsgQ.
1224 *
1225 *LOGIC:
1226 * NA
1227 *
1228 *ASSUMPTIONS:
1229 * NA
1230 *
1231 *NOTE:
1232 * NA
1233 *
1234 * @param pMac - Pointer to Global MAC structure
1235 * @param pMsg - Pointer to the message structure
1236 * @return None
1237 */
1238
1239tANI_U32
1240limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1241{
1242#ifdef VOSS_ENABLED
1243 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1244
1245
1246#elif defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
1247 return tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_WAIT_FOREVER);
1248
1249#else
1250 /* Check if this is a timeout message from a timer
1251 * and if the timeout message is allowed if the device is in power-save state
1252 */
1253 if(!limIsTimerAllowedInPowerSaveState(pMac, pMsg))
1254 {
1255 limLog(pMac, LOGW,
1256 FL("Timeout message %d is not allowed while device is in Power-Save mode\n"),
1257 pMsg->type);
1258
1259 return TX_SUCCESS;
1260 }
1261 if(pMac->gDriverType != eDRIVER_TYPE_MFG)
1262 {
1263 limMessageProcessor(pMac, pMsg);
1264 }
1265
1266 return TX_SUCCESS;
1267
1268#endif
1269} /*** end limPostMsgApi() ***/
1270
1271
1272/*--------------------------------------------------------------------------
1273
1274 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1275
1276 This function can be called by legacy code to post message to voss queues OR
1277 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1278 for dispatching it later.
1279
1280 \param pMac - Pointer to Global MAC structure
1281 \param pMsg - Pointer to the message structure
1282
1283 \return tANI_U32 - TX_SUCCESS for success.
1284
1285 --------------------------------------------------------------------------*/
1286
1287tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1288{
1289 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1290}
1291
1292/*--------------------------------------------------------------------------
1293
1294 \brief peProcessMessages() - Message Processor for PE
1295
1296 Voss calls this function to dispatch the message to PE
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 peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1306{
1307 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1308 {
1309 return eSIR_SUCCESS;
1310 }
1311 /**
1312 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1313 * for all the other cases post it to LIM
1314 */
1315 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1316 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1317 else
1318 limMessageProcessor(pMac, pMsg);
1319 return eSIR_SUCCESS;
1320}
1321
1322
1323#ifdef VOSS_ENABLED
1324
1325// ---------------------------------------------------------------------------
1326/**
1327 * peHandleMgmtFrame
1328 *
1329 * FUNCTION:
1330 * Process the Management frames from TL
1331 *
1332 * LOGIC:
1333 *
1334 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1335 *
1336 * NOTE:
1337 *
1338 * @param pvosGCtx Global Vos Context
1339 * @param vossBuff Packet
1340 * @return None
1341 */
1342
1343VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1344{
1345 tpAniSirGlobal pMac;
1346 tpSirMacMgmtHdr mHdr;
1347 tSirMsgQ msg;
1348 vos_pkt_t *pVosPkt;
1349 VOS_STATUS vosStatus;
1350 v_U8_t *pRxPacketInfo;
1351
1352 pVosPkt = (vos_pkt_t *)vosBuff;
1353 if (NULL == pVosPkt)
1354 {
1355 return VOS_STATUS_E_FAILURE;
1356 }
1357
1358 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1359 if (NULL == pMac)
1360 {
1361 // cannot log a failure without a valid pMac
1362 vos_pkt_return_packet(pVosPkt);
1363 return VOS_STATUS_E_FAILURE;
1364 }
1365
1366 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1367
1368 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1369 {
1370 vos_pkt_return_packet(pVosPkt);
1371 return VOS_STATUS_E_FAILURE;
1372 }
1373
1374
1375 //
1376 // The MPDU header is now present at a certain "offset" in
1377 // the BD and is specified in the BD itself
1378 //
1379 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1380 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1381 {
1382 PELOG1(limLog( pMac, LOG1,
1383 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001384 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
Jeff Johnsone7245742012-09-05 17:12:55 -07001386 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1388 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1389 }
1390
1391
1392 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1393 msg.type = SIR_BB_XPORT_MGMT_MSG;
1394 msg.bodyptr = vosBuff;
1395 msg.bodyval = 0;
1396
1397 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1398 &msg,
1399 mHdr->fc.type,
1400 mHdr->fc.subType ))
1401 {
1402 vos_pkt_return_packet(pVosPkt);
1403 limLog( pMac, LOGW,
1404 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
1405 return VOS_STATUS_E_FAILURE;
1406 }
1407
1408 return VOS_STATUS_SUCCESS;
1409}
1410
1411// ---------------------------------------------------------------------------
1412/**
1413 * peRegisterTLHandle
1414 *
1415 * FUNCTION:
1416 * Registers the Handler which, process the Management frames from TL
1417 *
1418 * LOGIC:
1419 *
1420 * ASSUMPTIONS:
1421 *
1422 * NOTE:
1423 *
1424 * @return None
1425 */
1426
1427void peRegisterTLHandle(tpAniSirGlobal pMac)
1428{
1429 v_PVOID_t pvosGCTx;
1430 VOS_STATUS retStatus;
1431
1432 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1433
1434 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1435
1436 if (retStatus != VOS_STATUS_SUCCESS)
1437 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
1438
1439}
1440#endif
1441
1442
1443/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 * limIsSystemInScanState()
1445 *
1446 *FUNCTION:
1447 * This function is called by various MAC software modules to
1448 * determine if System is in Scan/Learn state
1449 *
1450 *LOGIC:
1451 * NA
1452 *
1453 *ASSUMPTIONS:
1454 * NA
1455 *
1456 *NOTE:
1457 *
1458 * @param pMac - Pointer to Global MAC structure
1459 * @return true - System is in Scan/Learn state
1460 * false - System is NOT in Scan/Learn state
1461 */
1462
1463tANI_U8
1464limIsSystemInScanState(tpAniSirGlobal pMac)
1465{
1466 switch (pMac->lim.gLimSmeState)
1467 {
1468 case eLIM_SME_CHANNEL_SCAN_STATE:
1469 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1470 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1471 case eLIM_SME_WT_SCAN_STATE:
1472 // System is in Learn mode
1473 return true;
1474
1475 default:
1476 // System is NOT in Learn mode
1477 return false;
1478 }
1479} /*** end limIsSystemInScanState() ***/
1480
1481
1482
1483/**
1484 * limIsSystemInActiveState()
1485 *
1486 *FUNCTION:
1487 * This function is called by various MAC software modules to
1488 * determine if System is in Active/Wakeup state
1489 *
1490 *LOGIC:
1491 * NA
1492 *
1493 *ASSUMPTIONS:
1494 * NA
1495 *
1496 *NOTE:
1497 *
1498 * @param pMac - Pointer to Global MAC structure
1499 * @return true - System is in Active state
1500 * false - System is not in Active state
1501 */
1502
1503tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1504{
1505 switch (pMac->pmm.gPmmState)
1506 {
1507 case ePMM_STATE_BMPS_WAKEUP:
1508 case ePMM_STATE_IMPS_WAKEUP:
1509 case ePMM_STATE_READY:
1510 // System is in Active mode
1511 return true;
1512 default:
1513 return false;
1514 // System is NOT in Active mode
1515 }
1516}
1517
1518
Jeff Johnson295189b2012-06-20 16:38:30 -07001519
Jeff Johnson295189b2012-06-20 16:38:30 -07001520
1521
1522/**
1523*\brief limReceivedHBHandler()
1524*
1525* This function is called by schBeaconProcess() upon
1526* receiving a Beacon on STA. This also gets called upon
1527* receiving Probe Response after heat beat failure is
1528* detected.
1529*
1530* param pMac - global mac structure
1531* param channel - channel number indicated in Beacon, Probe Response
1532* return - none
1533*/
1534
1535
1536void
1537limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1538{
1539 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1540 psessionEntry->LimRxedBeaconCntDuringHB++;
1541
1542 pMac->pmm.inMissedBeaconScenario = FALSE;
1543} /*** end limReceivedHBHandler() ***/
1544
1545
1546
1547#if 0
1548void limResetHBPktCount(tpPESession psessionEntry)
1549{
1550 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1551}
1552#endif
1553
1554
1555/*
1556 * limProcessWdsInfo()
1557 *
1558 *FUNCTION:
1559 * This function is called from schBeaconProcess in BP
1560 *
1561 *PARAMS:
1562 * @param pMac - Pointer to Global MAC structure
1563 * @param propIEInfo - proprietary IE info
1564 *
1565 *LOGIC:
1566 *
1567 *ASSUMPTIONS:
1568 * NA
1569 *
1570 *NOTE:
1571 *
1572 *
1573 *RETURNS:
1574 *
1575 */
1576
1577void limProcessWdsInfo(tpAniSirGlobal pMac,
1578 tSirPropIEStruct propIEInfo)
1579{
Jeff Johnson295189b2012-06-20 16:38:30 -07001580}
1581
1582
1583
1584/**
1585 * limInitWdsInfoParams()
1586 *
1587 *FUNCTION:
1588 * This function is called while processing
1589 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1590 * ind/set related parameters.
1591 *
1592 *LOGIC:
1593 *
1594 *ASSUMPTIONS:
1595 *
1596 *NOTE:
1597 *
1598 * @param pMac Pointer to Global MAC structure
1599 * @return None
1600 */
1601
1602void
1603limInitWdsInfoParams(tpAniSirGlobal pMac)
1604{
1605 pMac->lim.gLimWdsInfo.wdsLength = 0;
1606 pMac->lim.gLimNumWdsInfoInd = 0;
1607 pMac->lim.gLimNumWdsInfoSet = 0;
1608} /*** limInitWdsInfoParams() ***/
1609
1610
1611/** -------------------------------------------------------------
1612\fn limUpdateOverlapStaParam
1613\brief Updates overlap cache and param data structure
1614\param tpAniSirGlobal pMac
1615\param tSirMacAddr bssId
1616\param tpLimProtStaParams pStaParams
1617\return None
1618 -------------------------------------------------------------*/
1619void
1620limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1621{
1622 int i;
1623 if (!pStaParams->numSta)
1624 {
1625 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
1626 bssId,
1627 sizeof(tSirMacAddr));
1628 pMac->lim.protStaOverlapCache[0].active = true;
1629
1630 pStaParams->numSta = 1;
1631
1632 return;
1633 }
1634
1635 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
1636 {
1637 if (pMac->lim.protStaOverlapCache[i].active)
1638 {
1639 if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
1640 bssId,
1641 sizeof(tSirMacAddr))) {
1642 return; }
1643 }
1644 else
1645 break;
1646 }
1647
1648 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
1649 {
1650 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
1651 }
1652 else
1653 {
1654 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
1655 bssId,
1656 sizeof(tSirMacAddr));
1657 pMac->lim.protStaOverlapCache[i].active = true;
1658
1659 pStaParams->numSta++;
1660 }
1661}
1662
1663
1664/**
1665 * limHandleIBSScoalescing()
1666 *
1667 *FUNCTION:
1668 * This function is called upon receiving Beacon/Probe Response
1669 * while operating in IBSS mode.
1670 *
1671 *LOGIC:
1672 *
1673 *ASSUMPTIONS:
1674 *
1675 *NOTE:
1676 *
1677 * @param pMac - Pointer to Global MAC structure
1678 * @param pBeacon - Parsed Beacon Frame structure
1679 * @param pRxPacketInfo - Pointer to RX packet info structure
1680 *
1681 * @return Status whether to process or ignore received Beacon Frame
1682 */
1683
1684tSirRetStatus
1685limHandleIBSScoalescing(
1686 tpAniSirGlobal pMac,
1687 tpSchBeaconStruct pBeacon,
1688 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
1689{
1690 tpSirMacMgmtHdr pHdr;
1691 tSirRetStatus retCode;
1692
1693 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1694 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
1695 /* Received SSID does not match => Ignore received Beacon frame. */
1696 retCode = eSIR_LIM_IGNORE_BEACON;
1697 else
1698 {
1699 tANI_U32 ieLen;
1700 tANI_U16 tsfLater;
1701 tANI_U8 *pIEs;
1702 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
1703 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
1704 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
1705 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
1706 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
1707 }
1708 return retCode;
1709} /*** end limHandleIBSScoalescing() ***/
1710
1711
1712
1713/**
1714 * limDetectChangeInApCapabilities()
1715 *
1716 *FUNCTION:
1717 * This function is called while SCH is processing
1718 * received Beacon from AP on STA to detect any
1719 * change in AP's capabilities. If there any change
1720 * is detected, Roaming is informed of such change
1721 * so that it can trigger reassociation.
1722 *
1723 *LOGIC:
1724 *
1725 *ASSUMPTIONS:
1726 *
1727 *NOTE:
1728 * Notification is enabled for STA product only since
1729 * it is not a requirement on BP side.
1730 *
1731 * @param pMac Pointer to Global MAC structure
1732 * @param pBeacon Pointer to parsed Beacon structure
1733 * @return None
1734 */
1735
1736void
1737limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
1738 tpSirProbeRespBeacon pBeacon,
1739 tpPESession psessionEntry)
1740{
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 tANI_U8 len;
1742 tSirSmeApNewCaps apNewCaps;
1743 tANI_U8 newChannel;
1744 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
1745 newChannel = (tANI_U8) pBeacon->channelNumber;
1746
1747 if ((psessionEntry->limSentCapsChangeNtf == false) &&
1748 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
1749 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
1750 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
1751 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
1752 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
1753 (newChannel != psessionEntry->currentOperChannel)
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 )))
1755 {
1756
1757 /**
1758 * BSS capabilities have changed.
1759 * Inform Roaming.
1760 */
1761 len = sizeof(tSirMacCapabilityInfo) +
1762 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
1763 3 * sizeof(tANI_U8) + // reserved fields
1764 pBeacon->ssId.length + 1;
1765
1766 palCopyMemory( pMac->hHdd, apNewCaps.bssId,
1767 psessionEntry->bssId,
1768 sizeof(tSirMacAddr));
1769 if (newChannel != psessionEntry->currentOperChannel)
1770 {
1771 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
1772 "Ignoring beacon!\n"),
1773 psessionEntry->currentOperChannel, newChannel);)
1774 return;
1775 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05301776
1777 /**
1778 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
1779 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
1780 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
1781 * the privacy bit is set in Probe and association responses.
1782 * Due to this anomaly, we detect a change in
1783 * AP capabilities when we receive a beacon after association and
1784 * disconnect from the AP. The following check makes sure that we can
1785 * connect to such APs
1786 */
1787 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
1788 (pBeacon->rsnPresent || pBeacon->wpaPresent))
1789 {
1790 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
1791 " but WPA or RSN IE present, Ignore Beacon!\n"));)
1792 return;
1793 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001794 else
1795 apNewCaps.channelId = psessionEntry->currentOperChannel;
1796 palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
1797 (tANI_U8 *) &pBeacon->ssId,
1798 pBeacon->ssId.length + 1);
1799
1800 psessionEntry->limSentCapsChangeNtf = true;
1801 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
1802 (tANI_U32 *) &apNewCaps,
1803 len, psessionEntry->smeSessionId);
1804 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001805} /*** limDetectChangeInApCapabilities() ***/
1806
1807
1808
1809
1810// ---------------------------------------------------------------------
1811/**
1812 * limUpdateShortSlot
1813 *
1814 * FUNCTION:
1815 * Enable/Disable short slot
1816 *
1817 * LOGIC:
1818 *
1819 * ASSUMPTIONS:
1820 *
1821 * NOTE:
1822 *
1823 * @param enable Flag to enable/disable short slot
1824 * @return None
1825 */
1826
1827tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
1828{
1829
1830 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07001831 tANI_U32 nShortSlot;
1832 tANI_U32 val = 0;
1833 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001834
Jeff Johnsone7245742012-09-05 17:12:55 -07001835 // Check Admin mode first. If it is disabled just return
1836 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
1837 != eSIR_SUCCESS)
1838 {
1839 limLog(pMac, LOGP,
1840 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
1841 return eSIR_FAILURE;
1842 }
1843 if (val == false)
1844 return eSIR_SUCCESS;
1845
1846 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
1847 limGetPhyMode(pMac, &phyMode, psessionEntry);
1848 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
1849 return eSIR_SUCCESS;
1850
1851 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07001852
1853 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
1854 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
1855 // if no erp present, use short slot based on current ap caps
1856
1857 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
1858
1859 //Resolution : always use the shortSlot setting the capability info to decide slot time.
1860 // The difference between the earlier implementation and the new one is only Case4.
1861 /*
1862 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
1863 Case1 1 1 1 1 //AP should not advertise this combination.
1864 Case2 1 1 0 0
1865 Case3 1 0 1 1
1866 Case4 1 0 0 0
1867 Case5 0 1 1 1
1868 Case6 0 1 0 0
1869 Case7 0 0 1 1
1870 Case8 0 0 0 0
1871 */
1872 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
1873
Jeff Johnsone7245742012-09-05 17:12:55 -07001874 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 {
1876 // Short slot time capability of AP has changed. Adopt to it.
1877 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
1878 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07001879 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
1881 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 }
1883 return eSIR_SUCCESS;
1884}
1885
1886
Jeff Johnson295189b2012-06-20 16:38:30 -07001887
1888
Jeff Johnson295189b2012-06-20 16:38:30 -07001889
Jeff Johnson295189b2012-06-20 16:38:30 -07001890
1891
1892/** -----------------------------------------------------------------
1893 \brief limHandleLowRssiInd() - handles low rssi indication
1894
1895 This function process the SIR_HAL_LOW_RSSI_IND message from
1896 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
1897
1898 \param pMac - global mac structure
1899
1900 \return
1901
1902 \sa
1903 ----------------------------------------------------------------- */
1904void limHandleLowRssiInd(tpAniSirGlobal pMac)
1905{
1906#if 0 //RSSI related indications will now go to TL and not PE
1907 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1908 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1909 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1910 {
1911 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
1912 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
1913 }
1914 else
1915 {
1916 limLog(pMac, LOGE,
1917 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
1918 pMac->pmm.gPmmState);
1919 }
1920 return;
1921#endif
1922}
1923
1924
1925/** -----------------------------------------------------------------
1926 \brief limHandleBmpsStatusInd() - handles BMPS status indication
1927
1928 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
1929 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1930 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
1931
1932 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
1933 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
1934 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
1935 This message can also come from FW anytime after we have entered BMPS.
1936 This means we should handle it in WoWL and UAPSD states as well
1937
1938 \param pMac - global mac structure
1939 \return - none
1940 \sa
1941 ----------------------------------------------------------------- */
1942void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
1943{
1944 switch(pMac->pmm.gPmmState)
1945 {
1946 case ePMM_STATE_BMPS_SLEEP:
1947 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
1948 case ePMM_STATE_UAPSD_SLEEP:
1949 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
1950 case ePMM_STATE_WOWLAN:
1951 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1952 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
1953 break;
1954
1955 default:
1956 limLog(pMac, LOGE,
1957 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
1958 pMac->pmm.gPmmState);
1959 break;
1960 }
1961 return;
1962}
1963
1964
1965/** -----------------------------------------------------------------
1966 \brief limHandleMissedBeaconInd() - handles missed beacon indication
1967
1968 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
1969 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
1970 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
1971
1972 \param pMac - global mac structure
1973 \return - none
1974 \sa
1975 ----------------------------------------------------------------- */
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001976void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07001977{
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001978#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1979 tpSirSmeMissedBeaconInd pSirMissedBeaconInd =
1980 (tpSirSmeMissedBeaconInd)pMsg->bodyptr;
1981 tpPESession psessionEntry = peFindSessionByBssIdx(pMac,pSirMissedBeaconInd->bssIdx);
1982 if (psessionEntry == NULL)
1983 {
1984 limLog(pMac, LOGE,
1985 FL("session does not exist for given BSSIdx:%d"),
1986 pSirMissedBeaconInd->bssIdx);
1987 return;
1988 }
1989#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
1991 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
1992 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
1993 {
1994 pMac->pmm.inMissedBeaconScenario = TRUE;
1995 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
1996 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
1997 }
Yathish9f22e662012-12-10 14:21:35 -08001998/* ACTIVE_MODE_HB_OFFLOAD */
1999#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2000 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2001 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2002 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2003 {
2004 pMac->pmm.inMissedBeaconScenario = TRUE;
2005 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure\n"));)
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002006 limMissedBeaconInActiveMode(pMac, psessionEntry);
Yathish9f22e662012-12-10 14:21:35 -08002007 }
2008#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 else
2010 {
2011 limLog(pMac, LOGE,
2012 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
2013 pMac->pmm.gPmmState);
2014 }
2015 return;
2016}
2017
2018/** -----------------------------------------------------------------
2019 \brief limMicFailureInd() - handles mic failure indication
2020
2021 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2022
2023 \param pMac - global mac structure
2024 \return - none
2025 \sa
2026 ----------------------------------------------------------------- */
2027void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2028{
2029 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2030 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2031 tSirMsgQ mmhMsg;
2032 tpPESession psessionEntry ;
2033 tANI_U8 sessionId;
2034
2035 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2036 {
2037 limLog(pMac, LOGE,
2038 FL("session does not exist for given BSSId\n"));
2039 return;
2040 }
2041
2042 if (eHAL_STATUS_SUCCESS !=
2043 palAllocateMemory(pMac->hHdd,
2044 (void **) &pSirSmeMicFailureInd,
2045 sizeof(tSirSmeMicFailureInd)))
2046 {
2047 // Log error
2048 limLog(pMac, LOGP,
2049 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
2050 return;
2051 }
2052
2053 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2054 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2055 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2056
2057 vos_mem_copy(pSirSmeMicFailureInd->bssId,
2058 pSirMicFailureInd->bssId,
2059 sizeof(tSirMacAddr));
2060
2061 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
2062 pSirMicFailureInd->info.srcMacAddr,
2063 sizeof(tSirMacAddr));
2064
2065 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
2066 pSirMicFailureInd->info.taMacAddr,
2067 sizeof(tSirMacAddr));
2068
2069 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
2070 pSirMicFailureInd->info.dstMacAddr,
2071 sizeof(tSirMacAddr));
2072
2073 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
2074 pSirMicFailureInd->info.rxMacAddr,
2075 sizeof(tSirMacAddr));
2076
2077 pSirSmeMicFailureInd->info.multicast =
2078 pSirMicFailureInd->info.multicast;
2079
2080 pSirSmeMicFailureInd->info.keyId=
2081 pSirMicFailureInd->info.keyId;
2082
2083 pSirSmeMicFailureInd->info.IV1=
2084 pSirMicFailureInd->info.IV1;
2085
2086 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
2087 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
2088
2089 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2090 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2091 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002092 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2094 return;
2095}
2096
2097
2098/** -----------------------------------------------------------------
2099 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2100
2101 This function is called before enqueuing the frame to PE queue for further processing.
2102 This prevents unnecessary frames getting into PE Queue and drops them right away.
2103 Frames will be droped in the following scenarios:
2104
2105 - In Scan State, drop the frames which are not marked as scan frames
2106 - In non-Scan state, drop the frames which are marked as scan frames.
2107 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2108 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2109
2110 \param pMac - global mac structure
2111 \return - none
2112 \sa
2113 ----------------------------------------------------------------- */
2114
2115tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2116{
2117 tANI_U32 framelen;
2118 tANI_U8 *pBody;
2119 tSirMacCapabilityInfo capabilityInfo;
2120
2121 /*
2122 *
2123 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2124 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2125 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2126 * other than beacons or probe responses in scan state.
2127 */
2128 if( (subType == SIR_MAC_MGMT_BEACON) ||
2129 (subType == SIR_MAC_MGMT_PROBE_RSP))
2130 {
2131 if(pMac->pmm.inMissedBeaconScenario)
2132 {
Jeff Johnsonab79c8d2012-12-10 14:30:13 -08002133 PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon scenario"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 return eMGMT_DROP_NO_DROP;
2135 }
2136 if (limIsSystemInScanState(pMac))
2137 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002138 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 }
2140 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2141 {
2142 return eMGMT_DROP_SCAN_MODE_FRAME;
2143 }
2144 }
2145
2146 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2147 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2148
2149 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2150 * beacons from an infrastructure network
2151 */
2152 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2153 if(!capabilityInfo.ibss)
2154 return eMGMT_DROP_NO_DROP;
2155#if 0
2156 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2157 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2158 return eMGMT_DROP_NO_DROP;
2159#endif
2160
2161 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2162 if( (subType == SIR_MAC_MGMT_BEACON) ||
2163 (subType == SIR_MAC_MGMT_PROBE_RSP))
2164 {
2165 //drop the frame if length is less than 12
2166 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2167 return eMGMT_DROP_INVALID_SIZE;
2168
2169 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2170
2171 //This can be enhanced to even check the SSID before deciding to enque the frame.
2172 if(capabilityInfo.ess)
2173 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2174 }
2175 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2176 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2177 {
2178 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2179 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2180 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2181 }
2182
2183 return eMGMT_DROP_NO_DROP;
2184}
2185
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002186eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2187{
2188 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002189
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002190 if(psPe)
2191 {
2192 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2193 {
2194 status = eHAL_STATUS_SUCCESS;
2195 }
2196 }
2197 return (status);
2198}
2199eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2200{
2201 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2202 if(psPe)
2203 {
2204 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2205 {
2206 status = eHAL_STATUS_SUCCESS;
2207 }
2208 }
2209 return (status);
2210}