blob: 1ca441f03c961d12174d601755f1d044ec5f9056 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * 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 Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
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 Johnson295189b2012-06-20 16:38:30 -070042/**=========================================================================
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"
64#ifdef FEATURE_WLAN_CCX
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
79void 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 Gopalachari72515da2013-07-11 11:14:27 +053093 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 Johnson295189b2012-06-20 16:38:30 -0700100}
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 --------------------------------------------------------------------------*/
118tpPESession 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 Gopalachari72515da2013-07-11 11:14:27 +0530126 vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700127
128 //Allocate space for Station Table for this session.
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530129 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 Johnson295189b2012-06-20 16:38:30 -0700132 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700133 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700134 return NULL;
135 }
136
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530137 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 Johnson295189b2012-06-20 16:38:30 -0700140 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700141 limLog(pMac, LOGE, FL("memory allocate failed!"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530142 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 return NULL;
144 }
145 pMac->lim.gpSession[i].dph.dphHashTable.size = numSta;
146
147 dphHashTableClassInit(pMac,
148 &pMac->lim.gpSession[i].dph.dphHashTable);
149
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530150 pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_malloc(sizeof(
151 *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
152 if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool )
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800153 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700154 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530155 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
156 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800157 return NULL;
158 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530159 vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool,
160 sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800161 pMac->lim.gpSession[i].freePeerIdxHead = 0;
162 pMac->lim.gpSession[i].freePeerIdxTail = 0;
163 pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0;
164
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 /* Copy the BSSID to the session table */
166 sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid);
167 pMac->lim.gpSession[i].valid = TRUE;
168
169 /* Intialize the SME and MLM states to IDLE */
170 pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE;
171 pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE;
172 pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM;
173 peInitBeaconParams(pMac, &pMac->lim.gpSession[i]);
174#ifdef WLAN_FEATURE_VOWIFI_11R
175 pMac->lim.gpSession[i].is11Rconnection = FALSE;
176#endif
177
178#ifdef FEATURE_WLAN_CCX
179 pMac->lim.gpSession[i].isCCXconnection = FALSE;
180#endif
181
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700182#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
184#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700185#ifdef FEATURE_WLAN_LFR
186 pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE;
187#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700188 *sessionId = i;
189
Jeff Johnsone7245742012-09-05 17:12:55 -0700190 pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
191 /* Initialize CB mode variables when session is created */
192 pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0;
193 pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0;
194 pMac->lim.gpSession[i].htSecondaryChannelOffset = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800195#ifdef FEATURE_WLAN_TDLS
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530196 vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap,
197 sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0);
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800198#endif
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +0530199 pMac->lim.gpSession[i].fWaitForProbeRsp = 0;
200 pMac->lim.gpSession[i].fIgnoreCapsChange = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 return(&pMac->lim.gpSession[i]);
202 }
203 }
204 limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n "));
205 return NULL;
206}
207
208
209/*--------------------------------------------------------------------------
210 \brief peFindSessionByBssid() - looks up the PE session given the BSSID.
211
212 This function returns the session context and the session ID if the session
213 corresponding to the given BSSID is found in the PE session table.
214
215 \param pMac - pointer to global adapter context
216 \param bssid - BSSID of the session
217 \param sessionId -session ID is returned here, if session is found.
218
219 \return tpPESession - pointer to the session context or NULL if session is not found.
220
221 \sa
222 --------------------------------------------------------------------------*/
223tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId)
224{
225 tANI_U8 i;
226
227 for(i =0; i < pMac->lim.maxBssId; i++)
228 {
229 /* If BSSID matches return corresponding tables address*/
230 if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid)))
231 {
232 *sessionId = i;
233 return(&pMac->lim.gpSession[i]);
234 }
235 }
236
237 limLog(pMac, LOG4, FL("Session lookup fails for BSSID: \n "));
238 limPrintMacAddr(pMac, bssid, LOG4);
239 return(NULL);
240
241}
242
243
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -0800244/*--------------------------------------------------------------------------
245 \brief peFindSessionByBssIdx() - looks up the PE session given the bssIdx.
246
247 This function returns the session context if the session
248 corresponding to the given bssIdx is found in the PE session table.
249 \param pMac - pointer to global adapter context
250 \param bssIdx - bss index of the session
251 \return tpPESession - pointer to the session context or NULL if session is not found.
252 \sa
253 --------------------------------------------------------------------------*/
254tpPESession peFindSessionByBssIdx(tpAniSirGlobal pMac, tANI_U8 bssIdx)
255{
256 tANI_U8 i;
257 for (i = 0; i < pMac->lim.maxBssId; i++)
258 {
259 /* If BSSID matches return corresponding tables address*/
260 if ( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].bssIdx == bssIdx))
261 {
262 return &pMac->lim.gpSession[i];
263 }
264 }
265 limLog(pMac, LOG4, FL("Session lookup fails for bssIdx: %d"), bssIdx);
266 return NULL;
267}
Jeff Johnson295189b2012-06-20 16:38:30 -0700268
269/*--------------------------------------------------------------------------
270 \brief peFindSessionBySessionId() - looks up the PE session given the session ID.
271
272 This function returns the session context if the session
273 corresponding to the given session ID is found in the PE session table.
274
275 \param pMac - pointer to global adapter context
276 \param sessionId -session ID for which session context needs to be looked up.
277
278 \return tpPESession - pointer to the session context or NULL if session is not found.
279
280 \sa
281 --------------------------------------------------------------------------*/
282 tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId)
283{
284 if(sessionId >= pMac->lim.maxBssId)
285 {
286 limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
287 return(NULL);
288 }
289 if((pMac->lim.gpSession[sessionId].valid == TRUE))
290 {
291 return(&pMac->lim.gpSession[sessionId]);
292 }
293 limLog(pMac, LOG1, FL("Session %d not active\n "), sessionId);
294 return(NULL);
295
296}
297
298
299/*--------------------------------------------------------------------------
300 \brief peFindSessionByStaId() - looks up the PE session given staid.
301
302 This function returns the session context and the session ID if the session
303 corresponding to the given StaId is found in the PE session table.
304
305 \param pMac - pointer to global adapter context
306 \param staid - StaId of the session
307 \param sessionId -session ID is returned here, if session is found.
308
309 \return tpPESession - pointer to the session context or NULL if session is not found.
310
311 \sa
312 --------------------------------------------------------------------------*/
313tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId)
314{
315 tANI_U8 i, j;
316
317 for(i =0; i < pMac->lim.maxBssId; i++)
318 {
319 if(pMac->lim.gpSession[i].valid)
320 {
321 for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++)
322 {
323 if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) &&
324 (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) &&
325 (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex))
326 {
327 *sessionId = i;
328 return(&pMac->lim.gpSession[i]);
329 }
330 }
331 }
332 }
333
Jeff Johnsone7245742012-09-05 17:12:55 -0700334 limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 return(NULL);
336}
337
338
339
340/*--------------------------------------------------------------------------
341 \brief peDeleteSession() - deletes the PE session given the session ID.
342
343
344 \param pMac - pointer to global adapter context
345 \param sessionId -session ID of the session which needs to be deleted.
346
347 \sa
348 --------------------------------------------------------------------------*/
349void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
350{
351 tANI_U16 i = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700352 tANI_U16 n;
353 TX_TIMER *timer_ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700354
355 limLog(pMac, LOGW, FL("Trying to delete a session %d.\n "), psessionEntry->peSessionId);
356
Jeff Johnsone7245742012-09-05 17:12:55 -0700357 for (n = 0; n < pMac->lim.maxStation; n++)
358 {
359 timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];
360
361 if(psessionEntry->peSessionId == timer_ptr->sessionId)
362 {
363 if(VOS_TRUE == tx_timer_running(timer_ptr))
364 {
365 tx_timer_deactivate(timer_ptr);
366 }
367 }
368 }
369
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 if(psessionEntry->pLimStartBssReq != NULL)
371 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530372 vos_mem_free( psessionEntry->pLimStartBssReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 psessionEntry->pLimStartBssReq = NULL;
374 }
375
376 if(psessionEntry->pLimJoinReq != NULL)
377 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530378 vos_mem_free( psessionEntry->pLimJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 psessionEntry->pLimJoinReq = NULL;
380 }
381
382 if(psessionEntry->pLimReAssocReq != NULL)
383 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530384 vos_mem_free( psessionEntry->pLimReAssocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 psessionEntry->pLimReAssocReq = NULL;
386 }
387
388 if(psessionEntry->pLimMlmJoinReq != NULL)
389 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530390 vos_mem_free( psessionEntry->pLimMlmJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 psessionEntry->pLimMlmJoinReq = NULL;
392 }
393
394 if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
395 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530396 vos_mem_free(psessionEntry->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 psessionEntry->dph.dphHashTable.pHashTable = NULL;
398 }
399
400 if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
401 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530402 vos_mem_free(psessionEntry->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
404 }
405
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800406 if(psessionEntry->gpLimPeerIdxpool != NULL)
407 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530408 vos_mem_free(psessionEntry->gpLimPeerIdxpool);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800409 psessionEntry->gpLimPeerIdxpool = NULL;
410 }
411
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 if(psessionEntry->beacon != NULL)
413 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530414 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 psessionEntry->beacon = NULL;
416 }
417
418 if(psessionEntry->assocReq != NULL)
419 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530420 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 psessionEntry->assocReq = NULL;
422 }
423
424 if(psessionEntry->assocRsp != NULL)
425 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530426 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 psessionEntry->assocRsp = NULL;
428 }
429
430
431 if(psessionEntry->parsedAssocReq != NULL)
432 {
433 // Cleanup the individual allocation first
434 for (i=0; i < psessionEntry->dph.dphHashTable.size; i++)
435 {
436 if ( psessionEntry->parsedAssocReq[i] != NULL )
437 {
438 if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame )
439 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530440 vos_mem_free(((tpSirAssocReq)
441 (psessionEntry->parsedAssocReq[i]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
443 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
444 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530445 vos_mem_free(psessionEntry->parsedAssocReq[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 psessionEntry->parsedAssocReq[i] = NULL;
447 }
448 }
449 // Cleanup the whole block
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530450 vos_mem_free(psessionEntry->parsedAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 psessionEntry->parsedAssocReq = NULL;
452 }
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800453 if (NULL != psessionEntry->limAssocResponseData)
454 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530455 vos_mem_free( psessionEntry->limAssocResponseData);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800456 psessionEntry->limAssocResponseData = NULL;
457 }
458
459#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
460 if (NULL != psessionEntry->pLimMlmReassocRetryReq)
461 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530462 vos_mem_free( psessionEntry->pLimMlmReassocRetryReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800463 psessionEntry->pLimMlmReassocRetryReq = NULL;
464 }
465#endif
466
467 if (NULL != psessionEntry->pLimMlmReassocReq)
468 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530469 vos_mem_free( psessionEntry->pLimMlmReassocReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800470 psessionEntry->pLimMlmReassocReq = NULL;
471 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700472
473#ifdef FEATURE_WLAN_CCX
474 limCleanupCcxCtxt(pMac, psessionEntry);
475#endif
476
477 psessionEntry->valid = FALSE;
478 return;
479}
480
481
482/*--------------------------------------------------------------------------
483 \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address.
484
485 This function returns the session context and the session ID if the session
486 corresponding to the given station address is found in the PE session table.
487
488 \param pMac - pointer to global adapter context
489 \param sa - Peer STA Address of the session
490 \param sessionId -session ID is returned here, if session is found.
491
492 \return tpPESession - pointer to the session context or NULL if session is not found.
493
494 \sa
495 --------------------------------------------------------------------------*/
496
497
498tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId)
499{
500 tANI_U8 i;
501 tpDphHashNode pSta;
502 tANI_U16 aid;
503
504 for(i =0; i < pMac->lim.maxBssId; i++)
505 {
506 if( (pMac->lim.gpSession[i].valid))
507 {
508 pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable);
509 if (pSta != NULL)
510 {
511 *sessionId = i;
512 return &pMac->lim.gpSession[i];
513 }
514 }
515 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700516
517 limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
518 limPrintMacAddr(pMac, sa, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 return NULL;
520}
521
522
523
524
525
526
527
528
529