blob: 327c001faf8f20cabacac717d49bb77373b11d27 [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
Jeff Johnson295189b2012-06-20 16:38:30 -070036
37 ========================================================================*/
38
39
40/*--------------------------------------------------------------------------
41 Include Files
42 ------------------------------------------------------------------------*/
43#include "aniGlobal.h"
44#include "limDebug.h"
45#include "limSession.h"
46#include "limUtils.h"
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080047#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
48#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070049#endif
50
51/*--------------------------------------------------------------------------
52
53 \brief peInitBeaconParams() - Initialize the beaconParams structure
54
55
56 \param tpPESession - pointer to the session context or NULL if session can not be created.
57 \return void
58 \sa
59
60 --------------------------------------------------------------------------*/
61
62void peInitBeaconParams(tpAniSirGlobal pMac, tpPESession psessionEntry)
63{
64 psessionEntry->beaconParams.beaconInterval = 0;
65 psessionEntry->beaconParams.fShortPreamble = 0;
66 psessionEntry->beaconParams.llaCoexist = 0;
67 psessionEntry->beaconParams.llbCoexist = 0;
68 psessionEntry->beaconParams.llgCoexist = 0;
69 psessionEntry->beaconParams.ht20Coexist = 0;
70 psessionEntry->beaconParams.llnNonGFCoexist = 0;
71 psessionEntry->beaconParams.fRIFSMode = 0;
72 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = 0;
73 psessionEntry->beaconParams.gHTObssMode = 0;
74
75 // Number of legacy STAs associated
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +053076 vos_mem_set((void*)&psessionEntry->gLim11bParams, sizeof(tLimProtStaParams), 0);
77 vos_mem_set((void*)&psessionEntry->gLim11aParams, sizeof(tLimProtStaParams), 0);
78 vos_mem_set((void*)&psessionEntry->gLim11gParams, sizeof(tLimProtStaParams), 0);
79 vos_mem_set((void*)&psessionEntry->gLimNonGfParams, sizeof(tLimProtStaParams), 0);
80 vos_mem_set((void*)&psessionEntry->gLimHt20Params, sizeof(tLimProtStaParams), 0);
81 vos_mem_set((void*)&psessionEntry->gLimLsigTxopParams, sizeof(tLimProtStaParams), 0);
82 vos_mem_set((void*)&psessionEntry->gLimOlbcParams, sizeof(tLimProtStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -070083}
84
85/*--------------------------------------------------------------------------
86
87 \brief peCreateSession() - creates a new PE session given the BSSID
88
89 This function returns the session context and the session ID if the session
90 corresponding to the passed BSSID is found in the PE session table.
91
92 \param pMac - pointer to global adapter context
93 \param bssid - BSSID of the new session
94 \param sessionId -session ID is returned here, if session is created.
95
96 \return tpPESession - pointer to the session context or NULL if session can not be created.
97
98 \sa
99
100 --------------------------------------------------------------------------*/
101tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta)
102{
103 tANI_U8 i;
104 for(i =0; i < pMac->lim.maxBssId; i++)
105 {
106 /* Find first free room in session table */
107 if(pMac->lim.gpSession[i].valid == FALSE)
108 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530109 vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700110
111 //Allocate space for Station Table for this session.
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530112 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_malloc(
113 sizeof(tpDphHashNode)*numSta);
114 if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable )
Jeff Johnson295189b2012-06-20 16:38:30 -0700115 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700116 limLog(pMac, LOGE, FL("memory allocate failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 return NULL;
118 }
119
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530120 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_malloc(
121 sizeof(tDphHashNode)*numSta);
122 if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray )
Jeff Johnson295189b2012-06-20 16:38:30 -0700123 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700124 limLog(pMac, LOGE, FL("memory allocate failed!"));
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530125 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800126 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 return NULL;
128 }
129 pMac->lim.gpSession[i].dph.dphHashTable.size = numSta;
130
131 dphHashTableClassInit(pMac,
132 &pMac->lim.gpSession[i].dph.dphHashTable);
133
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530134 pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_malloc(sizeof(
135 *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
136 if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool )
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800137 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700138 PELOGE(limLog(pMac, LOGE, FL("memory allocate failed!"));)
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530139 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
140 vos_mem_free(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800141 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
142 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800143 return NULL;
144 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530145 vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool,
146 sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800147 pMac->lim.gpSession[i].freePeerIdxHead = 0;
148 pMac->lim.gpSession[i].freePeerIdxTail = 0;
149 pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0;
150
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 /* Copy the BSSID to the session table */
152 sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid);
153 pMac->lim.gpSession[i].valid = TRUE;
154
155 /* Intialize the SME and MLM states to IDLE */
156 pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE;
157 pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE;
158 pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM;
159 peInitBeaconParams(pMac, &pMac->lim.gpSession[i]);
160#ifdef WLAN_FEATURE_VOWIFI_11R
161 pMac->lim.gpSession[i].is11Rconnection = FALSE;
162#endif
163
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800164#ifdef FEATURE_WLAN_ESE
165 pMac->lim.gpSession[i].isESEconnection = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700166#endif
167
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800168#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700169 pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
170#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700171#ifdef FEATURE_WLAN_LFR
172 pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE;
173#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 *sessionId = i;
175
Jeff Johnsone7245742012-09-05 17:12:55 -0700176 pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
177 /* Initialize CB mode variables when session is created */
178 pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0;
179 pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0;
180 pMac->lim.gpSession[i].htSecondaryChannelOffset = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800181#ifdef FEATURE_WLAN_TDLS
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530182 vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap,
183 sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0);
Atul Mittalbceb4a12014-11-27 18:50:19 +0530184 pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800185#endif
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +0530186 pMac->lim.gpSession[i].fWaitForProbeRsp = 0;
187 pMac->lim.gpSession[i].fIgnoreCapsChange = 0;
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530188 limLog(pMac, LOG1, FL("Create a new sessionId (%d) with BSSID: "
189 MAC_ADDRESS_STR " Max No. of STA %d"),
190 pMac->lim.gpSession[i].peSessionId,
191 MAC_ADDR_ARRAY(bssid), numSta);
Jeff Johnson295189b2012-06-20 16:38:30 -0700192 return(&pMac->lim.gpSession[i]);
193 }
194 }
195 limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions \n "));
196 return NULL;
197}
198
199
200/*--------------------------------------------------------------------------
201 \brief peFindSessionByBssid() - looks up the PE session given the BSSID.
202
203 This function returns the session context and the session ID if the session
204 corresponding to the given BSSID is found in the PE session table.
205
206 \param pMac - pointer to global adapter context
207 \param bssid - BSSID of the session
208 \param sessionId -session ID is returned here, if session is found.
209
210 \return tpPESession - pointer to the session context or NULL if session is not found.
211
212 \sa
213 --------------------------------------------------------------------------*/
214tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId)
215{
216 tANI_U8 i;
217
218 for(i =0; i < pMac->lim.maxBssId; i++)
219 {
220 /* If BSSID matches return corresponding tables address*/
221 if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid)))
222 {
223 *sessionId = i;
224 return(&pMac->lim.gpSession[i]);
225 }
226 }
227
228 limLog(pMac, LOG4, FL("Session lookup fails for BSSID: \n "));
229 limPrintMacAddr(pMac, bssid, LOG4);
230 return(NULL);
231
232}
233
234
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -0800235/*--------------------------------------------------------------------------
236 \brief peFindSessionByBssIdx() - looks up the PE session given the bssIdx.
237
238 This function returns the session context if the session
239 corresponding to the given bssIdx is found in the PE session table.
240 \param pMac - pointer to global adapter context
241 \param bssIdx - bss index of the session
242 \return tpPESession - pointer to the session context or NULL if session is not found.
243 \sa
244 --------------------------------------------------------------------------*/
245tpPESession peFindSessionByBssIdx(tpAniSirGlobal pMac, tANI_U8 bssIdx)
246{
247 tANI_U8 i;
248 for (i = 0; i < pMac->lim.maxBssId; i++)
249 {
250 /* If BSSID matches return corresponding tables address*/
251 if ( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].bssIdx == bssIdx))
252 {
253 return &pMac->lim.gpSession[i];
254 }
255 }
256 limLog(pMac, LOG4, FL("Session lookup fails for bssIdx: %d"), bssIdx);
257 return NULL;
258}
Jeff Johnson295189b2012-06-20 16:38:30 -0700259
260/*--------------------------------------------------------------------------
261 \brief peFindSessionBySessionId() - looks up the PE session given the session ID.
262
263 This function returns the session context if the session
264 corresponding to the given session ID is found in the PE session table.
265
266 \param pMac - pointer to global adapter context
267 \param sessionId -session ID for which session context needs to be looked up.
268
269 \return tpPESession - pointer to the session context or NULL if session is not found.
270
271 \sa
272 --------------------------------------------------------------------------*/
273 tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId)
274{
275 if(sessionId >= pMac->lim.maxBssId)
276 {
277 limLog(pMac, LOGE, FL("Invalid sessionId: %d \n "), sessionId);
278 return(NULL);
279 }
280 if((pMac->lim.gpSession[sessionId].valid == TRUE))
281 {
282 return(&pMac->lim.gpSession[sessionId]);
283 }
284 limLog(pMac, LOG1, FL("Session %d not active\n "), sessionId);
285 return(NULL);
286
287}
288
289
290/*--------------------------------------------------------------------------
291 \brief peFindSessionByStaId() - looks up the PE session given staid.
292
293 This function returns the session context and the session ID if the session
294 corresponding to the given StaId is found in the PE session table.
295
296 \param pMac - pointer to global adapter context
297 \param staid - StaId of the session
298 \param sessionId -session ID is returned here, if session is found.
299
300 \return tpPESession - pointer to the session context or NULL if session is not found.
301
302 \sa
303 --------------------------------------------------------------------------*/
304tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId)
305{
306 tANI_U8 i, j;
307
308 for(i =0; i < pMac->lim.maxBssId; i++)
309 {
310 if(pMac->lim.gpSession[i].valid)
311 {
312 for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++)
313 {
314 if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) &&
315 (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) &&
316 (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex))
317 {
318 *sessionId = i;
319 return(&pMac->lim.gpSession[i]);
320 }
321 }
322 }
323 }
324
Jeff Johnsone7245742012-09-05 17:12:55 -0700325 limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 return(NULL);
327}
328
329
330
331/*--------------------------------------------------------------------------
332 \brief peDeleteSession() - deletes the PE session given the session ID.
333
334
335 \param pMac - pointer to global adapter context
336 \param sessionId -session ID of the session which needs to be deleted.
337
338 \sa
339 --------------------------------------------------------------------------*/
340void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
341{
342 tANI_U16 i = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700343 tANI_U16 n;
344 TX_TIMER *timer_ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700345
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530346 limLog(pMac, LOGW, FL("Trying to delete a session %d Opmode %d BssIdx %d"
347 " BSSID: " MAC_ADDRESS_STR), psessionEntry->peSessionId,
348 psessionEntry->operMode, psessionEntry->bssIdx,
349 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700350
Jeff Johnsone7245742012-09-05 17:12:55 -0700351 for (n = 0; n < pMac->lim.maxStation; n++)
352 {
353 timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];
354
355 if(psessionEntry->peSessionId == timer_ptr->sessionId)
356 {
357 if(VOS_TRUE == tx_timer_running(timer_ptr))
358 {
359 tx_timer_deactivate(timer_ptr);
360 }
361 }
362 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530363
364#ifdef WLAN_FEATURE_11AC
365
366 /* Unblock the MuBF for other session if the MuBf session is deleted
367 */
368 if(psessionEntry->txMuBformee)
369 {
370 pMac->isMuBfsessionexist = FALSE;
371 }
372
373#endif
374
375 if (psessionEntry->pLimStartBssReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530377 vos_mem_free( psessionEntry->pLimStartBssReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 psessionEntry->pLimStartBssReq = NULL;
379 }
380
381 if(psessionEntry->pLimJoinReq != NULL)
382 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530383 vos_mem_free( psessionEntry->pLimJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 psessionEntry->pLimJoinReq = NULL;
385 }
386
387 if(psessionEntry->pLimReAssocReq != NULL)
388 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530389 vos_mem_free( psessionEntry->pLimReAssocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 psessionEntry->pLimReAssocReq = NULL;
391 }
392
393 if(psessionEntry->pLimMlmJoinReq != NULL)
394 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530395 vos_mem_free( psessionEntry->pLimMlmJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 psessionEntry->pLimMlmJoinReq = NULL;
397 }
398
399 if(psessionEntry->dph.dphHashTable.pHashTable != NULL)
400 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530401 vos_mem_free(psessionEntry->dph.dphHashTable.pHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 psessionEntry->dph.dphHashTable.pHashTable = NULL;
403 }
404
405 if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
406 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530407 vos_mem_free(psessionEntry->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
409 }
410
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800411 if(psessionEntry->gpLimPeerIdxpool != NULL)
412 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530413 vos_mem_free(psessionEntry->gpLimPeerIdxpool);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800414 psessionEntry->gpLimPeerIdxpool = NULL;
415 }
416
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 if(psessionEntry->beacon != NULL)
418 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530419 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 psessionEntry->beacon = NULL;
421 }
422
423 if(psessionEntry->assocReq != NULL)
424 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530425 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 psessionEntry->assocReq = NULL;
427 }
428
429 if(psessionEntry->assocRsp != NULL)
430 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530431 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 psessionEntry->assocRsp = NULL;
433 }
434
435
436 if(psessionEntry->parsedAssocReq != NULL)
437 {
438 // Cleanup the individual allocation first
439 for (i=0; i < psessionEntry->dph.dphHashTable.size; i++)
440 {
441 if ( psessionEntry->parsedAssocReq[i] != NULL )
442 {
443 if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame )
444 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530445 vos_mem_free(((tpSirAssocReq)
446 (psessionEntry->parsedAssocReq[i]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
448 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
449 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530450 vos_mem_free(psessionEntry->parsedAssocReq[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 psessionEntry->parsedAssocReq[i] = NULL;
452 }
453 }
454 // Cleanup the whole block
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530455 vos_mem_free(psessionEntry->parsedAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 psessionEntry->parsedAssocReq = NULL;
457 }
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800458 if (NULL != psessionEntry->limAssocResponseData)
459 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530460 vos_mem_free( psessionEntry->limAssocResponseData);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800461 psessionEntry->limAssocResponseData = NULL;
462 }
463
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800464#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800465 if (NULL != psessionEntry->pLimMlmReassocRetryReq)
466 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530467 vos_mem_free( psessionEntry->pLimMlmReassocRetryReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800468 psessionEntry->pLimMlmReassocRetryReq = NULL;
469 }
470#endif
471
472 if (NULL != psessionEntry->pLimMlmReassocReq)
473 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530474 vos_mem_free( psessionEntry->pLimMlmReassocReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800475 psessionEntry->pLimMlmReassocReq = NULL;
476 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700477
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800478#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
479 limCleanupEseCtxt(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700480#endif
481
482 psessionEntry->valid = FALSE;
483 return;
484}
485
486
487/*--------------------------------------------------------------------------
488 \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address.
489
490 This function returns the session context and the session ID if the session
491 corresponding to the given station address is found in the PE session table.
492
493 \param pMac - pointer to global adapter context
494 \param sa - Peer STA Address of the session
495 \param sessionId -session ID is returned here, if session is found.
496
497 \return tpPESession - pointer to the session context or NULL if session is not found.
498
499 \sa
500 --------------------------------------------------------------------------*/
501
502
503tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId)
504{
505 tANI_U8 i;
506 tpDphHashNode pSta;
507 tANI_U16 aid;
508
509 for(i =0; i < pMac->lim.maxBssId; i++)
510 {
511 if( (pMac->lim.gpSession[i].valid))
512 {
513 pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable);
514 if (pSta != NULL)
515 {
516 *sessionId = i;
517 return &pMac->lim.gpSession[i];
518 }
519 }
520 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700521
522 limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: \n "));
523 limPrintMacAddr(pMac, sa, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 return NULL;
525}
526
527
528
529
530
531
532
533
534