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