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