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 | |
| 42 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | /**========================================================================= |
| 44 | |
| 45 | \file limSession.c |
| 46 | |
| 47 | \brief implementation for lim Session related APIs |
| 48 | |
| 49 | \author Sunit Bhatia |
| 50 | |
| 51 | Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved. |
| 52 | |
| 53 | Qualcomm Confidential and Proprietary. |
| 54 | |
| 55 | ========================================================================*/ |
| 56 | |
| 57 | |
| 58 | /*-------------------------------------------------------------------------- |
| 59 | Include Files |
| 60 | ------------------------------------------------------------------------*/ |
| 61 | #include "aniGlobal.h" |
| 62 | #include "limDebug.h" |
| 63 | #include "limSession.h" |
| 64 | #include "limUtils.h" |
| 65 | #ifdef FEATURE_WLAN_CCX |
| 66 | #include "ccxApi.h" |
| 67 | #endif |
| 68 | |
| 69 | /*-------------------------------------------------------------------------- |
| 70 | |
| 71 | \brief peInitBeaconParams() - Initialize the beaconParams structure |
| 72 | |
| 73 | |
| 74 | \param tpPESession - pointer to the session context or NULL if session can not be created. |
| 75 | \return void |
| 76 | \sa |
| 77 | |
| 78 | --------------------------------------------------------------------------*/ |
| 79 | |
| 80 | void peInitBeaconParams(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 81 | { |
| 82 | psessionEntry->beaconParams.beaconInterval = 0; |
| 83 | psessionEntry->beaconParams.fShortPreamble = 0; |
| 84 | psessionEntry->beaconParams.llaCoexist = 0; |
| 85 | psessionEntry->beaconParams.llbCoexist = 0; |
| 86 | psessionEntry->beaconParams.llgCoexist = 0; |
| 87 | psessionEntry->beaconParams.ht20Coexist = 0; |
| 88 | psessionEntry->beaconParams.llnNonGFCoexist = 0; |
| 89 | psessionEntry->beaconParams.fRIFSMode = 0; |
| 90 | psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = 0; |
| 91 | psessionEntry->beaconParams.gHTObssMode = 0; |
| 92 | |
| 93 | // Number of legacy STAs associated |
| 94 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11bParams, sizeof(tLimProtStaParams)); |
| 95 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11aParams, sizeof(tLimProtStaParams)); |
| 96 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLim11gParams, sizeof(tLimProtStaParams)); |
| 97 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimNonGfParams, sizeof(tLimProtStaParams)); |
| 98 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimHt20Params, sizeof(tLimProtStaParams)); |
| 99 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimLsigTxopParams, sizeof(tLimProtStaParams)); |
| 100 | palZeroMemory(pMac->hHdd, (void*)&psessionEntry->gLimOlbcParams, sizeof(tLimProtStaParams)); |
| 101 | } |
| 102 | |
| 103 | /*-------------------------------------------------------------------------- |
| 104 | |
| 105 | \brief peCreateSession() - creates a new PE session given the BSSID |
| 106 | |
| 107 | This function returns the session context and the session ID if the session |
| 108 | corresponding to the passed BSSID is found in the PE session table. |
| 109 | |
| 110 | \param pMac - pointer to global adapter context |
| 111 | \param bssid - BSSID of the new session |
| 112 | \param sessionId -session ID is returned here, if session is created. |
| 113 | |
| 114 | \return tpPESession - pointer to the session context or NULL if session can not be created. |
| 115 | |
| 116 | \sa |
| 117 | |
| 118 | --------------------------------------------------------------------------*/ |
| 119 | tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta) |
| 120 | { |
| 121 | tANI_U8 i; |
| 122 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 123 | { |
| 124 | /* Find first free room in session table */ |
| 125 | if(pMac->lim.gpSession[i].valid == FALSE) |
| 126 | { |
| 127 | palZeroMemory(pMac, (void*)&pMac->lim.gpSession[i], sizeof(tPESession)); |
| 128 | |
| 129 | //Allocate space for Station Table for this session. |
| 130 | if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, |
| 131 | (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pHashTable, sizeof(tpDphHashNode)*numSta)) |
| 132 | { |
| 133 | limLog(pMac, LOGE, FL("memory allocate failed!\n")); |
| 134 | return NULL; |
| 135 | } |
| 136 | |
| 137 | if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, |
| 138 | (void **) &pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray, sizeof(tDphHashNode)*numSta)) |
| 139 | { |
| 140 | limLog(pMac, LOGE, FL("memory allocate failed!\n")); |
| 141 | palFreeMemory(pMac->hHdd,pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); |
| 142 | return NULL; |
| 143 | } |
| 144 | pMac->lim.gpSession[i].dph.dphHashTable.size = numSta; |
| 145 | |
| 146 | dphHashTableClassInit(pMac, |
| 147 | &pMac->lim.gpSession[i].dph.dphHashTable); |
| 148 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 149 | if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, |
| 150 | (void **) &pMac->lim.gpSession[i].gpLimPeerIdxpool, |
| 151 | sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1))) |
| 152 | { |
| 153 | PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!\n"));) |
| 154 | palFreeMemory(pMac->hHdd,pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); |
| 155 | palFreeMemory(pMac->hHdd,pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray); |
| 156 | return NULL; |
| 157 | } |
| 158 | palZeroMemory(pMac->hHdd, pMac->lim.gpSession[i].gpLimPeerIdxpool, |
| 159 | sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); |
| 160 | pMac->lim.gpSession[i].freePeerIdxHead = 0; |
| 161 | pMac->lim.gpSession[i].freePeerIdxTail = 0; |
| 162 | pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0; |
| 163 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 164 | /* Copy the BSSID to the session table */ |
| 165 | sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid); |
| 166 | pMac->lim.gpSession[i].valid = TRUE; |
| 167 | |
| 168 | /* Intialize the SME and MLM states to IDLE */ |
| 169 | pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE; |
| 170 | pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE; |
| 171 | pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM; |
| 172 | peInitBeaconParams(pMac, &pMac->lim.gpSession[i]); |
| 173 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 174 | pMac->lim.gpSession[i].is11Rconnection = FALSE; |
| 175 | #endif |
| 176 | |
| 177 | #ifdef FEATURE_WLAN_CCX |
| 178 | pMac->lim.gpSession[i].isCCXconnection = FALSE; |
| 179 | #endif |
| 180 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 181 | #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] | 182 | pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE; |
| 183 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 184 | #ifdef FEATURE_WLAN_LFR |
| 185 | pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE; |
| 186 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | *sessionId = i; |
| 188 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 189 | pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode |
| 190 | /* Initialize CB mode variables when session is created */ |
| 191 | pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0; |
| 192 | pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0; |
| 193 | pMac->lim.gpSession[i].htSecondaryChannelOffset = 0; |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame^] | 194 | #ifdef FEATURE_WLAN_TDLS |
| 195 | palZeroMemory(pMac->hHdd, pMac->lim.gpSession[i].peerAIDBitmap, |
| 196 | sizeof(pMac->lim.gpSession[i].peerAIDBitmap)); |
| 197 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | return(&pMac->lim.gpSession[i]); |
| 199 | } |
| 200 | } |
| 201 | limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n ")); |
| 202 | return NULL; |
| 203 | } |
| 204 | |
| 205 | |
| 206 | /*-------------------------------------------------------------------------- |
| 207 | \brief peFindSessionByBssid() - looks up the PE session given the BSSID. |
| 208 | |
| 209 | This function returns the session context and the session ID if the session |
| 210 | corresponding to the given BSSID is found in the PE session table. |
| 211 | |
| 212 | \param pMac - pointer to global adapter context |
| 213 | \param bssid - BSSID of the session |
| 214 | \param sessionId -session ID is returned here, if session is found. |
| 215 | |
| 216 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 217 | |
| 218 | \sa |
| 219 | --------------------------------------------------------------------------*/ |
| 220 | tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId) |
| 221 | { |
| 222 | tANI_U8 i; |
| 223 | |
| 224 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 225 | { |
| 226 | /* If BSSID matches return corresponding tables address*/ |
| 227 | if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid))) |
| 228 | { |
| 229 | *sessionId = i; |
| 230 | return(&pMac->lim.gpSession[i]); |
| 231 | } |
| 232 | } |
| 233 | |
| 234 | limLog(pMac, LOG4, FL("Session lookup fails for BSSID: \n ")); |
| 235 | limPrintMacAddr(pMac, bssid, LOG4); |
| 236 | return(NULL); |
| 237 | |
| 238 | } |
| 239 | |
| 240 | |
| 241 | |
| 242 | /*-------------------------------------------------------------------------- |
| 243 | \brief peFindSessionBySessionId() - looks up the PE session given the session ID. |
| 244 | |
| 245 | This function returns the session context if the session |
| 246 | corresponding to the given session ID is found in the PE session table. |
| 247 | |
| 248 | \param pMac - pointer to global adapter context |
| 249 | \param sessionId -session ID for which session context needs to be looked up. |
| 250 | |
| 251 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 252 | |
| 253 | \sa |
| 254 | --------------------------------------------------------------------------*/ |
| 255 | tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId) |
| 256 | { |
| 257 | if(sessionId >= pMac->lim.maxBssId) |
| 258 | { |
| 259 | limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId); |
| 260 | return(NULL); |
| 261 | } |
| 262 | if((pMac->lim.gpSession[sessionId].valid == TRUE)) |
| 263 | { |
| 264 | return(&pMac->lim.gpSession[sessionId]); |
| 265 | } |
| 266 | limLog(pMac, LOG1, FL("Session %d not active\n "), sessionId); |
| 267 | return(NULL); |
| 268 | |
| 269 | } |
| 270 | |
| 271 | |
| 272 | /*-------------------------------------------------------------------------- |
| 273 | \brief peFindSessionByStaId() - looks up the PE session given staid. |
| 274 | |
| 275 | This function returns the session context and the session ID if the session |
| 276 | corresponding to the given StaId is found in the PE session table. |
| 277 | |
| 278 | \param pMac - pointer to global adapter context |
| 279 | \param staid - StaId of the session |
| 280 | \param sessionId -session ID is returned here, if session is found. |
| 281 | |
| 282 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 283 | |
| 284 | \sa |
| 285 | --------------------------------------------------------------------------*/ |
| 286 | tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId) |
| 287 | { |
| 288 | tANI_U8 i, j; |
| 289 | |
| 290 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 291 | { |
| 292 | if(pMac->lim.gpSession[i].valid) |
| 293 | { |
| 294 | for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++) |
| 295 | { |
| 296 | if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) && |
| 297 | (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) && |
| 298 | (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex)) |
| 299 | { |
| 300 | *sessionId = i; |
| 301 | return(&pMac->lim.gpSession[i]); |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 307 | limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 308 | return(NULL); |
| 309 | } |
| 310 | |
| 311 | |
| 312 | |
| 313 | /*-------------------------------------------------------------------------- |
| 314 | \brief peDeleteSession() - deletes the PE session given the session ID. |
| 315 | |
| 316 | |
| 317 | \param pMac - pointer to global adapter context |
| 318 | \param sessionId -session ID of the session which needs to be deleted. |
| 319 | |
| 320 | \sa |
| 321 | --------------------------------------------------------------------------*/ |
| 322 | void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 323 | { |
| 324 | tANI_U16 i = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 325 | tANI_U16 n; |
| 326 | TX_TIMER *timer_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 327 | |
| 328 | limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId); |
| 329 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 330 | for (n = 0; n < pMac->lim.maxStation; n++) |
| 331 | { |
| 332 | timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n]; |
| 333 | |
| 334 | if(psessionEntry->peSessionId == timer_ptr->sessionId) |
| 335 | { |
| 336 | if(VOS_TRUE == tx_timer_running(timer_ptr)) |
| 337 | { |
| 338 | tx_timer_deactivate(timer_ptr); |
| 339 | } |
| 340 | } |
| 341 | } |
| 342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | if(psessionEntry->pLimStartBssReq != NULL) |
| 344 | { |
| 345 | palFreeMemory( pMac->hHdd, psessionEntry->pLimStartBssReq ); |
| 346 | psessionEntry->pLimStartBssReq = NULL; |
| 347 | } |
| 348 | |
| 349 | if(psessionEntry->pLimJoinReq != NULL) |
| 350 | { |
| 351 | palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq ); |
| 352 | psessionEntry->pLimJoinReq = NULL; |
| 353 | } |
| 354 | |
| 355 | if(psessionEntry->pLimReAssocReq != NULL) |
| 356 | { |
| 357 | palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq ); |
| 358 | psessionEntry->pLimReAssocReq = NULL; |
| 359 | } |
| 360 | |
| 361 | if(psessionEntry->pLimMlmJoinReq != NULL) |
| 362 | { |
| 363 | palFreeMemory( pMac->hHdd, psessionEntry->pLimMlmJoinReq ); |
| 364 | psessionEntry->pLimMlmJoinReq = NULL; |
| 365 | } |
| 366 | |
| 367 | if(psessionEntry->dph.dphHashTable.pHashTable != NULL) |
| 368 | { |
| 369 | palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pHashTable); |
| 370 | psessionEntry->dph.dphHashTable.pHashTable = NULL; |
| 371 | } |
| 372 | |
| 373 | if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL) |
| 374 | { |
| 375 | palFreeMemory(pMac->hHdd, psessionEntry->dph.dphHashTable.pDphNodeArray); |
| 376 | psessionEntry->dph.dphHashTable.pDphNodeArray = NULL; |
| 377 | } |
| 378 | |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 379 | if(psessionEntry->gpLimPeerIdxpool != NULL) |
| 380 | { |
| 381 | palFreeMemory(pMac->hHdd, psessionEntry->gpLimPeerIdxpool); |
| 382 | psessionEntry->gpLimPeerIdxpool = NULL; |
| 383 | } |
| 384 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | if(psessionEntry->beacon != NULL) |
| 386 | { |
| 387 | palFreeMemory( pMac->hHdd, psessionEntry->beacon); |
| 388 | psessionEntry->beacon = NULL; |
| 389 | } |
| 390 | |
| 391 | if(psessionEntry->assocReq != NULL) |
| 392 | { |
| 393 | palFreeMemory( pMac->hHdd, psessionEntry->assocReq); |
| 394 | psessionEntry->assocReq = NULL; |
| 395 | } |
| 396 | |
| 397 | if(psessionEntry->assocRsp != NULL) |
| 398 | { |
| 399 | palFreeMemory( pMac->hHdd, psessionEntry->assocRsp); |
| 400 | psessionEntry->assocRsp = NULL; |
| 401 | } |
| 402 | |
| 403 | |
| 404 | if(psessionEntry->parsedAssocReq != NULL) |
| 405 | { |
| 406 | // Cleanup the individual allocation first |
| 407 | for (i=0; i < psessionEntry->dph.dphHashTable.size; i++) |
| 408 | { |
| 409 | if ( psessionEntry->parsedAssocReq[i] != NULL ) |
| 410 | { |
| 411 | if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame ) |
| 412 | { |
| 413 | palFreeMemory(pMac->hHdd, |
| 414 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame); |
| 415 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL; |
| 416 | ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0; |
| 417 | } |
| 418 | palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq[i]); |
| 419 | psessionEntry->parsedAssocReq[i] = NULL; |
| 420 | } |
| 421 | } |
| 422 | // Cleanup the whole block |
| 423 | palFreeMemory(pMac->hHdd, (void *)psessionEntry->parsedAssocReq); |
| 424 | psessionEntry->parsedAssocReq = NULL; |
| 425 | } |
| 426 | |
| 427 | #ifdef FEATURE_WLAN_CCX |
| 428 | limCleanupCcxCtxt(pMac, psessionEntry); |
| 429 | #endif |
| 430 | |
| 431 | psessionEntry->valid = FALSE; |
| 432 | return; |
| 433 | } |
| 434 | |
| 435 | |
| 436 | /*-------------------------------------------------------------------------- |
| 437 | \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address. |
| 438 | |
| 439 | This function returns the session context and the session ID if the session |
| 440 | corresponding to the given station address is found in the PE session table. |
| 441 | |
| 442 | \param pMac - pointer to global adapter context |
| 443 | \param sa - Peer STA Address of the session |
| 444 | \param sessionId -session ID is returned here, if session is found. |
| 445 | |
| 446 | \return tpPESession - pointer to the session context or NULL if session is not found. |
| 447 | |
| 448 | \sa |
| 449 | --------------------------------------------------------------------------*/ |
| 450 | |
| 451 | |
| 452 | tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId) |
| 453 | { |
| 454 | tANI_U8 i; |
| 455 | tpDphHashNode pSta; |
| 456 | tANI_U16 aid; |
| 457 | |
| 458 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 459 | { |
| 460 | if( (pMac->lim.gpSession[i].valid)) |
| 461 | { |
| 462 | pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable); |
| 463 | if (pSta != NULL) |
| 464 | { |
| 465 | *sessionId = i; |
| 466 | return &pMac->lim.gpSession[i]; |
| 467 | } |
| 468 | } |
| 469 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 470 | |
| 471 | limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n ")); |
| 472 | limPrintMacAddr(pMac, sa, LOG1); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 473 | return NULL; |
| 474 | } |
| 475 | |
| 476 | |
| 477 | |
| 478 | |
| 479 | |
| 480 | |
| 481 | |
| 482 | |
| 483 | |