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