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