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