blob: b7f52f765e4fce9e904275141124394499e43984 [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{
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800383#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 palZeroMemory(pMac->hHdd, pMac->lim.gpLimAIDpool,
385 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1));
386 pMac->lim.freeAidHead = 0;
387 pMac->lim.freeAidTail = 0;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800388#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 pMac->lim.gLimAssocStaLimit = WNI_CFG_ASSOC_STA_LIMIT_STADEF;
390
391 // Place holder for current authentication request
392 // being handled
393 pMac->lim.gpLimMlmAuthReq = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700394 //pMac->lim.gpLimMlmJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700395
396 /// MAC level Pre-authentication related globals
397 pMac->lim.gLimPreAuthChannelNumber = 0;
398 pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM;
399 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr));
400 pMac->lim.gLimNumPreAuthContexts = 0;
401 palZeroMemory(pMac->hHdd, &pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable));
402
403 // Placed holder to deauth reason
404 pMac->lim.gLimDeauthReasonCode = 0;
405
406 // Place holder for Pre-authentication node list
407 pMac->lim.pLimPreAuthList = NULL;
408
409 // Send Disassociate frame threshold parameters
410 pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD;
411 pMac->lim.gLimDisassocFrameCredit = 0;
412
413 //One cache for each overlap and associated case.
414 palZeroMemory(pMac->hHdd, pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE);
415 palZeroMemory(pMac->hHdd, pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE);
416
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -0700417#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
418 pMac->lim.pSessionEntry = NULL;
419 pMac->lim.reAssocRetryAttempt = 0;
420#endif
421
Jeff Johnson295189b2012-06-20 16:38:30 -0700422}
423
424
425static void __limInitTitanVars(tpAniSirGlobal pMac)
426{
Jeff Johnsone7245742012-09-05 17:12:55 -0700427#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 palZeroMemory(pMac->hHdd, &pMac->lim.gLimChannelSwitch, sizeof(tLimChannelSwitchInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 pMac->lim.gLimChannelSwitch.state = eLIM_CHANNEL_SWITCH_IDLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700430 pMac->lim.gLimChannelSwitch.secondarySubBand = PHY_SINGLE_CHANNEL_CENTERED;
431#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 // Debug workaround for BEACON's
433 // State change triggered by "dump 222"
434 pMac->lim.gLimScanOverride = 1;
435 pMac->lim.gLimScanOverrideSaved = eSIR_ACTIVE_SCAN;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 pMac->lim.gLimTitanStaCount = 0;
437 pMac->lim.gLimBlockNonTitanSta = 0;
438}
439
440static void __limInitHTVars(tpAniSirGlobal pMac)
441{
442 pMac->lim.htCapabilityPresentInBeacon = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 pMac->lim.gHTGreenfield = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 pMac->lim.gHTShortGI40Mhz = 0;
445 pMac->lim.gHTShortGI20Mhz = 0;
446 pMac->lim.gHTMaxAmsduLength = 0;
447 pMac->lim.gHTDsssCckRate40MHzSupport = 0;
448 pMac->lim.gHTPSMPSupport = 0;
449 pMac->lim.gHTLsigTXOPProtection = 0;
450 pMac->lim.gHTMIMOPSState = eSIR_HT_MIMO_PS_STATIC;
451 pMac->lim.gHTAMpduDensity = 0;
452
453 pMac->lim.gMaxAmsduSizeEnabled = false;
454 pMac->lim.gHTMaxRxAMpduFactor = 0;
455 pMac->lim.gHTServiceIntervalGranularity = 0;
456 pMac->lim.gHTControlledAccessOnly = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 pMac->lim.gHTOperMode = eSIR_HT_OP_MODE_PURE;
458 pMac->lim.gHTPCOActive = 0;
459
460 pMac->lim.gHTPCOPhase = 0;
461 pMac->lim.gHTSecondaryBeacon = 0;
462 pMac->lim.gHTDualCTSProtection = 0;
463 pMac->lim.gHTSTBCBasicMCS = 0;
464 pMac->lim.gAddBA_Declined = 0; // Flag to Decline the BAR if the particular bit (0-7) is being set
465}
466
467#if defined( FEATURE_WLAN_INTEGRATED_SOC )
468static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac )
469{
Jeff Johnsone7245742012-09-05 17:12:55 -0700470 tANI_U32 val1, val2, val3;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 tANI_U16 val16;
472 tANI_U8 val8;
473 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
474 tSirMacHTInfoField1 *pHTInfoField1;
475 tpSirPowerSaveCfg pPowerSaveConfig;
476 tSirMacHTParametersInfo *pAmpduParamInfo;
477
478 /* Read all the CFGs here that were updated before peStart is called */
Jeff Johnsone7245742012-09-05 17:12:55 -0700479 /* All these CFG READS/WRITES are only allowed in init, at start when there is no session
480 * and they will be used throughout when there is no session
481 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700482
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
484 {
485 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
486 return eSIR_FAILURE;
487 }
488
489 if(wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, &val2) != eSIR_SUCCESS)
490 {
491 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Channel Bonding CFG\n"));)
492 return eSIR_FAILURE;
493 }
494 val16 = ( tANI_U16 ) val1;
495 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
496
497 //channel bonding mode could be set to anything from 0 to 4(Titan had these
498 // modes But for Taurus we have only two modes: enable(>0) or disable(=0)
499 pHTCapabilityInfo->supportedChannelWidthSet = val2 ?
500 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE : WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
501 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo)
502 != eSIR_SUCCESS)
503 {
504 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
505 return eSIR_FAILURE;
506 }
507
508 if(wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &val1) != eSIR_SUCCESS)
509 {
510 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT INFO Field1 CFG\n"));)
511 return eSIR_FAILURE;
512 }
513
514 val8 = ( tANI_U8 ) val1;
515 pHTInfoField1 = ( tSirMacHTInfoField1* ) &val8;
516 pHTInfoField1->recommendedTxWidthSet =
517 (tANI_U8)pHTCapabilityInfo->supportedChannelWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 if(cfgSetInt(pMac, WNI_CFG_HT_INFO_FIELD1, *(tANI_U8*)pHTInfoField1)
519 != eSIR_SUCCESS)
520 {
521 PELOGE(limLog(pMac, LOGE, FL("could not update HT Info Field\n"));)
522 return eSIR_FAILURE;
523 }
524
525 /* WNI_CFG_HEART_BEAT_THRESHOLD */
526
527 if( wlan_cfgGetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, &val1) !=
528 eSIR_SUCCESS )
529 {
530 PELOGE(limLog(pMac, LOGE, FL("could not retrieve WNI_CFG_HEART_BEAT_THRESHOLD CFG\n"));)
531 return eSIR_FAILURE;
532 }
533 if(!val1)
534 {
535 limDeactivateAndChangeTimer(pMac, eLIM_HEART_BEAT_TIMER);
536 pMac->sys.gSysEnableLinkMonitorMode = 0;
537 }
538 else
539 {
540 //No need to activate the timer during init time.
541 pMac->sys.gSysEnableLinkMonitorMode = 1;
542 }
543
544 /* WNI_CFG_SHORT_GI_20MHZ */
545
546 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS)
547 {
548 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG\n"));)
549 return eSIR_FAILURE;
550 }
551 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_20MHZ, &val2) != eSIR_SUCCESS)
552 {
553 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 20Mhz CFG\n"));)
554 return eSIR_FAILURE;
555 }
556 if (wlan_cfgGetInt(pMac, WNI_CFG_SHORT_GI_40MHZ, &val3) != eSIR_SUCCESS)
557 {
558 PELOGE(limLog(pMac, LOGE, FL("could not retrieve shortGI 40Mhz CFG\n"));)
559 return eSIR_FAILURE;
560 }
561
562 val16 = ( tANI_U16 ) val1;
563 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &val16;
564 pHTCapabilityInfo->shortGI20MHz = (tANI_U16)val2;
565 pHTCapabilityInfo->shortGI40MHz = (tANI_U16)val3;
566
567 if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) !=
568 eSIR_SUCCESS)
569 {
570 PELOGE(limLog(pMac, LOGE, FL("could not update HT Cap Info CFG\n"));)
571 return eSIR_FAILURE;
572 }
573
574 /* WNI_CFG_MAX_RX_AMPDU_FACTOR */
575
576 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &val1) != eSIR_SUCCESS)
577 {
578 PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT AMPDU Param CFG\n"));)
579 return eSIR_FAILURE;
580 }
581 if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_RX_AMPDU_FACTOR, &val2) != eSIR_SUCCESS)
582 {
583 PELOGE(limLog(pMac, LOGE, FL("could not retrieve AMPDU Factor CFG\n"));)
584 return eSIR_FAILURE;
585 }
586 val16 = ( tANI_U16 ) val1;
587 pAmpduParamInfo = ( tSirMacHTParametersInfo* ) &val16;
588 pAmpduParamInfo->maxRxAMPDUFactor = (tANI_U8)val2;
589 if(cfgSetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, *(tANI_U8*)pAmpduParamInfo) !=
590 eSIR_SUCCESS)
591 {
592 PELOGE(limLog(pMac, LOGE, FL("could not update HT AMPDU Param CFG\n"));)
593 return eSIR_FAILURE;
594 }
595
596 /* WNI_CFG_SHORT_PREAMBLE - this one is not updated in
597 limHandleCFGparamUpdate do we want to update this? */
598 if(wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val1) != eSIR_SUCCESS)
599 {
600 limLog(pMac, LOGP, FL("cfg get short preamble failed\n"));
601 return eSIR_FAILURE;
602 }
603
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 /* WNI_CFG_MAX_PS_POLL */
605
606 /* Allocate and fill in power save configuration. */
607 if (palAllocateMemory(pMac->hHdd, (void **)&pPowerSaveConfig,
608 sizeof(tSirPowerSaveCfg)) != eHAL_STATUS_SUCCESS)
609 {
610 PELOGE(limLog(pMac, LOGE, FL("LIM: Cannot allocate memory for power save "
611 "configuration\n"));)
612 return eSIR_FAILURE;
613 }
614
615 /* This context should be valid if power-save configuration message has been
616 * already dispatched during initialization process. Re-using the present
617 * configuration mask
618 */
619 palCopyMemory(pMac->hHdd, pPowerSaveConfig, (tANI_U8 *)&pMac->pmm.gPmmCfg,
620 sizeof(tSirPowerSaveCfg));
621
622 /* Note: it is okay to do this since DAL/HAL is alrady started */
623 if ( (pmmSendPowerSaveCfg(pMac, pPowerSaveConfig)) != eSIR_SUCCESS)
624 {
625 PELOGE(limLog(pMac, LOGE, FL("LIM: pmmSendPowerSaveCfg() failed \n"));)
626 return eSIR_FAILURE;
627 }
628
629 /* WNI_CFG_BG_SCAN_CHANNEL_LIST_CHANNEL_LIST */
630
631#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA) || defined(ANI_AP_CLIENT_SDK)
632 PELOG1(limLog(pMac, LOG1,
633 FL("VALID_CHANNEL_LIST has changed, reset next bg scan channel\n"));)
634 pMac->lim.gLimBackgroundScanChannelId = 0;
635#endif
636
637 /* WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA - not needed */
638
639 /* This was initially done after resume notification from HAL. Now, DAL is
640 started before PE so this can be done here */
Jeff Johnsone7245742012-09-05 17:12:55 -0700641 handleHTCapabilityandHTInfo(pMac, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -0700642
643 return eSIR_SUCCESS;
644}
645#endif /* FEATURE_WLAN_INTEGRATED_SOC */
646
647/*
648 limStart
649 This function is to replace the __limProcessSmeStartReq since there is no
650 eWNI_SME_START_REQ post to PE.
651*/
652tSirRetStatus limStart(tpAniSirGlobal pMac)
653{
654 tSirResultCodes retCode = eSIR_SUCCESS;
655
656 PELOG1(limLog(pMac, LOG1, FL(" enter\n"));)
657
658 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
659 {
660 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
661
Jeff Johnsone7245742012-09-05 17:12:55 -0700662 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700663
664 // By default do not return after first scan match
665 pMac->lim.gLimReturnAfterFirstMatch = 0;
666
667 // Initialize MLM state machine
668 limInitMlm(pMac);
669
670 // By default return unique scan results
671 pMac->lim.gLimReturnUniqueResults = true;
672 pMac->lim.gLimSmeScanResultLength = 0;
673 }
674 else
675 {
676 /**
677 * Should not have received eWNI_SME_START_REQ in states
678 * other than OFFLINE. Return response to host and
679 * log error
680 */
681 limLog(pMac, LOGE, FL("Invalid SME state %X\n"),pMac->lim.gLimSmeState );
682 retCode = eSIR_FAILURE;
683 }
684
685 return retCode;
686}
687
688/**
689 * limInitialize()
690 *
691 *FUNCTION:
692 * This function is called from LIM thread entry function.
693 * LIM related global data structures are initialized in this function.
694 *
695 *LOGIC:
696 * NA
697 *
698 *ASSUMPTIONS:
699 * NA
700 *
701 *NOTE:
702 * NA
703 *
704 * @param pMac - Pointer to global MAC structure
705 * @return None
706 */
707
708tSirRetStatus
709limInitialize(tpAniSirGlobal pMac)
710{
711 tSirRetStatus status = eSIR_SUCCESS;
712
713 __limInitAssocVars(pMac);
714 __limInitVars(pMac);
715 __limInitStates(pMac);
716 __limInitStatsVars(pMac);
717 __limInitBssVars(pMac);
718 __limInitScanVars(pMac);
719 __limInitHTVars(pMac);
720 __limInitTitanVars(pMac);
721
722#if defined( FEATURE_WLAN_INTEGRATED_SOC )
723 status = limStart(pMac);
724 if(eSIR_SUCCESS != status)
725 {
726 return status;
727 }
728#endif /* FEATURE_WLAN_INTEGRATED_SOC */
729
730 /*
731 * MLM will be intitalized when 'START' request comes from SME.
732 * limInitMlm calls limCreateTimers, which actually relies on
733 * CFG to be downloaded. So it should not be called as part of
734 * peStart, as CFG download is happening after peStart.
735 */
736 //limInitMlm(pMac);
737 // Initializations for maintaining peers in IBSS
738 limIbssInit(pMac);
739
740 pmmInitialize(pMac);
741
742
743#if defined WLAN_FEATURE_VOWIFI
744 rrmInitialize(pMac);
745#endif
746#if defined WLAN_FEATURE_VOWIFI_11R
747 limFTOpen(pMac);
748#endif
749
750#ifdef WLAN_FEATURE_P2P
751 vos_list_init(&pMac->lim.gLimMgmtFrameRegistratinQueue);
752#endif
753
754#if 0
755
756 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR);
757 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_WARN);
758 vos_trace_setLevel(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_FATAL);
759
760 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_WARN);
761 vos_trace_setLevel(VOS_MODULE_ID_HAL, VOS_TRACE_LEVEL_ERROR);
762
763 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_WARN);
764 vos_trace_setLevel(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR);
765 vos_trace_setLevel(VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR);
766
767 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
768
769 vos_trace_setLevel(VOS_MODULE_ID_SSC, VOS_TRACE_LEVEL_ERROR);
770
771 vos_trace_setLevel(VOS_MODULE_ID_SAL, VOS_TRACE_LEVEL_ERROR);
772 vos_trace_setLevel(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR);
773
774 vos_trace_setLevel(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR);
775
776
777 vos_trace_setLevel(VOS_MODULE_ID_BAL, VOS_TRACE_LEVEL_ERROR);
778
779 vos_trace_setLevel(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR);
780#endif
781 MTRACE(limTraceInit(pMac));
782
783#if defined( FEATURE_WLAN_INTEGRATED_SOC )
784 //Initialize the configurations needed by PE
785 if( eSIR_FAILURE == __limInitConfig(pMac))
786 {
787 //We need to undo everything in limStart
788 limCleanupMlm(pMac);
789 return eSIR_FAILURE;
790 }
791
792 //initialize the TSPEC admission control table.
793 //Note that this was initially done after resume notification from HAL.
794 //Now, DAL is started before PE so this can be done here
795 limAdmitControlInit(pMac);
796 limRegisterHalIndCallBack(pMac);
797#endif /*FEATURE_WLAN_INTEGRATED_SOC*/
798
799 return status;
800
801} /*** end limInitialize() ***/
802
803
804
805/**
806 * limCleanup()
807 *
808 *FUNCTION:
809 * This function is called upon reset or persona change
810 * to cleanup LIM state
811 *
812 *LOGIC:
813 * NA
814 *
815 *ASSUMPTIONS:
816 * NA
817 *
818 *NOTE:
819 * NA
820 *
821 * @param pMac - Pointer to Global MAC structure
822 * @return None
823 */
824
825void
826limCleanup(tpAniSirGlobal pMac)
827{
828#ifdef VOSS_ENABLED
829 v_PVOID_t pvosGCTx;
830 VOS_STATUS retStatus;
831#endif
832
833#ifdef WLAN_FEATURE_P2P
834//Before destroying the list making sure all the nodes have been deleted.
835//Which should be the normal case, but a memory leak has been reported.
836
837 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL;
838
839 while(vos_list_remove_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
840 (vos_list_node_t**)&pLimMgmtRegistration) == VOS_STATUS_SUCCESS)
841 {
842 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
843 FL("Fixing leak! Deallocating pLimMgmtRegistration node"));
844
845 palFreeMemory(pMac, pLimMgmtRegistration);
846 }
847
848 vos_list_destroy(&pMac->lim.gLimMgmtFrameRegistratinQueue);
849#endif
850
851 limCleanupMlm(pMac);
852 limCleanupLmm(pMac);
853
854 // free up preAuth table
855 if (pMac->lim.gLimPreAuthTimerTable.pTable != NULL)
856 {
857 palFreeMemory(pMac->hHdd, pMac->lim.gLimPreAuthTimerTable.pTable);
858 pMac->lim.gLimPreAuthTimerTable.pTable = NULL;
859 pMac->lim.gLimPreAuthTimerTable.numEntry = 0;
860 }
861
862 if(NULL != pMac->lim.pDialogueTokenHead)
863 {
864 limDeleteDialogueTokenList(pMac);
865 }
866
867 if(NULL != pMac->lim.pDialogueTokenTail)
868 {
869 palFreeMemory(pMac->hHdd, (void *) pMac->lim.pDialogueTokenTail);
870 pMac->lim.pDialogueTokenTail = NULL;
871 }
872
873 # if 0
874 if (pMac->lim.gpLimStartBssReq != NULL)
875 {
876 palFreeMemory(pMac->hHdd, pMac->lim.gpLimStartBssReq);
877 pMac->lim.gpLimStartBssReq = NULL;
878 }
879 #endif
880
881 if (pMac->lim.gpLimMlmSetKeysReq != NULL)
882 {
883 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmSetKeysReq);
884 pMac->lim.gpLimMlmSetKeysReq = NULL;
885 }
886
887 #if 0
888 if (pMac->lim.gpLimJoinReq != NULL)
889 {
890 palFreeMemory(pMac->hHdd, pMac->lim.gpLimJoinReq);
891 pMac->lim.gpLimJoinReq = NULL;
892 }
893 #endif
894
895 if (pMac->lim.gpLimMlmAuthReq != NULL)
896 {
897 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmAuthReq);
898 pMac->lim.gpLimMlmAuthReq = NULL;
899 }
900
Jeff Johnsone7245742012-09-05 17:12:55 -0700901#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700902 if (pMac->lim.gpLimMlmJoinReq != NULL)
903 {
904 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmJoinReq);
905 pMac->lim.gpLimMlmJoinReq = NULL;
906 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700907#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700908
909 #if 0
910 if (pMac->lim.gpLimReassocReq != NULL)
911 {
912 palFreeMemory(pMac->hHdd, pMac->lim.gpLimReassocReq);
913 pMac->lim.gpLimReassocReq = NULL;
914 }
915 #endif
916
917 if (pMac->lim.gpLimMlmRemoveKeyReq != NULL)
918 {
919 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmRemoveKeyReq);
920 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
921 }
922
Viral Modid86bde22012-12-10 13:09:21 -0800923#ifdef WLAN_FEATURE_P2P
924 if (pMac->lim.gpLimSmeScanReq != NULL)
925 {
926 palFreeMemory(pMac->hHdd, pMac->lim.gpLimSmeScanReq);
927 pMac->lim.gpLimSmeScanReq = NULL;
928 }
929#endif
930
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 if (pMac->lim.gpLimMlmScanReq != NULL)
932 {
933 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmScanReq);
934 pMac->lim.gpLimMlmScanReq = NULL;
935 }
936
937#if 0
938 if(NULL != pMac->lim.beacon)
939 {
940 palFreeMemory(pMac->hHdd, (void*) pMac->lim.beacon);
941 pMac->lim.beacon = NULL;
942 }
943#endif
944 #if 0
945 if(NULL != pMac->lim.assocReq)
946 {
947 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocReq);
948 pMac->lim.assocReq= NULL;
949 }
950 #endif
951
952#if 0
953 if(NULL != pMac->lim.assocRsp)
954 {
955 palFreeMemory(pMac->hHdd, (void*) pMac->lim.assocRsp);
956 pMac->lim.assocRsp= NULL;
957 }
958#endif
959 // Now, finally reset the deferred message queue pointers
960 limResetDeferredMsgQ(pMac);
961
962#ifdef VOSS_ENABLED
963
964 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
965 retStatus = WLANTL_DeRegisterMgmtFrmClient(pvosGCTx);
966
967 if ( retStatus != VOS_STATUS_SUCCESS )
968 PELOGE(limLog(pMac, LOGE, FL("DeRegistering the PE Handle with TL has failed bailing out...\n"));)
969#endif
970
971#if defined WLAN_FEATURE_VOWIFI
972 rrmCleanup(pMac);
973#endif
974#if defined WLAN_FEATURE_VOWIFI_11R
975 limFTCleanup(pMac);
976#endif
977
978} /*** end limCleanup() ***/
979
980
981/** -------------------------------------------------------------
982\fn peOpen
983\brief will be called in Open sequence from macOpen
984\param tpAniSirGlobal pMac
985\param tHalOpenParameters *pHalOpenParam
986\return tSirRetStatus
987 -------------------------------------------------------------*/
988
989tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam)
990{
991 pMac->lim.maxBssId = pMacOpenParam->maxBssId;
992 pMac->lim.maxStation = pMacOpenParam->maxStation;
993
994 if ((pMac->lim.maxBssId == 0) || (pMac->lim.maxStation == 0))
995 {
996 PELOGE(limLog(pMac, LOGE, FL("max number of Bssid or Stations cannot be zero!\n"));)
997 return eSIR_FAILURE;
998 }
999
1000 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1001 (void **) &pMac->lim.limTimers.gpLimCnfWaitTimer, sizeof(TX_TIMER)*pMac->lim.maxStation))
1002 {
1003 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1004 return eSIR_FAILURE;
1005 }
1006
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001007#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1009 (void **) &pMac->lim.gpLimAIDpool,
1010 sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1)))
1011 {
1012 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1013 return eSIR_FAILURE;
1014 }
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001015#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1017 (void **) &pMac->lim.gpSession, sizeof(tPESession)* pMac->lim.maxBssId))
1018 {
1019 limLog(pMac, LOGE, FL("memory allocate failed!\n"));
1020 return eSIR_FAILURE;
1021 }
1022
1023 palZeroMemory(pMac->hHdd, pMac->lim.gpSession, sizeof(tPESession)*pMac->lim.maxBssId);
1024
1025
1026 /*
1027 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1028 (void **) &pMac->dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*pMac->lim.maxStation))
1029 {
1030 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1031 return eSIR_FAILURE;
1032 }
1033
1034 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1035 (void **) &pMac->dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*pMac->lim.maxStation))
1036 {
1037 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1038 return eSIR_FAILURE;
1039 }
1040 */
1041
1042#ifdef WLAN_SOFTAP_FEATURE
1043 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1044 (void **) &pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation))
1045 {
1046 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pTim!\n"));)
1047 return eSIR_FAILURE;
1048 }
1049 palZeroMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim, sizeof(tANI_U8)*pMac->lim.maxStation);
1050#endif
1051
1052#ifdef ANI_PRODUCT_TYPE_AP
1053
1054 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1055 (void **) &pMac->pmm.gPmmTim.pStaInfo, sizeof(*pMac->pmm.gPmmTim.pStaInfo) * pMac->lim.maxStation))
1056 {
1057 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed for pStaInfo!\n"));)
1058 return eSIR_FAILURE;
1059 }
1060
1061 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1062 (void **) &pMac->pmm.gpPmmStaState, sizeof(tPmmStaState)*pMac->lim.maxStation))
1063 {
1064 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1065 return eSIR_FAILURE;
1066 }
1067
1068 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
1069 (void **) &pMac->pmm.gpPmmPSState, sizeof(tANI_U8)*pMac->lim.maxStation))
1070 {
1071 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));)
1072 return eSIR_FAILURE;
1073 }
1074#endif
1075
Jeff Johnsone7245742012-09-05 17:12:55 -07001076#ifdef WLAN_FEATURE_P2P
1077 pMac->lim.actionFrameSessionId = 0xff;
1078#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001079
1080 return eSIR_SUCCESS;
1081}
1082
1083/** -------------------------------------------------------------
1084\fn peClose
1085\brief will be called in close sequence from macClose
1086\param tpAniSirGlobal pMac
1087\return tSirRetStatus
1088 -------------------------------------------------------------*/
1089
1090tSirRetStatus peClose(tpAniSirGlobal pMac)
1091{
1092 tANI_U8 i;
1093
1094 if (ANI_DRIVER_TYPE(pMac) == eDRIVER_TYPE_MFG)
1095 return eSIR_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07001096
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 for(i =0; i < pMac->lim.maxBssId; i++)
1098 {
1099 if(pMac->lim.gpSession[i].valid == TRUE)
1100 {
1101 peDeleteSession(pMac,&pMac->lim.gpSession[i]);
1102 }
1103 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001104 palFreeMemory(pMac->hHdd, pMac->lim.limTimers.gpLimCnfWaitTimer);
1105 pMac->lim.limTimers.gpLimCnfWaitTimer = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001106#if 0
Jeff Johnsone7245742012-09-05 17:12:55 -07001107 palFreeMemory(pMac->hHdd, pMac->lim.gpLimAIDpool);
1108 pMac->lim.gpLimAIDpool = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -08001109#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001110
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 palFreeMemory(pMac->hHdd, pMac->lim.gpSession);
1112 pMac->lim.gpSession = NULL;
1113 /*
1114 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pHashTable);
1115 pMac->dph.dphHashTable.pHashTable = NULL;
1116 palFreeMemory(pMac->hHdd, pMac->dph.dphHashTable.pDphNodeArray);
1117 pMac->dph.dphHashTable.pDphNodeArray = NULL;
1118 */
1119#ifdef WLAN_SOFTAP_FEATURE
1120 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pTim);
1121 pMac->pmm.gPmmTim.pTim = NULL;
1122#endif
1123#ifdef ANI_PRODUCT_TYPE_AP
1124 palFreeMemory(pMac->hHdd, pMac->pmm.gPmmTim.pStaInfo);
1125 pMac->pmm.gPmmTim.pStaInfo = NULL;
1126 palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmStaState);
1127 pMac->pmm.gpPmmStaState = NULL;
1128 palFreeMemory(pMac->hHdd, pMac->pmm.gpPmmPSState);
1129 pMac->pmm.gpPmmPSState = NULL;
1130#endif
1131
1132 return eSIR_SUCCESS;
1133}
1134
1135/** -------------------------------------------------------------
1136\fn peStart
1137\brief will be called in start sequence from macStart
1138\param tpAniSirGlobal pMac
1139\return none
1140 -------------------------------------------------------------*/
1141
1142tSirRetStatus peStart(tpAniSirGlobal pMac)
1143{
1144 tSirRetStatus status = eSIR_SUCCESS;
1145
1146 status = limInitialize(pMac);
1147#if defined(ANI_LOGDUMP)
1148 limDumpInit(pMac);
1149#endif //#if defined(ANI_LOGDUMP)
1150
1151 return status;
1152}
1153
1154/** -------------------------------------------------------------
1155\fn peStop
1156\brief will be called in stop sequence from macStop
1157\param tpAniSirGlobal pMac
1158\return none
1159 -------------------------------------------------------------*/
1160
1161void peStop(tpAniSirGlobal pMac)
1162{
1163 limCleanup(pMac);
1164 SET_LIM_MLM_STATE(pMac, eLIM_MLM_OFFLINE_STATE);
1165 return;
1166}
1167
1168/** -------------------------------------------------------------
1169\fn peFreeMsg
1170\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
1171\ to free a given PE message on the TX and MC thread.
1172\ This happens when there are messages pending in the PE
1173\ queue when system is being stopped and reset.
1174\param tpAniSirGlobal pMac
1175\param tSirMsgQ pMsg
1176\return none
1177-----------------------------------------------------------------*/
1178v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1179{
1180 if (pMsg != NULL)
1181 {
1182 if (NULL != pMsg->bodyptr)
1183 {
1184 if (SIR_BB_XPORT_MGMT_MSG == pMsg->type)
1185 {
1186 vos_pkt_return_packet((vos_pkt_t *)pMsg->bodyptr);
1187 }
1188 else
1189 {
1190 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
1191 }
1192 }
1193 pMsg->bodyptr = 0;
1194 pMsg->bodyval = 0;
1195 pMsg->type = 0;
1196 }
1197 return;
1198}
1199
1200
1201/**
1202 * The function checks if a particular timer should be allowed
1203 * into LIM while device is sleeping
1204 */
1205tANI_U8 limIsTimerAllowedInPowerSaveState(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1206{
1207 tANI_U8 retStatus = TRUE;
1208
1209 if(!limIsSystemInActiveState(pMac))
1210 {
1211 switch(pMsg->type)
1212 {
1213 /* Don't allow following timer messages if in sleep */
1214 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1215 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1216 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1217 retStatus = FALSE;
1218 break;
1219 /* May allow following timer messages in sleep mode */
1220 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1221
1222 /* Safe to allow as of today, this triggers background scan
1223 * which will not be started if the device is in power-save mode
1224 * might need to block in the future if we decide to implement
1225 * spectrum management
1226 */
1227 case SIR_LIM_QUIET_TIMEOUT:
1228
1229 /* Safe to allow as of today, this triggers background scan
1230 * which will not be started if the device is in power-save mode
1231 * might need to block in the future if we decide to implement
1232 * spectrum management
1233 */
1234 case SIR_LIM_QUIET_BSS_TIMEOUT:
1235
1236 /* Safe to allow this timermessage, triggers background scan
1237 * which is blocked in sleep mode
1238 */
1239 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
1240
1241 /* Safe to allow this timer, since, while in IMPS this timer will not
1242 * be started. In case of BMPS sleep, SoftMAC handles the heart-beat
1243 * when heart-beat control is handled back to PE, device would have
1244 * already woken-up due to EXIT_BMPS_IND mesage from SoftMAC
1245 */
1246 case SIR_LIM_HEART_BEAT_TIMEOUT:
1247 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1248
1249 /* Safe to allow, PE is not handling this message as of now. May need
1250 * to block it, basically, free the buffer and restart the timer
1251 */
1252 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1253 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001254 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1256 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1257 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1258 retStatus = TRUE;
1259 break;
1260
1261 /* by default allow rest of messages */
1262 default:
1263 retStatus = TRUE;
1264 break;
1265
1266
1267 }
1268 }
1269
1270 return retStatus;
1271
1272}
1273
1274
1275
1276/**
1277 * limPostMsgApi()
1278 *
1279 *FUNCTION:
1280 * This function is called from other thread while posting a
1281 * message to LIM message Queue gSirLimMsgQ.
1282 *
1283 *LOGIC:
1284 * NA
1285 *
1286 *ASSUMPTIONS:
1287 * NA
1288 *
1289 *NOTE:
1290 * NA
1291 *
1292 * @param pMac - Pointer to Global MAC structure
1293 * @param pMsg - Pointer to the message structure
1294 * @return None
1295 */
1296
1297tANI_U32
1298limPostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1299{
1300#ifdef VOSS_ENABLED
1301 return vos_mq_post_message(VOS_MQ_ID_PE, (vos_msg_t *) pMsg);
1302
1303
1304#elif defined(ANI_OS_TYPE_LINUX) || defined(ANI_OS_TYPE_OSX)
1305 return tx_queue_send(&pMac->sys.gSirLimMsgQ, pMsg, TX_WAIT_FOREVER);
1306
1307#else
1308 /* Check if this is a timeout message from a timer
1309 * and if the timeout message is allowed if the device is in power-save state
1310 */
1311 if(!limIsTimerAllowedInPowerSaveState(pMac, pMsg))
1312 {
1313 limLog(pMac, LOGW,
1314 FL("Timeout message %d is not allowed while device is in Power-Save mode\n"),
1315 pMsg->type);
1316
1317 return TX_SUCCESS;
1318 }
1319 if(pMac->gDriverType != eDRIVER_TYPE_MFG)
1320 {
1321 limMessageProcessor(pMac, pMsg);
1322 }
1323
1324 return TX_SUCCESS;
1325
1326#endif
1327} /*** end limPostMsgApi() ***/
1328
1329
1330/*--------------------------------------------------------------------------
1331
1332 \brief pePostMsgApi() - A wrapper function to post message to Voss msg queues
1333
1334 This function can be called by legacy code to post message to voss queues OR
1335 legacy code may keep on invoking 'limPostMsgApi' to post the message to voss queue
1336 for dispatching it later.
1337
1338 \param pMac - Pointer to Global MAC structure
1339 \param pMsg - Pointer to the message structure
1340
1341 \return tANI_U32 - TX_SUCCESS for success.
1342
1343 --------------------------------------------------------------------------*/
1344
1345tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
1346{
1347 return (tSirRetStatus)limPostMsgApi(pMac, pMsg);
1348}
1349
1350/*--------------------------------------------------------------------------
1351
1352 \brief peProcessMessages() - Message Processor for PE
1353
1354 Voss calls this function to dispatch the message to PE
1355
1356 \param pMac - Pointer to Global MAC structure
1357 \param pMsg - Pointer to the message structure
1358
1359 \return tANI_U32 - TX_SUCCESS for success.
1360
1361 --------------------------------------------------------------------------*/
1362
1363tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg)
1364{
1365 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1366 {
1367 return eSIR_SUCCESS;
1368 }
1369 /**
1370 * If the Message to be handled is for CFG Module call the CFG Msg Handler and
1371 * for all the other cases post it to LIM
1372 */
1373 if ( SIR_CFG_PARAM_UPDATE_IND != pMsg->type && IS_CFG_MSG(pMsg->type))
1374 cfgProcessMbMsg(pMac, (tSirMbMsg*)pMsg->bodyptr);
1375 else
1376 limMessageProcessor(pMac, pMsg);
1377 return eSIR_SUCCESS;
1378}
1379
1380
1381#ifdef VOSS_ENABLED
1382
1383// ---------------------------------------------------------------------------
1384/**
1385 * peHandleMgmtFrame
1386 *
1387 * FUNCTION:
1388 * Process the Management frames from TL
1389 *
1390 * LOGIC:
1391 *
1392 * ASSUMPTIONS: TL sends the packet along with the VOS GlobalContext
1393 *
1394 * NOTE:
1395 *
1396 * @param pvosGCtx Global Vos Context
1397 * @param vossBuff Packet
1398 * @return None
1399 */
1400
1401VOS_STATUS peHandleMgmtFrame( v_PVOID_t pvosGCtx, v_PVOID_t vosBuff)
1402{
1403 tpAniSirGlobal pMac;
1404 tpSirMacMgmtHdr mHdr;
1405 tSirMsgQ msg;
1406 vos_pkt_t *pVosPkt;
1407 VOS_STATUS vosStatus;
1408 v_U8_t *pRxPacketInfo;
1409
1410 pVosPkt = (vos_pkt_t *)vosBuff;
1411 if (NULL == pVosPkt)
1412 {
1413 return VOS_STATUS_E_FAILURE;
1414 }
1415
1416 pMac = (tpAniSirGlobal)vos_get_context(VOS_MODULE_ID_PE, pvosGCtx);
1417 if (NULL == pMac)
1418 {
1419 // cannot log a failure without a valid pMac
1420 vos_pkt_return_packet(pVosPkt);
1421 return VOS_STATUS_E_FAILURE;
1422 }
1423
1424 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (void *)&pRxPacketInfo, VOS_FALSE );
1425
1426 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1427 {
1428 vos_pkt_return_packet(pVosPkt);
1429 return VOS_STATUS_E_FAILURE;
1430 }
1431
1432
1433 //
1434 // The MPDU header is now present at a certain "offset" in
1435 // the BD and is specified in the BD itself
1436 //
1437 mHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1438 if(mHdr->fc.type == SIR_MAC_MGMT_FRAME)
1439 {
1440 PELOG1(limLog( pMac, LOG1,
1441 FL ( "RxBd=%p mHdr=%p Type: %d Subtype: %d Sizes:FC%d Mgmt%d\n"),
Jeff Johnsone7245742012-09-05 17:12:55 -07001442 pRxPacketInfo, mHdr, mHdr->fc.type, mHdr->fc.subType, sizeof(tSirMacFrameCtl), sizeof(tSirMacMgmtHdr) );)
Jeff Johnson295189b2012-06-20 16:38:30 -07001443
Jeff Johnsone7245742012-09-05 17:12:55 -07001444 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT, NO_SESSION,
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 LIM_TRACE_MAKE_RXMGMT(mHdr->fc.subType,
1446 (tANI_U16) (((tANI_U16) (mHdr->seqControl.seqNumHi << 4)) | mHdr->seqControl.seqNumLo)));)
1447 }
1448
1449
1450 // Forward to MAC via mesg = SIR_BB_XPORT_MGMT_MSG
1451 msg.type = SIR_BB_XPORT_MGMT_MSG;
1452 msg.bodyptr = vosBuff;
1453 msg.bodyval = 0;
1454
1455 if( eSIR_SUCCESS != sysBbtProcessMessageCore( pMac,
1456 &msg,
1457 mHdr->fc.type,
1458 mHdr->fc.subType ))
1459 {
1460 vos_pkt_return_packet(pVosPkt);
1461 limLog( pMac, LOGW,
1462 FL ( "sysBbtProcessMessageCore failed to process SIR_BB_XPORT_MGMT_MSG\n" ));
1463 return VOS_STATUS_E_FAILURE;
1464 }
1465
1466 return VOS_STATUS_SUCCESS;
1467}
1468
1469// ---------------------------------------------------------------------------
1470/**
1471 * peRegisterTLHandle
1472 *
1473 * FUNCTION:
1474 * Registers the Handler which, process the Management frames from TL
1475 *
1476 * LOGIC:
1477 *
1478 * ASSUMPTIONS:
1479 *
1480 * NOTE:
1481 *
1482 * @return None
1483 */
1484
1485void peRegisterTLHandle(tpAniSirGlobal pMac)
1486{
1487 v_PVOID_t pvosGCTx;
1488 VOS_STATUS retStatus;
1489
1490 pvosGCTx = vos_get_global_context(VOS_MODULE_ID_PE, (v_VOID_t *) pMac);
1491
1492 retStatus = WLANTL_RegisterMgmtFrmClient(pvosGCTx, peHandleMgmtFrame);
1493
1494 if (retStatus != VOS_STATUS_SUCCESS)
1495 limLog( pMac, LOGP, FL("Registering the PE Handle with TL has failed bailing out...\n"));
1496
1497}
1498#endif
1499
1500
1501/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 * limIsSystemInScanState()
1503 *
1504 *FUNCTION:
1505 * This function is called by various MAC software modules to
1506 * determine if System is in Scan/Learn state
1507 *
1508 *LOGIC:
1509 * NA
1510 *
1511 *ASSUMPTIONS:
1512 * NA
1513 *
1514 *NOTE:
1515 *
1516 * @param pMac - Pointer to Global MAC structure
1517 * @return true - System is in Scan/Learn state
1518 * false - System is NOT in Scan/Learn state
1519 */
1520
1521tANI_U8
1522limIsSystemInScanState(tpAniSirGlobal pMac)
1523{
1524 switch (pMac->lim.gLimSmeState)
1525 {
1526 case eLIM_SME_CHANNEL_SCAN_STATE:
1527 case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE:
1528 case eLIM_SME_LINK_EST_WT_SCAN_STATE:
1529 case eLIM_SME_WT_SCAN_STATE:
1530 // System is in Learn mode
1531 return true;
1532
1533 default:
1534 // System is NOT in Learn mode
1535 return false;
1536 }
1537} /*** end limIsSystemInScanState() ***/
1538
1539
1540
1541/**
1542 * limIsSystemInActiveState()
1543 *
1544 *FUNCTION:
1545 * This function is called by various MAC software modules to
1546 * determine if System is in Active/Wakeup state
1547 *
1548 *LOGIC:
1549 * NA
1550 *
1551 *ASSUMPTIONS:
1552 * NA
1553 *
1554 *NOTE:
1555 *
1556 * @param pMac - Pointer to Global MAC structure
1557 * @return true - System is in Active state
1558 * false - System is not in Active state
1559 */
1560
1561tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac)
1562{
1563 switch (pMac->pmm.gPmmState)
1564 {
1565 case ePMM_STATE_BMPS_WAKEUP:
1566 case ePMM_STATE_IMPS_WAKEUP:
1567 case ePMM_STATE_READY:
1568 // System is in Active mode
1569 return true;
1570 default:
1571 return false;
1572 // System is NOT in Active mode
1573 }
1574}
1575
1576
1577#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1578/**
1579 * limCheckAndQuietBSS()
1580 *
1581 *FUNCTION:
1582 * This function is called by limSetLearnMode() to check
1583 * if BSS needs to be quieted and call limQuietBSS() to
1584 * send data frame to self for that purpose.
1585 *
1586 *LOGIC:
1587 * NA
1588 *
1589 *ASSUMPTIONS:
1590 * NA
1591 *
1592 *NOTE:
1593 *
1594 * @param pMac - Pointer to Global MAC structure
1595 * @return None
1596 */
1597
1598void
1599limCheckAndQuietBSS(tpAniSirGlobal pMac)
1600{
1601 tANI_U32 dur;
1602
1603 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
1604 {
1605 // LIM is in AP role. Quiet the BSS before
1606 // switching to channel to be learned
1607 if (pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration >
1608 LIM_MAX_QUIET_DURATION)
1609 {
1610 // May need to quiet BSS multiple times.
1611 // Quiet for a limit of 32 msecs on Learn
1612 // duration for now.
1613 dur = LIM_MAX_QUIET_DURATION;
1614 }
1615 else
1616 {
1617 dur =
1618 pMac->lim.gpLimMeasReq->measDuration.shortChannelScanDuration;
1619 }
1620 PELOG3(limLog(pMac, LOG3,
1621 FL("*** Going to quiet BSS for duration=%d msec\n"),
1622 dur);)
1623
1624 limQuietBss(pMac, dur);
1625 }
1626} /*** end limCheckAndQuietBSS() ***/
1627#endif
1628
1629#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
1630/**
1631 * limSetLearnMode()
1632 *
1633 *FUNCTION:
1634 * This function is called to setup system into Learn mode
1635 * to collect DFS measurements.
1636 *
1637 *LOGIC:
1638 * NA
1639 *
1640 *ASSUMPTIONS:
1641 * NA
1642 *
1643 *NOTE:
1644 *
1645 * @param pMac - Pointer to Global MAC structure
1646 * @return None
1647 */
1648
1649void
1650limSetLearnMode(tpAniSirGlobal pMac)
1651{
1652 limSendHalInitScanReq(pMac, eLIM_HAL_INIT_LEARN_WAIT_STATE, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN);
1653 return;
1654} /*** end limSetLearnMode() ***/
1655
1656/**
1657 * limContinueChannelLearn()
1658 *
1659 *FUNCTION:
1660 * This function is called to do measurement (learn) on current channel.
1661 *
1662 *LOGIC:
1663 *
1664 *ASSUMPTIONS:
1665 * NA
1666 *
1667 *NOTE:
1668 * NA
1669 *
1670 * @param pMac - Pointer to Global MAC structure
1671 *
1672 * @return None
1673 */
1674
1675void
1676limContinueChannelLearn(tpAniSirGlobal pMac)
1677{
1678 tANI_U8 chanNum;
1679 tSirMacSSid ssId;
1680 tSirMacAddr bssId = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
1681
1682 // Time to collect measurements
1683 chanNum = limGetCurrentLearnChannel(pMac);
1684
1685 // Switch channel
1686 pMac->lim.gLimSystemInScanLearnMode = 1;
1687
1688 if (pMac->lim.gpLimMeasReq->measControl.scanType == eSIR_ACTIVE_SCAN)
1689 {
1690 /// Prepare and send Probe Request frame
1691 ssId.length = 0;
1692 /* for learning channel, we don't include any additional IE */
1693 limSendProbeReqMgmtFrame(pMac, &ssId, bssId, chanNum,pMac->lim.gSelfMacAddr, 0 , NULL);
1694 }
1695
1696 // Activate Learn duration timer during which
1697 // DFS measurements are made.
1698 pMac->lim.gLimMeasParams.shortDurationCount++;
1699 limDeactivateAndChangeTimer(pMac, eLIM_LEARN_DURATION_TIMER);
1700
Jeff Johnsone7245742012-09-05 17:12:55 -07001701 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_DURATION_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 if (tx_timer_activate(&pMac->lim.gLimMeasParams.learnDurationTimer)
1703 != TX_SUCCESS)
1704 {
1705 /// Could not activate learn duration timer.
1706 // Log error
1707 limLog(pMac, LOGP, FL("could not activate learn duration timer\n"));
1708
1709 return;
1710 }
1711} /*** end limContinueChannelLearn() ***/
1712
1713
1714/**
1715 * limReEnableLearnMode()
1716 *
1717 *FUNCTION:
1718 * This function is called by various MAC software modules to
1719 * re-enable Learn mode measurements.
1720 *
1721 *LOGIC:
1722 * NA
1723 *
1724 *ASSUMPTIONS:
1725 * NA
1726 *
1727 *NOTE:
1728 *
1729 * @param pMac - Pointer to Global MAC structure
1730 * @return None
1731 */
1732
1733void
1734limReEnableLearnMode(tpAniSirGlobal pMac)
1735{
1736 PELOG4(limLog(pMac, LOG4, FL("quietEnabled = %d\n"),
1737 pMac->lim.gLimSpecMgmt.fQuietEnabled);)
1738
1739 /** Stop measurement temperorily when radar is detected or channel
1740 * switch is running as part of periodic DFS */
1741 if (!pMac->lim.gpLimMeasReq || LIM_IS_RADAR_DETECTED(pMac) ||
1742 (pMac->lim.gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING))
1743 {
1744 return;
1745 }
1746
1747 if (pMac->lim.gLimSpecMgmt.fQuietEnabled)
1748 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001749 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_QUIET_BSS_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001750#ifdef GEN6_TODO
1751 /* revisit this piece of code to assign the appropriate sessionId below
1752 * priority - HIGH
1753 */
1754 pMac->lim.limTimers.gLimQuietBssTimer.sessionId = sessionId;
1755#endif
1756 if (tx_timer_activate(
1757 &pMac->lim.limTimers.gLimQuietBssTimer)
1758 != TX_SUCCESS)
1759 {
1760 limLog(pMac, LOGP, FL("could not start Quiet Bss timer\n"));
1761 return;
1762 }
1763 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
1764 }
1765 else
1766 {
1767 limDeactivateAndChangeTimer(pMac, eLIM_LEARN_INTERVAL_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -07001768 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_LEARN_INTERVAL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001769#ifdef GEN6_TODO
1770 /* revisit this piece of code to assign the appropriate sessionId below
1771 */
1772 pMac->lim.gLimMeasParams.learnIntervalTimer.sessionId = sessionId;
1773#endif
1774 if (tx_timer_activate(
1775 &pMac->lim.gLimMeasParams.learnIntervalTimer)
1776 != TX_SUCCESS)
1777 {
1778 /// Could not activate Learn Interval timer.
1779 // Log error
1780 limLog(pMac, LOGP, FL("could not start Learn Interval timer\n"));
1781 return;
1782 }
1783 }
1784
1785 PELOG3(limLog(pMac, LOG3, FL("Re-enabled Learn mode Measurements\n"));)
1786 pMac->lim.gLimMeasParams.disableMeasurements = 0;
1787
1788 return;
1789} /*** end limReEnableLearnMode() ***/
1790
1791#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
1792
1793
1794/**
1795*\brief limReceivedHBHandler()
1796*
1797* This function is called by schBeaconProcess() upon
1798* receiving a Beacon on STA. This also gets called upon
1799* receiving Probe Response after heat beat failure is
1800* detected.
1801*
1802* param pMac - global mac structure
1803* param channel - channel number indicated in Beacon, Probe Response
1804* return - none
1805*/
1806
1807
1808void
1809limReceivedHBHandler(tpAniSirGlobal pMac, tANI_U8 channelId, tpPESession psessionEntry)
1810{
1811 if((channelId == 0 ) || (channelId == psessionEntry->currentOperChannel) )
1812 psessionEntry->LimRxedBeaconCntDuringHB++;
1813
1814 pMac->pmm.inMissedBeaconScenario = FALSE;
1815} /*** end limReceivedHBHandler() ***/
1816
1817
1818
1819#if 0
1820void limResetHBPktCount(tpPESession psessionEntry)
1821{
1822 psessionEntry->LimRxedBeaconCntDuringHB = 0;
1823}
1824#endif
1825
1826
1827/*
1828 * limProcessWdsInfo()
1829 *
1830 *FUNCTION:
1831 * This function is called from schBeaconProcess in BP
1832 *
1833 *PARAMS:
1834 * @param pMac - Pointer to Global MAC structure
1835 * @param propIEInfo - proprietary IE info
1836 *
1837 *LOGIC:
1838 *
1839 *ASSUMPTIONS:
1840 * NA
1841 *
1842 *NOTE:
1843 *
1844 *
1845 *RETURNS:
1846 *
1847 */
1848
1849void limProcessWdsInfo(tpAniSirGlobal pMac,
1850 tSirPropIEStruct propIEInfo)
1851{
1852#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1853 tpSirSmeWdsInfoInd pSirSmeWdsInfoInd;
1854 tANI_U8 *pTemp;
1855 tSirMsgQ mmhMsg;
1856
1857 if (propIEInfo.wdsLength &&
1858 propIEInfo.wdsLength <= ANI_WDS_INFO_MAX_LENGTH)
1859 {
1860 if (pMac->lim.gLimWdsInfo.wdsLength)
1861 {
1862 if ((propIEInfo.wdsLength ==
1863 pMac->lim.gLimWdsInfo.wdsLength) &&
1864 (palEqualMemory( pMac->hHdd,propIEInfo.wdsData,
1865 pMac->lim.gLimWdsInfo.wdsBytes,
1866 pMac->lim.gLimWdsInfo.wdsLength) ))
1867
1868 return; // no difference in WDS info
1869 else
1870 {
1871 PELOG2(limLog(pMac, LOG2,
1872 FL("Cached WDS Info: length %d bytes is: "),
1873 pMac->lim.gLimWdsInfo.wdsLength);
1874 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
1875 pMac->lim.gLimWdsInfo.wdsBytes,
1876 pMac->lim.gLimWdsInfo.wdsLength);)
1877
1878 PELOG2(limLog(pMac, LOG2, FL("New WDS Info: length %d bytes is: "),
1879 propIEInfo.wdsLength);
1880 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
1881 propIEInfo.wdsData,
1882 propIEInfo.wdsLength);)
1883
1884 pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
1885 palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
1886 propIEInfo.wdsData,
1887 propIEInfo.wdsLength);
1888
1889 // send IND to WSM
1890 if (eHAL_STATUS_SUCCESS !=
1891 palAllocateMemory(pMac->hHdd,
1892 (void **) &pSirSmeWdsInfoInd,
1893 sizeof(tSirSmeWdsInfoInd)))
1894 {
1895 // Log error
1896 limLog(pMac, LOGP,
1897 FL("memory allocate failed for WDS_INFO_IND\n"));
1898
1899 return;
1900 }
1901
1902 pSirSmeWdsInfoInd->messageType = eWNI_SME_WDS_INFO_IND;
1903 pSirSmeWdsInfoInd->length = sizeof(tSirSmeWdsInfoInd);
1904
1905 pSirSmeWdsInfoInd->wdsInfo.wdsLength =
1906 pMac->lim.gLimWdsInfo.wdsLength;
1907
1908 palCopyMemory( pMac->hHdd, pSirSmeWdsInfoInd->wdsInfo.wdsBytes,
1909 pMac->lim.gLimWdsInfo.wdsBytes,
1910 pMac->lim.gLimWdsInfo.wdsLength);
1911
1912 pTemp = (tANI_U8 *) pSirSmeWdsInfoInd;
1913
1914 PELOG2(limLog(pMac, LOG2,
1915 FL("eWNI_SME_WDS_INFO_IND length %d bytes is: "),
1916 pSirSmeWdsInfoInd->length);
1917 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pTemp,
1918 pSirSmeWdsInfoInd->length);)
1919
1920 mmhMsg.type = eWNI_SME_WDS_INFO_IND;
1921 mmhMsg.bodyptr = pSirSmeWdsInfoInd;
1922 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001923 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1925 pMac->lim.gLimNumWdsInfoInd++;
1926 }
1927 }
1928 else
1929 {
1930 // first WDS info
1931 pMac->lim.gLimWdsInfo.wdsLength = propIEInfo.wdsLength;
1932 palCopyMemory( pMac->hHdd, pMac->lim.gLimWdsInfo.wdsBytes,
1933 propIEInfo.wdsData,
1934 propIEInfo.wdsLength);
1935
1936 PELOG1(limLog(pMac, LOG1, FL("First WDS Info: length %d bytes is:\n"),
1937 pMac->lim.gLimWdsInfo.wdsLength);
1938 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
1939 pMac->lim.gLimWdsInfo.wdsBytes,
1940 pMac->lim.gLimWdsInfo.wdsLength);)
1941
1942 }
1943 }
1944 else
1945 {
1946 PELOG2(limLog(pMac, LOG2,
1947 FL("Illegal WDS length = %d\n"),
1948 propIEInfo.wdsLength);)
1949 }
1950#endif
1951}
1952
1953
1954
1955/**
1956 * limInitWdsInfoParams()
1957 *
1958 *FUNCTION:
1959 * This function is called while processing
1960 * START_BSS/JOIN/REASSOC_REQ to initialize WDS info
1961 * ind/set related parameters.
1962 *
1963 *LOGIC:
1964 *
1965 *ASSUMPTIONS:
1966 *
1967 *NOTE:
1968 *
1969 * @param pMac Pointer to Global MAC structure
1970 * @return None
1971 */
1972
1973void
1974limInitWdsInfoParams(tpAniSirGlobal pMac)
1975{
1976 pMac->lim.gLimWdsInfo.wdsLength = 0;
1977 pMac->lim.gLimNumWdsInfoInd = 0;
1978 pMac->lim.gLimNumWdsInfoSet = 0;
1979} /*** limInitWdsInfoParams() ***/
1980
1981
1982/** -------------------------------------------------------------
1983\fn limUpdateOverlapStaParam
1984\brief Updates overlap cache and param data structure
1985\param tpAniSirGlobal pMac
1986\param tSirMacAddr bssId
1987\param tpLimProtStaParams pStaParams
1988\return None
1989 -------------------------------------------------------------*/
1990void
1991limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams)
1992{
1993 int i;
1994 if (!pStaParams->numSta)
1995 {
1996 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[0].addr,
1997 bssId,
1998 sizeof(tSirMacAddr));
1999 pMac->lim.protStaOverlapCache[0].active = true;
2000
2001 pStaParams->numSta = 1;
2002
2003 return;
2004 }
2005
2006 for (i=0; i<LIM_PROT_STA_OVERLAP_CACHE_SIZE; i++)
2007 {
2008 if (pMac->lim.protStaOverlapCache[i].active)
2009 {
2010 if (palEqualMemory( pMac->hHdd,pMac->lim.protStaOverlapCache[i].addr,
2011 bssId,
2012 sizeof(tSirMacAddr))) {
2013 return; }
2014 }
2015 else
2016 break;
2017 }
2018
2019 if (i == LIM_PROT_STA_OVERLAP_CACHE_SIZE)
2020 {
2021 PELOG1(limLog(pMac, LOG1, FL("Overlap cache is full\n"));)
2022 }
2023 else
2024 {
2025 palCopyMemory( pMac->hHdd, pMac->lim.protStaOverlapCache[i].addr,
2026 bssId,
2027 sizeof(tSirMacAddr));
2028 pMac->lim.protStaOverlapCache[i].active = true;
2029
2030 pStaParams->numSta++;
2031 }
2032}
2033
2034
2035/**
2036 * limHandleIBSScoalescing()
2037 *
2038 *FUNCTION:
2039 * This function is called upon receiving Beacon/Probe Response
2040 * while operating in IBSS mode.
2041 *
2042 *LOGIC:
2043 *
2044 *ASSUMPTIONS:
2045 *
2046 *NOTE:
2047 *
2048 * @param pMac - Pointer to Global MAC structure
2049 * @param pBeacon - Parsed Beacon Frame structure
2050 * @param pRxPacketInfo - Pointer to RX packet info structure
2051 *
2052 * @return Status whether to process or ignore received Beacon Frame
2053 */
2054
2055tSirRetStatus
2056limHandleIBSScoalescing(
2057 tpAniSirGlobal pMac,
2058 tpSchBeaconStruct pBeacon,
2059 tANI_U8 *pRxPacketInfo,tpPESession psessionEntry)
2060{
2061 tpSirMacMgmtHdr pHdr;
2062 tSirRetStatus retCode;
2063
2064 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
2065 if ( (!pBeacon->capabilityInfo.ibss) || (limCmpSSid(pMac, &pBeacon->ssId,psessionEntry) != true) )
2066 /* Received SSID does not match => Ignore received Beacon frame. */
2067 retCode = eSIR_LIM_IGNORE_BEACON;
2068 else
2069 {
2070 tANI_U32 ieLen;
2071 tANI_U16 tsfLater;
2072 tANI_U8 *pIEs;
2073 ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2074 tsfLater = WDA_GET_RX_TSF_LATER(pRxPacketInfo);
2075 pIEs = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2076 PELOG3(limLog(pMac, LOG3, FL("BEFORE Coalescing tsfLater val :%d"), tsfLater);)
2077 retCode = limIbssCoalesce(pMac, pHdr, pBeacon, pIEs, ieLen, tsfLater,psessionEntry);
2078 }
2079 return retCode;
2080} /*** end limHandleIBSScoalescing() ***/
2081
2082
2083
2084/**
2085 * limDetectChangeInApCapabilities()
2086 *
2087 *FUNCTION:
2088 * This function is called while SCH is processing
2089 * received Beacon from AP on STA to detect any
2090 * change in AP's capabilities. If there any change
2091 * is detected, Roaming is informed of such change
2092 * so that it can trigger reassociation.
2093 *
2094 *LOGIC:
2095 *
2096 *ASSUMPTIONS:
2097 *
2098 *NOTE:
2099 * Notification is enabled for STA product only since
2100 * it is not a requirement on BP side.
2101 *
2102 * @param pMac Pointer to Global MAC structure
2103 * @param pBeacon Pointer to parsed Beacon structure
2104 * @return None
2105 */
2106
2107void
2108limDetectChangeInApCapabilities(tpAniSirGlobal pMac,
2109 tpSirProbeRespBeacon pBeacon,
2110 tpPESession psessionEntry)
2111{
2112#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2113 tANI_U8 len;
2114 tSirSmeApNewCaps apNewCaps;
2115 tANI_U8 newChannel;
2116 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
2117 newChannel = (tANI_U8) pBeacon->channelNumber;
2118
2119 if ((psessionEntry->limSentCapsChangeNtf == false) &&
2120 (((!limIsNullSsid(&pBeacon->ssId)) && (limCmpSSid(pMac, &pBeacon->ssId, psessionEntry) == false)) ||
2121 ((SIR_MAC_GET_ESS(apNewCaps.capabilityInfo) != SIR_MAC_GET_ESS(psessionEntry->limCurrentBssCaps)) ||
2122 (SIR_MAC_GET_PRIVACY(apNewCaps.capabilityInfo) != SIR_MAC_GET_PRIVACY(psessionEntry->limCurrentBssCaps)) ||
2123 (SIR_MAC_GET_SHORT_PREAMBLE(apNewCaps.capabilityInfo) != SIR_MAC_GET_SHORT_PREAMBLE(psessionEntry->limCurrentBssCaps)) ||
2124 (SIR_MAC_GET_QOS(apNewCaps.capabilityInfo) != SIR_MAC_GET_QOS(psessionEntry->limCurrentBssCaps)) ||
2125 (newChannel != psessionEntry->currentOperChannel)
2126#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
2127 || (LIM_BSS_CAPS_GET(HCF, psessionEntry->limCurrentBssQosCaps) !=
2128 pBeacon->propIEinfo.hcfEnabled)
2129#endif
2130 )))
2131 {
2132
2133 /**
2134 * BSS capabilities have changed.
2135 * Inform Roaming.
2136 */
2137 len = sizeof(tSirMacCapabilityInfo) +
2138 sizeof(tSirMacAddr) + sizeof(tANI_U8) +
2139 3 * sizeof(tANI_U8) + // reserved fields
2140 pBeacon->ssId.length + 1;
2141
2142 palCopyMemory( pMac->hHdd, apNewCaps.bssId,
2143 psessionEntry->bssId,
2144 sizeof(tSirMacAddr));
2145 if (newChannel != psessionEntry->currentOperChannel)
2146 {
2147 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
2148 "Ignoring beacon!\n"),
2149 psessionEntry->currentOperChannel, newChannel);)
2150 return;
2151 }
2152 else
2153 apNewCaps.channelId = psessionEntry->currentOperChannel;
2154 palCopyMemory( pMac->hHdd, (tANI_U8 *) &apNewCaps.ssId,
2155 (tANI_U8 *) &pBeacon->ssId,
2156 pBeacon->ssId.length + 1);
2157
2158 psessionEntry->limSentCapsChangeNtf = true;
2159 limSendSmeWmStatusChangeNtf(pMac, eSIR_SME_AP_CAPS_CHANGED,
2160 (tANI_U32 *) &apNewCaps,
2161 len, psessionEntry->smeSessionId);
2162 }
2163#endif
2164} /*** limDetectChangeInApCapabilities() ***/
2165
2166
2167
2168
2169// ---------------------------------------------------------------------
2170/**
2171 * limUpdateShortSlot
2172 *
2173 * FUNCTION:
2174 * Enable/Disable short slot
2175 *
2176 * LOGIC:
2177 *
2178 * ASSUMPTIONS:
2179 *
2180 * NOTE:
2181 *
2182 * @param enable Flag to enable/disable short slot
2183 * @return None
2184 */
2185
2186tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeacon, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry)
2187{
2188
2189 tSirSmeApNewCaps apNewCaps;
Jeff Johnsone7245742012-09-05 17:12:55 -07002190 tANI_U32 nShortSlot;
2191 tANI_U32 val = 0;
2192 tANI_U32 phyMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002193
Jeff Johnsone7245742012-09-05 17:12:55 -07002194 // Check Admin mode first. If it is disabled just return
2195 if (wlan_cfgGetInt(pMac, WNI_CFG_11G_SHORT_SLOT_TIME_ENABLED, &val)
2196 != eSIR_SUCCESS)
2197 {
2198 limLog(pMac, LOGP,
2199 FL("cfg get WNI_CFG_11G_SHORT_SLOT_TIME failed\n"));
2200 return eSIR_FAILURE;
2201 }
2202 if (val == false)
2203 return eSIR_SUCCESS;
2204
2205 // Check for 11a mode or 11b mode. In both cases return since slot time is constant and cannot/should not change in beacon
2206 limGetPhyMode(pMac, &phyMode, psessionEntry);
2207 if ((phyMode == WNI_CFG_PHY_MODE_11A) || (phyMode == WNI_CFG_PHY_MODE_11B))
2208 return eSIR_SUCCESS;
2209
2210 apNewCaps.capabilityInfo = limGetU16((tANI_U8 *) &pBeacon->capabilityInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07002211
2212 // Earlier implementation: determine the appropriate short slot mode based on AP advertised modes
2213 // when erp is present, apply short slot always unless, prot=on && shortSlot=off
2214 // if no erp present, use short slot based on current ap caps
2215
2216 // Issue with earlier implementation : Cisco 1231 BG has shortSlot = 0, erpIEPresent and useProtection = 0 (Case4);
2217
2218 //Resolution : always use the shortSlot setting the capability info to decide slot time.
2219 // The difference between the earlier implementation and the new one is only Case4.
2220 /*
2221 ERP IE Present | useProtection | shortSlot = QC STA Short Slot
2222 Case1 1 1 1 1 //AP should not advertise this combination.
2223 Case2 1 1 0 0
2224 Case3 1 0 1 1
2225 Case4 1 0 0 0
2226 Case5 0 1 1 1
2227 Case6 0 1 0 0
2228 Case7 0 0 1 1
2229 Case8 0 0 0 0
2230 */
2231 nShortSlot = SIR_MAC_GET_SHORT_SLOT_TIME(apNewCaps.capabilityInfo);
2232
Jeff Johnsone7245742012-09-05 17:12:55 -07002233 if (nShortSlot != psessionEntry->shortSlotTimeSupported)
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
2235 // Short slot time capability of AP has changed. Adopt to it.
2236 PELOG1(limLog(pMac, LOG1, FL("Shortslot capability of AP changed: %d\n"), nShortSlot);)
2237 ((tpSirMacCapabilityInfo)&psessionEntry->limCurrentBssCaps)->shortSlotTime = (tANI_U16)nShortSlot;
Jeff Johnsone7245742012-09-05 17:12:55 -07002238 psessionEntry->shortSlotTimeSupported = nShortSlot;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 pBeaconParams->fShortSlotTime = (tANI_U8) nShortSlot;
2240 pBeaconParams->paramChangeBitmap |= PARAM_SHORT_SLOT_TIME_CHANGED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 }
2242 return eSIR_SUCCESS;
2243}
2244
2245
2246#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
2247
2248/**
2249 * limUpdateQuietIEInBeacons()
2250 *
2251 *FUNCTION:
2252 * This function is called by specialBeaconProcessing(),
2253 * when it is time to generate the next beacon.
2254 * If gLimQuietState is not in the INIT state, then it
2255 * means that the next beacon may need to include some
2256 * information about the Quiet BSS IE.
2257 * This function makes that decision based on the current
2258 * state of gLimQuietState
2259 *
2260 *LOGIC:
2261 * This routine invokes schSetFixedBeaconFields() only
2262 * if necessary, as it is expensive to update the fixed
2263 * beacon fields during each beacon interval.
2264 *
2265 *ASSUMPTIONS:
2266 * This Quiet BSS IE will be sent out as part of
2267 * Proprietary IE's. If 802.11H is enabled, this IE
2268 * will be sent out as defined in the 11H spec
2269 *
2270 *NOTE:
2271 *
2272 * @param pMac Pointer to Global MAC structure
2273 * @return true, if the beacon fields need updating
2274 * false, if not
2275 */
2276tANI_BOOLEAN limUpdateQuietIEInBeacons( tpAniSirGlobal pMac )
2277{
2278 tANI_BOOLEAN fUpdateBeaconFields = eANI_BOOLEAN_TRUE;
2279
2280 limLog( pMac, LOG2, FL("Quiet BSS State = %d\n"),
2281 pMac->lim.gLimSpecMgmt.quietState );
2282 switch( pMac->lim.gLimSpecMgmt.quietState )
2283 {
2284 case eLIM_QUIET_BEGIN:
2285 // We need to start broadcasting the Quiet BSS IE
2286 // Transition to eLIM_QUIET_RUNNING
2287 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_RUNNING;
2288 break;
2289
2290 case eLIM_QUIET_RUNNING:
2291 // Start down-counting...
2292 pMac->lim.gLimSpecMgmt.quietCount--;
2293 if( pMac->lim.gLimSpecMgmt.quietCount == 0 )
2294 {
2295 //
2296 // We no longer need to broadcast the Quiet BSS IE
2297 //
2298 // NOTE - We still need to call schSetFixedBeaconFields()
2299 // one last time, just to remove the Quiet BSS IE from
2300 // the list of fixed beacon fields
2301 //
2302 // Transition to eLIM_QUIET_END
2303 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
2304 limProcessLearnIntervalTimeout(pMac);
2305 }
2306 break;
2307
2308 case eLIM_QUIET_CHANGED:
2309 //
2310 // State possibly changed via setupQuietBss().
2311 // This means, gLimQuietCount has been changed!!
2312 //
2313 // NOTE - We still need to call schSetFixedBeaconFields()
2314 // one last time, just to remove the Quiet BSS IE from
2315 // the list of fixed beacon fields
2316 //
2317
2318 // Transition to eLIM_QUIET_END
2319 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_END;
2320 break;
2321
2322 case eLIM_QUIET_INIT:
2323 case eLIM_QUIET_END:
2324 // Transition to eLIM_QUIET_INIT
2325 pMac->lim.gLimSpecMgmt.quietState = eLIM_QUIET_INIT;
2326 // Fall thru'...
2327 default:
2328 fUpdateBeaconFields = eANI_BOOLEAN_FALSE;
2329 break;
2330 }
2331
2332 return fUpdateBeaconFields;
2333}
2334
2335#endif
2336
2337#if ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK))
2338void limConvertScanDuration(tpAniSirGlobal pMac)
2339{
2340 tpSirSmeMeasurementReq pMeasReq = pMac->lim.gpLimMeasReq;
2341 tpLimScanDurationConvert scanDurConv = &pMac->lim.gLimScanDurationConvert;
2342
2343 /* This is not a good idea to convert {long}shortChannelScanDuration from mS to TICKS *
2344 * The reason is that {long}shortChannelScanDuration is used all over and a lot of code *
2345 * that assumes the old mS definition was never changed to accommodate this new change to TICKS. *
2346 * If optimization is needed, create another set of shadow variables to store the converted *
2347 * values in Ticks, and TU. */
2348 scanDurConv->shortChannelScanDuration_tick =
2349 SYS_MS_TO_TICKS(pMeasReq->measDuration.shortChannelScanDuration +SYS_TICK_DUR_MS-1);
2350
2351 /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
2352 /* (shortChanneScanDuration * 1000) / 2^10 */
2353 scanDurConv->shortChannelScanDuration_TU = (pMeasReq->measDuration.shortChannelScanDuration * 1000) >> 10;
2354
2355 scanDurConv->longChannelScanDuration_tick =
2356 SYS_MS_TO_TICKS(pMeasReq->measDuration.longChannelScanDuration +SYS_TICK_DUR_MS-1);
2357
2358 /* convert shortChannelScanDuration to TU also for CB scan, used to set gLimQuietDuration */
2359 /* (longChanneScanDuration * 1000) / 2^10 */
2360 scanDurConv->longChannelScanDuration_TU = (pMeasReq->measDuration.longChannelScanDuration * 1000) >> 10;
2361}
2362#endif /* ((defined ANI_PRODUCT_TYPE_AP) && (defined ANI_AP_SDK)) */
2363
2364
2365#ifdef ANI_PRODUCT_TYPE_AP
2366/**-------------------------------------------------
2367\fn limIsRadarEnabled
2368
2369\brief Checks if radar is enabled
2370\param pMac
2371\return true - if Both 11h and radar enabled
2372 false - if either is not enabled.
2373 --------------------------------------------------*/
2374tANI_BOOLEAN limIsRadarEnabled(tpAniSirGlobal pMac)
2375{
2376 tANI_U32 fEnabled;
2377
2378 if(wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &fEnabled) != eSIR_SUCCESS)
2379 {
2380 limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
2381 return eANI_BOOLEAN_FALSE;
2382 }
2383
2384 if (!fEnabled)
2385 return eANI_BOOLEAN_FALSE;
2386
2387 if(wlan_cfgGetInt(pMac, WNI_CFG_RDET_FLAG, &fEnabled) != eSIR_SUCCESS)
2388 {
2389 limLog(pMac, LOGP, FL("HAL: could not retrieve radar config from CFG"));
2390 return eANI_BOOLEAN_FALSE;
2391 }
2392
2393 if (fEnabled)
2394 return eANI_BOOLEAN_TRUE;
2395
2396 return eANI_BOOLEAN_FALSE;
2397}
2398
2399/**---------------------------------------
2400\fn limRadarInit
2401\brief Initialize Radar Interrupt.
2402
2403\param pMac
2404\return None
2405 ----------------------------------------*/
2406void limRadarInit(tpAniSirGlobal pMac)
2407{
2408 tANI_U32 status;
2409 tSirMsgQ msg;
2410
2411 PELOG3(limLog(pMac, LOG3, FL("Radar Interrupt Already configured? %s\n"),
2412 pMac->lim.gLimSpecMgmt.fRadarIntrConfigured?"Yes":"No");)
2413 /** To avoid configuring the radar multiple times */
2414 if (pMac->lim.gLimSpecMgmt.fRadarIntrConfigured)
2415 return;
2416
2417 if (!limIsRadarEnabled(pMac))
2418 return;
2419 // Prepare and post message to HAL Message Queue
2420 msg.type = WDA_INIT_RADAR_IND;
2421 msg.bodyptr = NULL;
2422 msg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002423 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 status = wdaPostCtrlMsg(pMac, &msg);
2425 if (status != eHAL_STATUS_SUCCESS)
2426 {
2427 limLog(pMac, LOGP,
2428 FL("posting to HAL failed, reason=%d\n"), status);
2429 return;
2430 }
2431 pMac->lim.gLimSpecMgmt.fRadarIntrConfigured = eANI_BOOLEAN_TRUE;
2432} /****** end limRadarInit() ******/
2433
2434#endif
2435
2436
2437/** -----------------------------------------------------------------
2438 \brief limHandleLowRssiInd() - handles low rssi indication
2439
2440 This function process the SIR_HAL_LOW_RSSI_IND message from
2441 HAL, and sends a eWNI_SME_LOW_RSSI_IND to CSR.
2442
2443 \param pMac - global mac structure
2444
2445 \return
2446
2447 \sa
2448 ----------------------------------------------------------------- */
2449void limHandleLowRssiInd(tpAniSirGlobal pMac)
2450{
2451#if 0 //RSSI related indications will now go to TL and not PE
2452 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2453 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2454 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2455 {
2456 PELOG1(limLog(pMac, LOG1, FL("Sending LOW_RSSI_IND to SME \n"));)
2457 limSendSmeRsp(pMac, eWNI_SME_LOW_RSSI_IND, eSIR_SME_SUCCESS, 0, 0);
2458 }
2459 else
2460 {
2461 limLog(pMac, LOGE,
2462 FL("Received SIR_HAL_LOW_RSSI_IND while in incorrect state: %d\n"),
2463 pMac->pmm.gPmmState);
2464 }
2465 return;
2466#endif
2467}
2468
2469
2470/** -----------------------------------------------------------------
2471 \brief limHandleBmpsStatusInd() - handles BMPS status indication
2472
2473 This function process the SIR_HAL_BMPS_STATUS_IND message from HAL,
2474 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2475 to SME with reason code 'eSME_EXIT_BMPS_IND_RCVD'.
2476
2477 HAL sends this message when Firmware fails to enter BMPS mode 'AFTER'
2478 HAL had already send PE a SIR_HAL_ENTER_BMPS_RSP with status
2479 code "success". Hence, HAL needs to notify PE to get out of BMPS mode.
2480 This message can also come from FW anytime after we have entered BMPS.
2481 This means we should handle it in WoWL and UAPSD states as well
2482
2483 \param pMac - global mac structure
2484 \return - none
2485 \sa
2486 ----------------------------------------------------------------- */
2487void limHandleBmpsStatusInd(tpAniSirGlobal pMac)
2488{
2489 switch(pMac->pmm.gPmmState)
2490 {
2491 case ePMM_STATE_BMPS_SLEEP:
2492 case ePMM_STATE_UAPSD_WT_SLEEP_RSP:
2493 case ePMM_STATE_UAPSD_SLEEP:
2494 case ePMM_STATE_UAPSD_WT_WAKEUP_RSP:
2495 case ePMM_STATE_WOWLAN:
2496 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
2497 limSendExitBmpsInd(pMac, eSME_BMPS_STATUS_IND_RCVD);
2498 break;
2499
2500 default:
2501 limLog(pMac, LOGE,
2502 FL("Received SIR_HAL_BMPS_STATUS_IND while in incorrect state: %d\n"),
2503 pMac->pmm.gPmmState);
2504 break;
2505 }
2506 return;
2507}
2508
2509
2510/** -----------------------------------------------------------------
2511 \brief limHandleMissedBeaconInd() - handles missed beacon indication
2512
2513 This function process the SIR_HAL_MISSED_BEACON_IND message from HAL,
2514 and invokes limSendExitBmpsInd( ) to send an eWNI_PMC_EXIT_BMPS_IND
2515 to SME with reason code 'eSME_MISSED_BEACON_IND_RCVD'.
2516
2517 \param pMac - global mac structure
2518 \return - none
2519 \sa
2520 ----------------------------------------------------------------- */
2521void limHandleMissedBeaconInd(tpAniSirGlobal pMac)
2522{
2523 if ( (pMac->pmm.gPmmState == ePMM_STATE_BMPS_SLEEP) ||
2524 (pMac->pmm.gPmmState == ePMM_STATE_UAPSD_SLEEP)||
2525 (pMac->pmm.gPmmState == ePMM_STATE_WOWLAN) )
2526 {
2527 pMac->pmm.inMissedBeaconScenario = TRUE;
2528 PELOG1(limLog(pMac, LOG1, FL("Sending EXIT_BMPS_IND to SME \n"));)
2529 limSendExitBmpsInd(pMac, eSME_MISSED_BEACON_IND_RCVD);
2530 }
Yathish9f22e662012-12-10 14:21:35 -08002531/* ACTIVE_MODE_HB_OFFLOAD */
2532#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2533 else if(((pMac->pmm.gPmmState == ePMM_STATE_READY) ||
2534 (pMac->pmm.gPmmState == ePMM_STATE_BMPS_WAKEUP)) &&
2535 (IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
2536 {
2537 pMac->pmm.inMissedBeaconScenario = TRUE;
2538 PELOGE(limLog(pMac, LOGE, FL("Received Heart Beat Failure\n"));)
2539 limMissedBeaconInActiveMode(pMac);
2540 }
2541#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 else
2543 {
2544 limLog(pMac, LOGE,
2545 FL("Received SIR_HAL_MISSED_BEACON_IND while in incorrect state: %d\n"),
2546 pMac->pmm.gPmmState);
2547 }
2548 return;
2549}
2550
2551/** -----------------------------------------------------------------
2552 \brief limMicFailureInd() - handles mic failure indication
2553
2554 This function process the SIR_HAL_MIC_FAILURE_IND message from HAL,
2555
2556 \param pMac - global mac structure
2557 \return - none
2558 \sa
2559 ----------------------------------------------------------------- */
2560void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
2561{
2562 tpSirSmeMicFailureInd pSirSmeMicFailureInd;
2563 tpSirSmeMicFailureInd pSirMicFailureInd = (tpSirSmeMicFailureInd)pMsg->bodyptr;
2564 tSirMsgQ mmhMsg;
2565 tpPESession psessionEntry ;
2566 tANI_U8 sessionId;
2567
2568 if((psessionEntry = peFindSessionByBssid(pMac,pSirMicFailureInd->bssId,&sessionId))== NULL)
2569 {
2570 limLog(pMac, LOGE,
2571 FL("session does not exist for given BSSId\n"));
2572 return;
2573 }
2574
2575 if (eHAL_STATUS_SUCCESS !=
2576 palAllocateMemory(pMac->hHdd,
2577 (void **) &pSirSmeMicFailureInd,
2578 sizeof(tSirSmeMicFailureInd)))
2579 {
2580 // Log error
2581 limLog(pMac, LOGP,
2582 FL("memory allocate failed for eWNI_SME_MIC_FAILURE_IND\n"));
2583 return;
2584 }
2585
2586 pSirSmeMicFailureInd->messageType = eWNI_SME_MIC_FAILURE_IND;
2587 pSirSmeMicFailureInd->length = sizeof(pSirSmeMicFailureInd);
2588 pSirSmeMicFailureInd->sessionId = psessionEntry->smeSessionId;
2589
2590 vos_mem_copy(pSirSmeMicFailureInd->bssId,
2591 pSirMicFailureInd->bssId,
2592 sizeof(tSirMacAddr));
2593
2594 vos_mem_copy(pSirSmeMicFailureInd->info.srcMacAddr,
2595 pSirMicFailureInd->info.srcMacAddr,
2596 sizeof(tSirMacAddr));
2597
2598 vos_mem_copy(pSirSmeMicFailureInd->info.taMacAddr,
2599 pSirMicFailureInd->info.taMacAddr,
2600 sizeof(tSirMacAddr));
2601
2602 vos_mem_copy(pSirSmeMicFailureInd->info.dstMacAddr,
2603 pSirMicFailureInd->info.dstMacAddr,
2604 sizeof(tSirMacAddr));
2605
2606 vos_mem_copy(pSirSmeMicFailureInd->info.rxMacAddr,
2607 pSirMicFailureInd->info.rxMacAddr,
2608 sizeof(tSirMacAddr));
2609
2610 pSirSmeMicFailureInd->info.multicast =
2611 pSirMicFailureInd->info.multicast;
2612
2613 pSirSmeMicFailureInd->info.keyId=
2614 pSirMicFailureInd->info.keyId;
2615
2616 pSirSmeMicFailureInd->info.IV1=
2617 pSirMicFailureInd->info.IV1;
2618
2619 vos_mem_copy(pSirSmeMicFailureInd->info.TSC,
2620 pSirMicFailureInd->info.TSC,SIR_CIPHER_SEQ_CTR_SIZE);
2621
2622 mmhMsg.type = eWNI_SME_MIC_FAILURE_IND;
2623 mmhMsg.bodyptr = pSirSmeMicFailureInd;
2624 mmhMsg.bodyval = 0;
2625 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2626 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2627 return;
2628}
2629
2630
2631/** -----------------------------------------------------------------
2632 \brief limIsPktCandidateForDrop() - decides whether to drop the frame or not
2633
2634 This function is called before enqueuing the frame to PE queue for further processing.
2635 This prevents unnecessary frames getting into PE Queue and drops them right away.
2636 Frames will be droped in the following scenarios:
2637
2638 - In Scan State, drop the frames which are not marked as scan frames
2639 - In non-Scan state, drop the frames which are marked as scan frames.
2640 - Drop INFRA Beacons and Probe Responses in IBSS Mode
2641 - Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2642
2643 \param pMac - global mac structure
2644 \return - none
2645 \sa
2646 ----------------------------------------------------------------- */
2647
2648tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType)
2649{
2650 tANI_U32 framelen;
2651 tANI_U8 *pBody;
2652 tSirMacCapabilityInfo capabilityInfo;
2653
2654 /*
2655 *
2656 * In scan mode, drop only Beacon/Probe Response which are NOT marked as scan-frames.
2657 * In non-scan mode, drop only Beacon/Probe Response which are marked as scan frames.
2658 * Allow other mgmt frames, they must be from our own AP, as we don't allow
2659 * other than beacons or probe responses in scan state.
2660 */
2661 if( (subType == SIR_MAC_MGMT_BEACON) ||
2662 (subType == SIR_MAC_MGMT_PROBE_RSP))
2663 {
2664 if(pMac->pmm.inMissedBeaconScenario)
2665 {
Jeff Johnsonab79c8d2012-12-10 14:30:13 -08002666 PELOGE(limLog(pMac, LOGE, FL("Do not drop beacon and probe response - Missed beacon scenario"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 return eMGMT_DROP_NO_DROP;
2668 }
2669 if (limIsSystemInScanState(pMac))
2670 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002671 return eMGMT_DROP_NO_DROP;
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 }
2673 else if (WDA_IS_RX_IN_SCAN(pRxPacketInfo))
2674 {
2675 return eMGMT_DROP_SCAN_MODE_FRAME;
2676 }
2677 }
2678
2679 framelen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo);
2680 pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
2681
2682 /* Note sure if this is sufficient, basically this condition allows all probe responses and
2683 * beacons from an infrastructure network
2684 */
2685 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2686 if(!capabilityInfo.ibss)
2687 return eMGMT_DROP_NO_DROP;
2688#if 0
2689 //Allow the mgmt frames to be queued if STA not in IBSS mode.
2690 if (pMac->lim.gLimSystemRole != eLIM_STA_IN_IBSS_ROLE)
2691 return eMGMT_DROP_NO_DROP;
2692#endif
2693
2694 //Drop INFRA Beacons and Probe Responses in IBSS Mode
2695 if( (subType == SIR_MAC_MGMT_BEACON) ||
2696 (subType == SIR_MAC_MGMT_PROBE_RSP))
2697 {
2698 //drop the frame if length is less than 12
2699 if(framelen < LIM_MIN_BCN_PR_LENGTH)
2700 return eMGMT_DROP_INVALID_SIZE;
2701
2702 *((tANI_U16*) &capabilityInfo) = sirReadU16(pBody+ LIM_BCN_PR_CAPABILITY_OFFSET);
2703
2704 //This can be enhanced to even check the SSID before deciding to enque the frame.
2705 if(capabilityInfo.ess)
2706 return eMGMT_DROP_INFRA_BCN_IN_IBSS;
2707 }
2708 else if( (subType == SIR_MAC_MGMT_PROBE_REQ) &&
2709 (!WDA_GET_RX_BEACON_SENT(pRxPacketInfo)))
2710 {
2711 //Drop the Probe Request in IBSS mode, if STA did not send out the last beacon
2712 //In IBSS, the node which sends out the beacon, is supposed to respond to ProbeReq
2713 return eMGMT_DROP_NOT_LAST_IBSS_BCN;
2714 }
2715
2716 return eMGMT_DROP_NO_DROP;
2717}
2718
2719