blob: feb52accaf55c0cbef37208f33b415f5172c3802 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05302 * Copyright (c) 2012-2017 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
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limProcessMlmRspMessages.cc contains the code
30 * for processing response messages from MLM state machine.
31 * Author: Chandra Modumudi
32 * Date: 02/11/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38#include "wniApi.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053039#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070040#include "cfgApi.h"
41#include "sirApi.h"
42#include "schApi.h"
43#include "utilsApi.h"
44#include "limUtils.h"
45#include "limAssocUtils.h"
46#include "limSecurityUtils.h"
47#include "limSerDesUtils.h"
48#include "limTimerUtils.h"
49#include "limSendMessages.h"
50#include "limAdmitControl.h"
51#include "limSendMessages.h"
52#include "limIbssPeerMgmt.h"
53#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070054#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#if defined WLAN_FEATURE_VOWIFI
56#include "rrmApi.h"
57#endif
58#if defined WLAN_FEATURE_VOWIFI_11R
59#include <limFT.h>
60#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "wlan_qct_wda.h"
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053062#include "vos_utils.h"
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053063
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +053064#ifdef WLAN_FEATURE_LFR_MBB
65#include "lim_mbb.h"
66#endif
67
Jeff Johnson295189b2012-06-20 16:38:30 -070068static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070069static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070070void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070071#ifdef FEATURE_OEM_DATA_SUPPORT
72void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
73#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070074void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
86void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
87void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
88void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
89void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
90void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
91static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
92void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
93static void
94limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080095
96void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
97 eHalStatus status, tANI_U32* mlmAddBssRsp);
98
Jeff Johnson295189b2012-06-20 16:38:30 -070099/**
100 * limProcessMlmRspMessages()
101 *
102 *FUNCTION:
103 * This function is called to processes various MLM response (CNF/IND
104 * messages from MLM State machine.
105 *
106 *LOGIC:
107 *
108 *ASSUMPTIONS:
109 *
110 *NOTE:
111 *
112 * @param pMac Pointer to Global MAC structure
113 * @param msgType Indicates the MLM message type
114 * @param *pMsgBuf A pointer to the MLM message buffer
115 *
116 * @return None
117 */
118void
119limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
120{
121
122 if(pMsgBuf == NULL)
123 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700124 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 return;
126 }
Abhishek Singh82a7a5b2014-10-07 13:05:12 +0530127 MTRACE(macTrace(pMac, TRACE_CODE_TX_LIM_MSG, 0, msgType));
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 switch (msgType)
129 {
130 case LIM_MLM_SCAN_CNF:
131 limProcessMlmScanCnf(pMac, pMsgBuf);
132 break;
133
Jeff Johnsone7245742012-09-05 17:12:55 -0700134#ifdef FEATURE_OEM_DATA_SUPPORT
135 case LIM_MLM_OEM_DATA_CNF:
136 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800137 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700138 break;
139#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700140
141 case LIM_MLM_AUTH_CNF:
142 limProcessMlmAuthCnf(pMac, pMsgBuf);
143 break;
144 case LIM_MLM_AUTH_IND:
145 limProcessMlmAuthInd(pMac, pMsgBuf);
146 break;
147 case LIM_MLM_ASSOC_CNF:
148 limProcessMlmAssocCnf(pMac, pMsgBuf);
149 break;
150 case LIM_MLM_START_CNF:
151 limProcessMlmStartCnf(pMac, pMsgBuf);
152 break;
153 case LIM_MLM_JOIN_CNF:
154 limProcessMlmJoinCnf(pMac, pMsgBuf);
155 break;
156 case LIM_MLM_ASSOC_IND:
157 limProcessMlmAssocInd(pMac, pMsgBuf);
158 break;
159 case LIM_MLM_REASSOC_CNF:
160 limProcessMlmReassocCnf(pMac, pMsgBuf);
161 break;
162 case LIM_MLM_REASSOC_IND:
163 limProcessMlmReassocInd(pMac, pMsgBuf);
164 break;
165 case LIM_MLM_DISASSOC_CNF:
166 limProcessMlmDisassocCnf(pMac, pMsgBuf);
167 break;
168 case LIM_MLM_DISASSOC_IND:
169 limProcessMlmDisassocInd(pMac, pMsgBuf);
170 break;
171 case LIM_MLM_PURGE_STA_IND:
172 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
173 break;
174 case LIM_MLM_DEAUTH_CNF:
175 limProcessMlmDeauthCnf(pMac, pMsgBuf);
176 break;
177 case LIM_MLM_DEAUTH_IND:
178 limProcessMlmDeauthInd(pMac, pMsgBuf);
179 break;
180 case LIM_MLM_SETKEYS_CNF:
181 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
182 break;
183 case LIM_MLM_REMOVEKEY_CNF:
184 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
185 break;
186 case LIM_MLM_TSPEC_CNF:
187 break;
188 case LIM_MLM_ADDBA_CNF:
189 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800190 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700191 break;
192 case LIM_MLM_DELBA_CNF:
193 limProcessMlmDelBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800194 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 break;
196 default:
197 break;
198 } // switch (msgType)
199 return;
200} /*** end limProcessMlmRspMessages() ***/
201
202/**
203 * limProcessMlmScanCnf()
204 *
205 *FUNCTION:
206 * This function is called to processes MLM_SCAN_CNF
207 * message from MLM State machine.
208 *
209 *LOGIC:
210 *
211 *ASSUMPTIONS:
212 *
213 *NOTE:
214 *
215 * @param pMac Pointer to Global MAC structure
216 * @param pMsgBuf A pointer to the MLM message buffer
217 *
218 * @return None
219 */
220void
221limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
222{
223 switch(pMac->lim.gLimSmeState)
224 {
225 case eLIM_SME_WT_SCAN_STATE:
226 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
227 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
228 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700229 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 pMac->lim.gLimSystemInScanLearnMode = 0;
231 break;
232 default:
233 /**
234 * Should not have received scan confirm
235 * from MLM in other states.
236 * Log error
237 */
238 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530239 FL("received unexpected MLM_SCAN_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 pMac->lim.gLimSmeState);)
241 return;
242 }
243
244 /// Process received scan confirm
245 /// Increment length of cached scan results
246 pMac->lim.gLimSmeScanResultLength +=
247 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
248 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
249 {
250 tANI_U16 scanRspLen = 0;
251 /// Need to send response to Host
252 pMac->lim.gLimRspReqd = false;
253 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
254 eSIR_SME_SUCCESS) ||
255 pMac->lim.gLimSmeScanResultLength)
256 {
257 scanRspLen = sizeof(tSirSmeScanRsp) +
258 pMac->lim.gLimSmeScanResultLength -
259 sizeof(tSirBssDescription);
260 }
261 else
262 {
263 scanRspLen = sizeof(tSirSmeScanRsp);
264 }
265 if(pMac->lim.gLimReportBackgroundScanResults)
266 {
267 pMac->lim.gLimBackgroundScanTerminate = TRUE;
268 }
269 if (pMac->lim.gLimSmeScanResultLength == 0)
270 {
271 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
272 }
273 else
274 {
275 limSendSmeScanRsp(pMac, scanRspLen,
276 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
277 }
278 } // if (pMac->lim.gLimRspReqd)
279 //check to see whether we need to run bgScan timer
280 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
281 {
282 if (tx_timer_activate(
283 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
284 {
285 /// Could not activate background scan timer.
286 // Log error
287 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700288 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 pMac->lim.gLimBackgroundScanStarted = FALSE;
290 }
291 else
292 {
293 pMac->lim.gLimBackgroundScanStarted = TRUE;
294 }
295 }
296} /*** end limProcessMlmScanCnf() ***/
297
Jeff Johnsone7245742012-09-05 17:12:55 -0700298#ifdef FEATURE_OEM_DATA_SUPPORT
299
300/**
301 * limProcessMlmOemDataReqCnf()
302 *
303 *FUNCTION:
304 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
305 * message from MLM State machine.
306 *
307 *LOGIC:
308 *
309 *ASSUMPTIONS:
310 *
311 *NOTE:
312 *
313 * @param pMac Pointer to Global MAC structure
314 * @param pMsgBuf A pointer to the MLM message buffer
315 *
316 * @return None
317 */
318
319void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
320{
321 tLimMlmOemDataRsp* measRsp;
322
323 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
324
325 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
326
327 //Now send the meas confirm message to the sme
328 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
329
330 //Dont free the memory here. It will be freed up by the callee
331
332 return;
333}
334#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700335
336/**
337 * limProcessMlmStartCnf()
338 *
339 *FUNCTION:
340 * This function is called to processes MLM_START_CNF
341 * message from MLM State machine.
342 *
343 *LOGIC:
344 *
345 *ASSUMPTIONS:
346 *
347 *NOTE:
348 *
349 * @param pMac Pointer to Global MAC structure
350 * @param pMsgBuf A pointer to the MLM message buffer
351 *
352 * @return None
353 */
354void
355limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
356{
357 tpPESession psessionEntry = NULL;
358 tLimMlmStartCnf *pLimMlmStartCnf;
359 tANI_U8 smesessionId;
360 tANI_U16 smetransactionId;
361
362 if(pMsgBuf == NULL)
363 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700364 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 return;
366 }
367 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
368 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
369 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700370 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 return;
372 }
373 smesessionId = psessionEntry->smeSessionId;
374 smetransactionId = psessionEntry->transactionId;
375
376 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
377 {
378 /**
379 * Should not have received Start confirm from MLM
380 * in other states.
381 * Log error
382 */
383 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530384 FL("received unexpected MLM_START_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 psessionEntry->limSmeState);)
386 return;
387 }
388 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
389 eSIR_SME_SUCCESS)
390 {
391
392 /**
393 * Update global SME state so that Beacon Generation
394 * module starts writing Beacon frames into TFP's
395 * Beacon file register.
396 */
397 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700398 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
400 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700401 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
403 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
404 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700405 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700409 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530412 limLog(pMac, LOG1, FL("*** Started BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 }
414 else
415 {
416 /// Start BSS is a failure
417 peDeleteSession(pMac,psessionEntry);
418 psessionEntry = NULL;
Leela Venkata Kiran Kumar Reddy Chiralac7a12152014-02-03 11:20:14 -0800419 PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 }
421 /// Send response to Host
422 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
423 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
424 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
426 {
427 //Configure beacon and send beacons to HAL
428 limSendBeaconInd(pMac, psessionEntry);
429 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700430}
431
432 /*** end limProcessMlmStartCnf() ***/
433
434/**
435 * limProcessMlmJoinCnf()
436 *
437 *FUNCTION:
438 * This function is called to processes MLM_JOIN_CNF
439 * message from MLM State machine.
440 *
441 *LOGIC:
442 *
443 *ASSUMPTIONS:
444 *
445 *NOTE:
446 *
447 * @param pMac Pointer to Global MAC structure
448 * @param pMsgBuf A pointer to the MLM message buffer
449 *
450 * @return None
451 */
452void
453limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
454{
455 tSirResultCodes resultCode;
456 tLimMlmJoinCnf *pLimMlmJoinCnf;
457 tpPESession psessionEntry;
458 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
459 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
460 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530461 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
462 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return;
464 }
465
466 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
467 {
468 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530469 FL("received unexpected MLM_JOIN_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 psessionEntry->limSmeState);)
471 return;
472 }
473
474 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
475 /// Process Join confirm from MLM
476 if (resultCode == eSIR_SME_SUCCESS)
477 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530478 limLog(pMac, LOG1, FL("***SessionId: %d Joined ESS ***"),
479 pLimMlmJoinCnf->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
482 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
483 return;
484 else
485 resultCode = eSIR_SME_REFUSED;
486 }
487 {
488 /// Join failure
489 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700490 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 /// Send Join response to Host
492 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
493 }
494} /*** end limProcessMlmJoinCnf() ***/
495
496/**
497 * limProcessMlmAuthCnf()
498 *
499 *FUNCTION:
500 * This function is called to processes MLM_AUTH_CNF
501 * message from MLM State machine.
502 *
503 *LOGIC:
504 *
505 *ASSUMPTIONS:
506 *
507 *NOTE:
508 *
509 * @param pMac Pointer to Global MAC structure
510 * @param pMsgBuf A pointer to the MLM message buffer
511 *
512 * @return None
513 */
514void
515limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
516{
517 tANI_U16 caps;
518 tANI_U32 val;
519 tAniAuthType cfgAuthType, authMode;
520 tLimMlmAuthReq *pMlmAuthReq;
521 tLimMlmAssocReq *pMlmAssocReq;
522 tLimMlmAuthCnf *pMlmAuthCnf;
523 tpPESession psessionEntry;
524 tANI_U32 teleBcnEn = 0;
525// tANI_U8 sessionId;
526
527 if(pMsgBuf == NULL)
528 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700529 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 return;
531 }
532 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
533 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
534 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530535 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),
536 pMlmAuthCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 return;
538 }
539
540 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
541 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
542 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
543 {
544 /**
545 * Should not have received AUTH confirm
546 * from MLM in other states or on AP.
547 * Log error
548 */
549 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530550 FL("SessionId:%d received unexpected MLM_AUTH_CNF in state %d"),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530551 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 return;
553 }
Sushant Kaushikb97a0082015-08-31 12:36:45 +0530554#ifdef FEATURE_WLAN_DIAG_SUPPORT
555 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_COMP_EVENT, psessionEntry,
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530556 pMlmAuthCnf->resultCode,
557 pMlmAuthCnf->protStatusCode);
Sushant Kaushikb97a0082015-08-31 12:36:45 +0530558#endif
559
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 /// Process AUTH confirm from MLM
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530561 if (pMlmAuthCnf->resultCode != eSIR_SME_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 {
563 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
564 {
565 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
566 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
567 {
568 /**
569 * Could not get AuthType value from CFG.
570 * Log error.
571 */
572 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700573 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 }
575 }
576 else
577 cfgAuthType = pMac->lim.gLimPreAuthType;
578
579 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530580 (pMlmAuthCnf->authType == eSIR_SHARED_KEY)
581 && ((eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS ==
582 pMlmAuthCnf->protStatusCode) ||
583 (pMlmAuthCnf->resultCode == eSIR_SME_AUTH_TIMEOUT_RESULT_CODE)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 {
585 /**
Hu Wang0650dbc2015-12-07 13:44:57 +0800586 * When Shared authentication fails with reason code "13" and
587 * authType set to 'auto switch', Try with Open Authentication
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 */
Hu Wang0650dbc2015-12-07 13:44:57 +0800589 authMode = eSIR_OPEN_SYSTEM;
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530591 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
592 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 {
594 // Log error
595 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530596 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 return;
598 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530599 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 val = sizeof(tSirMacAddr);
601 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
602 {
603 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
604 }
605 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530606 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
607 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 sizeof(tSirMacAddr));
609 pMlmAuthReq->authType = authMode;
610 /* Update PE session Id*/
611 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
612 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
613 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
614 != eSIR_SUCCESS)
615 {
616 /**
617 * Could not get AuthFailureTimeout value from CFG.
618 * Log error.
619 */
620 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700621 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 }
623 limPostMlmMessage(pMac,
624 LIM_MLM_AUTH_REQ,
625 (tANI_U32 *) pMlmAuthReq);
626 return;
627 }
628 else
629 {
630 // MAC based authentication failure
631 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
632 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700633 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700635 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700637 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
638
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 /**
640 * Need to send Join response with
641 * auth failure to Host.
642 */
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530643 limHandleSmeJoinResult(pMac, pMlmAuthCnf->resultCode,
644 pMlmAuthCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 }
646 else
647 {
648 /**
649 * Pre-authentication failure.
650 * Send Pre-auth failure response to host
651 */
652 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700653 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 limSendSmeAuthRsp(
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530655 pMac, pMlmAuthCnf->resultCode,
656 pMlmAuthCnf->peerMacAddr, pMlmAuthCnf->authType,
657 pMlmAuthCnf->protStatusCode, psessionEntry,
658 psessionEntry->smeSessionId,
659 psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 }
661 } // end if (cfgAuthType == eAUTO_SWITCH)
662 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
663 else
664 {
665 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
666 {
667 /**
668 * Successful MAC based authentication
669 * Trigger Association with BSS
670 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530671 limLog(pMac, LOG1,
672 FL("SessionId: %d Authenticated with BSS"),
673 psessionEntry->peSessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530674 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
675 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700676 {
677 // Log error
678 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530679 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 return;
681 }
682 val = sizeof(tSirMacAddr);
683 #if 0
684 if (cfgGetStr(pMac, WNI_CFG_BSSID,
685 pMlmAssocReq->peerMacAddr,
686 &val) != eSIR_SUCCESS)
687 {
688 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700689 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691 #endif //SUPPORT BT-AMP
692 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
693 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
694 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
695 != eSIR_SUCCESS)
696 {
697 /**
698 * Could not get AssocFailureTimeout value
699 * from CFG. Log error.
700 */
701 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700702 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 }
704 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
705 {
706 /**
707 * Could not get Capabilities value
708 * from CFG. Log error.
709 */
710 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700711 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 }
713 /*Clear spectrum management bit if AP doesn't support it*/
714 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
715 {
716 /*AP doesn't support spectrum management clear spectrum management bit*/
717 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
718 }
719
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530720 /* Clear rrm bit if AP doesn't support it */
721 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
722 & LIM_RRM_BIT_MASK))
723 {
724 caps &= (~LIM_RRM_BIT_MASK);
725 }
726
Chandrasekaran, Manishekarc949a8b2014-06-27 12:34:09 +0530727 /* Clear short preamble bit if AP does not support it */
728 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
729 (LIM_SHORT_PREAMBLE_BIT_MASK)))
730 {
731 caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
732 limLog(pMac, LOG1, FL("Clearing short preamble:no AP support"));
733 }
734
735 /* Clear immediate block ack bit if AP does not support it */
736 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
737 (LIM_IMMEDIATE_BLOCK_ACK_MASK)))
738 {
739 caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
740 limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
741 }
742
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 pMlmAssocReq->capabilityInfo = caps;
744 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700745 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700747 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
748 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700749
750 /* If telescopic beaconing is enabled, set listen interval to
751 WNI_CFG_TELE_BCN_MAX_LI */
752 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
753 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700754 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700755
756 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
757
758 if(teleBcnEn)
759 {
760 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
761 eSIR_SUCCESS)
762 {
763 /**
764 * Could not get ListenInterval value
765 * from CFG. Log error.
766 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700767 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 }
769 }
770 else
771 {
772 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
773 {
774 /**
775 * Could not get ListenInterval value
776 * from CFG. Log error.
777 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700778 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 }
780 }
781
782 pMlmAssocReq->listenInterval = (tANI_U16)val;
783 /* Update PE session ID*/
784 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
785 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
786 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700787 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530788 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
789 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 limPostMlmMessage(pMac,
791 LIM_MLM_ASSOC_REQ,
792 (tANI_U32 *) pMlmAssocReq);
793 }
794 else
795 {
796 /**
797 * Successful Pre-authentication.
798 * Send Pre-auth response to host
799 */
800 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700801 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Sridhar, Selvaraj80bf0322016-03-02 18:44:47 +0530802 limSendSmeAuthRsp(pMac, pMlmAuthCnf->resultCode,
803 pMlmAuthCnf->peerMacAddr, pMlmAuthCnf->authType,
804 pMlmAuthCnf->protStatusCode, psessionEntry,
805 psessionEntry->smeSessionId,
806 psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700807 }
808 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
809} /*** end limProcessMlmAuthCnf() ***/
810
811/**
812 * limProcessMlmAssocCnf()
813 *
814 *FUNCTION:
815 * This function is called to processes MLM_ASSOC_CNF
816 * message from MLM State machine.
817 *
818 *LOGIC:
819 *
820 *ASSUMPTIONS:
821 *
822 *NOTE:
823 *
824 * @param pMac Pointer to Global MAC structure
825 * @param pMsgBuf A pointer to the MLM message buffer
826 *
827 * @return None
828 */
829void
830limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
831{
832 tpPESession psessionEntry;
833 tLimMlmAssocCnf *pLimMlmAssocCnf;
834
835 if(pMsgBuf == NULL)
836 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700837 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 return;
839 }
840 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
841 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
842 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530843 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
844 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 return;
846 }
847 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
848 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
849 {
850 /**
851 * Should not have received Assocication confirm
852 * from MLM in other states OR on AP.
853 * Log error
854 */
855 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530856 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %d"),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530857 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 return;
859 }
860 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
861 {
862 // Association failure
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530863 limLog(pMac, LOG1,
864 FL("SessionId: %d Association failure resultCode: %d"
865 "limSmeState: %d"), psessionEntry->peSessionId,
c_hpothua9dc89c2014-03-22 19:22:31 +0530866 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530867 psessionEntry->limSmeState);
c_hpothua9dc89c2014-03-22 19:22:31 +0530868
869 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
870 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
871 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
872 */
873 if(((tLimMlmAssocCnf *) pMsgBuf)->resultCode
874 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
875 {
876 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
877 }
878 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
879 pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 /**
881 * Need to send Join response with
882 * Association failure to Host.
883 */
884 limHandleSmeJoinResult(pMac,
885 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
886 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
887 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
888 else
889 {
890 // Successful Association
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530891 limLog(pMac, LOG1, FL("SessionId: %d Associated with BSS"),
892 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700894 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 /**
896 * Need to send Join response with
897 * Association success to Host.
898 */
899 limHandleSmeJoinResult(pMac,
900 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
901 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
902 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
903} /*** end limProcessMlmAssocCnf() ***/
904
905/**
906 * limProcessMlmReassocCnf()
907 *
908 *FUNCTION:
909 * This function is called to processes MLM_REASSOC_CNF
910 * message from MLM State machine.
911 *
912 *LOGIC:
913 *
914 *ASSUMPTIONS:
915 *
916 *NOTE:
917 *
918 * @param pMac Pointer to Global MAC structure
919 * @param pMsgBuf A pointer to the MLM message buffer
920 *
921 * @return None
922 */
923void
924limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
925{
926 tpPESession psessionEntry;
927 tLimMlmReassocCnf *pLimMlmReassocCnf;
928
929 if(pMsgBuf == NULL)
930 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700931 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 return;
933 }
934 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
935 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
936 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700937 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 return;
939 }
940 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
941 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
942 {
943 /**
944 * Should not have received Reassocication confirm
945 * from MLM in other states OR on AP.
946 * Log error
947 */
948 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530949 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
951 return;
952 }
953 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530954 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 psessionEntry->pLimReAssocReq = NULL;
956 }
957
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530958 /* Upon Reassoc success or failure, freeup the cached
959 * preauth request, to ensure that channel switch is now
960 * allowed following any change in HT params.
961 */
962 if (pMac->ft.ftPEContext.pFTPreAuthReq)
963 {
964 limLog(pMac, LOG1, "%s: Freeing pFTPreAuthReq= %p", __func__,
965 pMac->ft.ftPEContext.pFTPreAuthReq);
966 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
967 {
968 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
969 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
970 }
971 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
972 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
973 }
974
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530975 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
977 // Successful Reassociation
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530978 limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700979
980 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700981 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700982
983 /**
984 * Need to send Reassoc response with
985 * Reassociation success to Host.
986 */
987 limSendSmeJoinReassocRsp(
988 pMac, eWNI_SME_REASSOC_RSP,
989 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
990 psessionEntry->smeSessionId,psessionEntry->transactionId);
991 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
992 /** Reassociation failure With the New AP
993 * but we still have the link with the Older AP
994 */
995 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700996 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700997
998 /**
999 * Need to send Reassoc response with
1000 * Association failure to Host.
1001 */
1002 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
1003 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
1004 psessionEntry->smeSessionId,psessionEntry->transactionId);
1005 }else {
Mukul Sharmaa052e3d2014-09-08 23:47:06 +05301006 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
1007 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
1008 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
1009 */
1010 if(pLimMlmReassocCnf->resultCode
1011 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
1012 {
1013 // Reassociation failure
1014 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
1015 }
1016 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 /**
1018 * Need to send Reassoc response with
1019 * Association failure to Host.
1020 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001021 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 }
1023} /*** end limProcessMlmReassocCnf() ***/
1024
1025/**
1026 * limProcessMlmReassocInd()
1027 *
1028 *FUNCTION:
1029 * This function is called to processes MLM_REASSOC_IND
1030 * message from MLM State machine.
1031 *
1032 *LOGIC:
1033 *
1034 *ASSUMPTIONS:
1035 *
1036 *NOTE:
1037 *
1038 * @param pMac Pointer to Global MAC structure
1039 * @param pMsgBuf A pointer to the MLM message buffer
1040 *
1041 * @return None
1042 */
1043void
1044limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1045{
1046 tANI_U32 len;
1047 tSirMsgQ msgQ;
1048 tSirSmeReassocInd *pSirSmeReassocInd;
1049 tpDphHashNode pStaDs=0;
1050 tpPESession psessionEntry;
1051 tANI_U8 sessionId;
1052 if(pMsgBuf == NULL)
1053 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001054 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 return;
1056 }
1057 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001059 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 return;
1061 }
1062 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301064 pSirSmeReassocInd = vos_mem_malloc(len);
1065 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 {
1067 // Log error
1068 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301069 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 return;
1071
1072 }
1073 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1074 eWNI_SME_REASSOC_IND);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301075 if (limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1076 (tANI_U8 *) &(pSirSmeReassocInd->length),
1077 psessionEntry, sizeof(tSirSmeReassocInd))
1078 != eSIR_SUCCESS)
1079 {
1080 limLog(pMac, LOGE,FL(" Received SME message with invalid rem length"));
1081 vos_mem_free(pSirSmeReassocInd);
1082 return;
1083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001084
1085 // Required for indicating the frames to upper layer
1086 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1087 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1088 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1089 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1090
1091 msgQ.type = eWNI_SME_REASSOC_IND;
1092 msgQ.bodyptr = pSirSmeReassocInd;
1093 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301094 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001095#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1096 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1097#endif //FEATURE_WLAN_DIAG_SUPPORT
1098 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1099 if (! pStaDs)
1100 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001101 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301103 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 return;
1105 }
1106
1107 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301108 limLog(pMac, LOG1,
1109 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 /*
1111 ** turn on a timer to detect the loss of REASSOC CNF
1112 **/
1113 limActivateCnfTimer(pMac,
1114 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1115} /*** end limProcessMlmReassocInd() ***/
1116
1117/**
1118 * limProcessMlmAuthInd()
1119 *
1120 *FUNCTION:
1121 * This function is called to processes MLM_AUTH_IND
1122 * message from MLM State machine.
1123 *
1124 *LOGIC:
1125 *
1126 *ASSUMPTIONS:
1127 *
1128 *NOTE:
1129 *
1130 * @param pMac Pointer to Global MAC structure
1131 * @param pMsgBuf A pointer to the MLM message buffer
1132 *
1133 * @return None
1134 */
1135void
1136limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1137{
1138 tSirMsgQ msgQ;
1139 tSirSmeAuthInd *pSirSmeAuthInd;
1140
1141 if(pMsgBuf == NULL)
1142 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001143 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 return;
1145 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301146 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1147 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 {
1149 // Log error
1150 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301151 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05301152 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 }
1154 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
Nishank Aggarwal760a2e42017-02-14 12:49:20 +05301155 if (limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1156 (tANI_U8 *) &(pSirSmeAuthInd->length),
1157 sizeof(tSirSmeAuthInd)) != eSIR_SUCCESS)
1158 {
1159 limLog(pMac, LOGE,FL(" Received SME message with invalid rem length"));
1160 vos_mem_free(pSirSmeAuthInd);
1161 return;
1162 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 msgQ.type = eWNI_SME_AUTH_IND;
1164 msgQ.bodyptr = pSirSmeAuthInd;
1165 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301166 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001167#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1168 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1169#endif //FEATURE_WLAN_DIAG_SUPPORT
1170 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1171} /*** end limProcessMlmAuthInd() ***/
1172
1173
1174
1175
1176void
1177limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1178 tSirSmeAssocInd *pSirSmeAssocInd,
1179 tpPESession psessionEntry)
1180{
1181 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1182 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1183
1184 // Required for indicating the frames to upper layer
1185 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1186 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1187
1188 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1189 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1190
1191 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301192 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1193 sizeof(tSirMacAddr));
1194
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 // Fill in aid
1196 pSirSmeAssocInd->aid = pAssocInd->aid;
1197 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301198 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 // Fill in staId
1200 //pSirSmeAssocInd->staId = psessionEntry->staId;
1201 // Fill in authType
1202 pSirSmeAssocInd->authType = pAssocInd->authType;
1203 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301204 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1205 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301207 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1208 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1209 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001210
1211 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301212 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1213 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1214 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001215
1216 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1218 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1219 {
1220 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1221 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1222 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301223 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301225 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 // Fill in WmmInfo
1228 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301229#ifdef WLAN_FEATURE_AP_HT40_24G
1230 pSirSmeAssocInd->HT40MHzIntoEnabledSta = pAssocInd->HT40MHzIntoPresent;
Sushant Kaushik87787972015-09-11 16:05:00 +05301231 limLog(pMac, LOGW, FL("HT40MHzIntoPresent: %d"),
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301232 pSirSmeAssocInd->HT40MHzIntoEnabledSta);
1233#endif
Deepthi Gowriae6a1662015-10-12 12:59:37 +05301234 // Fill in rate flags
1235 pSirSmeAssocInd->rate_flags = pAssocInd->rate_flags;
Jeff Johnson295189b2012-06-20 16:38:30 -07001236} /*** end limAssocIndSerDes() ***/
1237
1238
1239
1240/**
1241 * limProcessMlmAssocInd()
1242 *
1243 *FUNCTION:
1244 * This function is called to processes MLM_ASSOC_IND
1245 * message from MLM State machine.
1246 *
1247 *LOGIC:
1248 *
1249 *ASSUMPTIONS:
1250 *
1251 *NOTE:
1252 *
1253 * @param pMac Pointer to Global MAC structure
1254 * @param pMsgBuf A pointer to the MLM message buffer
1255 *
1256 * @return None
1257 */
1258void
1259limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1260{
1261 tANI_U32 len;
1262 tSirMsgQ msgQ;
1263 tSirSmeAssocInd *pSirSmeAssocInd;
1264 tpDphHashNode pStaDs=0;
1265 tpPESession psessionEntry;
1266 if(pMsgBuf == NULL)
1267 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001268 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 return;
1270 }
1271 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001273 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 return;
1275 }
1276 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301278 pSirSmeAssocInd = vos_mem_malloc(len);
1279 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 {
1281 // Log error
1282 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301283 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 return;
1285 }
1286
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1288 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 msgQ.type = eWNI_SME_ASSOC_IND;
1290 msgQ.bodyptr = pSirSmeAssocInd;
1291 msgQ.bodyval = 0;
1292 pStaDs = dphGetHashEntry(pMac,
1293 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1294 if (! pStaDs)
1295 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001296 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301298 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300 return;
1301 }
1302 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301304 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1305 msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001306#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1307 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1308#endif //FEATURE_WLAN_DIAG_SUPPORT
1309 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1310
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301311 limLog(pMac, LOG1,
1312 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 /*
1314 ** turn on a timer to detect the loss of ASSOC CNF
1315 **/
1316 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1317
1318// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1319#ifdef TEST_BTAMP_AP
1320//tANI_U32 *pMsgBuf;
1321{
1322 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301323 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1324 if ( NULL == pSmeAssoccnf )
1325 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1327 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301328 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1329 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1331 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301332 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1333 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301335 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1337 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301338 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001339}
1340#endif
1341
1342
1343} /*** end limProcessMlmAssocInd() ***/
1344
1345
1346
1347
1348/**
1349 * limProcessMlmDisassocInd()
1350 *
1351 *FUNCTION:
1352 * This function is called to processes MLM_DISASSOC_IND
1353 * message from MLM State machine.
1354 *
1355 *LOGIC:
1356 *
1357 *ASSUMPTIONS:
1358 *
1359 *NOTE:
1360 *
1361 * @param pMac Pointer to Global MAC structure
1362 * @param pMsgBuf A pointer to the MLM message buffer
1363 *
1364 * @return None
1365 */
1366void
1367limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1368{
1369 tLimMlmDisassocInd *pMlmDisassocInd;
1370 tpPESession psessionEntry;
1371 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1372 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1373 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001374 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 return;
1376 }
1377 switch (psessionEntry->limSystemRole)
1378 {
1379 case eLIM_STA_IN_IBSS_ROLE:
1380 break;
1381 case eLIM_STA_ROLE:
1382 case eLIM_BT_AMP_STA_ROLE:
1383 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001384 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 break;
1386 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301387 limLog(pMac, LOG1,
1388 FL("*** Peer staId = %d Disassociated ***"),
1389 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 // Send SME_DISASOC_IND after Polaris cleanup
1391 // (after receiving LIM_MLM_PURGE_STA_IND)
1392 break;
1393 } // end switch (psessionEntry->limSystemRole)
1394} /*** end limProcessMlmDisassocInd() ***/
1395
1396/**
1397 * limProcessMlmDisassocCnf()
1398 *
1399 *FUNCTION:
1400 * This function is called to processes MLM_DISASSOC_CNF
1401 * message from MLM State machine.
1402 *
1403 *LOGIC:
1404 *
1405 *ASSUMPTIONS:
1406 *
1407 *NOTE:
1408 *
1409 * @param pMac Pointer to Global MAC structure
1410 * @param pMsgBuf A pointer to the MLM message buffer
1411 *
1412 * @return None
1413 */
1414void
1415limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1416{
1417 tSirResultCodes resultCode;
1418 tLimMlmDisassocCnf *pMlmDisassocCnf;
1419 tpPESession psessionEntry;
1420 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1421 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1422 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001423 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 return;
1425 }
1426 resultCode = (tSirResultCodes)
1427 (pMlmDisassocCnf->disassocTrigger ==
1428 eLIM_LINK_MONITORING_DISASSOC) ?
1429 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1430 pMlmDisassocCnf->resultCode;
1431 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1432 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 // Disassociate Confirm from MLM
1434 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1435 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1436 {
1437 /**
1438 * Should not have received
1439 * Disassocate confirm
1440 * from MLM in other states.
1441 * Log error
1442 */
1443 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301444 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 return;
1446 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 if (pMac->lim.gLimRspReqd)
1448 pMac->lim.gLimRspReqd = false;
1449 if (pMlmDisassocCnf->disassocTrigger ==
1450 eLIM_PROMISCUOUS_MODE_DISASSOC)
1451 {
1452 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1453 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1454 else
1455 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001456 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 // Send Promiscuous mode response to host
1458 limSendSmePromiscuousModeRsp(pMac);
1459 }
1460 else
1461 {
1462 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1463 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1464 else
1465 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001466 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1468 resultCode,
1469 pMlmDisassocCnf->disassocTrigger,
1470 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1471 }
1472 }
1473 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1474 {
1475 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1476 resultCode,
1477 pMlmDisassocCnf->disassocTrigger,
1478 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1479 }
1480} /*** end limProcessMlmDisassocCnf() ***/
1481
1482/**
1483 * limProcessMlmDeauthInd()
1484 *
1485 *FUNCTION:
1486 * This function is called to processes MLM_DEAUTH_IND
1487 * message from MLM State machine.
1488 *
1489 *LOGIC:
1490 *
1491 *ASSUMPTIONS:
1492 *
1493 *NOTE:
1494 *
1495 * @param pMac Pointer to Global MAC structure
1496 * @param pMsgBuf A pointer to the MLM message buffer
1497 *
1498 * @return None
1499 */
1500void
1501limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1502{
1503 tLimMlmDeauthInd *pMlmDeauthInd;
1504 tpPESession psessionEntry;
1505 tANI_U8 sessionId;
1506 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1507 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1508 {
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05301509 PELOGE(limLog(pMac, LOGE,FL("session does not exist for Addr:" MAC_ADDRESS_STR),
1510 MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 return;
1512 }
1513 switch (psessionEntry->limSystemRole)
1514 {
1515 case eLIM_STA_IN_IBSS_ROLE:
1516 break;
1517 case eLIM_STA_ROLE:
1518 case eLIM_BT_AMP_STA_ROLE:
1519 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001520 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001521
1522 default: // eLIM_AP_ROLE
1523 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301524 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001525 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301526 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 }
1528 // Send SME_DEAUTH_IND after Polaris cleanup
1529 // (after receiving LIM_MLM_PURGE_STA_IND)
1530 break;
1531 } // end switch (psessionEntry->limSystemRole)
1532} /*** end limProcessMlmDeauthInd() ***/
1533
1534/**
1535 * limProcessMlmDeauthCnf()
1536 *
1537 *FUNCTION:
1538 * This function is called to processes MLM_DEAUTH_CNF
1539 * message from MLM State machine.
1540 *
1541 *LOGIC:
1542 *
1543 *ASSUMPTIONS:
1544 *
1545 *NOTE:
1546 *
1547 * @param pMac Pointer to Global MAC structure
1548 * @param pMsgBuf A pointer to the MLM message buffer
1549 *
1550 * @return None
1551 */
1552void
1553limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1554{
1555 tANI_U16 aid;
1556 tSirResultCodes resultCode;
1557 tLimMlmDeauthCnf *pMlmDeauthCnf;
1558 tpPESession psessionEntry;
1559
1560 if(pMsgBuf == NULL)
1561 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001562 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 return;
1564 }
1565 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1566 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1567 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001568 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 return;
1570 }
1571
1572 resultCode = (tSirResultCodes)
1573 (pMlmDeauthCnf->deauthTrigger ==
1574 eLIM_LINK_MONITORING_DEAUTH) ?
1575 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1576 pMlmDeauthCnf->resultCode;
1577 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1578 pMlmDeauthCnf->aid : 1;
1579 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1580 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 // Deauth Confirm from MLM
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05301582 if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1583 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 {
1585 /**
1586 * Should not have received Deauth confirm
1587 * from MLM in other states.
1588 * Log error
1589 */
1590 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301591 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 psessionEntry->limSmeState);)
1593 return;
1594 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1596 {
1597 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301598 limLog(pMac, LOG1,
1599 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 }
1601 else
1602 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001603 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001604
1605 if (pMac->lim.gLimRspReqd)
1606 pMac->lim.gLimRspReqd = false;
1607 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1609 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1610 resultCode,
1611 pMlmDeauthCnf->deauthTrigger,
1612 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001613} /*** end limProcessMlmDeauthCnf() ***/
1614
1615/**
1616 * limProcessMlmPurgeStaInd()
1617 *
1618 *FUNCTION:
1619 * This function is called to processes MLM_PURGE_STA_IND
1620 * message from MLM State machine.
1621 *
1622 *LOGIC:
1623 *
1624 *ASSUMPTIONS:
1625 *
1626 *NOTE:
1627 *
1628 * @param pMac Pointer to Global MAC structure
1629 * @param pMsgBuf A pointer to the MLM message buffer
1630 *
1631 * @return None
1632 */
1633void
1634limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1635{
1636 tSirResultCodes resultCode;
1637 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1638 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 if(pMsgBuf == NULL)
1640 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001641 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 return;
1643 }
1644 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1645 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1646 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001647 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 return;
1649 }
1650 // Purge STA indication from MLM
1651 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1652 switch (psessionEntry->limSystemRole)
1653 {
1654 case eLIM_STA_IN_IBSS_ROLE:
1655 break;
1656 case eLIM_STA_ROLE:
1657 case eLIM_BT_AMP_STA_ROLE:
1658 default: // eLIM_AP_ROLE
1659 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1660 (psessionEntry->limSmeState !=
1661 eLIM_SME_WT_DISASSOC_STATE) &&
1662 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1663 {
1664 /**
1665 * Should not have received
1666 * Purge STA indication
1667 * from MLM in other states.
1668 * Log error
1669 */
1670 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301671 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001672 psessionEntry->limSmeState);)
1673 break;
1674 }
1675 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001676 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 pMlmPurgeStaInd->aid);)
1678 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1679 {
1680 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001681 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001682
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 }
1684 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1685 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 limSendSmeDeauthNtf(pMac,
1687 pMlmPurgeStaInd->peerMacAddr,
1688 resultCode,
1689 pMlmPurgeStaInd->purgeTrigger,
1690 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 }
1692 else
1693 limSendSmeDisassocNtf(pMac,
1694 pMlmPurgeStaInd->peerMacAddr,
1695 resultCode,
1696 pMlmPurgeStaInd->purgeTrigger,
1697 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1698 } // end switch (psessionEntry->limSystemRole)
1699} /*** end limProcessMlmPurgeStaInd() ***/
1700
1701/**
1702 * limProcessMlmSetKeysCnf()
1703 *
1704 *FUNCTION:
1705 * This function is called to processes MLM_SETKEYS_CNF
1706 * message from MLM State machine.
1707 *
1708 *LOGIC:
1709 *
1710 *ASSUMPTIONS:
1711 *
1712 *NOTE:
1713 *
1714 * @param pMac Pointer to Global MAC structure
1715 * @param pMsgBuf A pointer to the MLM message buffer
1716 *
1717 * @return None
1718 */
1719void
1720limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1721{
1722 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001723 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301725 tANI_U16 aid;
1726 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001727
1728 if(pMsgBuf == NULL)
1729 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001730 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001731 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 }
1733 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1734 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1735 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001736 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 return;
1738 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301739 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001741 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301743 /* if the status is success keys are installed in the
1744 * Firmware so we can set the protection bit
1745 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301746 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301747 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301748 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1749 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1750 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1751 &psessionEntry->dph.dphHashTable);
1752 if (pStaDs != NULL)
1753 pStaDs->isKeyInstalled = 1;
1754 }
1755 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 limSendSmeSetContextRsp(pMac,
1757 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001759 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1760 psessionEntry->transactionId);
1761} /*** end limProcessMlmSetKeysCnf() ***/
1762/**
1763 * limProcessMlmRemoveKeyCnf()
1764 *
1765 *FUNCTION:
1766 * This function is called to processes MLM_REMOVEKEY_CNF
1767 * message from MLM State machine.
1768 *
1769 *LOGIC:
1770 *
1771 *ASSUMPTIONS:
1772 *
1773 *NOTE:
1774 *
1775 * @param pMac Pointer to Global MAC structure
1776 * @param pMsgBuf A pointer to the MLM message buffer
1777 *
1778 * @return None
1779 */
1780void
1781limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1782{
1783 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001784 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 tpPESession psessionEntry;
1786
1787 if(pMsgBuf == NULL)
1788 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001789 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001790 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001791 }
1792 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1793 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1794 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001795 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 return;
1797 }
1798 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001799 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 pMlmRemoveKeyCnf->resultCode );
1801 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001802 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1804 psessionEntry->smeSessionId,psessionEntry->transactionId);
1805} /*** end limProcessMlmRemoveKeyCnf() ***/
1806
1807
1808/**
1809 * limHandleSmeJoinResult()
1810 *
1811 *FUNCTION:
1812 * This function is called to process join/auth/assoc failures
1813 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1814 * MLM_ASSOC_CNF with a success code in case of STA role and
1815 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1816 *
1817 *LOGIC:
1818 *
1819 *ASSUMPTIONS:
1820 *
1821 *NOTE:
1822 *
1823 * @param pMac Pointer to Global MAC structure
1824 * @param resultCode Failure code to be sent
1825 *
1826 *
1827 * @return None
1828 */
1829static void
1830limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1831{
1832 tpDphHashNode pStaDs = NULL;
1833 tANI_U8 smesessionId;
1834 tANI_U16 smetransactionId;
1835
1836 /* Newly Added on oct 11 th*/
1837 if(psessionEntry == NULL)
1838 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001839 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 return;
1841 }
1842 smesessionId = psessionEntry->smeSessionId;
1843 smetransactionId = psessionEntry->transactionId;
1844 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1845 if(resultCode != eSIR_SME_SUCCESS)
1846 {
1847 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1848 if (pStaDs != NULL)
1849 {
1850 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1851 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1852 pStaDs->mlmStaContext.resultCode = resultCode;
1853 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1854 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1855 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301856 /* Cleanup if add bss failed */
1857 if(psessionEntry->addBssfailed)
1858 {
1859 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1860 &psessionEntry->dph.dphHashTable);
1861 goto error;
1862 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301863 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001864 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 return;
1866 }
1867 }
1868
Abhishek Singhde7f0512015-10-23 14:31:15 +05301869error:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301870 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 psessionEntry->pLimJoinReq = NULL;
1872 //Delete teh session if JOIN failure occurred.
1873 if(resultCode != eSIR_SME_SUCCESS)
1874 {
1875 if(NULL != psessionEntry)
1876 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001877 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1878 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001879 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 peDeleteSession(pMac,psessionEntry);
1881 psessionEntry = NULL;
1882 }
1883 }
1884 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1885 smesessionId, smetransactionId);
1886} /*** end limHandleSmeJoinResult() ***/
1887
1888/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001889 * limHandleSmeReaasocResult()
1890 *
1891 *FUNCTION:
1892 * This function is called to process reassoc failures
1893 * upon receiving REASSOC_CNF with a failure code or
1894 * MLM_REASSOC_CNF with a success code in case of STA role
1895 *
1896 *LOGIC:
1897 *
1898 *ASSUMPTIONS:
1899 *
1900 *NOTE:
1901 *
1902 * @param pMac Pointer to Global MAC structure
1903 * @param resultCode Failure code to be sent
1904 *
1905 *
1906 * @return None
1907 */
1908static void
1909limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1910{
1911 tpDphHashNode pStaDs = NULL;
1912 tANI_U8 smesessionId;
1913 tANI_U16 smetransactionId;
1914
1915 if(psessionEntry == NULL)
1916 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001917 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001918 return;
1919 }
1920 smesessionId = psessionEntry->smeSessionId;
1921 smetransactionId = psessionEntry->transactionId;
1922 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1923 if(resultCode != eSIR_SME_SUCCESS)
1924 {
1925 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1926 if (pStaDs != NULL)
1927 {
1928 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1929 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1930 pStaDs->mlmStaContext.resultCode = resultCode;
1931 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1932 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301933 /* Cleanup if add bss failed */
1934 if(psessionEntry->addBssfailed)
1935 {
1936 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1937 &psessionEntry->dph.dphHashTable);
1938 goto error;
1939 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001940 return;
1941 }
1942 }
Abhishek Singhde7f0512015-10-23 14:31:15 +05301943error:
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 //Delete teh session if REASSOC failure occurred.
1945 if(resultCode != eSIR_SME_SUCCESS)
1946 {
1947 if(NULL != psessionEntry)
1948 {
1949 peDeleteSession(pMac,psessionEntry);
1950 psessionEntry = NULL;
1951 }
1952 }
1953 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1954 smesessionId, smetransactionId);
1955} /*** end limHandleSmeReassocResult() ***/
1956
1957/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 * limProcessMlmAddStaRsp()
1959 *
1960 *FUNCTION:
1961 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1962 * Upon receipt of this message from HAL, MLME -
1963 * > Determines the "state" in which this message was received
1964 * > Forwards it to the appropriate callback
1965 *
1966 *ASSUMPTIONS:
1967 *
1968 *NOTE:
1969 *
1970 * @param pMac Pointer to Global MAC structure
1971 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1972 *
1973 * @return None
1974 */
1975void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1976{
1977 //we need to process the deferred message since the initiating req. there might be nested request.
1978 //in the case of nested request the new request initiated from the response will take care of resetting
1979 //the deffered flag.
1980 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 )
1984 {
1985 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1986 return;
1987 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05301988#ifdef WLAN_FEATURE_LFR_MBB
1989 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
1990 lim_process_sta_mlm_add_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
1991 return;
1992 }
1993#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001995}
1996void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1997{
1998 tLimMlmAssocCnf mlmAssocCnf;
1999 tpDphHashNode pStaDs;
2000 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2001 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
2002
2003 if(NULL == pAddStaParams )
2004 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002005 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 return;
2007 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302008
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302009 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302011 PELOGE(limLog(pMac, LOGE,
2012 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05302013
2014 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
2015 {
2016 PELOGE(limLog(pMac, LOGE,
2017 FL("ADD_STA success, send update result code with"
2018 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
2019 "limMlmState: %d"), pAddStaParams->staIdx,
2020 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302021 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2022 mesgType = LIM_MLM_REASSOC_CNF;
2023 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
2024 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
2025 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05302026 mlmAssocCnf.resultCode =
2027 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302028 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
c_hpothua9dc89c2014-03-22 19:22:31 +05302029 psessionEntry->staId = pAddStaParams->staIdx;
2030 goto end;
2031 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302032 }
2033
2034 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
2035 {
2036 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 {
2038 //TODO: any response to be sent out here ?
2039 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302040 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 psessionEntry->limMlmState);
2042 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2043 goto end;
2044 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302045
2046 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2047 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 //
2049 // Update the DPH Hash Entry for this STA
2050 // with proper state info
2051 //
2052 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2053 if( NULL != pStaDs)
2054 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
2055 else
2056 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002057 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 DPH_STA_HASH_INDEX_PEER);
2059 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002060 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 /*
2062 * Storing the self StaIndex(Generated by HAL) in session context,
2063 * instead of storing it in DPH Hash entry for Self STA.
2064 * DPH entry for the self STA stores the sta index for the BSS entry
2065 * to which the STA is associated.
2066 */
2067 psessionEntry->staId = pAddStaParams->staIdx;
2068 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002069#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2070 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2071#endif
2072 {
2073 limReactivateHeartBeatTimer(pMac, psessionEntry);
2074 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002075 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002076
2077 //assign the sessionId to the timer Object
2078 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2079 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002080 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002081#ifdef WLAN_DEBUG
2082 pMac->lim.gLimNumLinkEsts++;
2083#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002084#ifdef FEATURE_WLAN_TDLS
2085 /* initialize TDLS peer related data */
2086 limInitTdlsData(pMac,psessionEntry);
2087#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 // Return Assoc confirm to SME with success
2089 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2090 // be passed in here....
2091 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2092 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2093 }
2094 else
2095 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302096 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302097 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302098 {
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302099 mesgType = LIM_MLM_REASSOC_CNF;
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302100 mlmAssocCnf.resultCode = (tSirResultCodes)eSIR_SME_FT_REASSOC_FAILURE;
2101 }
2102 else
2103 {
2104 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2105 }
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302106 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 }
2108end:
2109 if( 0 != limMsgQ->bodyptr )
2110 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302111 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002112 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 }
2114 /* Updating PE session Id*/
2115 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2116 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302117 if (true == psessionEntry->fDeauthReceived)
2118 {
2119 psessionEntry->fDeauthReceived = false;
2120 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 return;
2122}
2123void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2124{
2125 //we need to process the deferred message since the initiating req. there might be nested request.
2126 //in the case of nested request the new request initiated from the response will take care of resetting
2127 //the deffered flag.
2128 // tpPESession psessionEntry;
2129 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2130 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2131 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002132 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 // return;
2134 // }
2135 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002136
2137 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2138 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 ) &&
2141 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2142 {
2143 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2144 return;
2145 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002147
2148 if(!limIsInMCC(pMac))
2149 {
2150 WDA_TrafficStatsTimerActivate(FALSE);
2151 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002152
2153#ifdef WLAN_FEATURE_11W
2154 if (psessionEntry->limRmfEnabled)
2155 {
2156 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2157 {
2158 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002159 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002160 }
2161 }
2162#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002163}
2164
2165void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2166{
2167 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2168 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2169 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302170
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302171#ifdef WLAN_FEATURE_LFR_MBB
2172 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2173 lim_process_sta_mlm_del_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
2174 return;
2175 }
2176#endif
2177
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302178 if (NULL == pDelBssParams)
2179 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002180 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302181 goto end;
2182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2184 {
2185 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002186 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2188 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2189
2190 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002191 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 statusCode = eSIR_SME_REFUSED;
2193 goto end;
2194 }
2195 if(pStaDs == NULL)
2196 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002197 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 statusCode = eSIR_SME_REFUSED;
2199 goto end;
2200 }
2201 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2202 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302203 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 pStaDs->mlmStaContext.mlmState);)
2205 statusCode = eSIR_SME_REFUSED;
2206 goto end;
2207 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302208 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2209 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 }
2211 else
2212 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302213 /* If DelBSS response is failure, go ahead and
2214 * post response to SME
2215 */
2216 limLog( pMac, LOGE, FL( "DEL BSS failed! Status:%d" ),
2217 pDelBssParams->status );
2218 statusCode = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302220
2221end:
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 if( 0 != limMsgQ->bodyptr )
2223 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302224 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002225 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 }
2227 if(pStaDs == NULL)
2228 return;
2229 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2230 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2231 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2232 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2233 {
2234 /** The Case where the DelBss is invoked from
2235 * context of other than normal DisAssoc / Deauth OR
2236 * as part of Join Failure.
2237 */
2238 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2239 return;
2240 }
2241 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2242 return;
2243}
2244
Jeff Johnson295189b2012-06-20 16:38:30 -07002245void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2246{
2247 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002248 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2250 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2251
2252 if(psessionEntry == NULL)
2253 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002254 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002255 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002256 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302257 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002258 limMsgQ->bodyptr = NULL;
2259 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 return;
2261 }
2262
2263 if (pDelBss == NULL)
2264 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002265 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 rc = eSIR_SME_REFUSED;
2267 goto end;
2268 }
2269 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002270 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2271
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2273 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002274 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302275 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002276 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002277 rc = eSIR_SME_REFUSED;
2278 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 }
2280 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2281 {
2282 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2283 pDelBss->status, pDelBss->bssIdx);
2284 rc = eSIR_SME_STOP_BSS_FAILURE;
2285 goto end;
2286 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002287 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002289 if (status != eSIR_SUCCESS)
2290 {
2291 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002293 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 /** Softmac may send all the buffered packets right after resuming the transmission hence
2295 * to occupy the medium during non channel occupancy period. So resume the transmission after
2296 * HAL gives back the response.
2297 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002298#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 if (LIM_IS_RADAR_DETECTED(pMac))
2300 {
2301 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2302 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2303 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002304#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2306 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002308 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 end:
2310 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2311 peDeleteSession(pMac, psessionEntry);
2312
2313 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002314 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302315 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002316 limMsgQ->bodyptr = NULL;
2317 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002318}
2319
2320void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2321{
2322 //we need to process the deferred message since the initiating req. there might be nested request.
2323 //in the case of nested request the new request initiated from the response will take care of resetting
2324 //the deffered flag.
2325
2326 tpPESession psessionEntry;
2327 tpDeleteStaParams pDeleteStaParams;
2328 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2329 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302330
2331 if(NULL == pDeleteStaParams ||
2332 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002334 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002335 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002336 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302337 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002338 limMsgQ->bodyptr = NULL;
2339 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 return;
2341 }
2342
Jeff Johnson295189b2012-06-20 16:38:30 -07002343 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 )
2346 {
2347 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2348 return;
2349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002351}
2352
Jeff Johnson295189b2012-06-20 16:38:30 -07002353void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2354{
2355 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2356 tpDphHashNode pStaDs;
2357 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2358 if(limMsgQ->bodyptr == NULL)
2359 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302360 limLog( pMac, LOGE,
2361 FL( "limMsgQ->bodyptry NULL"));
2362 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2365 if(pStaDs == NULL)
2366 {
2367 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302368 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302370 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002371 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002372
2373 return;
2374 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302375 limLog( pMac, LOG1,
2376 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2377 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002378 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2379 {
2380 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302381 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002382
2383 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2384 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2385 {
2386 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002387 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2389 statusCode = eSIR_SME_REFUSED;
2390 goto end;
2391 }
2392
2393 limLog( pMac, LOG1,
2394 FL("Deleted STA AssocID %d staId %d MAC "),
2395 pStaDs->assocId, pStaDs->staIndex);
2396 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2397 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2398 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302399 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002400 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002401 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 {
2403 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002404 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 pStaDs->assocId);)
2406 // delete the TS if it has already been added.
2407 // send the response with error status.
2408 if(pStaDs->qos.addtsPresent)
2409 {
2410 tpLimTspecInfo pTspecInfo;
2411 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2412 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2413 {
2414 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2415 NULL, &pTspecInfo->idx);
2416 }
2417 }
2418 limRejectAssociation(pMac,
2419 pStaDs->staAddr,
2420 pStaDs->mlmStaContext.subType,
2421 true, pStaDs->mlmStaContext.authType,
2422 pStaDs->assocId, true,
2423 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2424 psessionEntry);
2425 }
2426 return;
2427 }
2428 }
2429 else
2430 {
2431 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002432 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 statusCode = eSIR_SME_REFUSED;
2434 }
2435 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302436 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002437 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2439 {
2440 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2441 }
2442 return;
2443}
2444
2445void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2446{
2447 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2448 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2449 tpDphHashNode pStaDs = NULL;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302450
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302451#ifdef WLAN_FEATURE_LFR_MBB
2452 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2453 lim_process_sta_mlm_del_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
2454 return;
2455 }
2456#endif
2457
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 if(NULL == pDelStaParams )
2459 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002460 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 goto end;
2462 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302463
2464 limLog(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"),
2465 pDelStaParams->status, pDelStaParams->assocId);
2466
2467 if (eHAL_STATUS_SUCCESS != pDelStaParams->status)
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302469 limLog(pMac, LOGE, FL("Del STA failed! Status:%d, still proceeding"
2470 "with Del BSS"), pDelStaParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302472
2473 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2474
2475 if (pStaDs == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302477 //TODO: any response to be sent out here ?
2478 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
2479 pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 statusCode = eSIR_SME_REFUSED;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302481 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302483
2484 if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2485 {
2486 //TODO: any response to be sent out here ?
2487 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
2488 limMlmStateStr(psessionEntry->limMlmState));
2489 statusCode = eSIR_SME_REFUSED;
2490 goto end;
2491 }
2492
2493 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2494 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2495
2496 //we must complete all cleanup related to delSta before calling limDelBSS.
2497 if (0 != limMsgQ->bodyptr )
2498 {
2499 vos_mem_free(pDelStaParams);
2500 limMsgQ->bodyptr = NULL;
2501 }
2502
2503 // Proceed to do DelBSS even if DelSta resulted in failure
2504 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2505 return;
2506
Jeff Johnson295189b2012-06-20 16:38:30 -07002507end:
2508 if( 0 != limMsgQ->bodyptr )
2509 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302510 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002511 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 }
2513 return;
2514}
2515
Jeff Johnson295189b2012-06-20 16:38:30 -07002516void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2517{
2518 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302519 tpDphHashNode pStaDs = NULL;
2520
2521 if (NULL == pAddStaParams)
2522 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002523 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302524 goto end;
2525 }
2526
2527 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 if(pStaDs == NULL)
2529 {
2530 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002531 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 goto end;
2533 }
2534 //
2535 // TODO & FIXME_GEN4
2536 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2537 //
2538 //TODO: any check for pMac->lim.gLimMlmState ?
2539 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2540 {
2541 //TODO: any response to be sent out here ?
2542 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302543 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 pStaDs->mlmStaContext.mlmState);
2545 goto end;
2546 }
2547 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2548 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002549 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 limRejectAssociation(pMac, pStaDs->staAddr,
2551 pStaDs->mlmStaContext.subType,
2552 true, pStaDs->mlmStaContext.authType,
2553 pStaDs->assocId, true,
2554 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2555 psessionEntry);
2556 goto end;
2557 }
2558 pStaDs->bssId = pAddStaParams->bssIdx;
2559 pStaDs->staIndex = pAddStaParams->staIdx;
2560 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2561 pStaDs->valid = 1;
2562 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2563 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302564 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 pStaDs->assocId,
2566 pStaDs->staIndex);
2567 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2568
2569 /* For BTAMP-AP, the flow sequence shall be:
2570 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2571 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2572 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2573 */
2574 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2575 // fall though to reclaim the original Add STA Response message
2576end:
2577 if( 0 != limMsgQ->bodyptr )
2578 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302579 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002580 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 }
2582 return;
2583}
2584
2585/**
2586 * limProcessApMlmAddBssRsp()
2587 *
2588 *FUNCTION:
2589 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2590 * Upon receipt of this message from HAL, MLME -
2591 * > Validates the result of WDA_ADD_BSS_REQ
2592 * > Init other remaining LIM variables
2593 * > Init the AID pool, for that BSSID
2594 * > Init the Pre-AUTH list, for that BSSID
2595 * > Create LIM timers, specific to that BSSID
2596 * > Init DPH related parameters that are specific to that BSSID
2597 * > TODO - When do we do the actual change channel?
2598 *
2599 *LOGIC:
2600 * SME sends eWNI_SME_START_BSS_REQ to LIM
2601 * LIM sends LIM_MLM_START_REQ to MLME
2602 * MLME sends WDA_ADD_BSS_REQ to HAL
2603 * HAL responds with WDA_ADD_BSS_RSP to MLME
2604 * MLME responds with LIM_MLM_START_CNF to LIM
2605 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2606 *
2607 *ASSUMPTIONS:
2608 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2609 * tSirMsgQ.body will now be freed by this routine
2610 *
2611 *NOTE:
2612 *
2613 * @param pMac Pointer to Global MAC structure
2614 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2615 *
2616 * @return None
2617 */
2618static void
2619limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2620{
2621 tLimMlmStartCnf mlmStartCnf;
2622 tANI_U32 val;
2623 tpPESession psessionEntry;
2624// tANI_U8 sessionId;
2625 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2626 if(NULL == pAddBssParams )
2627 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002628 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 goto end;
2630 }
2631 //TBD: free the memory before returning, do it for all places where lookup fails.
2632 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002634 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002635 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002636 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302637 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302638 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002639 limMsgQ->bodyptr = NULL;
2640 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 return;
2642 }
2643 /* Update PE session Id*/
2644 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2645 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2646 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302647 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2649 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2650 goto end;
2651 // Set MLME state
2652 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002653 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2655 {
2656 /** IBSS is 'active' when we receive
2657 * Beacon frames from other STAs that are part of same IBSS.
2658 * Mark internal state as inactive until then.
2659 */
2660 psessionEntry->limIbssActive = false;
2661 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2662 limResetHBPktCount( psessionEntry );
2663 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002664 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002665 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002666 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 }
2668 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2669
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002671
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2673 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2674 else
2675 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 schEdcaProfileUpdate(pMac, psessionEntry);
2677 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002678 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 // Create timers used by LIM
2680 if (!pMac->lim.gLimTimersCreated)
2681 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002682
2683 // Start OLBC timer
2684 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2685 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002686 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002687 }
2688
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2690 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002691 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2693 // Apply previously set configuration at HW
2694 limApplyConfiguration(pMac,psessionEntry);
2695 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2696 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2697 }
2698 else
2699 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002700 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2702 }
2703 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2704 end:
2705 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002706 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302707 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302708 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002709 limMsgQ->bodyptr = NULL;
2710 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002711}
2712
2713
2714/**
2715 * limProcessIbssMlmAddBssRsp()
2716 *
2717 *FUNCTION:
2718 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2719 * Upon receipt of this message from HAL, MLME -
2720 * > Validates the result of WDA_ADD_BSS_REQ
2721 * > Init other remaining LIM variables
2722 * > Init the AID pool, for that BSSID
2723 * > Init the Pre-AUTH list, for that BSSID
2724 * > Create LIM timers, specific to that BSSID
2725 * > Init DPH related parameters that are specific to that BSSID
2726 * > TODO - When do we do the actual change channel?
2727 *
2728 *LOGIC:
2729 * SME sends eWNI_SME_START_BSS_REQ to LIM
2730 * LIM sends LIM_MLM_START_REQ to MLME
2731 * MLME sends WDA_ADD_BSS_REQ to HAL
2732 * HAL responds with WDA_ADD_BSS_RSP to MLME
2733 * MLME responds with LIM_MLM_START_CNF to LIM
2734 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2735 *
2736 *ASSUMPTIONS:
2737 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2738 * tSirMsgQ.body will now be freed by this routine
2739 *
2740 *NOTE:
2741 *
2742 * @param pMac Pointer to Global MAC structure
2743 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2744 *
2745 * @return None
2746 */
2747static void
2748limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2749{
2750 tLimMlmStartCnf mlmStartCnf;
2751 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2752 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302753
2754 if (NULL == pAddBssParams)
2755 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002756 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302757 goto end;
2758 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2760 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302761 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2763 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2764 goto end;
2765 // Set MLME state
2766 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002767 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 /** IBSS is 'active' when we receive
2769 * Beacon frames from other STAs that are part of same IBSS.
2770 * Mark internal state as inactive until then.
2771 */
2772 psessionEntry->limIbssActive = false;
2773 limResetHBPktCount( psessionEntry );
2774 /* Timer related functions are not modified for BT-AMP : To be Done */
2775 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002776 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002777 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002778 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2780 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2781 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2782 schEdcaProfileUpdate(pMac, psessionEntry);
2783 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2784 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002785 if (0 == psessionEntry->freePeerIdxHead)
2786 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 // Create timers used by LIM
2788#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2789 if (!pMac->lim.gLimTimersCreated)
2790 limCreateTimers(pMac);
2791#endif
2792 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2793 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002794 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2796 // Apply previously set configuration at HW
2797 limApplyConfiguration(pMac,psessionEntry);
2798 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2799 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2800 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2801 if(true == pMac->lim.gLimIbssCoalescingHappened)
2802 {
2803 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2804 goto end;
2805 }
2806 }
2807 else
2808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002809 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 pAddBssParams->status );
2811 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2812 }
2813 //Send this message to SME, when ADD_BSS is initiated by SME
2814 //If ADD_BSS is done as part of coalescing, this won't happen.
2815 /* Update PE session Id*/
2816 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2817 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2818 end:
2819 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002820 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302821 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302822 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002823 limMsgQ->bodyptr = NULL;
2824 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002825}
2826
2827static void
2828limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2829{
2830 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2831 tAniAuthType cfgAuthType, authMode;
2832 tLimMlmAuthReq *pMlmAuthReq;
2833 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302834
2835 if (NULL == pAddBssParams)
2836 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002837 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302838 goto joinFailure;
2839 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2841 {
2842 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2843 {
2844 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002845 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2847 goto joinFailure;
2848 }
2849 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2850 //Success, handle below
2851 pStaDs->bssId = pAddBssParams->bssIdx;
2852 //STA Index(genr by HAL) for the BSS entry is stored here
2853 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2854 // Trigger Authentication with AP
2855 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2856 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2857 {
2858 /**
2859 * Could not get AuthType from CFG.
2860 * Log error.
2861 */
2862 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002863 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 }
2865 if (cfgAuthType == eSIR_AUTO_SWITCH)
Hu Wang0650dbc2015-12-07 13:44:57 +08002866 authMode = eSIR_SHARED_KEY; // Try Shared Authentication first
Jeff Johnson295189b2012-06-20 16:38:30 -07002867 else
2868 authMode = cfgAuthType;
2869
2870 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302871 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2872 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 {
2874 // Log error
2875 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302876 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 return;
2878 }
2879 #if 0
2880 val = sizeof(tSirMacAddr);
2881 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2882 pMlmAuthReq->peerMacAddr,
2883 &val) != eSIR_SUCCESS)
2884 {
2885 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002886 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 }
2888 #endif //TO SUPPORT BT-AMP
2889 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2890
2891 pMlmAuthReq->authType = authMode;
2892 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2893 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2894 != eSIR_SUCCESS)
2895 {
2896 /**
2897 * Could not get AuthFailureTimeout
2898 * value from CFG. Log error.
2899 */
2900 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002901 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 }
2903 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2904 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2905 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002906 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002907 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2908 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2909 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2910 // remember staId in case of assoc timeout/failure handling
2911 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2912
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302913 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2914 psessionEntry->peSessionId, psessionEntry->limSmeState));
2915 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2916 "with limSmeState:%d",psessionEntry->peSessionId,
2917 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002918 limPostMlmMessage(pMac,
2919 LIM_MLM_AUTH_REQ,
2920 (tANI_U32 *) pMlmAuthReq);
2921 return;
2922 }
2923
2924joinFailure:
2925 {
2926 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002927 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002928
2929 /// Send Join response to Host
2930 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2931
2932 }
2933
2934}
2935
2936#ifdef WLAN_FEATURE_VOWIFI_11R
2937/*------------------------------------------------------------------------------------------
2938 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002939 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2940 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 *
2942 *
2943 *------------------------------------------------------------------------------------------
2944 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002945static inline void
2946limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002947{
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002949 tpDphHashNode pStaDs = NULL;
2950 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002951 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002952 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002953 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302954#ifdef FEATURE_WLAN_ESE
2955 tLimMlmReassocReq *pMlmReassocReq;
2956 tANI_U32 val = 0;
2957#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002958
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002959 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002960
2961 if (pAddBssParams == NULL)
2962 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002963 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002964 goto end;
2965 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002966 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2967 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002968 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002969 goto end;
2970 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002971 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2972 {
2973 goto end;
2974 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002975
2976 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2977 &psessionEntry->dph.dphHashTable)) == NULL)
2978 {
2979 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002980 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2982 goto end;
2983 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302984 if (pMac->roam.configParam.roamDelayStatsEnabled)
2985 {
2986 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2987 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 // Prepare and send Reassociation request frame
2989 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05302990
2991
2992#ifdef FEATURE_WLAN_ESE
2993 /*
2994 * In case of Ese Reassociation, change the reassoc timer
2995 * value.
2996 */
2997 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2998 if (pMlmReassocReq == NULL)
2999 {
3000 limLog(pMac, LOGE,
3001 FL("Invalid pMlmReassocReq"));
3002 goto end;
3003 }
3004 val = pMlmReassocReq->reassocFailureTimeout;
3005 if (psessionEntry->isESEconnection)
3006 {
3007 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3008 }
3009 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3010 TX_SUCCESS)
3011 {
3012 limLog(pMac, LOGP,
3013 FL("unable to deactivate Reassoc failure timer"));
3014 }
3015 val = SYS_MS_TO_TICKS(val);
3016 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3017 val, 0) != TX_SUCCESS)
3018 {
3019 limLog(pMac, LOGP,
3020 FL("unable to change Reassociation failure timer"));
3021 }
3022#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
3024 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003025 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3027 != TX_SUCCESS)
3028 {
3029 /// Could not start reassoc failure timer.
3030 // Log error
3031 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003032 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 // Return Reassoc confirm with
3034 // Resources Unavailable
3035 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3036 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3037 goto end;
3038 }
Mihir Shete63561c82014-08-23 16:58:07 +05303039 // remember staId
3040 psessionEntry->staId = pAddBssParams->staContext.staIdx;
3041
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003042#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003043 pMac->lim.pSessionEntry = psessionEntry;
3044 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
3045 {
3046 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303047 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
3048 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
3049 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
3050 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
3051 psessionEntry->pLimMlmReassocReq,
3052 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003053 }
3054 pMac->lim.reAssocRetryAttempt = 0;
3055#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003056 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05303057 if (pMac->roam.configParam.roamDelayStatsEnabled)
3058 {
3059 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
3060 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
3062 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08003063 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003064 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 psessionEntry->limMlmState, psessionEntry->peSessionId);)
3066
3067 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3068
3069 //Success, handle below
3070 pStaDs->bssId = pAddBssParams->bssIdx;
3071 //STA Index(genr by HAL) for the BSS entry is stored here
3072 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3073 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3074 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3075
Jeff Johnson295189b2012-06-20 16:38:30 -07003076#if defined WLAN_FEATURE_VOWIFI
3077 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3078#endif
3079
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303080 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
3081 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303083 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07003084 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303086 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003087
3088 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303089 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
3090 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003091
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303092 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3093 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003094
3095 // Update this when we get reassoc rsp , with success.
3096 // pAddStaParams->assocId = psessionEntry->limAID;
3097
3098 pAddStaParams->staType = STA_ENTRY_SELF;
3099 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3100 pAddStaParams->respReqd = 1;
3101
3102 /* Update PE session ID */
3103 pAddStaParams->sessionId = psessionEntry->peSessionId;
3104
3105 // This will indicate HAL to "allocate" a new STA index
3106 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3107 pAddStaParams->updateSta = FALSE;
3108
3109 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003110#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003111 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003112#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003113 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003114#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003115
Jeff Johnsone7245742012-09-05 17:12:55 -07003116 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003118 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003119#ifdef WLAN_FEATURE_11AC
3120 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3121 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3122#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003123#ifdef DISABLE_GF_FOR_INTEROP
3124 /*
3125 * To resolve the interop problem with Broadcom AP,
3126 * where TQ STA could not pass traffic with GF enabled,
3127 * TQ STA will do Greenfield only with TQ AP, for
3128 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003129 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3131 {
3132 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3133 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3134 }
3135 else
3136#endif
3137
Jeff Johnson295189b2012-06-20 16:38:30 -07003138 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003139 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3140 {
3141 pAddStaParams->txChannelWidthSet =
3142 pMac->roam.configParam.channelBondingMode24GHz;
3143 }
3144 else
3145 {
3146 pAddStaParams->txChannelWidthSet =
3147 pMac->roam.configParam.channelBondingMode5GHz;
3148 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003149 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3150 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3151 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3152 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3153 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3154 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3155 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3156 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3157 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3158 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 }
3160
3161 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003162 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003164 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3165 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003166 // Lets save this for when we receive the Reassoc Rsp
3167 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003168
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003169 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003170 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303171 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003172 vos_mem_free(pAddBssParams);
3173 pAddBssParams = NULL;
3174 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003175 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 return;
3177
3178end:
3179 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003180 if (psessionEntry != NULL)
3181 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003182 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003183 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3184 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003186
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003187 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003188 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303189 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003190 vos_mem_free(pAddBssParams);
3191 pAddBssParams = NULL;
3192 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003193 }
3194
3195 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3196 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303197 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003198 if (psessionEntry != NULL)
3199 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003200 else
3201 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003202
3203 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3204}
Jeff Johnson295189b2012-06-20 16:38:30 -07003205#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003206/**
3207 * limProcessStaMlmAddBssRsp()
3208 *
3209 *FUNCTION:
3210 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3211 * Upon receipt of this message from HAL, MLME -
3212 * > Validates the result of WDA_ADD_BSS_REQ
3213 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3214 *
3215 *LOGIC:
3216 * MLME had sent WDA_ADD_BSS_REQ to HAL
3217 * HAL responded with WDA_ADD_BSS_RSP to MLME
3218 * MLME now sends WDA_ADD_STA_REQ to HAL
3219 *
3220 *ASSUMPTIONS:
3221 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3222 * tSirMsgQ.body will now be freed by this routine
3223 *
3224 *NOTE:
3225 *
3226 * @param pMac Pointer to Global MAC structure
3227 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3228 *
3229 * @return None
3230 */
3231static void
3232limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3233{
3234 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3235 tLimMlmAssocCnf mlmAssocCnf;
3236 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3237 tANI_U32 subType = LIM_ASSOC;
3238 tpDphHashNode pStaDs = NULL;
3239 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3240 tANI_U8 updateSta = false;
3241 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3242
3243 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3244 {
3245 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303246 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3247 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3249 goto end;
3250 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303251
3252 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3253 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 {
3255 mesgType = LIM_MLM_REASSOC_CNF;
3256 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303257 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3258 //to update the existing STA entry.
3259 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3260 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3261 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 {
3263 staIdx = psessionEntry->staId;
3264 updateSta = true;
3265 }
3266 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003267
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003268 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003269 goto end;
3270
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3272 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003273#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3275 {
3276#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003277 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 psessionEntry->limMlmState,
3279 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3280#endif
3281 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3282 goto end;
3283 }
3284#endif /* WLAN_FEATURE_VOWIFI_11R */
3285
3286 // Set MLME state
3287 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003288 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3290 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303291 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3292 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3294 if (pStaDs == NULL)
3295 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303296 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3297 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3299 }
3300 else
3301 {
3302 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3303 //Success, handle below
3304 pStaDs->bssId = pAddBssParams->bssIdx;
3305 //STA Index(genr by HAL) for the BSS entry is stored here
3306 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3307 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3308 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3309 // Downgrade the EDCA parameters if needed
3310 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3311 // Send the active EDCA parameters to HAL
3312 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3313 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3314 } else {
3315 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3316 }
3317#if defined WLAN_FEATURE_VOWIFI
3318 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3319#endif
3320
3321 if (subType == LIM_REASSOC)
3322 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3323 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3324 {
3325 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303326 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3327 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003328 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3329 }
3330 }
3331 }
3332 else
3333 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303334 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3335 psessionEntry->peSessionId, psessionEntry->limMlmState);
Abhishek Singhc0fccd22015-10-19 16:44:00 +05303336 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303338 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3339 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3340 else
3341 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Abhishek Singhde7f0512015-10-23 14:31:15 +05303342 psessionEntry->addBssfailed = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 }
3344
3345 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3346 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303347 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3348 //Set the RXP mode to IDLE, so it starts filtering the frames.
3349 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3350 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3351 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 /* Update PE session Id*/
3353 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3354 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3355 }
3356 end:
3357 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003358 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303359 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303360 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003361 limMsgQ->bodyptr = NULL;
3362 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003363}
3364
3365
3366
3367/**
3368 * limProcessMlmAddBssRsp()
3369 *
3370 *FUNCTION:
3371 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3372 * Upon receipt of this message from HAL, MLME -
3373 * > Determines the "state" in which this message was received
3374 * > Forwards it to the appropriate callback
3375 *
3376 *LOGIC:
3377 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3378 * in the following two states:
3379 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3380 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3381 * Based on these two states, this API will determine where to
3382 * route the message to
3383 *
3384 *ASSUMPTIONS:
3385 *
3386 *NOTE:
3387 *
3388 * @param pMac Pointer to Global MAC structure
3389 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3390 *
3391 * @return None
3392 */
3393void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3394{
3395 tLimMlmStartCnf mlmStartCnf;
3396 tpPESession psessionEntry;
3397 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3398
3399 if(NULL == pAddBssParams )
3400 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003401 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003402 return;
3403 }
3404
3405 //
3406 // TODO & FIXME_GEN4
3407 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3408 //
3409 //we need to process the deferred message since the initiating req. there might be nested request.
3410 //in the case of nested request the new request initiated from the response will take care of resetting
3411 //the deffered flag.
3412 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3413 // Validate SME/LIM state
3414 // Validate MLME state
3415 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3416 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303417 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3418 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003419 if( NULL != pAddBssParams )
3420 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303421 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003422 vos_mem_free(pAddBssParams);
3423 limMsgQ->bodyptr = NULL;
3424 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003425 return;
3426 }
3427 /* update PE session Id*/
3428 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3429 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3430 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3431 else
3432 {
3433 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3434 {
3435 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3436 {
3437 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303438 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303439 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303440 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003441 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3442 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003443 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303444 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303445 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003446 limMsgQ->bodyptr = NULL;
3447 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3449 }
3450 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3451 {
3452 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3453 }
3454 else
3455 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3456 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303457 else {
3458#ifdef WLAN_FEATURE_LFR_MBB
3459 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
3460 lim_process_sta_mlm_add_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
3461 return;
3462 }
3463#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 /* Called while processing assoc response */
3465 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303466 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003467 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003468
3469 if(limIsInMCC(pMac))
3470 {
3471 WDA_TrafficStatsTimerActivate(TRUE);
3472 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003473
3474#ifdef WLAN_FEATURE_11W
3475 if (psessionEntry->limRmfEnabled)
3476 {
3477 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3478 {
3479 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003480 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003481 }
3482 }
3483#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003484}
3485/**
3486 * limProcessMlmSetKeyRsp()
3487 *
3488 *FUNCTION:
3489 * This function is called to process the following two
3490 * messages from HAL:
3491 * 1) WDA_SET_BSSKEY_RSP
3492 * 2) WDA_SET_STAKEY_RSP
3493 * 3) WDA_SET_STA_BCASTKEY_RSP
3494 * Upon receipt of this message from HAL,
3495 * MLME -
3496 * > Determines the "state" in which this message was received
3497 * > Forwards it to the appropriate callback
3498 *
3499 *LOGIC:
3500 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3501 * received by MLME while in the following state:
3502 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3503 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3504 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3505 * Based on this state, this API will determine where to
3506 * route the message to
3507 *
3508 *ASSUMPTIONS:
3509 * ONLY the MLME state is being taken into account for now.
3510 * This is because, it appears that the handling of the
3511 * SETKEYS REQ is handled symmetrically on both the AP & STA
3512 *
3513 *NOTE:
3514 *
3515 * @param pMac Pointer to Global MAC structure
3516 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3517 *
3518 * @return None
3519 */
3520void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3521{
Jeff Johnsone7245742012-09-05 17:12:55 -07003522 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 tLimMlmSetKeysCnf mlmSetKeysCnf;
3524 tANI_U8 sessionId = 0;
3525 tpPESession psessionEntry;
3526 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303527 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003528 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003529 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003531 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 return;
3533 }
3534 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3535 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003537 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303538 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303539 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003540 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 return;
3542 }
3543 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3544 {
3545 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303546 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 // There's not much that MLME can do at this stage...
3548 respReqd = 0;
3549 }
3550 else
3551 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3552
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303553 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303554 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003555 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003556 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003558 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003559 if( respReqd )
3560 {
3561 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3562 // Prepare and Send LIM_MLM_SETKEYS_CNF
3563 if( NULL != lpLimMlmSetKeysReq )
3564 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303565 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3566 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3567 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003568 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303569 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3570 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303571 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 pMac->lim.gpLimMlmSetKeysReq = NULL;
3573 }
3574 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003575 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 }
3577}
3578void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3579{
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003581 tANI_U16 resultCode;
3582 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303584 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3585
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303587 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303588 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003590 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 return;
3592 }
3593 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303594 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303596 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3597 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303598 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303599 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003600 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003601 return;
3602 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303603 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003604 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3605 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303606 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3607 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003608
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3610 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3611 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303612 /* Mesg received from HAL in Invalid state! */
3613 limLog( pMac, LOGW,
3614 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3615 limMsgQ->type, psessionEntry->limMlmState );
3616 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 }
3618 else
3619 mlmSetKeysCnf.resultCode = resultCode;
3620
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303621 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303622 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003623 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3626
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303627 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3628 psessionEntry->peSessionId, psessionEntry->limMlmState));
3629 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3630 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003631
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303632 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3633 if( NULL != lpLimMlmSetKeysReq )
3634 {
3635 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3636 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3637 sizeof(tSirMacAddr));
3638 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3639 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3640 sizeof(tLimMlmSetKeysReq));
3641 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3642 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303644 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003645}
3646/**
3647 * limProcessMlmRemoveKeyRsp()
3648 *
3649 *FUNCTION:
3650 *
3651 *LOGIC:
3652 *
3653 *ASSUMPTIONS:
3654 *
3655 *NOTE:
3656 *
3657 * @param pMac Pointer to Global MAC structure
3658 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3659 *
3660 * @return None
3661 */
3662void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3663{
Jeff Johnsone7245742012-09-05 17:12:55 -07003664 tANI_U8 respReqd = 1;
3665 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3666 tANI_U16 resultCode;
3667 tANI_U8 sessionId = 0;
3668 tpPESession psessionEntry;
3669 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303670 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003671
3672 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003673 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003674 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003675 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003676 }
3677
Jeff Johnsone7245742012-09-05 17:12:55 -07003678 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3679 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3680 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3681 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003682
Jeff Johnsone7245742012-09-05 17:12:55 -07003683 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003685 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003686 return;
3687 }
3688
3689 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3690 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3691 else
3692 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3693
3694 // Validate MLME state
3695 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3696 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3697 {
3698 // Mesg received from HAL in Invalid state!
3699 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303700 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003701 limMsgQ->type,
3702 psessionEntry->limMlmState );
3703 respReqd = 0;
3704 }
3705 else
3706 mlmRemoveCnf.resultCode = resultCode;
3707
3708 //
3709 // TODO & FIXME_GEN4
3710 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3711 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303712 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303713 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003714 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003715
3716 // Restore MLME state
3717 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3718 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3719
3720 if( respReqd )
3721 {
3722 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3723 mlmRemoveCnf.sessionId = sessionId;
3724
3725 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3726 if( NULL != lpLimMlmRemoveKeyReq )
3727 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303728 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3729 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3730 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003731 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303732 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003733 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3734 }
3735 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3736 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003737}
3738
Jeff Johnson295189b2012-06-20 16:38:30 -07003739
3740/** ---------------------------------------------------------------------
3741\fn limProcessInitScanRsp
3742\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3743\ message from HAL. If status code is failure, then
3744\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3745\param tpAniSirGlobal pMac
3746\param tANI_U32 body
3747\return none
3748\ ----------------------------------------------------------------------- */
3749void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3750{
3751 tpInitScanParams pInitScanParam;
3752 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3754 pInitScanParam = (tpInitScanParams) body;
3755 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303756 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003757
3758 //Only abort scan if the we are scanning.
3759 if( pMac->lim.abortScan &&
3760 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3761 {
krunal sonid3d60e12013-07-17 13:24:09 -07003762 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 pMac->lim.abortScan = 0;
3764 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3765 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3766 //Set the resume channel to Any valid channel (invalid).
3767 //This will instruct HAL to set it to any previous valid channel.
3768 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003769 if (status != eHAL_STATUS_SUCCESS)
3770 {
3771 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3772 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3773 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3774 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3775 return;
3776 }
3777 else
3778 {
3779 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3780 }
3781
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 }
3783 switch(pMac->lim.gLimHalScanState)
3784 {
3785 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3786 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3787 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003788 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3790 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3791 /*
3792 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3793 * another Scan request in the same context (happens when 11d is enabled
3794 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3795 * scan in the same context but with bigger channel list), so the state needs to be
3796 * changed before this response message is sent.
3797 */
3798 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 return;
3800 }
3801 else if (status == eHAL_STATUS_SUCCESS)
3802 {
3803 /* since we have successfully triggered a background scan,
3804 * reset the "consecutive bkgnd scan failure" count to 0
3805 */
3806 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3807 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003808 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 }
3810 limContinueChannelScan(pMac);
3811 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003812//WLAN_SUSPEND_LINK Related
3813 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3814 if( pMac->lim.gpLimSuspendCallback )
3815 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303816 if( eHAL_STATUS_SUCCESS == status )
3817 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303819 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303821 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303823 pMac->lim.gLimSystemInScanLearnMode = 0;
3824 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003825
3826 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3827 pMac->lim.gpLimSuspendCallback = NULL;
3828 pMac->lim.gpLimSuspendData = NULL;
3829 }
3830 else
3831 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003832 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 return;
3834 }
3835 break;
3836//end WLAN_SUSPEND_LINK Related
3837 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003838 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 pMac->lim.gLimHalScanState);
3840 break;
3841 }
3842 return;
3843}
3844/**
3845 * limProcessSwitchChannelReAssocReq()
3846 *
3847 *FUNCTION:
3848 * This function is called to send the reassoc req mgmt frame after the
3849 * switchChannelRsp message is received from HAL.
3850 *
3851 *LOGIC:
3852 *
3853 *ASSUMPTIONS:
3854 * NA
3855 *
3856 *NOTE:
3857 * NA
3858 *
3859 * @param pMac - Pointer to Global MAC structure.
3860 * @param psessionEntry - session related information.
3861 * @param status - channel switch success/failure.
3862 *
3863 * @return None
3864 */
3865static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3866{
3867 tLimMlmReassocCnf mlmReassocCnf;
3868 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303869#ifdef FEATURE_WLAN_ESE
3870 tANI_U32 val = 0;
3871#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003872 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3873 if(pMlmReassocReq == NULL)
3874 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003875 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3877 goto end;
3878 }
3879
3880 if(status != eHAL_STATUS_SUCCESS)
3881 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003882 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3884 goto end;
3885 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303886
3887#ifdef FEATURE_WLAN_ESE
3888 /*
3889 * In case of Ese Reassociation, change the reassoc timer
3890 * value.
3891 */
3892 val = pMlmReassocReq->reassocFailureTimeout;
3893 if (psessionEntry->isESEconnection)
3894 {
3895 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3896 }
3897 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3898 TX_SUCCESS)
3899 {
3900 limLog(pMac, LOGP,
3901 FL("unable to deactivate Reassoc failure timer"));
3902 }
3903 val = SYS_MS_TO_TICKS(val);
3904 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3905 val, 0) != TX_SUCCESS)
3906 {
3907 limLog(pMac, LOGP,
3908 FL("unable to change Reassociation failure timer"));
3909 }
3910#endif
3911 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003912 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003913 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3915 != TX_SUCCESS)
3916 {
3917 /// Could not start reassoc failure timer.
3918 // Log error
3919 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003920 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003921 // Return Reassoc confirm with
3922 // Resources Unavailable
3923 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3924 goto end;
3925 }
3926 /// Prepare and send Reassociation request frame
3927 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3928 return;
3929end:
3930 // Free up buffer allocated for reassocReq
3931 if(pMlmReassocReq != NULL)
3932 {
3933 /* Update PE session Id*/
3934 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303935 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003936 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003937 }
3938 else
3939 {
3940 mlmReassocCnf.sessionId = 0;
3941 }
3942
3943 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3944 /* Update PE sessio Id*/
3945 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3946
3947 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3948}
3949/**
3950 * limProcessSwitchChannelJoinReq()
3951 *
3952 *FUNCTION:
3953 * This function is called to send the probe req mgmt frame after the
3954 * switchChannelRsp message is received from HAL.
3955 *
3956 *LOGIC:
3957 *
3958 *ASSUMPTIONS:
3959 * NA
3960 *
3961 *NOTE:
3962 * NA
3963 *
3964 * @param pMac - Pointer to Global MAC structure.
3965 * @param psessionEntry - session related information.
3966 * @param status - channel switch success/failure.
3967 *
3968 * @return None
3969 */
3970static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3971{
3972 tANI_U32 val;
3973 tSirMacSSid ssId;
3974 tLimMlmJoinCnf mlmJoinCnf;
3975 if(status != eHAL_STATUS_SUCCESS)
3976 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003977 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 goto error;
3979 }
3980
3981 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3982 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003983 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003984 goto error;
3985 }
3986
Jeff Johnsone7245742012-09-05 17:12:55 -07003987
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3989 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3990 {
3991 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3992 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303993 {
3994 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3995 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3996 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303998 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004000
4001 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4002 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004003 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4005 // Apply previously set configuration at HW
4006 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05304007
4008 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
4009 * disconnection was caused by HB failure.
4010 */
4011 if(pMac->roam.configParam.sendDeauthBeforeCon)
4012 {
4013 int apCount;
4014
4015 for(apCount = 0; apCount < 2; apCount++)
4016 {
4017
4018 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4019 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
4020 {
4021 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
4022 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
4023 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
4024 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
4025
4026 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
4027 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4028 psessionEntry, FALSE );
4029
4030 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
4031 sizeof(tSirMacAddr));
4032 break;
4033 }
4034 }
4035 }
4036
Jeff Johnson295189b2012-06-20 16:38:30 -07004037 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304038 vos_mem_copy(ssId.ssId,
4039 psessionEntry->ssId.ssId,
4040 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004042
4043 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
4044
4045 //assign appropriate sessionId to the timer object
4046 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05304047 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
4048 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
4049 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304050 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 // include additional IE if there is
4052 limSendProbeReqMgmtFrame( pMac, &ssId,
4053 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
4054 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
4055 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07004056
4057 // Sending mgmt frame is a blocking call activate Join failure timer now
4058 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
4059 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
4060 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004061 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004062 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
4063 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
4064 //memory is freed up below.
4065 psessionEntry->pLimMlmJoinReq = NULL;
4066 goto error;
4067 }
4068
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004069 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
4070 {
Yathish9f22e662012-12-10 14:21:35 -08004071 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004072 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
4073 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004074 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004075 goto error;
4076 }
4077 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004078
Jeff Johnson295189b2012-06-20 16:38:30 -07004079 return;
4080error:
4081 if(NULL != psessionEntry)
4082 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304083 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004084 psessionEntry->pLimMlmJoinReq = NULL;
4085 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
4086 }
4087 else
4088 {
4089 mlmJoinCnf.sessionId = 0;
4090 }
4091 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4092 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4093 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
4094}
4095
4096/**
4097 * limProcessSwitchChannelRsp()
4098 *
4099 *FUNCTION:
4100 * This function is called to process switchChannelRsp message from HAL.
4101 *
4102 *LOGIC:
4103 *
4104 *ASSUMPTIONS:
4105 * NA
4106 *
4107 *NOTE:
4108 * NA
4109 *
4110 * @param pMac - Pointer to Global MAC structure
4111 * @param body - message body.
4112 *
4113 * @return None
4114 */
4115void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4116{
4117 tpSwitchChannelParams pChnlParams = NULL;
4118 eHalStatus status;
4119 tANI_U16 channelChangeReasonCode;
4120 tANI_U8 peSessionId;
4121 tpPESession psessionEntry;
4122 //we need to process the deferred message since the initiating req. there might be nested request.
4123 //in the case of nested request the new request initiated from the response will take care of resetting
4124 //the deffered flag.
4125 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4126 pChnlParams = (tpSwitchChannelParams) body;
4127 status = pChnlParams->status;
4128 peSessionId = pChnlParams->peSessionId;
4129 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4130 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304131 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004132 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 return;
4134 }
4135#if defined WLAN_FEATURE_VOWIFI
4136 //HAL fills in the tx power used for mgmt frames in this field.
4137 //Store this value to use in TPC report IE.
4138 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4139#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4141 // initialize it back to invalid id
4142 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304143 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 switch(channelChangeReasonCode)
4145 {
4146 case LIM_SWITCH_CHANNEL_REASSOC:
4147 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4148 break;
4149 case LIM_SWITCH_CHANNEL_JOIN:
4150 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4151 break;
4152
4153 case LIM_SWITCH_CHANNEL_OPERATION:
4154 /*
4155 * The above code should also use the callback.
4156 * mechanism below, there is scope for cleanup here.
4157 * THat way all this response handler does is call the call back
4158 * We can get rid of the reason code here.
4159 */
4160 if (pMac->lim.gpchangeChannelCallback)
4161 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304162 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004163 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4164 {
4165 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4166 {
4167 if ( psessionEntry && psessionEntry->limSmeState
4168 == eLIM_SME_LINK_EST_STATE )
4169 {
4170 peSetResumeChannel( pMac,
4171 psessionEntry->currentOperChannel,
4172 psessionEntry->htSecondaryChannelOffset);
4173 }
4174 else
4175 {
4176 peSetResumeChannel( pMac, 0, 0);
4177 }
4178 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4179 }
4180 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4182 }
4183 break;
4184 default:
4185 break;
4186 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304187 vos_mem_free(body);
4188 body = NULL;
4189
Jeff Johnson295189b2012-06-20 16:38:30 -07004190}
4191/**
4192 * limProcessStartScanRsp()
4193 *
4194 *FUNCTION:
4195 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4196 * then it will start scan/learn on the next channel.
4197 *
4198 *LOGIC:
4199 *
4200 *ASSUMPTIONS:
4201 * NA
4202 *
4203 *NOTE:
4204 * NA
4205 *
4206 * @param pMac - Pointer to Global MAC structure
4207 * @param body - message body.
4208 *
4209 * @return None
4210 */
4211
4212void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4213{
4214 tpStartScanParams pStartScanParam;
4215 eHalStatus status;
4216 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4217 pStartScanParam = (tpStartScanParams) body;
4218 status = pStartScanParam->status;
4219#if defined WLAN_FEATURE_VOWIFI
4220 //HAL fills in the tx power used for mgmt frames in this field.
4221 //Store this value to use in TPC report IE.
4222 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4223 //Store start TSF of scan start. This will be stored in BSS params.
4224 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4225#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304226 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004227 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 if( pMac->lim.abortScan )
4229 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004230 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 pMac->lim.abortScan = 0;
4232 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4233 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4234 //Set the resume channel to Any valid channel (invalid).
4235 //This will instruct HAL to set it to any previous valid channel.
4236 peSetResumeChannel(pMac, 0, 0);
4237 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4238 }
4239 switch(pMac->lim.gLimHalScanState)
4240 {
4241 case eLIM_HAL_START_SCAN_WAIT_STATE:
4242 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4243 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004244 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 //
4246 // FIXME - With this, LIM will try and recover state, but
4247 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4248 // status back to the SME
4249 //
4250 //Set the resume channel to Any valid channel (invalid).
4251 //This will instruct HAL to set it to any previous valid channel.
4252 peSetResumeChannel(pMac, 0, 0);
4253 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4254 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4255 }
4256 else
4257 {
4258 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4259 limContinuePostChannelScan(pMac);
4260 }
4261 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004263 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004264 pMac->lim.gLimHalScanState);
4265 break;
4266 }
4267 return;
4268}
4269void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4270{
4271 tpEndScanParams pEndScanParam;
4272 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4274 pEndScanParam = (tpEndScanParams) body;
4275 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304276 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004277 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004278 switch(pMac->lim.gLimHalScanState)
4279 {
4280 case eLIM_HAL_END_SCAN_WAIT_STATE:
4281 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4282 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004283 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4285 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4286 }
4287 else
4288 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004289 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 limContinueChannelScan(pMac);
4291 }
4292 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004294 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 pMac->lim.gLimHalScanState);
4296 break;
4297 }
4298 return;
4299}
Jeff Johnsone7245742012-09-05 17:12:55 -07004300/**
4301 * limStopTxAndSwitch()
4302 *
4303 *FUNCTION:
4304 * Start channel switch on all sessions that is in channel switch state.
4305 *
4306 * @param pMac - pointer to global adapter context
4307 *
4308 * @return None
4309 *
4310 */
4311static void
4312limStopTxAndSwitch (tpAniSirGlobal pMac)
4313{
4314 tANI_U8 i;
4315
4316 for(i =0; i < pMac->lim.maxBssId; i++)
4317 {
4318 if(pMac->lim.gpSession[i].valid &&
4319 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4320 {
4321 limStopTxAndSwitchChannel(pMac, i);
4322 }
4323 }
4324 return;
4325}
4326/**
4327 * limStartQuietOnSession()
4328 *
4329 *FUNCTION:
4330 * This function is called to start quiet timer after finish scan if there is
4331 * qeuieting on any session.
4332 *
4333 *LOGIC:
4334 *
4335 *ASSUMPTIONS:
4336 * NA
4337 *
4338 *NOTE:
4339 * NA
4340 *
4341 * @param pMac - Pointer to Global MAC structure
4342 *
4343 * @return None
4344 */
4345static void
4346limStartQuietOnSession (tpAniSirGlobal pMac)
4347{
4348 tANI_U8 i;
4349
4350 for(i =0; i < pMac->lim.maxBssId; i++)
4351 {
4352 if(pMac->lim.gpSession[i].valid &&
4353 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4354 {
4355 limStartQuietTimer(pMac, i);
4356 }
4357 }
4358 return;
4359}
Jeff Johnson295189b2012-06-20 16:38:30 -07004360void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4361{
4362 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004363 eHalStatus status;
4364 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4365 pFinishScanParam = (tpFinishScanParams) body;
4366 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004367
Sushant Kaushik826de802014-05-08 18:04:11 +05304368 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4369 pMac->lim.gLimHalScanState,
4370 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004371
Jeff Johnson295189b2012-06-20 16:38:30 -07004372 switch(pMac->lim.gLimHalScanState)
4373 {
4374 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304375#ifdef FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05304376 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_COMP_EVENT, NULL,
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304377 status, eSIR_SUCCESS);
4378#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Padma, Santhosh Kumar8eb1d7a2015-07-31 11:35:53 +05304380 if (pMac->lim.abortScan)
4381 pMac->lim.abortScan = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004383 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004384 {
4385 /** Right time to stop tx and start the timer for channel switch */
4386 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4387 * be any associated session id
4388 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004389 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004391 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 {
4393 /** Start the quieting */
4394 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4395 * be any associated session id
4396 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004397 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4400 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004401 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 }
4403 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004404//WLAN_SUSPEND_LINK Related
4405 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4406 if( pMac->lim.gpLimResumeCallback )
4407 {
4408 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4409 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4410 pMac->lim.gpLimResumeCallback = NULL;
4411 pMac->lim.gpLimResumeData = NULL;
4412 pMac->lim.gLimSystemInScanLearnMode = 0;
4413 }
4414 else
4415 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004416 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304417 vos_mem_free(body);
4418 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 return;
4420 }
4421 break;
4422//end WLAN_SUSPEND_LINK Related
4423
4424 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004425 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 pMac->lim.gLimHalScanState);
4427 break;
4428 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304429 vos_mem_free(body);
4430 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 return;
4432}
4433/**
4434 * @function : limProcessMlmHalAddBARsp
4435 *
4436 * @brief: Process WDA_ADDBA_RSP coming from HAL
4437 *
4438 *
4439 * @param pMac The global tpAniSirGlobal object
4440 *
4441 * @param tSirMsgQ The MsgQ header containing the response buffer
4442 *
4443 * @return none
4444 */
4445void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4446 tpSirMsgQ limMsgQ )
4447{
4448 // Send LIM_MLM_ADDBA_CNF to LIM
4449 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004450 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004452
Jeff Johnson295189b2012-06-20 16:38:30 -07004453 //now LIM can process any defer message.
4454 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4455 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004456 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 return;
4458 }
4459 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4460 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004461 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304462 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004463 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 return;
4465 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004466
4467 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304468 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4469 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004470 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304471 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004472 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 return;
4474 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304475 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304477 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4478 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 // Copy other ADDBA Rsp parameters
4480 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4481 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4482 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4483 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4484 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4485 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4486 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4487 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4488 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4489 else
4490 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304491
4492#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4493 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry,
4494 pAddBAParams->status, pMlmAddBACnf->addBAResultCode);
4495#endif //FEATURE_WLAN_DIAG_SUPPORT
4496
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304497 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004498 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 // Send ADDBA CNF to LIM
4500 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4501}
4502/**
4503 * \brief Process LIM_MLM_ADDBA_CNF
4504 *
4505 * \sa limProcessMlmAddBACnf
4506 *
4507 * \param pMac The global tpAniSirGlobal object
4508 *
4509 * \param tSirMsgQ The MsgQ header containing the response buffer
4510 *
4511 * \return none
4512 */
4513void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4514 tANI_U32 *pMsgBuf )
4515{
4516tpLimMlmAddBACnf pMlmAddBACnf;
4517tpDphHashNode pSta;
4518tANI_U16 aid;
4519tLimBAState curBaState;
4520tpPESession psessionEntry = NULL;
4521if(pMsgBuf == NULL)
4522{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004523 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004524 return;
4525}
4526pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4527 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4528 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004529 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304530 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 return;
4532 }
4533 // First, extract the DPH entry
4534 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4535 if( NULL == pSta )
4536 {
4537 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004538 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304539 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 return;
4541 }
4542 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4543 // Need to validate SME state
4544 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4545 {
4546 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004547 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304549 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 return;
4551 }
4552 // Restore STA BA state
4553 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004554 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 {
4556 // Update LIM internal cache...
4557 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4558 {
4559 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4560 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4561 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4562 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4563 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004564 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4565 // status code. MLME will then send an ADDBA RSP
4566 // over the air to the peer MAC entity
4567 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4568 pMlmAddBACnf->peerMacAddr,
4569 pMlmAddBACnf->addBAResultCode,
4570 pMlmAddBACnf->baDialogToken,
4571 (tANI_U8) pMlmAddBACnf->baTID,
4572 (tANI_U8) pMlmAddBACnf->baPolicy,
4573 pMlmAddBACnf->baBufferSize,
4574 pMlmAddBACnf->baTimeout,psessionEntry))
4575 {
4576 PELOGW(limLog( pMac, LOGW,
4577 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4578 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4579 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 }
4581 else
4582 {
4583 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4584 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4585 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4586 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4587 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4588 }
4589 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004590 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304591 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004592 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004593}
4594/**
4595 * \brief Process LIM_MLM_DELBA_CNF
4596 *
4597 * \sa limProcessMlmDelBACnf
4598 *
4599 * \param pMac The global tpAniSirGlobal object
4600 *
4601 * \param tSirMsgQ The MsgQ header containing the response buffer
4602 *
4603 * \return none
4604 */
4605void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4606 tANI_U32 *pMsgBuf )
4607{
4608 tpLimMlmDelBACnf pMlmDelBACnf;
4609 tpDphHashNode pSta;
4610 tANI_U16 aid;
4611// tANI_U8 sessionId;
4612 tLimBAState curBaState;
4613 tpPESession psessionEntry;
4614
4615 if(pMsgBuf == NULL)
4616 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004617 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 return;
4619 }
4620 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4621 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4622 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304623 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4624 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304625 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 return;
4627 }
4628 // First, extract the DPH entry
4629 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4630 if( NULL == pSta )
4631 {
4632 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004633 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304634 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004635 return;
4636 }
4637 if(NULL == pMlmDelBACnf)
4638 {
4639 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004640 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004641 return;
4642 }
4643 // Need to validate baState
4644 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4645 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4646 {
4647 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004648 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304650 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 return;
4652 }
4653 // Restore STA BA state
4654 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4655 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304656 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004657}
4658/**
4659 * \brief Process SIR_LIM_DEL_BA_IND
4660 *
4661 * \sa limProcessMlmHalBADeleteInd
4662 *
4663 * \param pMac The global tpAniSirGlobal object
4664 *
4665 * \param tSirMsgQ The MsgQ header containing the indication buffer
4666 *
4667 * \return none
4668 */
4669void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4670 tpSirMsgQ limMsgQ )
4671{
4672 tSirRetStatus status = eSIR_SUCCESS;
4673 tpBADeleteParams pBADeleteParams;
4674 tpDphHashNode pSta;
4675 tANI_U16 aid;
4676 tLimBAState curBaState;
4677 tpPESession psessionEntry;
4678 tANI_U8 sessionId;
4679
4680 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4681
4682 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4683 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004684 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304685 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004686 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004687 return;
4688 }
4689 // First, extract the DPH entry
4690 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4691 if( NULL == pSta )
4692 {
4693 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004694 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 goto returnAfterCleanup;
4696 }
4697
4698 // Need to validate BA state
4699 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4700 if( eLIM_BA_STATE_IDLE != curBaState )
4701 {
4702 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004703 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004704 curBaState );
4705 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304706 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004707
Abhishek Singh66c16762014-08-14 19:13:19 +05304708 // Post DELBA REQ to MLME...
4709 if( eSIR_SUCCESS !=
4710 (status = limPostMlmDelBAReq( pMac,
4711 pSta,
4712 pBADeleteParams->baDirection,
4713 pBADeleteParams->baTID,
4714 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004715 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304716 limLog( pMac, LOGE,
4717 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004718 }
4719 else
4720 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304721 limLog( pMac, LOGE,
4722 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4723 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4724 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004725 }
4726returnAfterCleanup:
4727 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304728 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004729 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004730}
4731/**
4732 * @function : limProcessSetMimoRsp()
4733 *
4734 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4735 * after Processing the Req from the SME (PMC)
4736 *
4737 * LOGIC:
4738 *
4739 * ASSUMPTIONS:
4740 * NA
4741 *
4742 * NOTE:
4743 * NA
4744 *
4745 * @param pMac - Pointer to Global MAC structure
4746 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4747 * @return None
4748 */
4749
4750void
4751limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4752{
4753#if 0
4754 tSirRetStatus retStatus;
4755 tpSetMIMOPS pMIMO_PSParams;
4756
4757
4758 do {
4759
4760 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4761 if( NULL == pMIMO_PSParams ) {
4762 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4763 return;
4764 }
4765
4766 /** If Updation of the HAL Fail's*/
4767 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004768 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004769 break;
4770 }
4771
4772 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4773 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4774 break;
4775
4776 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4777 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4778
4779 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4780 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4781 * the Action Frame is being sent at first before setting the internal structures
4782 */
4783 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4784 tSirMacAddr macAddr;
4785
4786 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304787 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004788
4789 /** Send Action Frame with the corresponding mode */
4790 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4791 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004792 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 break;
4794 }
4795 }
4796 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4797 }while(0);
4798
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304799 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004800#endif
4801}
4802/**
4803 * @function : limHandleDelBssInReAssocContext
4804 * @brief : While Processing the ReAssociation Response Frame in STA,
4805 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4806 * being issued and the end of DelBSS the new BSS is being added.
4807 *
4808 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4809 * change, We need to update CSR with ReAssocCNF Response with the
4810 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4811 * context only
4812 *
4813 * @param : pMac - tpAniSirGlobal
4814 * pStaDs - Station Descriptor
4815 *
4816 * @return : none
4817 */
4818static void
4819limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4820{
4821 tLimMlmReassocCnf mlmReassocCnf;
4822 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4823 /** Set the MlmState to IDLE*/
4824 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 /* Update PE session Id*/
4826 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304827 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 case eLIM_SME_WT_REASSOC_STATE :
4829 {
4830 tpSirAssocRsp assocRsp;
4831 tpDphHashNode pStaDs;
4832 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304833 tpSchBeaconStruct pBeaconStruct;
4834 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4835 if (NULL == pBeaconStruct)
4836 {
4837 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4838 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4839 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4840 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4841 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4842 goto Error;
4843 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 /** Delete the older STA Table entry */
4845 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4846 /**
4847 * Add an entry for AP to hash table
4848 * maintained by DPH module
4849 */
4850 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4851 {
4852 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004853 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004854 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4855 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4856 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Abhishek Singh2b055852015-10-07 14:14:13 +05304857 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 goto Error;
4859 }
4860 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4861 * is being stored to be used here for sending ADDBSS
4862 */
4863 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4864 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4865 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004866 limExtractApCapabilities( pMac,
Abhishek Singhbad2b322016-10-21 11:22:33 +05304867 (tANI_U8 *)
4868 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4869 GET_IE_LEN_IN_BSS(
4870 psessionEntry->pLimReAssocReq->bssDescription.length),
4871 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304873 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4874 if(pBeaconStruct->erpPresent) {
4875 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004876 psessionEntry->beaconParams.fShortPreamble = 0;
4877 else
4878 psessionEntry->beaconParams.fShortPreamble = 1;
4879 }
4880 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
Sushant Kaushik374fd052015-03-12 16:47:53 +05304881 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004882 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004883 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 retStatus = eSIR_FAILURE;
4885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 if (retStatus != eSIR_SUCCESS)
4887 {
4888 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4889 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304890 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304891 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004892 pMac->lim.gLimAssocResponseData = NULL;
4893 goto Error;
4894 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304895 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304896 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004897 psessionEntry->limAssocResponseData = NULL;
4898 }
4899 break;
4900 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4901 {
4902 /** Case wherein the DisAssoc / Deauth
4903 * being sent as response to ReAssoc Req*/
4904 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4905 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4906 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4907 /** Set the SME State back to WT_Reassoc State*/
4908 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4910 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4911 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4912 {
4913 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 }
4915 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4916 }
4917 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004919 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004920 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4921 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4922 goto Error;
4923 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004924 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004925Error:
4926 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4927}
4928
4929/* Added For BT -AMP Support */
4930static void
4931limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4932{
4933 tLimMlmStartCnf mlmStartCnf;
4934 tANI_U32 val;
4935 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4936
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304937 if (NULL == pAddBssParams)
4938 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004939 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304940 goto end;
4941 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004942 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4943 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004944 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4946 {
4947 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4948 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4949 goto end;
4950 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4951 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4952 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4953 goto end;
4954 }
4955
4956 // Set MLME state
4957 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4958 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4959 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4960 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004961 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 // Create timers used by LIM
4963 if (!pMac->lim.gLimTimersCreated)
4964 limCreateTimers(pMac);
4965 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4966 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004967 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4969 // Apply previously set configuration at HW
4970 limApplyConfiguration(pMac,psessionEntry);
4971 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4972 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4973 }
4974 else
4975 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004976 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004977 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4978 }
4979 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4980 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4981 end:
4982 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004983 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304984 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304985 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004986 limMsgQ->bodyptr = NULL;
4987 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004988}
4989
4990/**
4991 * @function : limHandleAddBssInReAssocContext
4992 * @brief : While Processing the ReAssociation Response Frame in STA,
4993 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4994 * being issued and the end of DelBSS the new BSS is being added.
4995 *
4996 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4997 * change, We need to update CSR with ReAssocCNF Response with the
4998 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4999 * context only
5000 *
5001 * @param : pMac - tpAniSirGlobal
5002 * pStaDs - Station Descriptor
5003 *
5004 * @return : none
5005 */
5006void
5007limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
5008{
5009 tLimMlmReassocCnf mlmReassocCnf;
5010 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
5011 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005012 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
5013 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07005014 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07005015 case eLIM_SME_WT_REASSOC_STATE : {
5016 tpSirAssocRsp assocRsp;
5017 tpDphHashNode pStaDs;
5018 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005019 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305020 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
5021 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005022 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305023 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005024 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5025 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5026 goto Error;
5027 }
5028
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 // Get the AP entry from DPH hash table
5030 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5031 if (pStaDs == NULL )
5032 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005033 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005034 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5035 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305036 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005037 goto Error;
5038 }
5039 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
5040 * is being stored to be used here for sending ADDBSS
5041 */
5042 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
5043 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
5044 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Abhishek Singhbad2b322016-10-21 11:22:33 +05305045 limExtractApCapabilities(pMac,
5046 (tANI_U8 *)
5047 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
5048 GET_IE_LEN_IN_BSS(
5049 psessionEntry->pLimReAssocReq->bssDescription.length),
5050 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005051 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005052 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
5053
5054 if(pBeaconStruct->erpPresent)
5055 {
5056 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 psessionEntry->beaconParams.fShortPreamble = 0;
5058 else
5059 psessionEntry->beaconParams.fShortPreamble = 1;
5060 }
5061
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005062 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005064 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 retStatus = eSIR_FAILURE;
5066 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005067 if (retStatus != eSIR_SUCCESS)
5068 {
5069 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5070 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305071 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305073 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005074 goto Error;
5075 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305076 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005077 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305078 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 }
5080 break;
5081 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
5082 * being sent as response to ReAssoc Req*/
5083 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
5084 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
5085 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
5086 /** Set the SME State back to WT_Reassoc State*/
5087 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
5088 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
5089 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005090 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005091 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005092 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
5093 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005094
5095 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5096 }
5097 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005098 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005099 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
5101 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
5102 goto Error;
5103 }
5104return;
5105Error:
5106 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5107}
5108
5109#if 0
5110 static void
5111limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
5112{
5113 tSirSmeAssocCnf assocCnf;
5114 tpDphHashNode pStaDs;
5115 tpPESession psessionEntry;
5116 tANI_U8 sessionId;
5117
5118 if(pMsgBuf == NULL)
5119 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005120 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005121 goto end;
5122 }
5123 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
5124 !__limIsSmeAssocCnfValid(&assocCnf))
5125 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005126 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005127 goto end;
5128 }
5129 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5130 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005131 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005132 goto end;
5133 }
5134 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5135 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5136 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005137 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005138 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5139 goto end;
5140 }
5141 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5142 if (pStaDs == NULL)
5143 {
5144 limLog(pMac, LOG1,
5145 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5146 msgType, assocCnf.aid);
5147 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5148 /*
5149 ** send a DISASSOC_IND message to WSM to make sure
5150 ** the state in WSM and LIM is the same
5151 **/
5152 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5153 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5154 goto end;
5155 }
5156 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305157 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005158 (tANI_U8 *) assocCnf.peerMacAddr,
5159 sizeof(tSirMacAddr)) ) ||
5160 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5161 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5162 (msgType != eWNI_SME_ASSOC_CNF)) ||
5163 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5164 (msgType != eWNI_SME_REASSOC_CNF)))))
5165 {
5166 limLog(pMac, LOG1,
5167 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5168 msgType, assocCnf.aid);
5169 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5170 goto end;
5171 }
5172 /*
5173 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5174 ** has been received
5175 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005176 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005177 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5178 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5179 {
5180 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5181 * when it had received Assoc Request frame. Now, PE just needs to send
5182 * Association Response frame to the requesting BTAMP-STA.
5183 */
5184 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005185 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005186 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5187 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5188 goto end;
5189 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5190 else
5191 {
5192 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5193 limRejectAssociation(pMac, pStaDs->staAddr,
5194 pStaDs->mlmStaContext.subType,
5195 true, pStaDs->mlmStaContext.authType,
5196 pStaDs->assocId, true,
5197 assocCnf.statusCode, psessionEntry);
5198 return;
5199 }
5200end:
5201 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5202 {
5203 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5204 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305205 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005206 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5207 }
5208
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305209 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5211 }
5212} /*** end __limProcessSmeAssocCnfNew() ***/
5213#endif
5214
Jeff Johnson295189b2012-06-20 16:38:30 -07005215void
5216limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5217 tBeaconGenParams *pBeaconGenParams = NULL;
5218 tSirMsgQ limMsg;
5219 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5220 if(psessionEntry == NULL ){
5221 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005222 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005223 return;
5224 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305225 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5226 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005227 {
5228 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305229 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005230 return;
5231 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305232 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5233 vos_mem_copy((void *) pBeaconGenParams->bssId,
5234 (void *)psessionEntry->bssId,
5235 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005236 limMsg.bodyptr = pBeaconGenParams;
5237 schProcessPreBeaconInd(pMac, &limMsg);
5238 return;
5239}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305240
5241void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5242 tSirResultCodes reasonCode)
5243{
5244 tANI_U16 scanRspLen = 0;
5245
5246 pMac->lim.gLimSmeScanResultLength +=
5247 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305248 pMac->lim.gLimRspReqd = false;
5249 if ((reasonCode == eSIR_SME_SUCCESS) ||
5250 pMac->lim.gLimSmeScanResultLength) {
5251 scanRspLen = sizeof(tSirSmeScanRsp) +
5252 pMac->lim.gLimSmeScanResultLength -
5253 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305254 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305255 else
5256 scanRspLen = sizeof(tSirSmeScanRsp);
5257
5258 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5259 pMac->lim.gSmeSessionId,
5260 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305261}
5262
5263
5264void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5265{
5266 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5267
5268 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005269 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305270
5271 switch (pScanEvent->event)
5272 {
5273 case SCAN_EVENT_STARTED:
5274 break;
5275 case SCAN_EVENT_START_FAILED:
5276 case SCAN_EVENT_COMPLETED:
5277 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5278 break;
5279 case SCAN_EVENT_BSS_CHANNEL:
5280 case SCAN_EVENT_FOREIGN_CHANNEL:
5281 case SCAN_EVENT_DEQUEUED:
5282 case SCAN_EVENT_PREEMPTED:
5283 default:
5284 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005285 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305286 }
5287}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005288
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305289void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5290{
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305291 tANI_U32 val;
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305292
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305293 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING, &val)
5294 != eSIR_SUCCESS)
5295 {
5296 limLog(pMac, LOGP, FL("fail to Get WNI_CFG_ENABLE_MAC_ADDR_SPOOFING"));
5297 /*If we here means mac spoofing is enable. So enable both Host and
5298 FW spoofing */
5299 val = 1;
5300 }
5301 if ((rspStatus != eSIR_SUCCESS) || (val != 1) ||
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305302 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5303 {
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305304 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing %d"), val);
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305305 pMac->lim.isSpoofingEnabled = FALSE;
5306 } else {
5307 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5308 pMac->lim.isSpoofingEnabled = TRUE;
5309 }
5310
5311 return;
5312}
5313
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005314void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5315 eHalStatus status,
5316 tANI_U32* mlmAddBssRsp)
5317{
5318 if (status != eHAL_STATUS_SUCCESS)
5319 {
5320 limLog(pMac, LOGE,
5321 FL(" CSA failed to get the response for resume link"));
5322 }
5323 return;
5324}