blob: 3c853324e040b63af5e50e9e61c30cf454ebbe19 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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 Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
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 Johnson295189b2012-06-20 16:38:30 -070028/**=========================================================================
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 Yeturu5d5e2c62014-02-27 13:31:29 -080050#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
51#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070052#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
65void 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 Gopalachari72515da2013-07-11 11:14:27 +053079 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 Johnson295189b2012-06-20 16:38:30 -070086}
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 --------------------------------------------------------------------------*/
104tpPESession 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 Gopalachari72515da2013-07-11 11:14:27 +0530112 vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700113
114 //Allocate space for Station Table for this session.
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530115 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 Johnson295189b2012-06-20 16:38:30 -0700118 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700119 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700120 return NULL;
121 }
122
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530123 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 Johnson295189b2012-06-20 16:38:30 -0700126 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700127 limLog(pMac, LOGE, FL("memory allocate failed!"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530128 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800129 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 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 Gopalachari72515da2013-07-11 11:14:27 +0530137 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 Nakkala777e6032012-12-31 16:39:21 -0800140 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700141 PELOGE(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);
143 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800144 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
145 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800146 return NULL;
147 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530148 vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool,
149 sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800150 pMac->lim.gpSession[i].freePeerIdxHead = 0;
151 pMac->lim.gpSession[i].freePeerIdxTail = 0;
152 pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0;
153
Jeff Johnson295189b2012-06-20 16:38:30 -0700154 /* 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 Yeturu5d5e2c62014-02-27 13:31:29 -0800167#ifdef FEATURE_WLAN_ESE
168 pMac->lim.gpSession[i].isESEconnection = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700169#endif
170
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800171#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
173#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700174#ifdef FEATURE_WLAN_LFR
175 pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE;
176#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700177 *sessionId = i;
178
Jeff Johnsone7245742012-09-05 17:12:55 -0700179 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 Nakkala2a0a1572013-02-10 21:39:16 -0800184#ifdef FEATURE_WLAN_TDLS
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530185 vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap,
186 sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0);
Atul Mittalbceb4a12014-11-27 18:50:19 +0530187 pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800188#endif
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +0530189 pMac->lim.gpSession[i].fWaitForProbeRsp = 0;
190 pMac->lim.gpSession[i].fIgnoreCapsChange = 0;
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530191 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 Johnson295189b2012-06-20 16:38:30 -0700195 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 --------------------------------------------------------------------------*/
217tpPESession 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 Chirala3ca17902013-02-27 19:50:05 -0800238/*--------------------------------------------------------------------------
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 --------------------------------------------------------------------------*/
248tpPESession 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 Johnson295189b2012-06-20 16:38:30 -0700262
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 --------------------------------------------------------------------------*/
307tpPESession 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 Johnsone7245742012-09-05 17:12:55 -0700328 limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 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 --------------------------------------------------------------------------*/
343void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
344{
345 tANI_U16 i = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700346 tANI_U16 n;
347 TX_TIMER *timer_ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700348
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530349 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 Johnson295189b2012-06-20 16:38:30 -0700353
Jeff Johnsone7245742012-09-05 17:12:55 -0700354 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 Singh6d5d29c2014-07-03 14:25:22 +0530366
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 Johnson295189b2012-06-20 16:38:30 -0700379 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530380 vos_mem_free( psessionEntry->pLimStartBssReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 psessionEntry->pLimStartBssReq = NULL;
382 }
383
384 if(psessionEntry->pLimJoinReq != NULL)
385 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530386 vos_mem_free( psessionEntry->pLimJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 psessionEntry->pLimJoinReq = NULL;
388 }
389
390 if(psessionEntry->pLimReAssocReq != NULL)
391 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530392 vos_mem_free( psessionEntry->pLimReAssocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 psessionEntry->pLimReAssocReq = NULL;
394 }
395
396 if(psessionEntry->pLimMlmJoinReq != NULL)
397 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530398 vos_mem_free( psessionEntry->pLimMlmJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 psessionEntry->pLimMlmJoinReq = NULL;
400 }
401
402 if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
403 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530404 vos_mem_free(psessionEntry->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 psessionEntry->dph.dphHashTable.pHashTable = NULL;
406 }
407
408 if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
409 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530410 vos_mem_free(psessionEntry->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
412 }
413
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800414 if(psessionEntry->gpLimPeerIdxpool != NULL)
415 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530416 vos_mem_free(psessionEntry->gpLimPeerIdxpool);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800417 psessionEntry->gpLimPeerIdxpool = NULL;
418 }
419
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 if(psessionEntry->beacon != NULL)
421 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530422 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 psessionEntry->beacon = NULL;
424 }
425
426 if(psessionEntry->assocReq != NULL)
427 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530428 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 psessionEntry->assocReq = NULL;
430 }
431
432 if(psessionEntry->assocRsp != NULL)
433 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530434 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 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 Gopalachari72515da2013-07-11 11:14:27 +0530448 vos_mem_free(((tpSirAssocReq)
449 (psessionEntry->parsedAssocReq[i]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
451 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
452 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530453 vos_mem_free(psessionEntry->parsedAssocReq[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 psessionEntry->parsedAssocReq[i] = NULL;
455 }
456 }
457 // Cleanup the whole block
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530458 vos_mem_free(psessionEntry->parsedAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 psessionEntry->parsedAssocReq = NULL;
460 }
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800461 if (NULL != psessionEntry->limAssocResponseData)
462 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530463 vos_mem_free( psessionEntry->limAssocResponseData);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800464 psessionEntry->limAssocResponseData = NULL;
465 }
466
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800467#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800468 if (NULL != psessionEntry->pLimMlmReassocRetryReq)
469 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530470 vos_mem_free( psessionEntry->pLimMlmReassocRetryReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800471 psessionEntry->pLimMlmReassocRetryReq = NULL;
472 }
473#endif
474
475 if (NULL != psessionEntry->pLimMlmReassocReq)
476 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530477 vos_mem_free( psessionEntry->pLimMlmReassocReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800478 psessionEntry->pLimMlmReassocReq = NULL;
479 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700480
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800481#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
482 limCleanupEseCtxt(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700483#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
506tpPESession 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 Johnsone7245742012-09-05 17:12:55 -0700524
525 limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
526 limPrintMacAddr(pMac, sa, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 return NULL;
528}
529
530
531
532
533
534
535
536
537