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