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