blob: 299e151f786cc69d2a096761e4bd34bb66ecf587 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhinav Kumar8eed0362019-08-05 14:26:07 +05302 * Copyright (c) 2011-2014, 2016-2017, 2019 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.
Sushant Kaushike470a452015-04-07 15:37:56 +0530112 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_vmalloc(
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530113 sizeof(tpDphHashNode)*numSta);
114 if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable )
Jeff Johnson295189b2012-06-20 16:38:30 -0700115 {
Sushant Kaushike470a452015-04-07 15:37:56 +0530116 limLog(pMac, LOGE, FL("memory allocate for size %lu failed!"),
117 (long unsigned int) sizeof(tpDphHashNode)*numSta);
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 return NULL;
119 }
120
Sushant Kaushike470a452015-04-07 15:37:56 +0530121 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_vmalloc(
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530122 sizeof(tDphHashNode)*numSta);
123 if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray )
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 {
Sushant Kaushike470a452015-04-07 15:37:56 +0530125 limLog(pMac, LOGE, FL("memory allocate failed for Node array"
126 "of size %lu"),
127 (long unsigned int) sizeof(tDphHashNode)*numSta);
128 vos_mem_vfree(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
Sushant Kaushike470a452015-04-07 15:37:56 +0530137 pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_vmalloc(sizeof(
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530138 *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
139 if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool )
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800140 {
Sushant Kaushike470a452015-04-07 15:37:56 +0530141 limLog(pMac, LOGE, FL("memory allocate failed "
142 "for peerId pool of size %lu!"), (long unsigned int)
143 sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1));
144 vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable);
145 vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800146 pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL;
147 pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL;
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800148 return NULL;
149 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530150 vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool,
151 sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800152 pMac->lim.gpSession[i].freePeerIdxHead = 0;
153 pMac->lim.gpSession[i].freePeerIdxTail = 0;
154 pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0;
155
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 /* Copy the BSSID to the session table */
157 sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid);
158 pMac->lim.gpSession[i].valid = TRUE;
159
160 /* Intialize the SME and MLM states to IDLE */
161 pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE;
162 pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE;
163 pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM;
164 peInitBeaconParams(pMac, &pMac->lim.gpSession[i]);
165#ifdef WLAN_FEATURE_VOWIFI_11R
166 pMac->lim.gpSession[i].is11Rconnection = FALSE;
167#endif
168
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800169#ifdef FEATURE_WLAN_ESE
170 pMac->lim.gpSession[i].isESEconnection = FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700171#endif
172
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800173#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE;
175#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700176#ifdef FEATURE_WLAN_LFR
177 pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE;
178#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 *sessionId = i;
180
Jeff Johnsone7245742012-09-05 17:12:55 -0700181 pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode
182 /* Initialize CB mode variables when session is created */
183 pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0;
184 pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0;
185 pMac->lim.gpSession[i].htSecondaryChannelOffset = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800186#ifdef FEATURE_WLAN_TDLS
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530187 vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap,
188 sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0);
Atul Mittalbceb4a12014-11-27 18:50:19 +0530189 pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -0800190#endif
Gopichand Nakkalabe8653b2013-04-10 08:16:05 +0530191 pMac->lim.gpSession[i].fWaitForProbeRsp = 0;
192 pMac->lim.gpSession[i].fIgnoreCapsChange = 0;
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530193 limLog(pMac, LOG1, FL("Create a new sessionId (%d) with BSSID: "
194 MAC_ADDRESS_STR " Max No. of STA %d"),
195 pMac->lim.gpSession[i].peSessionId,
196 MAC_ADDR_ARRAY(bssid), numSta);
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 return(&pMac->lim.gpSession[i]);
198 }
199 }
Sushant Kaushik87787972015-09-11 16:05:00 +0530200 limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 return NULL;
202}
203
204
205/*--------------------------------------------------------------------------
206 \brief peFindSessionByBssid() - looks up the PE session given the BSSID.
207
208 This function returns the session context and the session ID if the session
209 corresponding to the given BSSID is found in the PE session table.
210
211 \param pMac - pointer to global adapter context
212 \param bssid - BSSID of the session
213 \param sessionId -session ID is returned here, if session is found.
214
215 \return tpPESession - pointer to the session context or NULL if session is not found.
216
217 \sa
218 --------------------------------------------------------------------------*/
219tpPESession peFindSessionByBssid(tpAniSirGlobal pMac, tANI_U8* bssid, tANI_U8* sessionId)
220{
221 tANI_U8 i;
222
223 for(i =0; i < pMac->lim.maxBssId; i++)
224 {
225 /* If BSSID matches return corresponding tables address*/
226 if( (pMac->lim.gpSession[i].valid) && (sirCompareMacAddr(pMac->lim.gpSession[i].bssId, bssid)))
227 {
228 *sessionId = i;
229 return(&pMac->lim.gpSession[i]);
230 }
231 }
232
Sushant Kaushik87787972015-09-11 16:05:00 +0530233 limLog(pMac, LOG4, FL("Session lookup fails for BSSID: "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 limPrintMacAddr(pMac, bssid, LOG4);
235 return(NULL);
236
237}
238
Kapil Gupta7a3d9b12016-12-20 20:36:38 +0530239tANI_S8 limGetInfraSessionId(tpAniSirGlobal pMac)
240{
241 tANI_U8 i;
242 for (i = 0; i < pMac->lim.maxBssId; i++)
243 {
244 if ((pMac->lim.gpSession[i].valid) &&
245 (pMac->lim.gpSession[i].limSystemRole == eLIM_STA_ROLE))
246 {
247 return i;
248 }
249 }
250 limLog(pMac, LOG4, FL("Session lookup fails for infra mode"));
251 return -1;
252}
Jeff Johnson295189b2012-06-20 16:38:30 -0700253
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -0800254/*--------------------------------------------------------------------------
255 \brief peFindSessionByBssIdx() - looks up the PE session given the bssIdx.
256
257 This function returns the session context if the session
258 corresponding to the given bssIdx is found in the PE session table.
259 \param pMac - pointer to global adapter context
260 \param bssIdx - bss index of the session
261 \return tpPESession - pointer to the session context or NULL if session is not found.
262 \sa
263 --------------------------------------------------------------------------*/
264tpPESession peFindSessionByBssIdx(tpAniSirGlobal pMac, tANI_U8 bssIdx)
265{
266 tANI_U8 i;
267 for (i = 0; i < pMac->lim.maxBssId; i++)
268 {
269 /* If BSSID matches return corresponding tables address*/
270 if ( (pMac->lim.gpSession[i].valid) && (pMac->lim.gpSession[i].bssIdx == bssIdx))
271 {
272 return &pMac->lim.gpSession[i];
273 }
274 }
275 limLog(pMac, LOG4, FL("Session lookup fails for bssIdx: %d"), bssIdx);
276 return NULL;
277}
Jeff Johnson295189b2012-06-20 16:38:30 -0700278
Abhinav Kumar8eed0362019-08-05 14:26:07 +0530279tpPESession pe_find_session_by_sme_session_id(tpAniSirGlobal mac_ctx,
280 tANI_U8 sme_session_id)
281{
282 uint8_t i;
283
284 for (i = 0; i < mac_ctx->lim.maxBssId; i++) {
285 if ((mac_ctx->lim.gpSession[i].valid) &&
286 (mac_ctx->lim.gpSession[i].smeSessionId == sme_session_id))
287 return &mac_ctx->lim.gpSession[i];
288 }
289 limLog(mac_ctx, LOG4, FL("Session lookup fails for smeSessionID: %d"),
290 sme_session_id);
291
292 return NULL;
293}
294
Jeff Johnson295189b2012-06-20 16:38:30 -0700295/*--------------------------------------------------------------------------
296 \brief peFindSessionBySessionId() - looks up the PE session given the session ID.
297
298 This function returns the session context if the session
299 corresponding to the given session ID is found in the PE session table.
300
301 \param pMac - pointer to global adapter context
302 \param sessionId -session ID for which session context needs to be looked up.
303
304 \return tpPESession - pointer to the session context or NULL if session is not found.
305
306 \sa
307 --------------------------------------------------------------------------*/
308 tpPESession peFindSessionBySessionId(tpAniSirGlobal pMac , tANI_U8 sessionId)
309{
310 if(sessionId >= pMac->lim.maxBssId)
311 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530312 limLog(pMac, LOGE, FL("Invalid sessionId: %d "), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700313 return(NULL);
314 }
315 if((pMac->lim.gpSession[sessionId].valid == TRUE))
316 {
317 return(&pMac->lim.gpSession[sessionId]);
318 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 return(NULL);
320
321}
322
323
324/*--------------------------------------------------------------------------
325 \brief peFindSessionByStaId() - looks up the PE session given staid.
326
327 This function returns the session context and the session ID if the session
328 corresponding to the given StaId is found in the PE session table.
329
330 \param pMac - pointer to global adapter context
331 \param staid - StaId of the session
332 \param sessionId -session ID is returned here, if session is found.
333
334 \return tpPESession - pointer to the session context or NULL if session is not found.
335
336 \sa
337 --------------------------------------------------------------------------*/
338tpPESession peFindSessionByStaId(tpAniSirGlobal pMac, tANI_U8 staid, tANI_U8* sessionId)
339{
340 tANI_U8 i, j;
341
342 for(i =0; i < pMac->lim.maxBssId; i++)
343 {
344 if(pMac->lim.gpSession[i].valid)
345 {
346 for(j = 0; j < pMac->lim.gpSession[i].dph.dphHashTable.size; j++)
347 {
348 if((pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].valid) &&
349 (pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].added) &&
350 (staid == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray[j].staIndex))
351 {
352 *sessionId = i;
353 return(&pMac->lim.gpSession[i]);
354 }
355 }
356 }
357 }
358
Jeff Johnsone7245742012-09-05 17:12:55 -0700359 limLog(pMac, LOG4, FL("Session lookup fails for StaId: %d\n "), staid);
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 return(NULL);
361}
362
363
364
365/*--------------------------------------------------------------------------
366 \brief peDeleteSession() - deletes the PE session given the session ID.
367
368
369 \param pMac - pointer to global adapter context
370 \param sessionId -session ID of the session which needs to be deleted.
371
372 \sa
373 --------------------------------------------------------------------------*/
374void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
375{
376 tANI_U16 i = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700377 tANI_U16 n;
378 TX_TIMER *timer_ptr;
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +0530379 eHalStatus lock_status = eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700380
Abhishek Singh9c1262f2014-02-26 14:48:36 +0530381 limLog(pMac, LOGW, FL("Trying to delete a session %d Opmode %d BssIdx %d"
382 " BSSID: " MAC_ADDRESS_STR), psessionEntry->peSessionId,
383 psessionEntry->operMode, psessionEntry->bssIdx,
384 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700385
Surabhi Vishnoic5cfde02020-07-24 17:00:47 +0530386 if (psessionEntry->gLimSpecMgmt.dfs_channel_csa) {
387 limFrameTransmissionControl(pMac, eLIM_TX_ALL, eLIM_RESUME_TX);
388 psessionEntry->gLimSpecMgmt.dfs_channel_csa = false;
389 }
390
Jeff Johnsone7245742012-09-05 17:12:55 -0700391 for (n = 0; n < pMac->lim.maxStation; n++)
392 {
393 timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n];
394
395 if(psessionEntry->peSessionId == timer_ptr->sessionId)
396 {
397 if(VOS_TRUE == tx_timer_running(timer_ptr))
398 {
399 tx_timer_deactivate(timer_ptr);
400 }
401 }
402 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530403
404#ifdef WLAN_FEATURE_11AC
405
406 /* Unblock the MuBF for other session if the MuBf session is deleted
407 */
408 if(psessionEntry->txMuBformee)
409 {
410 pMac->isMuBfsessionexist = FALSE;
411 }
412
413#endif
414
415 if (psessionEntry->pLimStartBssReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530417 vos_mem_free( psessionEntry->pLimStartBssReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 psessionEntry->pLimStartBssReq = NULL;
419 }
420
421 if(psessionEntry->pLimJoinReq != NULL)
422 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530423 vos_mem_free( psessionEntry->pLimJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 psessionEntry->pLimJoinReq = NULL;
425 }
426
427 if(psessionEntry->pLimReAssocReq != NULL)
428 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530429 vos_mem_free( psessionEntry->pLimReAssocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 psessionEntry->pLimReAssocReq = NULL;
431 }
432
433 if(psessionEntry->pLimMlmJoinReq != NULL)
434 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530435 vos_mem_free( psessionEntry->pLimMlmJoinReq );
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 psessionEntry->pLimMlmJoinReq = NULL;
437 }
438
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +0530439 lock_status = pe_AcquireGlobalLock(&pMac->lim);
440 if (eHAL_STATUS_SUCCESS == lock_status)
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 {
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +0530442 if (psessionEntry->dph.dphHashTable.pHashTable != NULL)
443 {
444 vos_mem_vfree(psessionEntry->dph.dphHashTable.pHashTable);
445 psessionEntry->dph.dphHashTable.pHashTable = NULL;
446 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 }
Padma, Santhosh Kumarbe316c92015-09-14 18:29:55 +0530448 pe_ReleaseGlobalLock(&pMac->lim);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
450 if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL)
451 {
Sushant Kaushike470a452015-04-07 15:37:56 +0530452 vos_mem_vfree(psessionEntry->dph.dphHashTable.pDphNodeArray);
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 psessionEntry->dph.dphHashTable.pDphNodeArray = NULL;
454 }
455
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800456 if(psessionEntry->gpLimPeerIdxpool != NULL)
457 {
Sushant Kaushike470a452015-04-07 15:37:56 +0530458 vos_mem_vfree(psessionEntry->gpLimPeerIdxpool);
Gopichand Nakkala777e6032012-12-31 16:39:21 -0800459 psessionEntry->gpLimPeerIdxpool = NULL;
460 }
461
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 if(psessionEntry->beacon != NULL)
463 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530464 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 psessionEntry->beacon = NULL;
466 }
467
468 if(psessionEntry->assocReq != NULL)
469 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530470 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 psessionEntry->assocReq = NULL;
472 }
473
474 if(psessionEntry->assocRsp != NULL)
475 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530476 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 psessionEntry->assocRsp = NULL;
478 }
479
480
481 if(psessionEntry->parsedAssocReq != NULL)
482 {
483 // Cleanup the individual allocation first
484 for (i=0; i < psessionEntry->dph.dphHashTable.size; i++)
485 {
486 if ( psessionEntry->parsedAssocReq[i] != NULL )
487 {
488 if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame )
489 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530490 vos_mem_free(((tpSirAssocReq)
491 (psessionEntry->parsedAssocReq[i]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL;
493 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0;
494 }
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530495 vos_mem_free(psessionEntry->parsedAssocReq[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 psessionEntry->parsedAssocReq[i] = NULL;
497 }
498 }
499 // Cleanup the whole block
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530500 vos_mem_free(psessionEntry->parsedAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 psessionEntry->parsedAssocReq = NULL;
502 }
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800503 if (NULL != psessionEntry->limAssocResponseData)
504 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530505 vos_mem_free( psessionEntry->limAssocResponseData);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800506 psessionEntry->limAssocResponseData = NULL;
507 }
508
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800509#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800510 if (NULL != psessionEntry->pLimMlmReassocRetryReq)
511 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530512 vos_mem_free( psessionEntry->pLimMlmReassocRetryReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800513 psessionEntry->pLimMlmReassocRetryReq = NULL;
514 }
515#endif
516
517 if (NULL != psessionEntry->pLimMlmReassocReq)
518 {
Bansidhar Gopalachari72515da2013-07-11 11:14:27 +0530519 vos_mem_free( psessionEntry->pLimMlmReassocReq);
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800520 psessionEntry->pLimMlmReassocReq = NULL;
521 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700522
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800523#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
524 limCleanupEseCtxt(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700525#endif
526
527 psessionEntry->valid = FALSE;
528 return;
529}
530
531
532/*--------------------------------------------------------------------------
533 \brief peFindSessionByPeerSta() - looks up the PE session given the Station Address.
534
535 This function returns the session context and the session ID if the session
536 corresponding to the given station address is found in the PE session table.
537
538 \param pMac - pointer to global adapter context
539 \param sa - Peer STA Address of the session
540 \param sessionId -session ID is returned here, if session is found.
541
542 \return tpPESession - pointer to the session context or NULL if session is not found.
543
544 \sa
545 --------------------------------------------------------------------------*/
546
547
548tpPESession peFindSessionByPeerSta(tpAniSirGlobal pMac, tANI_U8* sa, tANI_U8* sessionId)
549{
550 tANI_U8 i;
551 tpDphHashNode pSta;
552 tANI_U16 aid;
553
554 for(i =0; i < pMac->lim.maxBssId; i++)
555 {
556 if( (pMac->lim.gpSession[i].valid))
557 {
558 pSta = dphLookupHashEntry(pMac, sa, &aid, &pMac->lim.gpSession[i].dph.dphHashTable);
559 if (pSta != NULL)
560 {
561 *sessionId = i;
562 return &pMac->lim.gpSession[i];
563 }
564 }
565 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700566
Sushant Kaushik87787972015-09-11 16:05:00 +0530567 limLog(pMac, LOG1, FL("Session lookup fails for Peer StaId: "));
Jeff Johnsone7245742012-09-05 17:12:55 -0700568 limPrintMacAddr(pMac, sa, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 return NULL;
570}
571
572
573
574
575
576
577
578
579