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