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