Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Padma, Santhosh Kumar | 5a3054e | 2017-02-13 19:05:54 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2014, 2016-2017 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. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /**========================================================================= |
| 29 | |
| 30 | \file limSession.c |
| 31 | |
| 32 | \brief implementation for lim Session related APIs |
| 33 | |
| 34 | \author Sunit Bhatia |
| 35 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 36 | |
| 37 | ========================================================================*/ |
| 38 | |
| 39 | |
| 40 | /*-------------------------------------------------------------------------- |
| 41 | Include Files |
| 42 | ------------------------------------------------------------------------*/ |
| 43 | #include "aniGlobal.h" |
| 44 | #include "limDebug.h" |
| 45 | #include "limSession.h" |
| 46 | #include "limUtils.h" |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 47 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 48 | #include "eseApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 49 | #endif |
| 50 | |
| 51 | /*-------------------------------------------------------------------------- |
| 52 | |
| 53 | \brief peInitBeaconParams() - Initialize the beaconParams structure |
| 54 | |
| 55 | |
| 56 | \param tpPESession - pointer to the session context or NULL if session can not be created. |
| 57 | \return void |
| 58 | \sa |
| 59 | |
| 60 | --------------------------------------------------------------------------*/ |
| 61 | |
| 62 | void peInitBeaconParams(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 63 | { |
| 64 | psessionEntry->beaconParams.beaconInterval = 0; |
| 65 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 66 | psessionEntry->beaconParams.llaCoexist = 0; |
| 67 | psessionEntry->beaconParams.llbCoexist = 0; |
| 68 | psessionEntry->beaconParams.llgCoexist = 0; |
| 69 | psessionEntry->beaconParams.ht20Coexist = 0; |
| 70 | psessionEntry->beaconParams.llnNonGFCoexist = 0; |
| 71 | psessionEntry->beaconParams.fRIFSMode = 0; |
| 72 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = 0; |
| 73 | psessionEntry->beaconParams.gHTObssMode = 0; |
| 74 | |
| 75 | // Number of legacy STAs associated |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 76 | vos_mem_set((void*)&psessionEntry->gLim11bParams, sizeof(tLimProtStaParams), 0); |
| 77 | vos_mem_set((void*)&psessionEntry->gLim11aParams, sizeof(tLimProtStaParams), 0); |
| 78 | vos_mem_set((void*)&psessionEntry->gLim11gParams, sizeof(tLimProtStaParams), 0); |
| 79 | vos_mem_set((void*)&psessionEntry->gLimNonGfParams, sizeof(tLimProtStaParams), 0); |
| 80 | vos_mem_set((void*)&psessionEntry->gLimHt20Params, sizeof(tLimProtStaParams), 0); |
| 81 | vos_mem_set((void*)&psessionEntry->gLimLsigTxopParams, sizeof(tLimProtStaParams), 0); |
| 82 | vos_mem_set((void*)&psessionEntry->gLimOlbcParams, sizeof(tLimProtStaParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | /*-------------------------------------------------------------------------- |
| 86 | |
| 87 | \brief peCreateSession() - creates a new PE session given the BSSID |
| 88 | |
| 89 | This function returns the session context and the session ID if the session |
| 90 | corresponding to the passed BSSID is found in the PE session table. |
| 91 | |
| 92 | \param pMac - pointer to global adapter context |
| 93 | \param bssid - BSSID of the new session |
| 94 | \param sessionId -session ID is returned here, if session is created. |
| 95 | |
| 96 | \return tpPESession - pointer to the session context or NULL if session can not be created. |
| 97 | |
| 98 | \sa |
| 99 | |
| 100 | --------------------------------------------------------------------------*/ |
| 101 | tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta) |
| 102 | { |
| 103 | tANI_U8 i; |
| 104 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 105 | { |
| 106 | /* Find first free room in session table */ |
| 107 | if(pMac->lim.gpSession[i].valid == FALSE) |
| 108 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 109 | vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | |
| 111 | //Allocate space for Station Table for this session. |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 112 | pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_vmalloc( |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 113 | sizeof(tpDphHashNode)*numSta); |
| 114 | if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | { |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 116 | limLog(pMac, LOGE, FL("memory allocate for size %lu failed!"), |
| 117 | (long unsigned int) sizeof(tpDphHashNode)*numSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | return NULL; |
| 119 | } |
| 120 | |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 121 | pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_vmalloc( |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 122 | sizeof(tDphHashNode)*numSta); |
| 123 | if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | { |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 125 | limLog(pMac, LOGE, FL("memory allocate failed for Node array" |
| 126 | "of size %lu"), |
| 127 | (long unsigned int) sizeof(tDphHashNode)*numSta); |
| 128 | vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 129 | pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | return NULL; |
| 131 | } |
| 132 | pMac->lim.gpSession[i].dph.dphHashTable.size = numSta; |
| 133 | |
| 134 | dphHashTableClassInit(pMac, |
| 135 | &pMac->lim.gpSession[i].dph.dphHashTable); |
| 136 | |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 137 | pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_vmalloc(sizeof( |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 138 | *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); |
| 139 | if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool ) |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 140 | { |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 141 | limLog(pMac, LOGE, FL("memory allocate failed " |
| 142 | "for peerId pool of size %lu!"), (long unsigned int) |
| 143 | sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); |
| 144 | vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); |
| 145 | vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray); |
Leela Venkata Kiran Kumar Reddy Chirala | d6c0fe2 | 2013-12-11 19:10:50 -0800 | [diff] [blame] | 146 | pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; |
| 147 | pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL; |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 148 | return NULL; |
| 149 | } |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 150 | vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool, |
| 151 | sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 152 | pMac->lim.gpSession[i].freePeerIdxHead = 0; |
| 153 | pMac->lim.gpSession[i].freePeerIdxTail = 0; |
| 154 | pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0; |
| 155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | /* Copy the BSSID to the session table */ |
| 157 | sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid); |
| 158 | pMac->lim.gpSession[i].valid = TRUE; |
| 159 | |
| 160 | /* Intialize the SME and MLM states to IDLE */ |
| 161 | pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE; |
| 162 | pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE; |
| 163 | pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM; |
| 164 | peInitBeaconParams(pMac, &pMac->lim.gpSession[i]); |
| 165 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 166 | pMac->lim.gpSession[i].is11Rconnection = FALSE; |
| 167 | #endif |
| 168 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 169 | #ifdef FEATURE_WLAN_ESE |
| 170 | pMac->lim.gpSession[i].isESEconnection = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | #endif |
| 172 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 173 | #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE; |
| 175 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 176 | #ifdef FEATURE_WLAN_LFR |
| 177 | pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE; |
| 178 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 179 | *sessionId = i; |
| 180 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 181 | pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode |
| 182 | /* Initialize CB mode variables when session is created */ |
| 183 | pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0; |
| 184 | pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0; |
| 185 | pMac->lim.gpSession[i].htSecondaryChannelOffset = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 186 | #ifdef FEATURE_WLAN_TDLS |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 187 | vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap, |
| 188 | sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0); |
Atul Mittal | bceb4a1 | 2014-11-27 18:50:19 +0530 | [diff] [blame] | 189 | pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 190 | #endif |
Gopichand Nakkala | be8653b | 2013-04-10 08:16:05 +0530 | [diff] [blame] | 191 | pMac->lim.gpSession[i].fWaitForProbeRsp = 0; |
| 192 | pMac->lim.gpSession[i].fIgnoreCapsChange = 0; |
Abhishek Singh | 9c1262f | 2014-02-26 14:48:36 +0530 | [diff] [blame] | 193 | limLog(pMac, LOG1, FL("Create a new sessionId (%d) with BSSID: " |
| 194 | MAC_ADDRESS_STR " Max No. of STA %d"), |
| 195 | pMac->lim.gpSession[i].peSessionId, |
| 196 | MAC_ADDR_ARRAY(bssid), numSta); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | return(&pMac->lim.gpSession[i]); |
| 198 | } |
| 199 | } |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 200 | limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | return NULL; |
| 202 | } |
| 203 | |
| 204 | |
| 205 | /*-------------------------------------------------------------------------- |
| 206 | \brief peFindSessionByBssid() - looks up the PE session given the BSSID. |
| 207 | |
| 208 | This function returns the session context and the session ID if the session |
| 209 | corresponding to the given BSSID is found in the PE session table. |
| 210 | |
| 211 | \param pMac - pointer to global adapter context |
| 212 | \param bssid - BSSID of the session |
| 213 | \param sessionId -session ID is returned here, if session is found. |
| 214 | |
| 215 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 216 | |
| 217 | \sa |
| 218 | --------------------------------------------------------------------------*/ |
| 219 | tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId) |
| 220 | { |
| 221 | tANI_U8 i; |
| 222 | |
| 223 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 224 | { |
| 225 | /* If BSSID matches return corresponding tables address*/ |
| 226 | if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid))) |
| 227 | { |
| 228 | *sessionId = i; |
| 229 | return(&pMac->lim.gpSession[i]); |
| 230 | } |
| 231 | } |
| 232 | |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 233 | limLog(pMac, LOG4, FL("Session lookup fails for BSSID: ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 234 | limPrintMacAddr(pMac, bssid, LOG4); |
| 235 | return(NULL); |
| 236 | |
| 237 | } |
| 238 | |
Kapil Gupta | 7a3d9b1 | 2016-12-20 20:36:38 +0530 | [diff] [blame] | 239 | tANI_S8 limGetInfraSessionId(tpAniSirGlobal pMac) |
| 240 | { |
| 241 | tANI_U8 i; |
| 242 | for (i = 0; i < pMac->lim.maxBssId; i++) |
| 243 | { |
| 244 | if ((pMac->lim.gpSession[i].valid) && |
| 245 | (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE)) |
| 246 | { |
| 247 | return i; |
| 248 | } |
| 249 | } |
| 250 | limLog(pMac, LOG4, FL("Session lookup fails for infra mode")); |
| 251 | return -1; |
| 252 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 253 | |
Leela Venkata Kiran Kumar Reddy Chirala | 3ca1790 | 2013-02-27 19:50:05 -0800 | [diff] [blame] | 254 | /*-------------------------------------------------------------------------- |
| 255 | \brief peFindSessionByBssIdx() - looks up the PE session given the bssIdx. |
| 256 | |
| 257 | This function returns the session context if the session |
| 258 | corresponding to the given bssIdx is found in the PE session table. |
| 259 | \param pMac - pointer to global adapter context |
| 260 | \param bssIdx - bss index of the session |
| 261 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 262 | \sa |
| 263 | --------------------------------------------------------------------------*/ |
| 264 | tpPESession peFindSessionByBssIdx(tpAniSirGlobal pMac, tANI_U8 bssIdx) |
| 265 | { |
| 266 | tANI_U8 i; |
| 267 | for (i = 0; i < pMac->lim.maxBssId; i++) |
| 268 | { |
| 269 | /* If BSSID matches return corresponding tables address*/ |
| 270 | if ( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].bssIdx == bssIdx)) |
| 271 | { |
| 272 | return &pMac->lim.gpSession[i]; |
| 273 | } |
| 274 | } |
| 275 | limLog(pMac, LOG4, FL("Session lookup fails for bssIdx: %d"), bssIdx); |
| 276 | return NULL; |
| 277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | |
| 279 | /*-------------------------------------------------------------------------- |
| 280 | \brief peFindSessionBySessionId() - looks up the PE session given the session ID. |
| 281 | |
| 282 | This function returns the session context if the session |
| 283 | corresponding to the given session ID is found in the PE session table. |
| 284 | |
| 285 | \param pMac - pointer to global adapter context |
| 286 | \param sessionId -session ID for which session context needs to be looked up. |
| 287 | |
| 288 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 289 | |
| 290 | \sa |
| 291 | --------------------------------------------------------------------------*/ |
| 292 | tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId) |
| 293 | { |
| 294 | if(sessionId >= pMac->lim.maxBssId) |
| 295 | { |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 296 | limLog(pMac, LOGE, FL("Invalid sessionId: %d "), sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | return(NULL); |
| 298 | } |
| 299 | if((pMac->lim.gpSession[sessionId].valid == TRUE)) |
| 300 | { |
| 301 | return(&pMac->lim.gpSession[sessionId]); |
| 302 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 303 | return(NULL); |
| 304 | |
| 305 | } |
| 306 | |
| 307 | |
| 308 | /*-------------------------------------------------------------------------- |
| 309 | \brief peFindSessionByStaId() - looks up the PE session given staid. |
| 310 | |
| 311 | This function returns the session context and the session ID if the session |
| 312 | corresponding to the given StaId is found in the PE session table. |
| 313 | |
| 314 | \param pMac - pointer to global adapter context |
| 315 | \param staid - StaId of the session |
| 316 | \param sessionId -session ID is returned here, if session is found. |
| 317 | |
| 318 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 319 | |
| 320 | \sa |
| 321 | --------------------------------------------------------------------------*/ |
| 322 | tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId) |
| 323 | { |
| 324 | tANI_U8 i, j; |
| 325 | |
| 326 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 327 | { |
| 328 | if(pMac->lim.gpSession[i].valid) |
| 329 | { |
| 330 | for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++) |
| 331 | { |
| 332 | if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) && |
| 333 | (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) && |
| 334 | (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex)) |
| 335 | { |
| 336 | *sessionId = i; |
| 337 | return(&pMac->lim.gpSession[i]); |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 343 | limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 344 | return(NULL); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | |
| 349 | /*-------------------------------------------------------------------------- |
| 350 | \brief peDeleteSession() - deletes the PE session given the session ID. |
| 351 | |
| 352 | |
| 353 | \param pMac - pointer to global adapter context |
| 354 | \param sessionId -session ID of the session which needs to be deleted. |
| 355 | |
| 356 | \sa |
| 357 | --------------------------------------------------------------------------*/ |
| 358 | void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 359 | { |
| 360 | tANI_U16 i = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 361 | tANI_U16 n; |
| 362 | TX_TIMER *timer_ptr; |
Padma, Santhosh Kumar | be316c9 | 2015-09-14 18:29:55 +0530 | [diff] [blame] | 363 | eHalStatus lock_status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | |
Abhishek Singh | 9c1262f | 2014-02-26 14:48:36 +0530 | [diff] [blame] | 365 | limLog(pMac, LOGW, FL("Trying to delete a session %d Opmode %d BssIdx %d" |
| 366 | " BSSID: " MAC_ADDRESS_STR), psessionEntry->peSessionId, |
| 367 | psessionEntry->operMode, psessionEntry->bssIdx, |
| 368 | MAC_ADDR_ARRAY(psessionEntry->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 370 | for (n = 0; n < pMac->lim.maxStation; n++) |
| 371 | { |
| 372 | timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n]; |
| 373 | |
| 374 | if(psessionEntry->peSessionId == timer_ptr->sessionId) |
| 375 | { |
| 376 | if(VOS_TRUE == tx_timer_running(timer_ptr)) |
| 377 | { |
| 378 | tx_timer_deactivate(timer_ptr); |
| 379 | } |
| 380 | } |
| 381 | } |
Abhishek Singh | 6d5d29c | 2014-07-03 14:25:22 +0530 | [diff] [blame] | 382 | |
| 383 | #ifdef WLAN_FEATURE_11AC |
| 384 | |
| 385 | /* Unblock the MuBF for other session if the MuBf session is deleted |
| 386 | */ |
| 387 | if(psessionEntry->txMuBformee) |
| 388 | { |
| 389 | pMac->isMuBfsessionexist = FALSE; |
| 390 | } |
| 391 | |
| 392 | #endif |
| 393 | |
| 394 | if (psessionEntry->pLimStartBssReq != NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 396 | vos_mem_free( psessionEntry->pLimStartBssReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | psessionEntry->pLimStartBssReq = NULL; |
| 398 | } |
| 399 | |
| 400 | if(psessionEntry->pLimJoinReq != NULL) |
| 401 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 402 | vos_mem_free( psessionEntry->pLimJoinReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 403 | psessionEntry->pLimJoinReq = NULL; |
| 404 | } |
| 405 | |
| 406 | if(psessionEntry->pLimReAssocReq != NULL) |
| 407 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 408 | vos_mem_free( psessionEntry->pLimReAssocReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 409 | psessionEntry->pLimReAssocReq = NULL; |
| 410 | } |
| 411 | |
| 412 | if(psessionEntry->pLimMlmJoinReq != NULL) |
| 413 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 414 | vos_mem_free( psessionEntry->pLimMlmJoinReq ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 415 | psessionEntry->pLimMlmJoinReq = NULL; |
| 416 | } |
| 417 | |
Padma, Santhosh Kumar | be316c9 | 2015-09-14 18:29:55 +0530 | [diff] [blame] | 418 | lock_status = pe_AcquireGlobalLock(&pMac->lim); |
| 419 | if (eHAL_STATUS_SUCCESS == lock_status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 420 | { |
Padma, Santhosh Kumar | be316c9 | 2015-09-14 18:29:55 +0530 | [diff] [blame] | 421 | if (psessionEntry->dph.dphHashTable.pHashTable != NULL) |
| 422 | { |
| 423 | vos_mem_vfree(psessionEntry->dph.dphHashTable.pHashTable); |
| 424 | psessionEntry->dph.dphHashTable.pHashTable = NULL; |
| 425 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 426 | } |
Padma, Santhosh Kumar | be316c9 | 2015-09-14 18:29:55 +0530 | [diff] [blame] | 427 | pe_ReleaseGlobalLock(&pMac->lim); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 428 | |
| 429 | if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL) |
| 430 | { |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 431 | vos_mem_vfree(psessionEntry->dph.dphHashTable.pDphNodeArray); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | psessionEntry->dph.dphHashTable.pDphNodeArray = NULL; |
| 433 | } |
| 434 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 435 | if(psessionEntry->gpLimPeerIdxpool != NULL) |
| 436 | { |
Sushant Kaushik | e470a45 | 2015-04-07 15:37:56 +0530 | [diff] [blame] | 437 | vos_mem_vfree(psessionEntry->gpLimPeerIdxpool); |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 438 | psessionEntry->gpLimPeerIdxpool = NULL; |
| 439 | } |
| 440 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 441 | if(psessionEntry->beacon != NULL) |
| 442 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 443 | vos_mem_free( psessionEntry->beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 444 | psessionEntry->beacon = NULL; |
| 445 | } |
| 446 | |
| 447 | if(psessionEntry->assocReq != NULL) |
| 448 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 449 | vos_mem_free( psessionEntry->assocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 450 | psessionEntry->assocReq = NULL; |
| 451 | } |
| 452 | |
| 453 | if(psessionEntry->assocRsp != NULL) |
| 454 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 455 | vos_mem_free( psessionEntry->assocRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 456 | psessionEntry->assocRsp = NULL; |
| 457 | } |
| 458 | |
| 459 | |
| 460 | if(psessionEntry->parsedAssocReq != NULL) |
| 461 | { |
| 462 | // Cleanup the individual allocation first |
| 463 | for (i=0; i < psessionEntry->dph.dphHashTable.size; i++) |
| 464 | { |
| 465 | if ( psessionEntry->parsedAssocReq[i] != NULL ) |
| 466 | { |
| 467 | if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame ) |
| 468 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 469 | vos_mem_free(((tpSirAssocReq) |
| 470 | (psessionEntry->parsedAssocReq[i]))->assocReqFrame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 471 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL; |
| 472 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0; |
| 473 | } |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 474 | vos_mem_free(psessionEntry->parsedAssocReq[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | psessionEntry->parsedAssocReq[i] = NULL; |
| 476 | } |
| 477 | } |
| 478 | // Cleanup the whole block |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 479 | vos_mem_free(psessionEntry->parsedAssocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 480 | psessionEntry->parsedAssocReq = NULL; |
| 481 | } |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 482 | if (NULL != psessionEntry->limAssocResponseData) |
| 483 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 484 | vos_mem_free( psessionEntry->limAssocResponseData); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 485 | psessionEntry->limAssocResponseData = NULL; |
| 486 | } |
| 487 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 488 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 489 | if (NULL != psessionEntry->pLimMlmReassocRetryReq) |
| 490 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 491 | vos_mem_free( psessionEntry->pLimMlmReassocRetryReq); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 492 | psessionEntry->pLimMlmReassocRetryReq = NULL; |
| 493 | } |
| 494 | #endif |
| 495 | |
| 496 | if (NULL != psessionEntry->pLimMlmReassocReq) |
| 497 | { |
Bansidhar Gopalachari | 72515da | 2013-07-11 11:14:27 +0530 | [diff] [blame] | 498 | vos_mem_free( psessionEntry->pLimMlmReassocReq); |
Dhanashri Atre | e3a2a59 | 2013-03-08 13:18:42 -0800 | [diff] [blame] | 499 | psessionEntry->pLimMlmReassocReq = NULL; |
| 500 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 502 | #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) |
| 503 | limCleanupEseCtxt(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 504 | #endif |
| 505 | |
| 506 | psessionEntry->valid = FALSE; |
| 507 | return; |
| 508 | } |
| 509 | |
| 510 | |
| 511 | /*-------------------------------------------------------------------------- |
| 512 | \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address. |
| 513 | |
| 514 | This function returns the session context and the session ID if the session |
| 515 | corresponding to the given station address is found in the PE session table. |
| 516 | |
| 517 | \param pMac - pointer to global adapter context |
| 518 | \param sa - Peer STA Address of the session |
| 519 | \param sessionId -session ID is returned here, if session is found. |
| 520 | |
| 521 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 522 | |
| 523 | \sa |
| 524 | --------------------------------------------------------------------------*/ |
| 525 | |
| 526 | |
| 527 | tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId) |
| 528 | { |
| 529 | tANI_U8 i; |
| 530 | tpDphHashNode pSta; |
| 531 | tANI_U16 aid; |
| 532 | |
| 533 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 534 | { |
| 535 | if( (pMac->lim.gpSession[i].valid)) |
| 536 | { |
| 537 | pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable); |
| 538 | if (pSta != NULL) |
| 539 | { |
| 540 | *sessionId = i; |
| 541 | return &pMac->lim.gpSession[i]; |
| 542 | } |
| 543 | } |
| 544 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 545 | |
Sushant Kaushik | 8778797 | 2015-09-11 16:05:00 +0530 | [diff] [blame] | 546 | limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: ")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 547 | limPrintMacAddr(pMac, sa, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 548 | return NULL; |
| 549 | } |
| 550 | |
| 551 | |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | |
| 557 | |
| 558 | |