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