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