blob: 2d1605f95f3fe89311ca5b10ca59f5c2fe90c3da [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"
55#ifdef ANI_PRODUCT_TYPE_AP
56#include "wniCfgAp.h"
57#else
58#include "wniCfgSta.h"
59#include "wniApi.h"
60#endif
61#include "sirCommon.h"
62#include "sirDebug.h"
63#include "aniParam.h"
64#include "cfgApi.h"
65
66#include "schApi.h"
67#include "utilsApi.h"
68#include "limApi.h"
69#include "limGlobal.h"
70#include "limTypes.h"
71#include "limUtils.h"
72#include "limAssocUtils.h"
73#include "limPropExtsUtils.h"
74#include "limSerDesUtils.h"
75#include "limIbssPeerMgmt.h"
76#include "limAdmitControl.h"
77#include "pmmApi.h"
78#include "logDump.h"
79#include "limSendSmeRspMessages.h"
80#include "wmmApsd.h"
81#include "limTrace.h"
82#include "limSession.h"
83#include "wlan_qct_wda.h"
84
85#if defined WLAN_FEATURE_VOWIFI
86#include "rrmApi.h"
87#endif
88
89#include <limFT.h>
90
91#ifdef VOSS_ENABLED
92#include "vos_types.h"
93#include "vos_packet.h"
94#include "wlan_qct_tl.h"
95#include "sysStartup.h"
96#endif
97
98
99static void __limInitScanVars(tpAniSirGlobal pMac)
100{
101 pMac->lim.gLimUseScanModeForLearnMode = 1;
102
103 pMac->lim.gLimSystemInScanLearnMode = 0;
104
105 // Scan related globals on STA
106 pMac->lim.gLimReturnAfterFirstMatch = 0;
107 pMac->lim.gLim24Band11dScanDone = 0;
108 pMac->lim.gLim50Band11dScanDone = 0;
109 pMac->lim.gLimReturnUniqueResults = 0;
110
111 // Background Scan related globals on STA
112 pMac->lim.gLimNumOfBackgroundScanSuccess = 0;
113 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
114 pMac->lim.gLimNumOfForcedBkgndScan = 0;
115 pMac->lim.gLimBackgroundScanDisable = false; //based on BG timer
116 pMac->lim.gLimForceBackgroundScanDisable = false; //debug control flag
117 pMac->lim.gLimBackgroundScanTerminate = TRUE; //controlled by SME
118 pMac->lim.gLimReportBackgroundScanResults = FALSE; //controlled by SME
119
120 pMac->lim.gLimCurrentScanChannelId = 0;
121 pMac->lim.gpLimMlmScanReq = NULL;
Viral Modid86bde22012-12-10 13:09:21 -0800122#ifdef WLAN_FEATURE_P2P
123 pMac->lim.gpLimSmeScanReq = NULL;
124#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 pMac->lim.gLimMlmScanResultLength = 0;
126 pMac->lim.gLimSmeScanResultLength = 0;
127
128 palZeroMemory(pMac->hHdd, pMac->lim.gLimCachedScanHashTable,
129 sizeof(pMac->lim.gLimCachedScanHashTable));
130
131#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
132 pMac->lim.gLimBackgroundScanChannelId = 0;
133 pMac->lim.gLimBackgroundScanStarted = 0;
134 pMac->lim.gLimRestoreCBNumScanInterval = LIM_RESTORE_CB_NUM_SCAN_INTERVAL_DEFAULT;
135 pMac->lim.gLimRestoreCBCount = 0;
136 palZeroMemory(pMac->hHdd, pMac->lim.gLimLegacyBssidList, sizeof(pMac->lim.gLimLegacyBssidList));
137#endif
138
139 /* Fill in default values */
140 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = 0;
141
142#ifdef ANI_AP_SDK
143 palZeroMemory(pMac->hHdd, &pMac->lim.gLimScanDurationConvert, sizeof(tLimScanDurationConvert)); /* Used to store converted scan duration values in TU and TICKS */
144#endif /* ANI_AP_SDK */
145
146 // abort scan is used to abort an on-going scan
147 pMac->lim.abortScan = 0;
148 palZeroMemory(pMac->hHdd, &pMac->lim.scanChnInfo, sizeof(tLimScanChnInfo));
149
150//WLAN_SUSPEND_LINK Related
151 pMac->lim.gpLimSuspendCallback = NULL;
152 pMac->lim.gpLimResumeCallback = NULL;
153//end WLAN_SUSPEND_LINK Related
154}
155
156
157static void __limInitBssVars(tpAniSirGlobal pMac)
158{
159
160 palZeroMemory(pMac->hHdd, (void*)pMac->lim.gpSession, sizeof(*pMac->lim.gpSession)*pMac->lim.maxBssId);
161
162
163 //pMac->lim.gpLimStartBssReq = NULL;
164
165#if defined(ANI_PRODUCT_TYPE_AP)
166 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNeighborBssList, sizeof(tSirMultipleNeighborBssInfo));
167#endif
168
169
170
171/* These global variables are moved to session table and intialization is done during session creation Oct 9th Review */
172#if 0
173
174 // Place holder for BSS description that we're
175 // currently joined with
176 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentBssId, sizeof(tSirMacAddr));
177 pMac->lim.gLimCurrentChannelId = HAL_INVALID_CHANNEL_ID;
178 palZeroMemory(pMac->hHdd, &pMac->lim.gLimCurrentSSID, sizeof(tSirMacSSid));
179 pMac->lim.gLimCurrentBssCaps = 0;
180 QosCaps is a bit map of various qos capabilities - see defn above
181 pMac->lim.gLimCurrentBssQosCaps = 0;
182 pMac->lim.gLimCurrentBssPropCap = 0;
183 pMac->lim.gLimSentCapsChangeNtf = 0;
184
185 // Place holder for BSS description that
186 // we're currently Reassociating
187 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocBssId, sizeof(tSirMacAddr));
188 pMac->lim.gLimReassocChannelId = 0;
189 palZeroMemory(pMac->hHdd, &pMac->lim.gLimReassocSSID, sizeof(tSirMacSSid));
190 pMac->lim.gLimReassocBssCaps = 0;
191 pMac->lim.gLimReassocBssQosCaps = 0;
192 pMac->lim.gLimReassocBssPropCap = 0;
193 #endif
194
195 /* This is for testing purposes only, be default should always be off */
196 pMac->lim.gLimForceNoPropIE = 0;
197
198 // pMac->lim.gLimBssIdx = 0;
199
200 pMac->lim.gpLimMlmSetKeysReq = NULL;
201 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
202 // pMac->lim.gLimStaid = 0; //TO SUPPORT BT-AMP
203
204}
205
206
207static void __limInitStatsVars(tpAniSirGlobal pMac)
208{
209 pMac->lim.gLimNumBeaconsRcvd = 0;
210 pMac->lim.gLimNumBeaconsIgnored = 0;
211
212 pMac->lim.gLimNumDeferredMsgs = 0;
213
214 /// Variable to keep track of number of currently associated STAs
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800215 //pMac->lim.gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 pMac->lim.gLimNumOfAniSTAs = 0; // count of ANI peers
217
218 /// This indicates number of RXed Beacons during HB period
219 //pMac->lim.gLimRxedBeaconCntDuringHB = 0;
220
221 // Heart-Beat interval value
222 pMac->lim.gLimHeartBeatCount = 0;
223
224 // Statistics to keep track of no. beacons rcvd in heart beat interval
225 palZeroMemory(pMac->hHdd, pMac->lim.gLimHeartBeatBeaconStats, sizeof(pMac->lim.gLimHeartBeatBeaconStats));
226
227#ifdef WLAN_DEBUG
228 // Debug counters
229 pMac->lim.numTot = 0;
230 pMac->lim.numBbt = 0;
231 pMac->lim.numProtErr = 0;
232 pMac->lim.numLearn = 0;
233 pMac->lim.numLearnIgnore = 0;
234 pMac->lim.numSme = 0;
235 palZeroMemory(pMac->hHdd, pMac->lim.numMAC, sizeof(pMac->lim.numMAC));
236 pMac->lim.gLimNumAssocReqDropInvldState = 0;
237 pMac->lim.gLimNumAssocReqDropACRejectTS = 0;
238 pMac->lim.gLimNumAssocReqDropACRejectSta = 0;
239 pMac->lim.gLimNumReassocReqDropInvldState = 0;
240 pMac->lim.gLimNumHashMissIgnored = 0;
241 pMac->lim.gLimUnexpBcnCnt = 0;
242 pMac->lim.gLimBcnSSIDMismatchCnt = 0;
243 pMac->lim.gLimNumLinkEsts = 0;
244 pMac->lim.gLimNumRxCleanup = 0;
245 pMac->lim.gLim11bStaAssocRejectCount = 0;
246#endif
247}
248
249
250
251static void __limInitStates(tpAniSirGlobal pMac)
252{
253 // Counts Heartbeat failures
254 pMac->lim.gLimHBfailureCntInLinkEstState = 0;
255 pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0;
256 pMac->lim.gLimHBfailureCntInOtherStates = 0;
257 pMac->lim.gLimRspReqd = 0;
258 pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE;
259
260 /// MLM State visible across all Sirius modules
Jeff Johnsone7245742012-09-05 17:12:55 -0700261 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700262 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
263
264 /// Previous MLM State
265 pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE;
266
267#ifdef GEN4_SCAN
268 // LIM to HAL SCAN Management Message Interface states
269 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
270#endif // GEN4_SCAN
271
272#ifdef FEATURE_WLAN_INTEGRATED_SOC
273 /**
Jeff Johnsone7245742012-09-05 17:12:55 -0700274 * Initialize state to eLIM_SME_OFFLINE_STATE
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700276 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700277#else
278 /**
279 * Initialize state to suspended state and wait for
280 * HAL to send LIM_RESUME_ACTIVITY_NTF message.
281 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700282 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 pMac->lim.gLimSmeState = eLIM_SME_SUSPEND_STATE;
284#endif /* FEATURE_WLAN_INTEGRATED_SOC */
285
286 /**
287 * By default assume 'unknown' role. This will be updated
288 * when SME_START_BSS_REQ is received.
289 */
290
291 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams));
292 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams));
293 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams));
294 palZeroMemory(pMac->hHdd, &pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams));
295 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams));
296 palZeroMemory(pMac->hHdd, &pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams));
297
298 pMac->lim.gLimPhyMode = 0;
299 pMac->lim.scanStartTime = 0; // used to measure scan time
300
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 palZeroMemory(pMac->hHdd, pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr));
302 pMac->lim.ackPolicy = 0;
303
304#if 0 /* Moving all these to session specific elements */
305 pMac->lim.gLimQosEnabled = 0; //11E
306 pMac->lim.gLimWmeEnabled = 0; //WME
307 pMac->lim.gLimWsmEnabled = 0; //WSM
308 pMac->lim.gLimHcfEnabled = 0;
309 pMac->lim.gLim11dEnabled = 0;
310#endif
311
312 pMac->lim.gLimProbeRespDisableFlag = 0; // control over probe response
313}
314
315static void __limInitVars(tpAniSirGlobal pMac)
316{
317
318#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
319 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadioList, sizeof(tSirMultipleAlternateRadioInfo));
320#endif
321
322 // Place holder for Measurement Req/Rsp/Ind related info
323#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
324 pMac->lim.gpLimMeasReq = NULL;
325 palZeroMemory(pMac->hHdd, &pMac->lim.gLimMeasParams, sizeof(tLimMeasParams));
326 pMac->lim.gpLimMeasData = NULL;
327#endif
328
329 // WDS info
330 pMac->lim.gLimNumWdsInfoInd = 0;
331 pMac->lim.gLimNumWdsInfoSet = 0;
332 palZeroMemory(pMac->hHdd, &pMac->lim.gLimWdsInfo, sizeof(tSirWdsInfo));
333 /* initialize some parameters */
334 limInitWdsInfoParams(pMac);
335
336 // Deferred Queue Paramters
337 palZeroMemory(pMac->hHdd, &pMac->lim.gLimDeferredMsgQ, sizeof(tSirAddtsReq));
338
339 // addts request if any - only one can be outstanding at any time
340 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAddtsReq, sizeof(tSirAddtsReq));
341 pMac->lim.gLimAddtsSent = 0;
342 pMac->lim.gLimAddtsRspTimerCount = 0;
343
344 //protection related config cache
345 palZeroMemory(pMac->hHdd, &pMac->lim.cfgProtection, sizeof(tCfgProtection));
346 pMac->lim.gLimProtectionControl = 0;
347 palZeroMemory(pMac->hHdd, &pMac->lim.gLimAlternateRadio, sizeof(tSirAlternateRadioInfo));
348 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
349
Jeff Johnsone7245742012-09-05 17:12:55 -0700350#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 // 11h Spectrum Management Related Flag
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
353 pMac->sys.gSysEnableLearnMode = eANI_BOOLEAN_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700354#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 // WMM Related Flag
356 pMac->lim.gUapsdEnable = 0;
357 pMac->lim.gUapsdPerAcBitmask = 0;
358 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
359 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
360
361 // QoS-AC Downgrade: Initially, no AC is admitted
362 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] = 0;
363 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] = 0;
364
365 //dialogue token List head/tail for Action frames request sent.
366 pMac->lim.pDialogueTokenHead = NULL;
367 pMac->lim.pDialogueTokenTail = NULL;
368
369 palZeroMemory(pMac->hHdd, &pMac->lim.tspecInfo, sizeof(tLimTspecInfo) * LIM_NUM_TSPEC_MAX);
370
371 // admission control policy information
372 palZeroMemory(pMac->hHdd, &pMac->lim.admitPolicyInfo, sizeof(tLimAdmitPolicyInfo));
373
374 pMac->lim.gLastBeaconDtimCount = 0;
375 pMac->lim.gLastBeaconDtimPeriod = 0;
376
377 //Scan in Power Save Flag
378 pMac->lim.gScanInPowersave = 0;
379}
380
381static void __limInitAssocVars(tpAniSirGlobal pMac)
382{
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800383 tANI_U32 val;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800384#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
386 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
387 pMac->lim.freeAidHead = 0;
388 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800389#endif
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800390 if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS)
391 {
392 limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" ));
393 }
394 pMac->lim.gLimAssocStaLimit = val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700395
396 // Place holder for current authentication request
397 // being handled
398 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700399 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700400
401 /// MAC level Pre-authentication related globals
402 pMac->lim.gLimPreAuthChannelNumber = 0;
403 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
404 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
405 pMac->lim.gLimNumPreAuthContexts = 0;
406 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
407
408 // Placed holder to deauth reason
409 pMac->lim.gLimDeauthReasonCode = 0;
410
411 // Place holder for Pre-authentication node list
412 pMac->lim.pLimPreAuthList = NULL;
413
414 // Send Disassociate frame threshold parameters
415 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
416 pMac->lim.gLimDisassocFrameCredit = 0;
417
418 //One cache for each overlap and associated case.
419 palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
420 palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
421
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700422#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
423 pMac->lim.pSessionEntry = NULL;
424 pMac->lim.reAssocRetryAttempt = 0;
425#endif
426
Jeff Johnson295189b2012-06-20 16:38:30 -0700427}
428
429
430static void __limInitTitanVars(tpAniSirGlobal pMac)
431{
Jeff Johnsone7245742012-09-05 17:12:55 -0700432#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700435 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
436#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 // Debug workaround for BEACON's
438 // State change triggered by "dump 222"
439 pMac->lim.gLimScanOverride = 1;
440 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 pMac->lim.gLimTitanStaCount = 0;
442 pMac->lim.gLimBlockNonTitanSta = 0;
443}
444
445static void __limInitHTVars(tpAniSirGlobal pMac)
446{
447 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 pMac->lim.gHTShortGI40Mhz = 0;
450 pMac->lim.gHTShortGI20Mhz = 0;
451 pMac->lim.gHTMaxAmsduLength = 0;
452 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
453 pMac->lim.gHTPSMPSupport = 0;
454 pMac->lim.gHTLsigTXOPProtection = 0;
455 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
456 pMac->lim.gHTAMpduDensity = 0;
457
458 pMac->lim.gMaxAmsduSizeEnabled = false;
459 pMac->lim.gHTMaxRxAMpduFactor = 0;
460 pMac->lim.gHTServiceIntervalGranularity = 0;
461 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
463 pMac->lim.gHTPCOActive = 0;
464
465 pMac->lim.gHTPCOPhase = 0;
466 pMac->lim.gHTSecondaryBeacon = 0;
467 pMac->lim.gHTDualCTSProtection = 0;
468 pMac->lim.gHTSTBCBasicMCS = 0;
469 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
470}
471
472#if defined( FEATURE_WLAN_INTEGRATED_SOC )
473static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
474{
Jeff Johnsone7245742012-09-05 17:12:55 -0700475 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 tANI_U16 val16;
477 tANI_U8 val8;
478 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
479 tSirMacHTInfoField1 *pHTInfoField1;
480 tpSirPowerSaveCfg pPowerSaveConfig;
481 tSirMacHTParametersInfo *pAmpduParamInfo;
482
483 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700484 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
485 * and they will be used throughout when there is no session
486 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700487
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
489 {
490 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
491 return eSIR_FAILURE;
492 }
493
494 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
495 {
496 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
497 return eSIR_FAILURE;
498 }
499 val16 = ( tANI_U16 ) val1;
500 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
501
502 //channel bonding mode could be set to anything from 0 to 4(Titan had these
503 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
504 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
505 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
506 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
507 != eSIR_SUCCESS)
508 {
509 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
510 return eSIR_FAILURE;
511 }
512
513 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
514 {
515 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
516 return eSIR_FAILURE;
517 }
518
519 val8 = ( tANI_U8 ) val1;
520 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
521 pHTInfoField1->recommendedTxWidthSet =
522 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
524 != eSIR_SUCCESS)
525 {
526 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
527 return eSIR_FAILURE;
528 }
529
530 /* WNI_CFG_HEART_BEAT_THRESHOLD */
531
532 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
533 eSIR_SUCCESS )
534 {
535 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
536 return eSIR_FAILURE;
537 }
538 if(!val1)
539 {
540 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
541 pMac->sys.gSysEnableLinkMonitorMode = 0;
542 }
543 else
544 {
545 //No need to activate the timer during init time.
546 pMac->sys.gSysEnableLinkMonitorMode = 1;
547 }
548
549 /* WNI_CFG_SHORT_GI_20MHZ */
550
551 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
552 {
553 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
554 return eSIR_FAILURE;
555 }
556 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
557 {
558 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
559 return eSIR_FAILURE;
560 }
561 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
562 {
563 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
564 return eSIR_FAILURE;
565 }
566
567 val16 = ( tANI_U16 ) val1;
568 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
569 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
570 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
571
572 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
573 eSIR_SUCCESS)
574 {
575 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
576 return eSIR_FAILURE;
577 }
578
579 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
580
581 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
582 {
583 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
584 return eSIR_FAILURE;
585 }
586 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
587 {
588 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
589 return eSIR_FAILURE;
590 }
591 val16 = ( tANI_U16 ) val1;
592 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
593 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
594 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
595 eSIR_SUCCESS)
596 {
597 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
598 return eSIR_FAILURE;
599 }
600
601 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
602 limHandleCFGparamUpdate do we want to update this? */
603 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
604 {
605 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
606 return eSIR_FAILURE;
607 }
608
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 /* WNI_CFG_MAX_PS_POLL */
610
611 /* Allocate and fill in power save configuration. */
612 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
613 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
614 {
615 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
616 "configuration\n"));)
617 return eSIR_FAILURE;
618 }
619
620 /* This context should be valid if power-save configuration message has been
621 * already dispatched during initialization process. Re-using the present
622 * configuration mask
623 */
624 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
625 sizeof(tSirPowerSaveCfg));
626
627 /* Note: it is okay to do this since DAL/HAL is alrady started */
628 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
629 {
630 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
631 return eSIR_FAILURE;
632 }
633
634 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
635
636#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
637 PELOG1(limLog(pMac, LOG1,
638 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
639 pMac->lim.gLimBackgroundScanChannelId = 0;
640#endif
641
642 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
643
644 /* This was initially done after resume notification from HAL. Now, DAL is
645 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700646 handleHTCapabilityandHTInfo(pMac, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700647
648 return eSIR_SUCCESS;
649}
650#endif /* FEATURE_WLAN_INTEGRATED_SOC */
651
652/*
653 limStart
654 This function is to replace the __limProcessSmeStartReq since there is no
655 eWNI_SME_START_REQ post to PE.
656*/
657tSirRetStatus limStart(tpAniSirGlobal pMac)
658{
659 tSirResultCodes retCode = eSIR_SUCCESS;
660
661 PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
662
663 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
664 {
665 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
666
Jeff Johnsone7245742012-09-05 17:12:55 -0700667 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700668
669 // By default do not return after first scan match
670 pMac->lim.gLimReturnAfterFirstMatch = 0;
671
672 // Initialize MLM state machine
673 limInitMlm(pMac);
674
675 // By default return unique scan results
676 pMac->lim.gLimReturnUniqueResults = true;
677 pMac->lim.gLimSmeScanResultLength = 0;
678 }
679 else
680 {
681 /**
682 * Should not have received eWNI_SME_START_REQ in states
683 * other than OFFLINE. Return response to host and
684 * log error
685 */
686 limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
687 retCode = eSIR_FAILURE;
688 }
689
690 return retCode;
691}
692
693/**
694 * limInitialize()
695 *
696 *FUNCTION:
697 * This function is called from LIM thread entry function.
698 * LIM related global data structures are initialized in this function.
699 *
700 *LOGIC:
701 * NA
702 *
703 *ASSUMPTIONS:
704 * NA
705 *
706 *NOTE:
707 * NA
708 *
709 * @param pMac - Pointer to global MAC structure
710 * @return None
711 */
712
713tSirRetStatus
714limInitialize(tpAniSirGlobal pMac)
715{
716 tSirRetStatus status = eSIR_SUCCESS;
717
718 __limInitAssocVars(pMac);
719 __limInitVars(pMac);
720 __limInitStates(pMac);
721 __limInitStatsVars(pMac);
722 __limInitBssVars(pMac);
723 __limInitScanVars(pMac);
724 __limInitHTVars(pMac);
725 __limInitTitanVars(pMac);
726
727#if defined( FEATURE_WLAN_INTEGRATED_SOC )
728 status = limStart(pMac);
729 if(eSIR_SUCCESS != status)
730 {
731 return status;
732 }
733#endif /* FEATURE_WLAN_INTEGRATED_SOC */
734
735 /*
736 * MLM will be intitalized when 'START' request comes from SME.
737 * limInitMlm calls limCreateTimers, which actually relies on
738 * CFG to be downloaded. So it should not be called as part of
739 * peStart, as CFG download is happening after peStart.
740 */
741 //limInitMlm(pMac);
742 // Initializations for maintaining peers in IBSS
743 limIbssInit(pMac);
744
745 pmmInitialize(pMac);
746
747
748#if defined WLAN_FEATURE_VOWIFI
749 rrmInitialize(pMac);
750#endif
751#if defined WLAN_FEATURE_VOWIFI_11R
752 limFTOpen(pMac);
753#endif
754
755#ifdef WLAN_FEATURE_P2P
756 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
757#endif
758
759#if 0
760
761 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
762 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
763 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
764
765 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
766 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
767
768 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
769 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
770 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
771
772 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
773
774 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
775
776 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
777 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
778
779 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
780
781
782 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
783
784 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
785#endif
786 MTRACE(limTraceInit(pMac));
787
788#if defined( FEATURE_WLAN_INTEGRATED_SOC )
789 //Initialize the configurations needed by PE
790 if( eSIR_FAILURE == __limInitConfig(pMac))
791 {
792 //We need to undo everything in limStart
793 limCleanupMlm(pMac);
794 return eSIR_FAILURE;
795 }
796
797 //initialize the TSPEC admission control table.
798 //Note that this was initially done after resume notification from HAL.
799 //Now, DAL is started before PE so this can be done here
800 limAdmitControlInit(pMac);
801 limRegisterHalIndCallBack(pMac);
802#endif /*FEATURE_WLAN_INTEGRATED_SOC*/
803
804 return status;
805
806} /*** end limInitialize() ***/
807
808
809
810/**
811 * limCleanup()
812 *
813 *FUNCTION:
814 * This function is called upon reset or persona change
815 * to cleanup LIM state
816 *
817 *LOGIC:
818 * NA
819 *
820 *ASSUMPTIONS:
821 * NA
822 *
823 *NOTE:
824 * NA
825 *
826 * @param pMac - Pointer to Global MAC structure
827 * @return None
828 */
829
830void
831limCleanup(tpAniSirGlobal pMac)
832{
833#ifdef VOSS_ENABLED
834 v_PVOID_t pvosGCTx;
835 VOS_STATUS retStatus;
836#endif
837
838#ifdef WLAN_FEATURE_P2P
839//Before destroying the list making sure all the nodes have been deleted.
840//Which should be the normal case, but a memory leak has been reported.
841
842 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
843
844 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
845 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
846 {
847 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
848 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
849
850 palFreeMemory(pMac, pLimMgmtRegistration);
851 }
852
853 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
854#endif
855
856 limCleanupMlm(pMac);
857 limCleanupLmm(pMac);
858
859 // free up preAuth table
860 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
861 {
862 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
863 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
864 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
865 }
866
867 if(NULL != pMac->lim.pDialogueTokenHead)
868 {
869 limDeleteDialogueTokenList(pMac);
870 }
871
872 if(NULL != pMac->lim.pDialogueTokenTail)
873 {
874 palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
875 pMac->lim.pDialogueTokenTail = NULL;
876 }
877
878 # if 0
879 if (pMac->lim.gpLimStartBssReq != NULL)
880 {
881 palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
882 pMac->lim.gpLimStartBssReq = NULL;
883 }
884 #endif
885
886 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
887 {
888 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
889 pMac->lim.gpLimMlmSetKeysReq = NULL;
890 }
891
892 #if 0
893 if (pMac->lim.gpLimJoinReq != NULL)
894 {
895 palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
896 pMac->lim.gpLimJoinReq = NULL;
897 }
898 #endif
899
900 if (pMac->lim.gpLimMlmAuthReq != NULL)
901 {
902 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
903 pMac->lim.gpLimMlmAuthReq = NULL;
904 }
905
Jeff Johnsone7245742012-09-05 17:12:55 -0700906#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 if (pMac->lim.gpLimMlmJoinReq != NULL)
908 {
909 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
910 pMac->lim.gpLimMlmJoinReq = NULL;
911 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700912#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700913
914 #if 0
915 if (pMac->lim.gpLimReassocReq != NULL)
916 {
917 palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
918 pMac->lim.gpLimReassocReq = NULL;
919 }
920 #endif
921
922 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
923 {
924 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
925 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
926 }
927
Viral Modid86bde22012-12-10 13:09:21 -0800928#ifdef WLAN_FEATURE_P2P
929 if (pMac->lim.gpLimSmeScanReq != NULL)
930 {
931 palFreeMemory(pMac->hHdd, pMac->lim.gpLimSmeScanReq);
932 pMac->lim.gpLimSmeScanReq = NULL;
933 }
934#endif
935
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 if (pMac->lim.gpLimMlmScanReq != NULL)
937 {
938 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
939 pMac->lim.gpLimMlmScanReq = NULL;
940 }
941
942#if 0
943 if(NULL != pMac->lim.beacon)
944 {
945 palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
946 pMac->lim.beacon = NULL;
947 }
948#endif
949 #if 0
950 if(NULL != pMac->lim.assocReq)
951 {
952 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
953 pMac->lim.assocReq= NULL;
954 }
955 #endif
956
957#if 0
958 if(NULL != pMac->lim.assocRsp)
959 {
960 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
961 pMac->lim.assocRsp= NULL;
962 }
963#endif
964 // Now, finally reset the deferred message queue pointers
965 limResetDeferredMsgQ(pMac);
966
967#ifdef VOSS_ENABLED
968
969 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
970 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
971
972 if ( retStatus != VOS_STATUS_SUCCESS )
973 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
974#endif
975
976#if defined WLAN_FEATURE_VOWIFI
977 rrmCleanup(pMac);
978#endif
979#if defined WLAN_FEATURE_VOWIFI_11R
980 limFTCleanup(pMac);
981#endif
982
983} /*** end limCleanup() ***/
984
985
986/** -------------------------------------------------------------
987\fn peOpen
988\brief will be called in Open sequence from macOpen
989\param tpAniSirGlobal pMac
990\param tHalOpenParameters *pHalOpenParam
991\return tSirRetStatus
992 -------------------------------------------------------------*/
993
994tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
995{
996 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
997 pMac->lim.maxStation = pMacOpenParam->maxStation;
998
999 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
1000 {
1001 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
1002 return eSIR_FAILURE;
1003 }
1004
1005 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1006 (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
1007 {
1008 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1009 return eSIR_FAILURE;
1010 }
1011
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001012#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1014 (void **) &pMac->lim.gpLimAIDpool,
1015 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
1016 {
1017 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1018 return eSIR_FAILURE;
1019 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001020#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1022 (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
1023 {
1024 limLog(pMac, LOGE, FL("memory allocate failed!\n"));
1025 return eSIR_FAILURE;
1026 }
1027
1028 palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
1029
1030
1031 /*
1032 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1033 (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
1034 {
1035 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1036 return eSIR_FAILURE;
1037 }
1038
1039 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1040 (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
1041 {
1042 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1043 return eSIR_FAILURE;
1044 }
1045 */
1046
1047#ifdef WLAN_SOFTAP_FEATURE
1048 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1049 (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
1050 {
1051 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
1052 return eSIR_FAILURE;
1053 }
1054 palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
1055#endif
1056
1057#ifdef ANI_PRODUCT_TYPE_AP
1058
1059 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1060 (void **) &pMac->pmm.gPmmTim.pStaInfo, sizeof(*pMac->pmm.gPmmTim.pStaInfo) * pMac->lim.maxStation))
1061 {
1062 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pStaInfo!\n"));)
1063 return eSIR_FAILURE;
1064 }
1065
1066 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1067 (void **) &pMac->pmm.gpPmmStaState, sizeof(tPmmStaState)*pMac->lim.maxStation))
1068 {
1069 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1070 return eSIR_FAILURE;
1071 }
1072
1073 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1074 (void **) &pMac->pmm.gpPmmPSState, sizeof(tANI_U8)*pMac->lim.maxStation))
1075 {
1076 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1077 return eSIR_FAILURE;
1078 }
1079#endif
1080
Jeff Johnsone7245742012-09-05 17:12:55 -07001081#ifdef WLAN_FEATURE_P2P
1082 pMac->lim.actionFrameSessionId = 0xff;
1083#endif
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001084 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->lim.lkPeGlobalLock ) ) )
1085 {
1086 PELOGE(limLog(pMac, LOGE, FL("pe lock init failed!\n"));)
1087 return eSIR_FAILURE;
1088 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 return eSIR_SUCCESS;
1090}
1091
1092/** -------------------------------------------------------------
1093\fn peClose
1094\brief will be called in close sequence from macClose
1095\param tpAniSirGlobal pMac
1096\return tSirRetStatus
1097 -------------------------------------------------------------*/
1098
1099tSirRetStatus peClose(tpAniSirGlobal pMac)
1100{
1101 tANI_U8 i;
1102
1103 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1104 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001105
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 for(i =0; i < pMac->lim.maxBssId; i++)
1107 {
1108 if(pMac->lim.gpSession[i].valid == TRUE)
1109 {
1110 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1111 }
1112 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001113 palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
1114 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001115#if 0
Jeff Johnsone7245742012-09-05 17:12:55 -07001116 palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
1117 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001118#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001119
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
1121 pMac->lim.gpSession = NULL;
1122 /*
1123 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
1124 pMac->dph.dphHashTable.pHashTable = NULL;
1125 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
1126 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1127 */
1128#ifdef WLAN_SOFTAP_FEATURE
1129 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
1130 pMac->pmm.gPmmTim.pTim = NULL;
1131#endif
1132#ifdef ANI_PRODUCT_TYPE_AP
1133 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pStaInfo);
1134 pMac->pmm.gPmmTim.pStaInfo = NULL;
1135 palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmStaState);
1136 pMac->pmm.gpPmmStaState = NULL;
1137 palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmPSState);
1138 pMac->pmm.gpPmmPSState = NULL;
1139#endif
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001140 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->lim.lkPeGlobalLock ) ) )
1141 {
1142 return eSIR_FAILURE;
1143 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 return eSIR_SUCCESS;
1145}
1146
1147/** -------------------------------------------------------------
1148\fn peStart
1149\brief will be called in start sequence from macStart
1150\param tpAniSirGlobal pMac
1151\return none
1152 -------------------------------------------------------------*/
1153
1154tSirRetStatus peStart(tpAniSirGlobal pMac)
1155{
1156 tSirRetStatus status = eSIR_SUCCESS;
1157
1158 status = limInitialize(pMac);
1159#if defined(ANI_LOGDUMP)
1160 limDumpInit(pMac);
1161#endif //#if defined(ANI_LOGDUMP)
1162
1163 return status;
1164}
1165
1166/** -------------------------------------------------------------
1167\fn peStop
1168\brief will be called in stop sequence from macStop
1169\param tpAniSirGlobal pMac
1170\return none
1171 -------------------------------------------------------------*/
1172
1173void peStop(tpAniSirGlobal pMac)
1174{
1175 limCleanup(pMac);
1176 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1177 return;
1178}
1179
1180/** -------------------------------------------------------------
1181\fn peFreeMsg
1182\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1183\ to free a given PE message on the TX and MC thread.
1184\ This happens when there are messages pending in the PE
1185\ queue when system is being stopped and reset.
1186\param tpAniSirGlobal pMac
1187\param tSirMsgQ pMsg
1188\return none
1189-----------------------------------------------------------------*/
1190v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1191{
1192 if (pMsg != NULL)
1193 {
1194 if (NULL != pMsg->bodyptr)
1195 {
1196 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1197 {
1198 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1199 }
1200 else
1201 {
1202 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1203 }
1204 }
1205 pMsg->bodyptr = 0;
1206 pMsg->bodyval = 0;
1207 pMsg->type = 0;
1208 }
1209 return;
1210}
1211
1212
1213/**
1214 * The function checks if a particular timer should be allowed
1215 * into LIM while device is sleeping
1216 */
1217tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1218{
1219 tANI_U8 retStatus = TRUE;
1220
1221 if(!limIsSystemInActiveState(pMac))
1222 {
1223 switch(pMsg->type)
1224 {
1225 /* Don't allow following timer messages if in sleep */
1226 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1227 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1228 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1229 retStatus = FALSE;
1230 break;
1231 /* May allow following timer messages in sleep mode */
1232 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1233
1234 /* Safe to allow as of today, this triggers background scan
1235 * which will not be started if the device is in power-save mode
1236 * might need to block in the future if we decide to implement
1237 * spectrum management
1238 */
1239 case SIR_LIM_QUIET_TIMEOUT:
1240
1241 /* Safe to allow as of today, this triggers background scan
1242 * which will not be started if the device is in power-save mode
1243 * might need to block in the future if we decide to implement
1244 * spectrum management
1245 */
1246 case SIR_LIM_QUIET_BSS_TIMEOUT:
1247
1248 /* Safe to allow this timermessage, triggers background scan
1249 * which is blocked in sleep mode
1250 */
1251 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1252
1253 /* Safe to allow this timer, since, while in IMPS this timer will not
1254 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1255 * when heart-beat control is handled back to PE, device would have
1256 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1257 */
1258 case SIR_LIM_HEART_BEAT_TIMEOUT:
1259 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1260
1261 /* Safe to allow, PE is not handling this message as of now. May need
1262 * to block it, basically, free the buffer and restart the timer
1263 */
1264 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1265 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001266 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001267 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1268 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1269 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1270 retStatus = TRUE;
1271 break;
1272
1273 /* by default allow rest of messages */
1274 default:
1275 retStatus = TRUE;
1276 break;
1277
1278
1279 }
1280 }
1281
1282 return retStatus;
1283
1284}
1285
1286
1287
1288/**
1289 * limPostMsgApi()
1290 *
1291 *FUNCTION:
1292 * This function is called from other thread while posting a
1293 * message to LIM message Queue gSirLimMsgQ.
1294 *
1295 *LOGIC:
1296 * NA
1297 *
1298 *ASSUMPTIONS:
1299 * NA
1300 *
1301 *NOTE:
1302 * NA
1303 *
1304 * @param pMac - Pointer to Global MAC structure
1305 * @param pMsg - Pointer to the message structure
1306 * @return None
1307 */
1308
1309tANI_U32
1310limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1311{
1312#ifdef VOSS_ENABLED
1313 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1314
1315
1316#elif defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
1317 return tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_WAIT_FOREVER);
1318
1319#else
1320 /* Check if this is a timeout message from a timer
1321 * and if the timeout message is allowed if the device is in power-save state
1322 */
1323 if(!limIsTimerAllowedInPowerSaveState(pMac, pMsg))
1324 {
1325 limLog(pMac, LOGW,
1326 FL("Timeout message %d is not allowed while device is in Power-Save mode\n"),
1327 pMsg->type);
1328
1329 return TX_SUCCESS;
1330 }
1331 if(pMac->gDriverType != eDRIVER_TYPE_MFG)
1332 {
1333 limMessageProcessor(pMac, pMsg);
1334 }
1335
1336 return TX_SUCCESS;
1337
1338#endif
1339} /*** end limPostMsgApi() ***/
1340
1341
1342/*--------------------------------------------------------------------------
1343
1344 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1345
1346 This function can be called by legacy code to post message to voss queues OR
1347 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1348 for dispatching it later.
1349
1350 \param pMac - Pointer to Global MAC structure
1351 \param pMsg - Pointer to the message structure
1352
1353 \return tANI_U32 - TX_SUCCESS for success.
1354
1355 --------------------------------------------------------------------------*/
1356
1357tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1358{
1359 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1360}
1361
1362/*--------------------------------------------------------------------------
1363
1364 \brief peProcessMessages() - Message Processor for PE
1365
1366 Voss calls this function to dispatch the message to PE
1367
1368 \param pMac - Pointer to Global MAC structure
1369 \param pMsg - Pointer to the message structure
1370
1371 \return tANI_U32 - TX_SUCCESS for success.
1372
1373 --------------------------------------------------------------------------*/
1374
1375tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1376{
1377 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1378 {
1379 return eSIR_SUCCESS;
1380 }
1381 /**
1382 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1383 * for all the other cases post it to LIM
1384 */
1385 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1386 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1387 else
1388 limMessageProcessor(pMac, pMsg);
1389 return eSIR_SUCCESS;
1390}
1391
1392
1393#ifdef VOSS_ENABLED
1394
1395// ---------------------------------------------------------------------------
1396/**
1397 * peHandleMgmtFrame
1398 *
1399 * FUNCTION:
1400 * Process the Management frames from TL
1401 *
1402 * LOGIC:
1403 *
1404 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1405 *
1406 * NOTE:
1407 *
1408 * @param pvosGCtx Global Vos Context
1409 * @param vossBuff Packet
1410 * @return None
1411 */
1412
1413VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1414{
1415 tpAniSirGlobal pMac;
1416 tpSirMacMgmtHdr mHdr;
1417 tSirMsgQ msg;
1418 vos_pkt_t *pVosPkt;
1419 VOS_STATUS vosStatus;
1420 v_U8_t *pRxPacketInfo;
1421
1422 pVosPkt = (vos_pkt_t *)vosBuff;
1423 if (NULL == pVosPkt)
1424 {
1425 return VOS_STATUS_E_FAILURE;
1426 }
1427
1428 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1429 if (NULL == pMac)
1430 {
1431 // cannot log a failure without a valid pMac
1432 vos_pkt_return_packet(pVosPkt);
1433 return VOS_STATUS_E_FAILURE;
1434 }
1435
1436 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1437
1438 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1439 {
1440 vos_pkt_return_packet(pVosPkt);
1441 return VOS_STATUS_E_FAILURE;
1442 }
1443
1444
1445 //
1446 // The MPDU header is now present at a certain "offset" in
1447 // the BD and is specified in the BD itself
1448 //
1449 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1450 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1451 {
1452 PELOG1(limLog( pMac, LOG1,
1453 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001454 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001455
Jeff Johnsone7245742012-09-05 17:12:55 -07001456 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1458 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1459 }
1460
1461
1462 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1463 msg.type = SIR_BB_XPORT_MGMT_MSG;
1464 msg.bodyptr = vosBuff;
1465 msg.bodyval = 0;
1466
1467 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1468 &msg,
1469 mHdr->fc.type,
1470 mHdr->fc.subType ))
1471 {
1472 vos_pkt_return_packet(pVosPkt);
1473 limLog( pMac, LOGW,
1474 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
1475 return VOS_STATUS_E_FAILURE;
1476 }
1477
1478 return VOS_STATUS_SUCCESS;
1479}
1480
1481// ---------------------------------------------------------------------------
1482/**
1483 * peRegisterTLHandle
1484 *
1485 * FUNCTION:
1486 * Registers the Handler which, process the Management frames from TL
1487 *
1488 * LOGIC:
1489 *
1490 * ASSUMPTIONS:
1491 *
1492 * NOTE:
1493 *
1494 * @return None
1495 */
1496
1497void peRegisterTLHandle(tpAniSirGlobal pMac)
1498{
1499 v_PVOID_t pvosGCTx;
1500 VOS_STATUS retStatus;
1501
1502 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1503
1504 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1505
1506 if (retStatus != VOS_STATUS_SUCCESS)
1507 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
1508
1509}
1510#endif
1511
1512
1513/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 * limIsSystemInScanState()
1515 *
1516 *FUNCTION:
1517 * This function is called by various MAC software modules to
1518 * determine if System is in Scan/Learn state
1519 *
1520 *LOGIC:
1521 * NA
1522 *
1523 *ASSUMPTIONS:
1524 * NA
1525 *
1526 *NOTE:
1527 *
1528 * @param pMac - Pointer to Global MAC structure
1529 * @return true - System is in Scan/Learn state
1530 * false - System is NOT in Scan/Learn state
1531 */
1532
1533tANI_U8
1534limIsSystemInScanState(tpAniSirGlobal pMac)
1535{
1536 switch (pMac->lim.gLimSmeState)
1537 {
1538 case eLIM_SME_CHANNEL_SCAN_STATE:
1539 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1540 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1541 case eLIM_SME_WT_SCAN_STATE:
1542 // System is in Learn mode
1543 return true;
1544
1545 default:
1546 // System is NOT in Learn mode
1547 return false;
1548 }
1549} /*** end limIsSystemInScanState() ***/
1550
1551
1552
1553/**
1554 * limIsSystemInActiveState()
1555 *
1556 *FUNCTION:
1557 * This function is called by various MAC software modules to
1558 * determine if System is in Active/Wakeup state
1559 *
1560 *LOGIC:
1561 * NA
1562 *
1563 *ASSUMPTIONS:
1564 * NA
1565 *
1566 *NOTE:
1567 *
1568 * @param pMac - Pointer to Global MAC structure
1569 * @return true - System is in Active state
1570 * false - System is not in Active state
1571 */
1572
1573tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1574{
1575 switch (pMac->pmm.gPmmState)
1576 {
1577 case ePMM_STATE_BMPS_WAKEUP:
1578 case ePMM_STATE_IMPS_WAKEUP:
1579 case ePMM_STATE_READY:
1580 // System is in Active mode
1581 return true;
1582 default:
1583 return false;
1584 // System is NOT in Active mode
1585 }
1586}
1587
1588
1589#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1590/**
1591 * limCheckAndQuietBSS()
1592 *
1593 *FUNCTION:
1594 * This function is called by limSetLearnMode() to check
1595 * if BSS needs to be quieted and call limQuietBSS() to
1596 * send data frame to self for that purpose.
1597 *
1598 *LOGIC:
1599 * NA
1600 *
1601 *ASSUMPTIONS:
1602 * NA
1603 *
1604 *NOTE:
1605 *
1606 * @param pMac - Pointer to Global MAC structure
1607 * @return None
1608 */
1609
1610void
1611limCheckAndQuietBSS(tpAniSirGlobal pMac)
1612{
1613 tANI_U32 dur;
1614
1615 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1616 {
1617 // LIM is in AP role. Quiet the BSS before
1618 // switching to channel to be learned
1619 if (pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration >
1620 LIM_MAX_QUIET_DURATION)
1621 {
1622 // May need to quiet BSS multiple times.
1623 // Quiet for a limit of 32 msecs on Learn
1624 // duration for now.
1625 dur = LIM_MAX_QUIET_DURATION;
1626 }
1627 else
1628 {
1629 dur =
1630 pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
1631 }
1632 PELOG3(limLog(pMac, LOG3,
1633 FL("*** Going to quiet BSS for duration=%d msec\n"),
1634 dur);)
1635
1636 limQuietBss(pMac, dur);
1637 }
1638} /*** end limCheckAndQuietBSS() ***/
1639#endif
1640
1641#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
1642/**
1643 * limSetLearnMode()
1644 *
1645 *FUNCTION:
1646 * This function is called to setup system into Learn mode
1647 * to collect DFS measurements.
1648 *
1649 *LOGIC:
1650 * NA
1651 *
1652 *ASSUMPTIONS:
1653 * NA
1654 *
1655 *NOTE:
1656 *
1657 * @param pMac - Pointer to Global MAC structure
1658 * @return None
1659 */
1660
1661void
1662limSetLearnMode(tpAniSirGlobal pMac)
1663{
1664 limSendHalInitScanReq(pMac, eLIM_HAL_INIT_LEARN_WAIT_STATE, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN);
1665 return;
1666} /*** end limSetLearnMode() ***/
1667
1668/**
1669 * limContinueChannelLearn()
1670 *
1671 *FUNCTION:
1672 * This function is called to do measurement (learn) on current channel.
1673 *
1674 *LOGIC:
1675 *
1676 *ASSUMPTIONS:
1677 * NA
1678 *
1679 *NOTE:
1680 * NA
1681 *
1682 * @param pMac - Pointer to Global MAC structure
1683 *
1684 * @return None
1685 */
1686
1687void
1688limContinueChannelLearn(tpAniSirGlobal pMac)
1689{
1690 tANI_U8 chanNum;
1691 tSirMacSSid ssId;
1692 tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
1693
1694 // Time to collect measurements
1695 chanNum = limGetCurrentLearnChannel(pMac);
1696
1697 // Switch channel
1698 pMac->lim.gLimSystemInScanLearnMode = 1;
1699
1700 if (pMac->lim.gpLimMeasReq->measControl.scanType == eSIR_ACTIVE_SCAN)
1701 {
1702 /// Prepare and send Probe Request frame
1703 ssId.length = 0;
1704 /* for learning channel, we don't include any additional IE */
1705 limSendProbeReqMgmtFrame(pMac, &ssId, bssId, chanNum,pMac->lim.gSelfMacAddr, 0 , NULL);
1706 }
1707
1708 // Activate Learn duration timer during which
1709 // DFS measurements are made.
1710 pMac->lim.gLimMeasParams.shortDurationCount++;
1711 limDeactivateAndChangeTimer(pMac, eLIM_LEARN_DURATION_TIMER);
1712
Jeff Johnsone7245742012-09-05 17:12:55 -07001713 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 if (tx_timer_activate(&pMac->lim.gLimMeasParams.learnDurationTimer)
1715 != TX_SUCCESS)
1716 {
1717 /// Could not activate learn duration timer.
1718 // Log error
1719 limLog(pMac, LOGP, FL("could not activate learn duration timer\n"));
1720
1721 return;
1722 }
1723} /*** end limContinueChannelLearn() ***/
1724
1725
1726/**
1727 * limReEnableLearnMode()
1728 *
1729 *FUNCTION:
1730 * This function is called by various MAC software modules to
1731 * re-enable Learn mode measurements.
1732 *
1733 *LOGIC:
1734 * NA
1735 *
1736 *ASSUMPTIONS:
1737 * NA
1738 *
1739 *NOTE:
1740 *
1741 * @param pMac - Pointer to Global MAC structure
1742 * @return None
1743 */
1744
1745void
1746limReEnableLearnMode(tpAniSirGlobal pMac)
1747{
1748 PELOG4(limLog(pMac, LOG4, FL("quietEnabled = %d\n"),
1749 pMac->lim.gLimSpecMgmt.fQuietEnabled);)
1750
1751 /** Stop measurement temperorily when radar is detected or channel
1752 * switch is running as part of periodic DFS */
1753 if (!pMac->lim.gpLimMeasReq || LIM_IS_RADAR_DETECTED(pMac) ||
1754 (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
1755 {
1756 return;
1757 }
1758
1759 if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
1760 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001761 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001762#ifdef GEN6_TODO
1763 /* revisit this piece of code to assign the appropriate sessionId below
1764 * priority - HIGH
1765 */
1766 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
1767#endif
1768 if (tx_timer_activate(
1769 &pMac->lim.limTimers.gLimQuietBssTimer)
1770 != TX_SUCCESS)
1771 {
1772 limLog(pMac, LOGP, FL("could not start Quiet Bss timer\n"));
1773 return;
1774 }
1775 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
1776 }
1777 else
1778 {
1779 limDeactivateAndChangeTimer(pMac, eLIM_LEARN_INTERVAL_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -07001780 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001781#ifdef GEN6_TODO
1782 /* revisit this piece of code to assign the appropriate sessionId below
1783 */
1784 pMac->lim.gLimMeasParams.learnIntervalTimer.sessionId = sessionId;
1785#endif
1786 if (tx_timer_activate(
1787 &pMac->lim.gLimMeasParams.learnIntervalTimer)
1788 != TX_SUCCESS)
1789 {
1790 /// Could not activate Learn Interval timer.
1791 // Log error
1792 limLog(pMac, LOGP, FL("could not start Learn Interval timer\n"));
1793 return;
1794 }
1795 }
1796
1797 PELOG3(limLog(pMac, LOG3, FL("Re-enabled Learn mode Measurements\n"));)
1798 pMac->lim.gLimMeasParams.disableMeasurements = 0;
1799
1800 return;
1801} /*** end limReEnableLearnMode() ***/
1802
1803#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
1804
1805
1806/**
1807*\brief limReceivedHBHandler()
1808*
1809* This function is called by schBeaconProcess() upon
1810* receiving a Beacon on STA. This also gets called upon
1811* receiving Probe Response after heat beat failure is
1812* detected.
1813*
1814* param pMac - global mac structure
1815* param channel - channel number indicated in Beacon, Probe Response
1816* return - none
1817*/
1818
1819
1820void
1821limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1822{
1823 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1824 psessionEntry->LimRxedBeaconCntDuringHB++;
1825
1826 pMac->pmm.inMissedBeaconScenario = FALSE;
1827} /*** end limReceivedHBHandler() ***/
1828
1829
1830
1831#if 0
1832void limResetHBPktCount(tpPESession psessionEntry)
1833{
1834 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1835}
1836#endif
1837
1838
1839/*
1840 * limProcessWdsInfo()
1841 *
1842 *FUNCTION:
1843 * This function is called from schBeaconProcess in BP
1844 *
1845 *PARAMS:
1846 * @param pMac - Pointer to Global MAC structure
1847 * @param propIEInfo - proprietary IE info
1848 *
1849 *LOGIC:
1850 *
1851 *ASSUMPTIONS:
1852 * NA
1853 *
1854 *NOTE:
1855 *
1856 *
1857 *RETURNS:
1858 *
1859 */
1860
1861void limProcessWdsInfo(tpAniSirGlobal pMac,
1862 tSirPropIEStruct propIEInfo)
1863{
1864#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1865 tpSirSmeWdsInfoInd pSirSmeWdsInfoInd;
1866 tANI_U8 *pTemp;
1867 tSirMsgQ mmhMsg;
1868
1869 if (propIEInfo.wdsLength &&
1870 propIEInfo.wdsLength <= ANI_WDS_INFO_MAX_LENGTH)
1871 {
1872 if (pMac->lim.gLimWdsInfo.wdsLength)
1873 {
1874 if ((propIEInfo.wdsLength ==
1875 pMac->lim.gLimWdsInfo.wdsLength) &&
1876 (palEqualMemory( pMac->hHdd,propIEInfo.wdsData,
1877 pMac->lim.gLimWdsInfo.wdsBytes,
1878 pMac->lim.gLimWdsInfo.wdsLength) ))
1879
1880 return; // no difference in WDS info
1881 else
1882 {
1883 PELOG2(limLog(pMac, LOG2,
1884 FL("Cached WDS Info: length %d bytes is: "),
1885 pMac->lim.gLimWdsInfo.wdsLength);
1886 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
1887 pMac->lim.gLimWdsInfo.wdsBytes,
1888 pMac->lim.gLimWdsInfo.wdsLength);)
1889
1890 PELOG2(limLog(pMac, LOG2, FL("New WDS Info: length %d bytes is: "),
1891 propIEInfo.wdsLength);
1892 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
1893 propIEInfo.wdsData,
1894 propIEInfo.wdsLength);)
1895
1896 pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
1897 palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
1898 propIEInfo.wdsData,
1899 propIEInfo.wdsLength);
1900
1901 // send IND to WSM
1902 if (eHAL_STATUS_SUCCESS !=
1903 palAllocateMemory(pMac->hHdd,
1904 (void **) &pSirSmeWdsInfoInd,
1905 sizeof(tSirSmeWdsInfoInd)))
1906 {
1907 // Log error
1908 limLog(pMac, LOGP,
1909 FL("memory allocate failed for WDS_INFO_IND\n"));
1910
1911 return;
1912 }
1913
1914 pSirSmeWdsInfoInd->messageType = eWNI_SME_WDS_INFO_IND;
1915 pSirSmeWdsInfoInd->length = sizeof(tSirSmeWdsInfoInd);
1916
1917 pSirSmeWdsInfoInd->wdsInfo.wdsLength =
1918 pMac->lim.gLimWdsInfo.wdsLength;
1919
1920 palCopyMemory( pMac->hHdd, pSirSmeWdsInfoInd->wdsInfo.wdsBytes,
1921 pMac->lim.gLimWdsInfo.wdsBytes,
1922 pMac->lim.gLimWdsInfo.wdsLength);
1923
1924 pTemp = (tANI_U8 *) pSirSmeWdsInfoInd;
1925
1926 PELOG2(limLog(pMac, LOG2,
1927 FL("eWNI_SME_WDS_INFO_IND length %d bytes is: "),
1928 pSirSmeWdsInfoInd->length);
1929 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pTemp,
1930 pSirSmeWdsInfoInd->length);)
1931
1932 mmhMsg.type = eWNI_SME_WDS_INFO_IND;
1933 mmhMsg.bodyptr = pSirSmeWdsInfoInd;
1934 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001935 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1937 pMac->lim.gLimNumWdsInfoInd++;
1938 }
1939 }
1940 else
1941 {
1942 // first WDS info
1943 pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
1944 palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
1945 propIEInfo.wdsData,
1946 propIEInfo.wdsLength);
1947
1948 PELOG1(limLog(pMac, LOG1, FL("First WDS Info: length %d bytes is:\n"),
1949 pMac->lim.gLimWdsInfo.wdsLength);
1950 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
1951 pMac->lim.gLimWdsInfo.wdsBytes,
1952 pMac->lim.gLimWdsInfo.wdsLength);)
1953
1954 }
1955 }
1956 else
1957 {
1958 PELOG2(limLog(pMac, LOG2,
1959 FL("Illegal WDS length = %d\n"),
1960 propIEInfo.wdsLength);)
1961 }
1962#endif
1963}
1964
1965
1966
1967/**
1968 * limInitWdsInfoParams()
1969 *
1970 *FUNCTION:
1971 * This function is called while processing
1972 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1973 * ind/set related parameters.
1974 *
1975 *LOGIC:
1976 *
1977 *ASSUMPTIONS:
1978 *
1979 *NOTE:
1980 *
1981 * @param pMac Pointer to Global MAC structure
1982 * @return None
1983 */
1984
1985void
1986limInitWdsInfoParams(tpAniSirGlobal pMac)
1987{
1988 pMac->lim.gLimWdsInfo.wdsLength = 0;
1989 pMac->lim.gLimNumWdsInfoInd = 0;
1990 pMac->lim.gLimNumWdsInfoSet = 0;
1991} /*** limInitWdsInfoParams() ***/
1992
1993
1994/** -------------------------------------------------------------
1995\fn limUpdateOverlapStaParam
1996\brief Updates overlap cache and param data structure
1997\param tpAniSirGlobal pMac
1998\param tSirMacAddr bssId
1999\param tpLimProtStaParams pStaParams
2000\return None
2001 -------------------------------------------------------------*/
2002void
2003limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
2004{
2005 int i;
2006 if (!pStaParams->numSta)
2007 {
2008 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
2009 bssId,
2010 sizeof(tSirMacAddr));
2011 pMac->lim.protStaOverlapCache[0].active = true;
2012
2013 pStaParams->numSta = 1;
2014
2015 return;
2016 }
2017
2018 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
2019 {
2020 if (pMac->lim.protStaOverlapCache[i].active)
2021 {
2022 if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
2023 bssId,
2024 sizeof(tSirMacAddr))) {
2025 return; }
2026 }
2027 else
2028 break;
2029 }
2030
2031 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
2032 {
2033 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
2034 }
2035 else
2036 {
2037 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
2038 bssId,
2039 sizeof(tSirMacAddr));
2040 pMac->lim.protStaOverlapCache[i].active = true;
2041
2042 pStaParams->numSta++;
2043 }
2044}
2045
2046
2047/**
2048 * limHandleIBSScoalescing()
2049 *
2050 *FUNCTION:
2051 * This function is called upon receiving Beacon/Probe Response
2052 * while operating in IBSS mode.
2053 *
2054 *LOGIC:
2055 *
2056 *ASSUMPTIONS:
2057 *
2058 *NOTE:
2059 *
2060 * @param pMac - Pointer to Global MAC structure
2061 * @param pBeacon - Parsed Beacon Frame structure
2062 * @param pRxPacketInfo - Pointer to RX packet info structure
2063 *
2064 * @return Status whether to process or ignore received Beacon Frame
2065 */
2066
2067tSirRetStatus
2068limHandleIBSScoalescing(
2069 tpAniSirGlobal pMac,
2070 tpSchBeaconStruct pBeacon,
2071 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2072{
2073 tpSirMacMgmtHdr pHdr;
2074 tSirRetStatus retCode;
2075
2076 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2077 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
2078 /* Received SSID does not match => Ignore received Beacon frame. */
2079 retCode = eSIR_LIM_IGNORE_BEACON;
2080 else
2081 {
2082 tANI_U32 ieLen;
2083 tANI_U16 tsfLater;
2084 tANI_U8 *pIEs;
2085 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2086 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
2087 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2088 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
2089 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
2090 }
2091 return retCode;
2092} /*** end limHandleIBSScoalescing() ***/
2093
2094
2095
2096/**
2097 * limDetectChangeInApCapabilities()
2098 *
2099 *FUNCTION:
2100 * This function is called while SCH is processing
2101 * received Beacon from AP on STA to detect any
2102 * change in AP's capabilities. If there any change
2103 * is detected, Roaming is informed of such change
2104 * so that it can trigger reassociation.
2105 *
2106 *LOGIC:
2107 *
2108 *ASSUMPTIONS:
2109 *
2110 *NOTE:
2111 * Notification is enabled for STA product only since
2112 * it is not a requirement on BP side.
2113 *
2114 * @param pMac Pointer to Global MAC structure
2115 * @param pBeacon Pointer to parsed Beacon structure
2116 * @return None
2117 */
2118
2119void
2120limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
2121 tpSirProbeRespBeacon pBeacon,
2122 tpPESession psessionEntry)
2123{
2124#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2125 tANI_U8 len;
2126 tSirSmeApNewCaps apNewCaps;
2127 tANI_U8 newChannel;
2128 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
2129 newChannel = (tANI_U8) pBeacon->channelNumber;
2130
2131 if ((psessionEntry->limSentCapsChangeNtf == false) &&
2132 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
2133 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
2134 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
2135 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
2136 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
2137 (newChannel != psessionEntry->currentOperChannel)
2138#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2139 || (LIM_BSS_CAPS_GET(HCF, psessionEntry->limCurrentBssQosCaps) !=
2140 pBeacon->propIEinfo.hcfEnabled)
2141#endif
2142 )))
2143 {
2144
2145 /**
2146 * BSS capabilities have changed.
2147 * Inform Roaming.
2148 */
2149 len = sizeof(tSirMacCapabilityInfo) +
2150 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
2151 3 * sizeof(tANI_U8) + // reserved fields
2152 pBeacon->ssId.length + 1;
2153
2154 palCopyMemory( pMac->hHdd, apNewCaps.bssId,
2155 psessionEntry->bssId,
2156 sizeof(tSirMacAddr));
2157 if (newChannel != psessionEntry->currentOperChannel)
2158 {
2159 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
2160 "Ignoring beacon!\n"),
2161 psessionEntry->currentOperChannel, newChannel);)
2162 return;
2163 }
Madan Mohan Koyyalamudi84479982013-01-24 17:58:05 +05302164
2165 /**
2166 * When Cisco 1262 Enterprise APs are configured with WPA2-PSK with
2167 * AES+TKIP Pairwise ciphers and WEP-40 Group cipher, they do not set
2168 * the privacy bit in Beacons (wpa/rsnie is still present in beacons),
2169 * the privacy bit is set in Probe and association responses.
2170 * Due to this anomaly, we detect a change in
2171 * AP capabilities when we receive a beacon after association and
2172 * disconnect from the AP. The following check makes sure that we can
2173 * connect to such APs
2174 */
2175 else if ((SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) == 0) &&
2176 (pBeacon->rsnPresent || pBeacon->wpaPresent))
2177 {
2178 PELOGE(limLog(pMac, LOGE, FL("BSS Caps (Privacy) bit 0 in beacon,"
2179 " but WPA or RSN IE present, Ignore Beacon!\n"));)
2180 return;
2181 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 else
2183 apNewCaps.channelId = psessionEntry->currentOperChannel;
2184 palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
2185 (tANI_U8 *) &pBeacon->ssId,
2186 pBeacon->ssId.length + 1);
2187
2188 psessionEntry->limSentCapsChangeNtf = true;
2189 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
2190 (tANI_U32 *) &apNewCaps,
2191 len, psessionEntry->smeSessionId);
2192 }
2193#endif
2194} /*** limDetectChangeInApCapabilities() ***/
2195
2196
2197
2198
2199// ---------------------------------------------------------------------
2200/**
2201 * limUpdateShortSlot
2202 *
2203 * FUNCTION:
2204 * Enable/Disable short slot
2205 *
2206 * LOGIC:
2207 *
2208 * ASSUMPTIONS:
2209 *
2210 * NOTE:
2211 *
2212 * @param enable Flag to enable/disable short slot
2213 * @return None
2214 */
2215
2216tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
2217{
2218
2219 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07002220 tANI_U32 nShortSlot;
2221 tANI_U32 val = 0;
2222 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223
Jeff Johnsone7245742012-09-05 17:12:55 -07002224 // Check Admin mode first. If it is disabled just return
2225 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
2226 != eSIR_SUCCESS)
2227 {
2228 limLog(pMac, LOGP,
2229 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
2230 return eSIR_FAILURE;
2231 }
2232 if (val == false)
2233 return eSIR_SUCCESS;
2234
2235 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
2236 limGetPhyMode(pMac, &phyMode, psessionEntry);
2237 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
2238 return eSIR_SUCCESS;
2239
2240 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002241
2242 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
2243 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
2244 // if no erp present, use short slot based on current ap caps
2245
2246 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
2247
2248 //Resolution : always use the shortSlot setting the capability info to decide slot time.
2249 // The difference between the earlier implementation and the new one is only Case4.
2250 /*
2251 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
2252 Case1 1 1 1 1 //AP should not advertise this combination.
2253 Case2 1 1 0 0
2254 Case3 1 0 1 1
2255 Case4 1 0 0 0
2256 Case5 0 1 1 1
2257 Case6 0 1 0 0
2258 Case7 0 0 1 1
2259 Case8 0 0 0 0
2260 */
2261 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
2262
Jeff Johnsone7245742012-09-05 17:12:55 -07002263 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 {
2265 // Short slot time capability of AP has changed. Adopt to it.
2266 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
2267 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07002268 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
2270 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 }
2272 return eSIR_SUCCESS;
2273}
2274
2275
2276#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
2277
2278/**
2279 * limUpdateQuietIEInBeacons()
2280 *
2281 *FUNCTION:
2282 * This function is called by specialBeaconProcessing(),
2283 * when it is time to generate the next beacon.
2284 * If gLimQuietState is not in the INIT state, then it
2285 * means that the next beacon may need to include some
2286 * information about the Quiet BSS IE.
2287 * This function makes that decision based on the current
2288 * state of gLimQuietState
2289 *
2290 *LOGIC:
2291 * This routine invokes schSetFixedBeaconFields() only
2292 * if necessary, as it is expensive to update the fixed
2293 * beacon fields during each beacon interval.
2294 *
2295 *ASSUMPTIONS:
2296 * This Quiet BSS IE will be sent out as part of
2297 * Proprietary IE's. If 802.11H is enabled, this IE
2298 * will be sent out as defined in the 11H spec
2299 *
2300 *NOTE:
2301 *
2302 * @param pMac Pointer to Global MAC structure
2303 * @return true, if the beacon fields need updating
2304 * false, if not
2305 */
2306tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac )
2307{
2308 tANI_BOOLEAN fUpdateBeaconFields = eANI_BOOLEAN_TRUE;
2309
2310 limLog( pMac, LOG2, FL("Quiet BSS State = %d\n"),
2311 pMac->lim.gLimSpecMgmt.quietState );
2312 switch( pMac->lim.gLimSpecMgmt.quietState )
2313 {
2314 case eLIM_QUIET_BEGIN:
2315 // We need to start broadcasting the Quiet BSS IE
2316 // Transition to eLIM_QUIET_RUNNING
2317 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
2318 break;
2319
2320 case eLIM_QUIET_RUNNING:
2321 // Start down-counting...
2322 pMac->lim.gLimSpecMgmt.quietCount--;
2323 if( pMac->lim.gLimSpecMgmt.quietCount == 0 )
2324 {
2325 //
2326 // We no longer need to broadcast the Quiet BSS IE
2327 //
2328 // NOTE - We still need to call schSetFixedBeaconFields()
2329 // one last time, just to remove the Quiet BSS IE from
2330 // the list of fixed beacon fields
2331 //
2332 // Transition to eLIM_QUIET_END
2333 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
2334 limProcessLearnIntervalTimeout(pMac);
2335 }
2336 break;
2337
2338 case eLIM_QUIET_CHANGED:
2339 //
2340 // State possibly changed via setupQuietBss().
2341 // This means, gLimQuietCount has been changed!!
2342 //
2343 // NOTE - We still need to call schSetFixedBeaconFields()
2344 // one last time, just to remove the Quiet BSS IE from
2345 // the list of fixed beacon fields
2346 //
2347
2348 // Transition to eLIM_QUIET_END
2349 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
2350 break;
2351
2352 case eLIM_QUIET_INIT:
2353 case eLIM_QUIET_END:
2354 // Transition to eLIM_QUIET_INIT
2355 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
2356 // Fall thru'...
2357 default:
2358 fUpdateBeaconFields = eANI_BOOLEAN_FALSE;
2359 break;
2360 }
2361
2362 return fUpdateBeaconFields;
2363}
2364
2365#endif
2366
2367#if ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK))
2368void limConvertScanDuration(tpAniSirGlobal pMac)
2369{
2370 tpSirSmeMeasurementReq pMeasReq = pMac->lim.gpLimMeasReq;
2371 tpLimScanDurationConvert scanDurConv = &pMac->lim.gLimScanDurationConvert;
2372
2373 /* This is not a good idea to convert {long}shortChannelScanDuration from mS to TICKS *
2374 * The reason is that {long}shortChannelScanDuration is used all over and a lot of code *
2375 * that assumes the old mS definition was never changed to accommodate this new change to TICKS. *
2376 * If optimization is needed, create another set of shadow variables to store the converted *
2377 * values in Ticks, and TU. */
2378 scanDurConv->shortChannelScanDuration_tick =
2379 SYS_MS_TO_TICKS(pMeasReq->measDuration.shortChannelScanDuration +SYS_TICK_DUR_MS-1);
2380
2381 /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
2382 /* (shortChanneScanDuration * 1000) / 2^10 */
2383 scanDurConv->shortChannelScanDuration_TU = (pMeasReq->measDuration.shortChannelScanDuration * 1000) >> 10;
2384
2385 scanDurConv->longChannelScanDuration_tick =
2386 SYS_MS_TO_TICKS(pMeasReq->measDuration.longChannelScanDuration +SYS_TICK_DUR_MS-1);
2387
2388 /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
2389 /* (longChanneScanDuration * 1000) / 2^10 */
2390 scanDurConv->longChannelScanDuration_TU = (pMeasReq->measDuration.longChannelScanDuration * 1000) >> 10;
2391}
2392#endif /* ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK)) */
2393
2394
2395#ifdef ANI_PRODUCT_TYPE_AP
2396/**-------------------------------------------------
2397\fn limIsRadarEnabled
2398
2399\brief Checks if radar is enabled
2400\param pMac
2401\return true - if Both 11h and radar enabled
2402 false - if either is not enabled.
2403 --------------------------------------------------*/
2404tANI_BOOLEAN limIsRadarEnabled(tpAniSirGlobal pMac)
2405{
2406 tANI_U32 fEnabled;
2407
2408 if(wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &fEnabled) != eSIR_SUCCESS)
2409 {
2410 limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
2411 return eANI_BOOLEAN_FALSE;
2412 }
2413
2414 if (!fEnabled)
2415 return eANI_BOOLEAN_FALSE;
2416
2417 if(wlan_cfgGetInt(pMac, WNI_CFG_RDET_FLAG, &fEnabled) != eSIR_SUCCESS)
2418 {
2419 limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
2420 return eANI_BOOLEAN_FALSE;
2421 }
2422
2423 if (fEnabled)
2424 return eANI_BOOLEAN_TRUE;
2425
2426 return eANI_BOOLEAN_FALSE;
2427}
2428
2429/**---------------------------------------
2430\fn limRadarInit
2431\brief Initialize Radar Interrupt.
2432
2433\param pMac
2434\return None
2435 ----------------------------------------*/
2436void limRadarInit(tpAniSirGlobal pMac)
2437{
2438 tANI_U32 status;
2439 tSirMsgQ msg;
2440
2441 PELOG3(limLog(pMac, LOG3, FL("Radar Interrupt Already configured? %s\n"),
2442 pMac->lim.gLimSpecMgmt.fRadarIntrConfigured?"Yes":"No");)
2443 /** To avoid configuring the radar multiple times */
2444 if (pMac->lim.gLimSpecMgmt.fRadarIntrConfigured)
2445 return;
2446
2447 if (!limIsRadarEnabled(pMac))
2448 return;
2449 // Prepare and post message to HAL Message Queue
2450 msg.type = WDA_INIT_RADAR_IND;
2451 msg.bodyptr = NULL;
2452 msg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002453 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 status = wdaPostCtrlMsg(pMac, &msg);
2455 if (status != eHAL_STATUS_SUCCESS)
2456 {
2457 limLog(pMac, LOGP,
2458 FL("posting to HAL failed, reason=%d\n"), status);
2459 return;
2460 }
2461 pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_TRUE;
2462} /****** end limRadarInit() ******/
2463
2464#endif
2465
2466
2467/** -----------------------------------------------------------------
2468 \brief limHandleLowRssiInd() - handles low rssi indication
2469
2470 This function process the SIR_HAL_LOW_RSSI_IND message from
2471 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
2472
2473 \param pMac - global mac structure
2474
2475 \return
2476
2477 \sa
2478 ----------------------------------------------------------------- */
2479void limHandleLowRssiInd(tpAniSirGlobal pMac)
2480{
2481#if 0 //RSSI related indications will now go to TL and not PE
2482 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2483 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2484 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2485 {
2486 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
2487 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
2488 }
2489 else
2490 {
2491 limLog(pMac, LOGE,
2492 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
2493 pMac->pmm.gPmmState);
2494 }
2495 return;
2496#endif
2497}
2498
2499
2500/** -----------------------------------------------------------------
2501 \brief limHandleBmpsStatusInd() - handles BMPS status indication
2502
2503 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
2504 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2505 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
2506
2507 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
2508 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
2509 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
2510 This message can also come from FW anytime after we have entered BMPS.
2511 This means we should handle it in WoWL and UAPSD states as well
2512
2513 \param pMac - global mac structure
2514 \return - none
2515 \sa
2516 ----------------------------------------------------------------- */
2517void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2518{
2519 switch(pMac->pmm.gPmmState)
2520 {
2521 case ePMM_STATE_BMPS_SLEEP:
2522 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2523 case ePMM_STATE_UAPSD_SLEEP:
2524 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2525 case ePMM_STATE_WOWLAN:
2526 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
2527 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2528 break;
2529
2530 default:
2531 limLog(pMac, LOGE,
2532 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
2533 pMac->pmm.gPmmState);
2534 break;
2535 }
2536 return;
2537}
2538
2539
2540/** -----------------------------------------------------------------
2541 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2542
2543 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2544 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2545 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2546
2547 \param pMac - global mac structure
2548 \return - none
2549 \sa
2550 ----------------------------------------------------------------- */
2551void limHandleMissedBeaconInd(tpAniSirGlobal pMac)
2552{
2553 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2554 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2555 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2556 {
2557 pMac->pmm.inMissedBeaconScenario = TRUE;
2558 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
2559 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2560 }
Yathish9f22e662012-12-10 14:21:35 -08002561/* ACTIVE_MODE_HB_OFFLOAD */
2562#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2563 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2564 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2565 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2566 {
2567 pMac->pmm.inMissedBeaconScenario = TRUE;
2568 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure\n"));)
2569 limMissedBeaconInActiveMode(pMac);
2570 }
2571#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 else
2573 {
2574 limLog(pMac, LOGE,
2575 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
2576 pMac->pmm.gPmmState);
2577 }
2578 return;
2579}
2580
2581/** -----------------------------------------------------------------
2582 \brief limMicFailureInd() - handles mic failure indication
2583
2584 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2585
2586 \param pMac - global mac structure
2587 \return - none
2588 \sa
2589 ----------------------------------------------------------------- */
2590void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2591{
2592 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2593 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2594 tSirMsgQ mmhMsg;
2595 tpPESession psessionEntry ;
2596 tANI_U8 sessionId;
2597
2598 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2599 {
2600 limLog(pMac, LOGE,
2601 FL("session does not exist for given BSSId\n"));
2602 return;
2603 }
2604
2605 if (eHAL_STATUS_SUCCESS !=
2606 palAllocateMemory(pMac->hHdd,
2607 (void **) &pSirSmeMicFailureInd,
2608 sizeof(tSirSmeMicFailureInd)))
2609 {
2610 // Log error
2611 limLog(pMac, LOGP,
2612 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
2613 return;
2614 }
2615
2616 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2617 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2618 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2619
2620 vos_mem_copy(pSirSmeMicFailureInd->bssId,
2621 pSirMicFailureInd->bssId,
2622 sizeof(tSirMacAddr));
2623
2624 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
2625 pSirMicFailureInd->info.srcMacAddr,
2626 sizeof(tSirMacAddr));
2627
2628 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
2629 pSirMicFailureInd->info.taMacAddr,
2630 sizeof(tSirMacAddr));
2631
2632 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
2633 pSirMicFailureInd->info.dstMacAddr,
2634 sizeof(tSirMacAddr));
2635
2636 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
2637 pSirMicFailureInd->info.rxMacAddr,
2638 sizeof(tSirMacAddr));
2639
2640 pSirSmeMicFailureInd->info.multicast =
2641 pSirMicFailureInd->info.multicast;
2642
2643 pSirSmeMicFailureInd->info.keyId=
2644 pSirMicFailureInd->info.keyId;
2645
2646 pSirSmeMicFailureInd->info.IV1=
2647 pSirMicFailureInd->info.IV1;
2648
2649 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
2650 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
2651
2652 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2653 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2654 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002655 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2657 return;
2658}
2659
2660
2661/** -----------------------------------------------------------------
2662 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2663
2664 This function is called before enqueuing the frame to PE queue for further processing.
2665 This prevents unnecessary frames getting into PE Queue and drops them right away.
2666 Frames will be droped in the following scenarios:
2667
2668 - In Scan State, drop the frames which are not marked as scan frames
2669 - In non-Scan state, drop the frames which are marked as scan frames.
2670 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2671 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2672
2673 \param pMac - global mac structure
2674 \return - none
2675 \sa
2676 ----------------------------------------------------------------- */
2677
2678tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2679{
2680 tANI_U32 framelen;
2681 tANI_U8 *pBody;
2682 tSirMacCapabilityInfo capabilityInfo;
2683
2684 /*
2685 *
2686 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2687 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2688 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2689 * other than beacons or probe responses in scan state.
2690 */
2691 if( (subType == SIR_MAC_MGMT_BEACON) ||
2692 (subType == SIR_MAC_MGMT_PROBE_RSP))
2693 {
2694 if(pMac->pmm.inMissedBeaconScenario)
2695 {
Jeff Johnsonab79c8d2012-12-10 14:30:13 -08002696 PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon scenario"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002697 return eMGMT_DROP_NO_DROP;
2698 }
2699 if (limIsSystemInScanState(pMac))
2700 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002701 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 }
2703 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2704 {
2705 return eMGMT_DROP_SCAN_MODE_FRAME;
2706 }
2707 }
2708
2709 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2710 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2711
2712 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2713 * beacons from an infrastructure network
2714 */
2715 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2716 if(!capabilityInfo.ibss)
2717 return eMGMT_DROP_NO_DROP;
2718#if 0
2719 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2720 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2721 return eMGMT_DROP_NO_DROP;
2722#endif
2723
2724 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2725 if( (subType == SIR_MAC_MGMT_BEACON) ||
2726 (subType == SIR_MAC_MGMT_PROBE_RSP))
2727 {
2728 //drop the frame if length is less than 12
2729 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2730 return eMGMT_DROP_INVALID_SIZE;
2731
2732 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2733
2734 //This can be enhanced to even check the SSID before deciding to enque the frame.
2735 if(capabilityInfo.ess)
2736 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2737 }
2738 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2739 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2740 {
2741 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2742 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2743 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2744 }
2745
2746 return eMGMT_DROP_NO_DROP;
2747}
2748
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002749eHalStatus pe_AcquireGlobalLock( tAniSirLim *psPe)
2750{
2751 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
Jeff Johnson295189b2012-06-20 16:38:30 -07002752
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002753 if(psPe)
2754 {
2755 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psPe->lkPeGlobalLock) ) )
2756 {
2757 status = eHAL_STATUS_SUCCESS;
2758 }
2759 }
2760 return (status);
2761}
2762eHalStatus pe_ReleaseGlobalLock( tAniSirLim *psPe)
2763{
2764 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2765 if(psPe)
2766 {
2767 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psPe->lkPeGlobalLock) ) )
2768 {
2769 status = eHAL_STATUS_SUCCESS;
2770 }
2771 }
2772 return (status);
2773}