blob: 29083df860a75c3cbe02b6db88c9e8e5aa31d838 [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 {
Jeff Johnson0fe596e2017-09-19 08:36:48 -0700964 limLog(pMac, LOG1, "%s: Freeing pFTPreAuthReq= %pK", __func__,
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530965 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;
Hanumanth Reddy Pothula57323632017-12-06 17:55:09 +05301236
1237 pSirSmeAssocInd->ch_width = pAssocInd->ch_width;
1238 pSirSmeAssocInd->chan_info = pAssocInd->chan_info;
1239 if (pAssocInd->HTCaps.present)
1240 pSirSmeAssocInd->HTCaps = pAssocInd->HTCaps;
1241 if (pAssocInd->VHTCaps.present)
1242 pSirSmeAssocInd->VHTCaps = pAssocInd->VHTCaps;
Jeff Johnson295189b2012-06-20 16:38:30 -07001243} /*** end limAssocIndSerDes() ***/
1244
1245
1246
1247/**
1248 * limProcessMlmAssocInd()
1249 *
1250 *FUNCTION:
1251 * This function is called to processes MLM_ASSOC_IND
1252 * message from MLM State machine.
1253 *
1254 *LOGIC:
1255 *
1256 *ASSUMPTIONS:
1257 *
1258 *NOTE:
1259 *
1260 * @param pMac Pointer to Global MAC structure
1261 * @param pMsgBuf A pointer to the MLM message buffer
1262 *
1263 * @return None
1264 */
1265void
1266limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1267{
1268 tANI_U32 len;
1269 tSirMsgQ msgQ;
1270 tSirSmeAssocInd *pSirSmeAssocInd;
1271 tpDphHashNode pStaDs=0;
1272 tpPESession psessionEntry;
1273 if(pMsgBuf == NULL)
1274 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001275 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 return;
1277 }
1278 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1279 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001280 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 return;
1282 }
1283 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301285 pSirSmeAssocInd = vos_mem_malloc(len);
1286 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 {
1288 // Log error
1289 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301290 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 return;
1292 }
Hanumanth Reddy Pothula57323632017-12-06 17:55:09 +05301293 vos_mem_zero(pSirSmeAssocInd, len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001294
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1296 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 msgQ.type = eWNI_SME_ASSOC_IND;
1298 msgQ.bodyptr = pSirSmeAssocInd;
1299 msgQ.bodyval = 0;
1300 pStaDs = dphGetHashEntry(pMac,
1301 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1302 if (! pStaDs)
1303 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001304 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301306 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001307
1308 return;
1309 }
1310 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301312 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1313 msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001314#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1315 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1316#endif //FEATURE_WLAN_DIAG_SUPPORT
1317 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1318
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301319 limLog(pMac, LOG1,
1320 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 /*
1322 ** turn on a timer to detect the loss of ASSOC CNF
1323 **/
1324 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1325
1326// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1327#ifdef TEST_BTAMP_AP
1328//tANI_U32 *pMsgBuf;
1329{
1330 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301331 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1332 if ( NULL == pSmeAssoccnf )
1333 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1335 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301336 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1337 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1339 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301340 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1341 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301343 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1345 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301346 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001347}
1348#endif
1349
1350
1351} /*** end limProcessMlmAssocInd() ***/
1352
1353
1354
1355
1356/**
1357 * limProcessMlmDisassocInd()
1358 *
1359 *FUNCTION:
1360 * This function is called to processes MLM_DISASSOC_IND
1361 * message from MLM State machine.
1362 *
1363 *LOGIC:
1364 *
1365 *ASSUMPTIONS:
1366 *
1367 *NOTE:
1368 *
1369 * @param pMac Pointer to Global MAC structure
1370 * @param pMsgBuf A pointer to the MLM message buffer
1371 *
1372 * @return None
1373 */
1374void
1375limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1376{
1377 tLimMlmDisassocInd *pMlmDisassocInd;
1378 tpPESession psessionEntry;
1379 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1380 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1381 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001382 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 return;
1384 }
1385 switch (psessionEntry->limSystemRole)
1386 {
1387 case eLIM_STA_IN_IBSS_ROLE:
1388 break;
1389 case eLIM_STA_ROLE:
1390 case eLIM_BT_AMP_STA_ROLE:
1391 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001392 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 break;
1394 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301395 limLog(pMac, LOG1,
1396 FL("*** Peer staId = %d Disassociated ***"),
1397 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 // Send SME_DISASOC_IND after Polaris cleanup
1399 // (after receiving LIM_MLM_PURGE_STA_IND)
1400 break;
1401 } // end switch (psessionEntry->limSystemRole)
1402} /*** end limProcessMlmDisassocInd() ***/
1403
1404/**
1405 * limProcessMlmDisassocCnf()
1406 *
1407 *FUNCTION:
1408 * This function is called to processes MLM_DISASSOC_CNF
1409 * message from MLM State machine.
1410 *
1411 *LOGIC:
1412 *
1413 *ASSUMPTIONS:
1414 *
1415 *NOTE:
1416 *
1417 * @param pMac Pointer to Global MAC structure
1418 * @param pMsgBuf A pointer to the MLM message buffer
1419 *
1420 * @return None
1421 */
1422void
1423limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1424{
1425 tSirResultCodes resultCode;
1426 tLimMlmDisassocCnf *pMlmDisassocCnf;
1427 tpPESession psessionEntry;
1428 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1429 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1430 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001431 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 return;
1433 }
1434 resultCode = (tSirResultCodes)
1435 (pMlmDisassocCnf->disassocTrigger ==
1436 eLIM_LINK_MONITORING_DISASSOC) ?
1437 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1438 pMlmDisassocCnf->resultCode;
1439 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1440 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 // Disassociate Confirm from MLM
1442 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1443 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1444 {
1445 /**
1446 * Should not have received
1447 * Disassocate confirm
1448 * from MLM in other states.
1449 * Log error
1450 */
1451 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301452 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 return;
1454 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 if (pMac->lim.gLimRspReqd)
1456 pMac->lim.gLimRspReqd = false;
1457 if (pMlmDisassocCnf->disassocTrigger ==
1458 eLIM_PROMISCUOUS_MODE_DISASSOC)
1459 {
1460 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1461 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1462 else
1463 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001464 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 // Send Promiscuous mode response to host
1466 limSendSmePromiscuousModeRsp(pMac);
1467 }
1468 else
1469 {
1470 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1471 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1472 else
1473 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001474 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1476 resultCode,
1477 pMlmDisassocCnf->disassocTrigger,
1478 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1479 }
1480 }
1481 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1482 {
1483 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1484 resultCode,
1485 pMlmDisassocCnf->disassocTrigger,
1486 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1487 }
1488} /*** end limProcessMlmDisassocCnf() ***/
1489
1490/**
1491 * limProcessMlmDeauthInd()
1492 *
1493 *FUNCTION:
1494 * This function is called to processes MLM_DEAUTH_IND
1495 * message from MLM State machine.
1496 *
1497 *LOGIC:
1498 *
1499 *ASSUMPTIONS:
1500 *
1501 *NOTE:
1502 *
1503 * @param pMac Pointer to Global MAC structure
1504 * @param pMsgBuf A pointer to the MLM message buffer
1505 *
1506 * @return None
1507 */
1508void
1509limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1510{
1511 tLimMlmDeauthInd *pMlmDeauthInd;
1512 tpPESession psessionEntry;
1513 tANI_U8 sessionId;
1514 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1515 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1516 {
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05301517 PELOGE(limLog(pMac, LOGE,FL("session does not exist for Addr:" MAC_ADDRESS_STR),
1518 MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 return;
1520 }
1521 switch (psessionEntry->limSystemRole)
1522 {
1523 case eLIM_STA_IN_IBSS_ROLE:
1524 break;
1525 case eLIM_STA_ROLE:
1526 case eLIM_BT_AMP_STA_ROLE:
1527 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001528 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001529
1530 default: // eLIM_AP_ROLE
1531 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301532 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001533 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301534 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 }
1536 // Send SME_DEAUTH_IND after Polaris cleanup
1537 // (after receiving LIM_MLM_PURGE_STA_IND)
1538 break;
1539 } // end switch (psessionEntry->limSystemRole)
1540} /*** end limProcessMlmDeauthInd() ***/
1541
1542/**
1543 * limProcessMlmDeauthCnf()
1544 *
1545 *FUNCTION:
1546 * This function is called to processes MLM_DEAUTH_CNF
1547 * message from MLM State machine.
1548 *
1549 *LOGIC:
1550 *
1551 *ASSUMPTIONS:
1552 *
1553 *NOTE:
1554 *
1555 * @param pMac Pointer to Global MAC structure
1556 * @param pMsgBuf A pointer to the MLM message buffer
1557 *
1558 * @return None
1559 */
1560void
1561limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1562{
1563 tANI_U16 aid;
1564 tSirResultCodes resultCode;
1565 tLimMlmDeauthCnf *pMlmDeauthCnf;
1566 tpPESession psessionEntry;
1567
1568 if(pMsgBuf == NULL)
1569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001570 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 return;
1572 }
1573 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1574 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1575 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001576 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 return;
1578 }
1579
1580 resultCode = (tSirResultCodes)
1581 (pMlmDeauthCnf->deauthTrigger ==
1582 eLIM_LINK_MONITORING_DEAUTH) ?
1583 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1584 pMlmDeauthCnf->resultCode;
1585 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1586 pMlmDeauthCnf->aid : 1;
1587 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1588 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 // Deauth Confirm from MLM
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05301590 if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1591 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 {
1593 /**
1594 * Should not have received Deauth confirm
1595 * from MLM in other states.
1596 * Log error
1597 */
1598 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301599 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 psessionEntry->limSmeState);)
1601 return;
1602 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1604 {
1605 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301606 limLog(pMac, LOG1,
1607 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 }
1609 else
1610 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001611 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001612
1613 if (pMac->lim.gLimRspReqd)
1614 pMac->lim.gLimRspReqd = false;
1615 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1617 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1618 resultCode,
1619 pMlmDeauthCnf->deauthTrigger,
1620 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001621} /*** end limProcessMlmDeauthCnf() ***/
1622
1623/**
1624 * limProcessMlmPurgeStaInd()
1625 *
1626 *FUNCTION:
1627 * This function is called to processes MLM_PURGE_STA_IND
1628 * message from MLM State machine.
1629 *
1630 *LOGIC:
1631 *
1632 *ASSUMPTIONS:
1633 *
1634 *NOTE:
1635 *
1636 * @param pMac Pointer to Global MAC structure
1637 * @param pMsgBuf A pointer to the MLM message buffer
1638 *
1639 * @return None
1640 */
1641void
1642limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1643{
1644 tSirResultCodes resultCode;
1645 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1646 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 if(pMsgBuf == NULL)
1648 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001649 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 return;
1651 }
1652 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1653 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1654 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001655 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 return;
1657 }
1658 // Purge STA indication from MLM
1659 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1660 switch (psessionEntry->limSystemRole)
1661 {
1662 case eLIM_STA_IN_IBSS_ROLE:
1663 break;
1664 case eLIM_STA_ROLE:
1665 case eLIM_BT_AMP_STA_ROLE:
1666 default: // eLIM_AP_ROLE
1667 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1668 (psessionEntry->limSmeState !=
1669 eLIM_SME_WT_DISASSOC_STATE) &&
1670 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1671 {
1672 /**
1673 * Should not have received
1674 * Purge STA indication
1675 * from MLM in other states.
1676 * Log error
1677 */
1678 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301679 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 psessionEntry->limSmeState);)
1681 break;
1682 }
1683 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001684 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 pMlmPurgeStaInd->aid);)
1686 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1687 {
1688 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001689 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001690
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 }
1692 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1693 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 limSendSmeDeauthNtf(pMac,
1695 pMlmPurgeStaInd->peerMacAddr,
1696 resultCode,
1697 pMlmPurgeStaInd->purgeTrigger,
1698 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 }
1700 else
1701 limSendSmeDisassocNtf(pMac,
1702 pMlmPurgeStaInd->peerMacAddr,
1703 resultCode,
1704 pMlmPurgeStaInd->purgeTrigger,
1705 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1706 } // end switch (psessionEntry->limSystemRole)
1707} /*** end limProcessMlmPurgeStaInd() ***/
1708
1709/**
1710 * limProcessMlmSetKeysCnf()
1711 *
1712 *FUNCTION:
1713 * This function is called to processes MLM_SETKEYS_CNF
1714 * message from MLM State machine.
1715 *
1716 *LOGIC:
1717 *
1718 *ASSUMPTIONS:
1719 *
1720 *NOTE:
1721 *
1722 * @param pMac Pointer to Global MAC structure
1723 * @param pMsgBuf A pointer to the MLM message buffer
1724 *
1725 * @return None
1726 */
1727void
1728limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1729{
1730 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001731 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301733 tANI_U16 aid;
1734 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001735
1736 if(pMsgBuf == NULL)
1737 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001738 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001739 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 }
1741 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1742 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1743 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001744 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 return;
1746 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301747 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001749 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301751 /* if the status is success keys are installed in the
1752 * Firmware so we can set the protection bit
1753 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301754 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301755 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301756 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1757 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1758 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1759 &psessionEntry->dph.dphHashTable);
1760 if (pStaDs != NULL)
1761 pStaDs->isKeyInstalled = 1;
1762 }
1763 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 limSendSmeSetContextRsp(pMac,
1765 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1768 psessionEntry->transactionId);
1769} /*** end limProcessMlmSetKeysCnf() ***/
1770/**
1771 * limProcessMlmRemoveKeyCnf()
1772 *
1773 *FUNCTION:
1774 * This function is called to processes MLM_REMOVEKEY_CNF
1775 * message from MLM State machine.
1776 *
1777 *LOGIC:
1778 *
1779 *ASSUMPTIONS:
1780 *
1781 *NOTE:
1782 *
1783 * @param pMac Pointer to Global MAC structure
1784 * @param pMsgBuf A pointer to the MLM message buffer
1785 *
1786 * @return None
1787 */
1788void
1789limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1790{
1791 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001792 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 tpPESession psessionEntry;
1794
1795 if(pMsgBuf == NULL)
1796 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001797 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001798 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 }
1800 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1801 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1802 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001803 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 return;
1805 }
1806 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001807 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 pMlmRemoveKeyCnf->resultCode );
1809 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001810 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1812 psessionEntry->smeSessionId,psessionEntry->transactionId);
1813} /*** end limProcessMlmRemoveKeyCnf() ***/
1814
1815
1816/**
1817 * limHandleSmeJoinResult()
1818 *
1819 *FUNCTION:
1820 * This function is called to process join/auth/assoc failures
1821 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1822 * MLM_ASSOC_CNF with a success code in case of STA role and
1823 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1824 *
1825 *LOGIC:
1826 *
1827 *ASSUMPTIONS:
1828 *
1829 *NOTE:
1830 *
1831 * @param pMac Pointer to Global MAC structure
1832 * @param resultCode Failure code to be sent
1833 *
1834 *
1835 * @return None
1836 */
1837static void
1838limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1839{
1840 tpDphHashNode pStaDs = NULL;
1841 tANI_U8 smesessionId;
1842 tANI_U16 smetransactionId;
1843
1844 /* Newly Added on oct 11 th*/
1845 if(psessionEntry == NULL)
1846 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001847 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 return;
1849 }
1850 smesessionId = psessionEntry->smeSessionId;
1851 smetransactionId = psessionEntry->transactionId;
1852 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1853 if(resultCode != eSIR_SME_SUCCESS)
1854 {
1855 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1856 if (pStaDs != NULL)
1857 {
1858 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1859 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1860 pStaDs->mlmStaContext.resultCode = resultCode;
1861 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1862 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1863 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301864 /* Cleanup if add bss failed */
1865 if(psessionEntry->addBssfailed)
1866 {
1867 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1868 &psessionEntry->dph.dphHashTable);
1869 goto error;
1870 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301871 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001872 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 return;
1874 }
1875 }
1876
Abhishek Singhde7f0512015-10-23 14:31:15 +05301877error:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301878 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 psessionEntry->pLimJoinReq = NULL;
1880 //Delete teh session if JOIN failure occurred.
1881 if(resultCode != eSIR_SME_SUCCESS)
1882 {
1883 if(NULL != psessionEntry)
1884 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001885 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1886 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001887 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 peDeleteSession(pMac,psessionEntry);
1889 psessionEntry = NULL;
1890 }
1891 }
1892 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1893 smesessionId, smetransactionId);
1894} /*** end limHandleSmeJoinResult() ***/
1895
1896/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001897 * limHandleSmeReaasocResult()
1898 *
1899 *FUNCTION:
1900 * This function is called to process reassoc failures
1901 * upon receiving REASSOC_CNF with a failure code or
1902 * MLM_REASSOC_CNF with a success code in case of STA role
1903 *
1904 *LOGIC:
1905 *
1906 *ASSUMPTIONS:
1907 *
1908 *NOTE:
1909 *
1910 * @param pMac Pointer to Global MAC structure
1911 * @param resultCode Failure code to be sent
1912 *
1913 *
1914 * @return None
1915 */
1916static void
1917limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1918{
1919 tpDphHashNode pStaDs = NULL;
1920 tANI_U8 smesessionId;
1921 tANI_U16 smetransactionId;
1922
1923 if(psessionEntry == NULL)
1924 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001925 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001926 return;
1927 }
1928 smesessionId = psessionEntry->smeSessionId;
1929 smetransactionId = psessionEntry->transactionId;
1930 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1931 if(resultCode != eSIR_SME_SUCCESS)
1932 {
1933 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1934 if (pStaDs != NULL)
1935 {
1936 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1937 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1938 pStaDs->mlmStaContext.resultCode = resultCode;
1939 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1940 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301941 /* Cleanup if add bss failed */
1942 if(psessionEntry->addBssfailed)
1943 {
1944 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1945 &psessionEntry->dph.dphHashTable);
1946 goto error;
1947 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001948 return;
1949 }
1950 }
Abhishek Singhde7f0512015-10-23 14:31:15 +05301951error:
Jeff Johnsone7245742012-09-05 17:12:55 -07001952 //Delete teh session if REASSOC failure occurred.
1953 if(resultCode != eSIR_SME_SUCCESS)
1954 {
1955 if(NULL != psessionEntry)
1956 {
1957 peDeleteSession(pMac,psessionEntry);
1958 psessionEntry = NULL;
1959 }
1960 }
1961 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1962 smesessionId, smetransactionId);
1963} /*** end limHandleSmeReassocResult() ***/
1964
1965/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 * limProcessMlmAddStaRsp()
1967 *
1968 *FUNCTION:
1969 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1970 * Upon receipt of this message from HAL, MLME -
1971 * > Determines the "state" in which this message was received
1972 * > Forwards it to the appropriate callback
1973 *
1974 *ASSUMPTIONS:
1975 *
1976 *NOTE:
1977 *
1978 * @param pMac Pointer to Global MAC structure
1979 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1980 *
1981 * @return None
1982 */
1983void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1984{
1985 //we need to process the deferred message since the initiating req. there might be nested request.
1986 //in the case of nested request the new request initiated from the response will take care of resetting
1987 //the deffered flag.
1988 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 )
1992 {
1993 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1994 return;
1995 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05301996#ifdef WLAN_FEATURE_LFR_MBB
1997 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
1998 lim_process_sta_mlm_add_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
1999 return;
2000 }
2001#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002003}
2004void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2005{
2006 tLimMlmAssocCnf mlmAssocCnf;
2007 tpDphHashNode pStaDs;
2008 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2009 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
2010
2011 if(NULL == pAddStaParams )
2012 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002013 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 return;
2015 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302016
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302017 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302019 PELOGE(limLog(pMac, LOGE,
2020 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05302021
2022 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
2023 {
2024 PELOGE(limLog(pMac, LOGE,
2025 FL("ADD_STA success, send update result code with"
2026 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
2027 "limMlmState: %d"), pAddStaParams->staIdx,
2028 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302029 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2030 mesgType = LIM_MLM_REASSOC_CNF;
2031 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
2032 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
2033 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05302034 mlmAssocCnf.resultCode =
2035 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302036 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
c_hpothua9dc89c2014-03-22 19:22:31 +05302037 psessionEntry->staId = pAddStaParams->staIdx;
2038 goto end;
2039 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302040 }
2041
2042 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
2043 {
2044 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 {
2046 //TODO: any response to be sent out here ?
2047 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302048 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 psessionEntry->limMlmState);
2050 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2051 goto end;
2052 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302053
2054 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2055 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 //
2057 // Update the DPH Hash Entry for this STA
2058 // with proper state info
2059 //
2060 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2061 if( NULL != pStaDs)
2062 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
2063 else
2064 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002065 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 DPH_STA_HASH_INDEX_PEER);
2067 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002068 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 /*
2070 * Storing the self StaIndex(Generated by HAL) in session context,
2071 * instead of storing it in DPH Hash entry for Self STA.
2072 * DPH entry for the self STA stores the sta index for the BSS entry
2073 * to which the STA is associated.
2074 */
2075 psessionEntry->staId = pAddStaParams->staIdx;
2076 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002077#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2078 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2079#endif
2080 {
2081 limReactivateHeartBeatTimer(pMac, psessionEntry);
2082 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002083 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002084
2085 //assign the sessionId to the timer Object
2086 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2087 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002088 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002089#ifdef WLAN_DEBUG
2090 pMac->lim.gLimNumLinkEsts++;
2091#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002092#ifdef FEATURE_WLAN_TDLS
2093 /* initialize TDLS peer related data */
2094 limInitTdlsData(pMac,psessionEntry);
2095#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 // Return Assoc confirm to SME with success
2097 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2098 // be passed in here....
2099 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2100 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2101 }
2102 else
2103 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302104 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302105 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302106 {
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302107 mesgType = LIM_MLM_REASSOC_CNF;
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302108 mlmAssocCnf.resultCode = (tSirResultCodes)eSIR_SME_FT_REASSOC_FAILURE;
2109 }
2110 else
2111 {
2112 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2113 }
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302114 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 }
2116end:
2117 if( 0 != limMsgQ->bodyptr )
2118 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302119 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002120 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 }
2122 /* Updating PE session Id*/
2123 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2124 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302125 if (true == psessionEntry->fDeauthReceived)
2126 {
2127 psessionEntry->fDeauthReceived = false;
2128 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 return;
2130}
2131void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2132{
2133 //we need to process the deferred message since the initiating req. there might be nested request.
2134 //in the case of nested request the new request initiated from the response will take care of resetting
2135 //the deffered flag.
2136 // tpPESession psessionEntry;
2137 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2138 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2139 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002140 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 // return;
2142 // }
2143 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144
2145 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2146 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 ) &&
2149 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2150 {
2151 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2152 return;
2153 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002155
2156 if(!limIsInMCC(pMac))
2157 {
2158 WDA_TrafficStatsTimerActivate(FALSE);
2159 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002160
2161#ifdef WLAN_FEATURE_11W
2162 if (psessionEntry->limRmfEnabled)
2163 {
2164 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2165 {
2166 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002167 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002168 }
2169 }
2170#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002171}
2172
2173void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2174{
2175 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2176 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2177 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302178
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302179#ifdef WLAN_FEATURE_LFR_MBB
2180 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2181 lim_process_sta_mlm_del_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
2182 return;
2183 }
2184#endif
2185
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302186 if (NULL == pDelBssParams)
2187 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002188 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302189 goto end;
2190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2192 {
2193 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002194 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2196 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2197
2198 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002199 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 statusCode = eSIR_SME_REFUSED;
2201 goto end;
2202 }
2203 if(pStaDs == NULL)
2204 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002205 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 statusCode = eSIR_SME_REFUSED;
2207 goto end;
2208 }
2209 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2210 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302211 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 pStaDs->mlmStaContext.mlmState);)
2213 statusCode = eSIR_SME_REFUSED;
2214 goto end;
2215 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302216 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2217 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 }
2219 else
2220 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302221 /* If DelBSS response is failure, go ahead and
2222 * post response to SME
2223 */
2224 limLog( pMac, LOGE, FL( "DEL BSS failed! Status:%d" ),
2225 pDelBssParams->status );
2226 statusCode = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302228
2229end:
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 if( 0 != limMsgQ->bodyptr )
2231 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302232 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002233 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 }
2235 if(pStaDs == NULL)
2236 return;
2237 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2238 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2239 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2240 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2241 {
2242 /** The Case where the DelBss is invoked from
2243 * context of other than normal DisAssoc / Deauth OR
2244 * as part of Join Failure.
2245 */
2246 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2247 return;
2248 }
2249 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2250 return;
2251}
2252
Jeff Johnson295189b2012-06-20 16:38:30 -07002253void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2254{
2255 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002256 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2258 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2259
2260 if(psessionEntry == NULL)
2261 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002262 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002263 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002264 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302265 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002266 limMsgQ->bodyptr = NULL;
2267 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 return;
2269 }
2270
2271 if (pDelBss == NULL)
2272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002273 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 rc = eSIR_SME_REFUSED;
2275 goto end;
2276 }
2277 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002278 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2279
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2281 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002282 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302283 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002284 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002285 rc = eSIR_SME_REFUSED;
2286 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2289 {
2290 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2291 pDelBss->status, pDelBss->bssIdx);
2292 rc = eSIR_SME_STOP_BSS_FAILURE;
2293 goto end;
2294 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002295 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002297 if (status != eSIR_SUCCESS)
2298 {
2299 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002301 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 /** Softmac may send all the buffered packets right after resuming the transmission hence
2303 * to occupy the medium during non channel occupancy period. So resume the transmission after
2304 * HAL gives back the response.
2305 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002306#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 if (LIM_IS_RADAR_DETECTED(pMac))
2308 {
2309 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2310 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2311 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002312#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2314 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002316 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 end:
2318 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2319 peDeleteSession(pMac, psessionEntry);
2320
2321 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002322 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302323 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002324 limMsgQ->bodyptr = NULL;
2325 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002326}
2327
2328void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2329{
2330 //we need to process the deferred message since the initiating req. there might be nested request.
2331 //in the case of nested request the new request initiated from the response will take care of resetting
2332 //the deffered flag.
2333
2334 tpPESession psessionEntry;
2335 tpDeleteStaParams pDeleteStaParams;
2336 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2337 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302338
2339 if(NULL == pDeleteStaParams ||
2340 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002342 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002343 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002344 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302345 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002346 limMsgQ->bodyptr = NULL;
2347 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 return;
2349 }
2350
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 )
2354 {
2355 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2356 return;
2357 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002359}
2360
Jeff Johnson295189b2012-06-20 16:38:30 -07002361void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2362{
2363 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2364 tpDphHashNode pStaDs;
2365 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2366 if(limMsgQ->bodyptr == NULL)
2367 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302368 limLog( pMac, LOGE,
2369 FL( "limMsgQ->bodyptry NULL"));
2370 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2373 if(pStaDs == NULL)
2374 {
2375 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302376 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302378 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002379 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002380
2381 return;
2382 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302383 limLog( pMac, LOG1,
2384 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2385 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2387 {
2388 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302389 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002390
2391 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2392 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2393 {
2394 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002395 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2397 statusCode = eSIR_SME_REFUSED;
2398 goto end;
2399 }
2400
2401 limLog( pMac, LOG1,
2402 FL("Deleted STA AssocID %d staId %d MAC "),
2403 pStaDs->assocId, pStaDs->staIndex);
2404 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2405 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2406 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302407 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002408 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002409 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 {
2411 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002412 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 pStaDs->assocId);)
2414 // delete the TS if it has already been added.
2415 // send the response with error status.
2416 if(pStaDs->qos.addtsPresent)
2417 {
2418 tpLimTspecInfo pTspecInfo;
2419 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2420 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2421 {
2422 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2423 NULL, &pTspecInfo->idx);
2424 }
2425 }
2426 limRejectAssociation(pMac,
2427 pStaDs->staAddr,
2428 pStaDs->mlmStaContext.subType,
2429 true, pStaDs->mlmStaContext.authType,
2430 pStaDs->assocId, true,
2431 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2432 psessionEntry);
2433 }
2434 return;
2435 }
2436 }
2437 else
2438 {
2439 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002440 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 statusCode = eSIR_SME_REFUSED;
2442 }
2443 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302444 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002445 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2447 {
2448 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2449 }
2450 return;
2451}
2452
2453void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2454{
2455 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2456 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2457 tpDphHashNode pStaDs = NULL;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302458
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302459#ifdef WLAN_FEATURE_LFR_MBB
2460 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2461 lim_process_sta_mlm_del_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
2462 return;
2463 }
2464#endif
2465
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 if(NULL == pDelStaParams )
2467 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002468 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 goto end;
2470 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302471
2472 limLog(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"),
2473 pDelStaParams->status, pDelStaParams->assocId);
2474
2475 if (eHAL_STATUS_SUCCESS != pDelStaParams->status)
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302477 limLog(pMac, LOGE, FL("Del STA failed! Status:%d, still proceeding"
2478 "with Del BSS"), pDelStaParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302480
2481 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2482
2483 if (pStaDs == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302485 //TODO: any response to be sent out here ?
2486 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
2487 pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 statusCode = eSIR_SME_REFUSED;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302489 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302491
2492 if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2493 {
2494 //TODO: any response to be sent out here ?
2495 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
2496 limMlmStateStr(psessionEntry->limMlmState));
2497 statusCode = eSIR_SME_REFUSED;
2498 goto end;
2499 }
2500
2501 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2502 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2503
2504 //we must complete all cleanup related to delSta before calling limDelBSS.
2505 if (0 != limMsgQ->bodyptr )
2506 {
2507 vos_mem_free(pDelStaParams);
2508 limMsgQ->bodyptr = NULL;
2509 }
2510
2511 // Proceed to do DelBSS even if DelSta resulted in failure
2512 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2513 return;
2514
Jeff Johnson295189b2012-06-20 16:38:30 -07002515end:
2516 if( 0 != limMsgQ->bodyptr )
2517 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302518 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002519 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 }
2521 return;
2522}
2523
Jeff Johnson295189b2012-06-20 16:38:30 -07002524void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2525{
2526 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302527 tpDphHashNode pStaDs = NULL;
2528
2529 if (NULL == pAddStaParams)
2530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002531 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302532 goto end;
2533 }
2534
2535 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 if(pStaDs == NULL)
2537 {
2538 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002539 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002540 goto end;
2541 }
2542 //
2543 // TODO & FIXME_GEN4
2544 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2545 //
2546 //TODO: any check for pMac->lim.gLimMlmState ?
2547 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2548 {
2549 //TODO: any response to be sent out here ?
2550 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302551 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 pStaDs->mlmStaContext.mlmState);
2553 goto end;
2554 }
2555 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002557 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 limRejectAssociation(pMac, pStaDs->staAddr,
2559 pStaDs->mlmStaContext.subType,
2560 true, pStaDs->mlmStaContext.authType,
2561 pStaDs->assocId, true,
2562 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2563 psessionEntry);
2564 goto end;
2565 }
2566 pStaDs->bssId = pAddStaParams->bssIdx;
2567 pStaDs->staIndex = pAddStaParams->staIdx;
2568 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2569 pStaDs->valid = 1;
2570 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2571 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302572 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 pStaDs->assocId,
2574 pStaDs->staIndex);
2575 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2576
2577 /* For BTAMP-AP, the flow sequence shall be:
2578 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2579 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2580 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2581 */
2582 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2583 // fall though to reclaim the original Add STA Response message
2584end:
2585 if( 0 != limMsgQ->bodyptr )
2586 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302587 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002588 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 }
2590 return;
2591}
2592
2593/**
2594 * limProcessApMlmAddBssRsp()
2595 *
2596 *FUNCTION:
2597 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2598 * Upon receipt of this message from HAL, MLME -
2599 * > Validates the result of WDA_ADD_BSS_REQ
2600 * > Init other remaining LIM variables
2601 * > Init the AID pool, for that BSSID
2602 * > Init the Pre-AUTH list, for that BSSID
2603 * > Create LIM timers, specific to that BSSID
2604 * > Init DPH related parameters that are specific to that BSSID
2605 * > TODO - When do we do the actual change channel?
2606 *
2607 *LOGIC:
2608 * SME sends eWNI_SME_START_BSS_REQ to LIM
2609 * LIM sends LIM_MLM_START_REQ to MLME
2610 * MLME sends WDA_ADD_BSS_REQ to HAL
2611 * HAL responds with WDA_ADD_BSS_RSP to MLME
2612 * MLME responds with LIM_MLM_START_CNF to LIM
2613 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2614 *
2615 *ASSUMPTIONS:
2616 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2617 * tSirMsgQ.body will now be freed by this routine
2618 *
2619 *NOTE:
2620 *
2621 * @param pMac Pointer to Global MAC structure
2622 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2623 *
2624 * @return None
2625 */
2626static void
2627limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2628{
2629 tLimMlmStartCnf mlmStartCnf;
2630 tANI_U32 val;
2631 tpPESession psessionEntry;
2632// tANI_U8 sessionId;
2633 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2634 if(NULL == pAddBssParams )
2635 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002636 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 goto end;
2638 }
2639 //TBD: free the memory before returning, do it for all places where lookup fails.
2640 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2641 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002642 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002643 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002644 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302645 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302646 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002647 limMsgQ->bodyptr = NULL;
2648 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 return;
2650 }
2651 /* Update PE session Id*/
2652 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2653 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2654 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302655 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2657 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2658 goto end;
2659 // Set MLME state
2660 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002661 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2663 {
2664 /** IBSS is 'active' when we receive
2665 * Beacon frames from other STAs that are part of same IBSS.
2666 * Mark internal state as inactive until then.
2667 */
2668 psessionEntry->limIbssActive = false;
2669 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2670 limResetHBPktCount( psessionEntry );
2671 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002672 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002673 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002674 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 }
2676 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2677
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002679
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2681 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2682 else
2683 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 schEdcaProfileUpdate(pMac, psessionEntry);
2685 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002686 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 // Create timers used by LIM
2688 if (!pMac->lim.gLimTimersCreated)
2689 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002690
2691 // Start OLBC timer
2692 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2693 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002694 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002695 }
2696
Jeff Johnson295189b2012-06-20 16:38:30 -07002697 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2698 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002699 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2701 // Apply previously set configuration at HW
2702 limApplyConfiguration(pMac,psessionEntry);
2703 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2704 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2705 }
2706 else
2707 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002708 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2710 }
2711 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2712 end:
2713 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002714 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302715 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302716 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002717 limMsgQ->bodyptr = NULL;
2718 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002719}
2720
2721
2722/**
2723 * limProcessIbssMlmAddBssRsp()
2724 *
2725 *FUNCTION:
2726 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2727 * Upon receipt of this message from HAL, MLME -
2728 * > Validates the result of WDA_ADD_BSS_REQ
2729 * > Init other remaining LIM variables
2730 * > Init the AID pool, for that BSSID
2731 * > Init the Pre-AUTH list, for that BSSID
2732 * > Create LIM timers, specific to that BSSID
2733 * > Init DPH related parameters that are specific to that BSSID
2734 * > TODO - When do we do the actual change channel?
2735 *
2736 *LOGIC:
2737 * SME sends eWNI_SME_START_BSS_REQ to LIM
2738 * LIM sends LIM_MLM_START_REQ to MLME
2739 * MLME sends WDA_ADD_BSS_REQ to HAL
2740 * HAL responds with WDA_ADD_BSS_RSP to MLME
2741 * MLME responds with LIM_MLM_START_CNF to LIM
2742 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2743 *
2744 *ASSUMPTIONS:
2745 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2746 * tSirMsgQ.body will now be freed by this routine
2747 *
2748 *NOTE:
2749 *
2750 * @param pMac Pointer to Global MAC structure
2751 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2752 *
2753 * @return None
2754 */
2755static void
2756limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2757{
2758 tLimMlmStartCnf mlmStartCnf;
2759 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2760 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302761
2762 if (NULL == pAddBssParams)
2763 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002764 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302765 goto end;
2766 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2768 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302769 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2771 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2772 goto end;
2773 // Set MLME state
2774 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002775 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002776 /** IBSS is 'active' when we receive
2777 * Beacon frames from other STAs that are part of same IBSS.
2778 * Mark internal state as inactive until then.
2779 */
2780 psessionEntry->limIbssActive = false;
2781 limResetHBPktCount( psessionEntry );
2782 /* Timer related functions are not modified for BT-AMP : To be Done */
2783 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002784 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002785 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002786 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2788 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2789 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2790 schEdcaProfileUpdate(pMac, psessionEntry);
2791 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2792 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002793 if (0 == psessionEntry->freePeerIdxHead)
2794 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 // Create timers used by LIM
2796#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2797 if (!pMac->lim.gLimTimersCreated)
2798 limCreateTimers(pMac);
2799#endif
2800 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2801 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002802 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002803 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2804 // Apply previously set configuration at HW
2805 limApplyConfiguration(pMac,psessionEntry);
2806 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2807 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2808 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2809 if(true == pMac->lim.gLimIbssCoalescingHappened)
2810 {
2811 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2812 goto end;
2813 }
2814 }
2815 else
2816 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002817 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 pAddBssParams->status );
2819 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2820 }
2821 //Send this message to SME, when ADD_BSS is initiated by SME
2822 //If ADD_BSS is done as part of coalescing, this won't happen.
2823 /* Update PE session Id*/
2824 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2825 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2826 end:
2827 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002828 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302829 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302830 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002831 limMsgQ->bodyptr = NULL;
2832 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002833}
2834
2835static void
2836limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2837{
2838 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2839 tAniAuthType cfgAuthType, authMode;
2840 tLimMlmAuthReq *pMlmAuthReq;
2841 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302842
2843 if (NULL == pAddBssParams)
2844 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002845 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302846 goto joinFailure;
2847 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2849 {
2850 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2851 {
2852 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002853 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2855 goto joinFailure;
2856 }
2857 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2858 //Success, handle below
2859 pStaDs->bssId = pAddBssParams->bssIdx;
2860 //STA Index(genr by HAL) for the BSS entry is stored here
2861 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2862 // Trigger Authentication with AP
2863 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2864 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2865 {
2866 /**
2867 * Could not get AuthType from CFG.
2868 * Log error.
2869 */
2870 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002871 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 }
2873 if (cfgAuthType == eSIR_AUTO_SWITCH)
Hu Wang0650dbc2015-12-07 13:44:57 +08002874 authMode = eSIR_SHARED_KEY; // Try Shared Authentication first
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 else
2876 authMode = cfgAuthType;
2877
2878 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302879 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2880 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 {
2882 // Log error
2883 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302884 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 return;
2886 }
2887 #if 0
2888 val = sizeof(tSirMacAddr);
2889 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2890 pMlmAuthReq->peerMacAddr,
2891 &val) != eSIR_SUCCESS)
2892 {
2893 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002894 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 }
2896 #endif //TO SUPPORT BT-AMP
2897 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2898
2899 pMlmAuthReq->authType = authMode;
2900 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2901 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2902 != eSIR_SUCCESS)
2903 {
2904 /**
2905 * Could not get AuthFailureTimeout
2906 * value from CFG. Log error.
2907 */
2908 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002909 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 }
2911 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2912 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2913 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002914 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2916 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2917 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2918 // remember staId in case of assoc timeout/failure handling
2919 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2920
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302921 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2922 psessionEntry->peSessionId, psessionEntry->limSmeState));
2923 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2924 "with limSmeState:%d",psessionEntry->peSessionId,
2925 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002926 limPostMlmMessage(pMac,
2927 LIM_MLM_AUTH_REQ,
2928 (tANI_U32 *) pMlmAuthReq);
2929 return;
2930 }
2931
2932joinFailure:
2933 {
2934 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002935 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002936
2937 /// Send Join response to Host
2938 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2939
2940 }
2941
2942}
2943
2944#ifdef WLAN_FEATURE_VOWIFI_11R
2945/*------------------------------------------------------------------------------------------
2946 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002947 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2948 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002949 *
2950 *
2951 *------------------------------------------------------------------------------------------
2952 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002953static inline void
2954limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002955{
Jeff Johnson295189b2012-06-20 16:38:30 -07002956 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002957 tpDphHashNode pStaDs = NULL;
2958 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002959 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002960 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002961 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302962#ifdef FEATURE_WLAN_ESE
2963 tLimMlmReassocReq *pMlmReassocReq;
2964 tANI_U32 val = 0;
2965#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002966
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002967 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002968
2969 if (pAddBssParams == NULL)
2970 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002971 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002972 goto end;
2973 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002974 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2975 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002976 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002977 goto end;
2978 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002979 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2980 {
2981 goto end;
2982 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002983
2984 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2985 &psessionEntry->dph.dphHashTable)) == NULL)
2986 {
2987 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002988 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2990 goto end;
2991 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302992 if (pMac->roam.configParam.roamDelayStatsEnabled)
2993 {
2994 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2995 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002996 // Prepare and send Reassociation request frame
2997 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05302998
2999
3000#ifdef FEATURE_WLAN_ESE
3001 /*
3002 * In case of Ese Reassociation, change the reassoc timer
3003 * value.
3004 */
3005 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3006 if (pMlmReassocReq == NULL)
3007 {
3008 limLog(pMac, LOGE,
3009 FL("Invalid pMlmReassocReq"));
3010 goto end;
3011 }
3012 val = pMlmReassocReq->reassocFailureTimeout;
3013 if (psessionEntry->isESEconnection)
3014 {
3015 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3016 }
3017 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3018 TX_SUCCESS)
3019 {
3020 limLog(pMac, LOGP,
3021 FL("unable to deactivate Reassoc failure timer"));
3022 }
3023 val = SYS_MS_TO_TICKS(val);
3024 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3025 val, 0) != TX_SUCCESS)
3026 {
3027 limLog(pMac, LOGP,
3028 FL("unable to change Reassociation failure timer"));
3029 }
3030#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
3032 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003033 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3035 != TX_SUCCESS)
3036 {
3037 /// Could not start reassoc failure timer.
3038 // Log error
3039 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003040 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 // Return Reassoc confirm with
3042 // Resources Unavailable
3043 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3044 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3045 goto end;
3046 }
Mihir Shete63561c82014-08-23 16:58:07 +05303047 // remember staId
3048 psessionEntry->staId = pAddBssParams->staContext.staIdx;
3049
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003050#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003051 pMac->lim.pSessionEntry = psessionEntry;
3052 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
3053 {
3054 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303055 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
3056 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
3057 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
3058 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
3059 psessionEntry->pLimMlmReassocReq,
3060 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003061 }
3062 pMac->lim.reAssocRetryAttempt = 0;
3063#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05303065 if (pMac->roam.configParam.roamDelayStatsEnabled)
3066 {
3067 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
3068 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003069 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
3070 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08003071 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003072 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 psessionEntry->limMlmState, psessionEntry->peSessionId);)
3074
3075 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3076
3077 //Success, handle below
3078 pStaDs->bssId = pAddBssParams->bssIdx;
3079 //STA Index(genr by HAL) for the BSS entry is stored here
3080 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3081 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3082 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3083
Jeff Johnson295189b2012-06-20 16:38:30 -07003084#if defined WLAN_FEATURE_VOWIFI
3085 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3086#endif
3087
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303088 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
3089 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07003090 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303091 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07003092 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303094 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003095
3096 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303097 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
3098 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003099
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303100 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3101 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003102
3103 // Update this when we get reassoc rsp , with success.
3104 // pAddStaParams->assocId = psessionEntry->limAID;
3105
3106 pAddStaParams->staType = STA_ENTRY_SELF;
3107 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3108 pAddStaParams->respReqd = 1;
3109
3110 /* Update PE session ID */
3111 pAddStaParams->sessionId = psessionEntry->peSessionId;
3112
3113 // This will indicate HAL to "allocate" a new STA index
3114 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3115 pAddStaParams->updateSta = FALSE;
3116
3117 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003118#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003119 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003120#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003121 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003122#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003123
Jeff Johnsone7245742012-09-05 17:12:55 -07003124 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003126 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003127#ifdef WLAN_FEATURE_11AC
3128 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3129 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3130#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003131#ifdef DISABLE_GF_FOR_INTEROP
3132 /*
3133 * To resolve the interop problem with Broadcom AP,
3134 * where TQ STA could not pass traffic with GF enabled,
3135 * TQ STA will do Greenfield only with TQ AP, for
3136 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003137 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003138 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3139 {
3140 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3141 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3142 }
3143 else
3144#endif
3145
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003147 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3148 {
3149 pAddStaParams->txChannelWidthSet =
3150 pMac->roam.configParam.channelBondingMode24GHz;
3151 }
3152 else
3153 {
3154 pAddStaParams->txChannelWidthSet =
3155 pMac->roam.configParam.channelBondingMode5GHz;
3156 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003157 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3158 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3159 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3160 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3161 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3162 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3163 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3164 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3165 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3166 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003167 }
3168
3169 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003170 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003171 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003172 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3173 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 // Lets save this for when we receive the Reassoc Rsp
3175 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003176
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003177 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003178 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303179 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003180 vos_mem_free(pAddBssParams);
3181 pAddBssParams = NULL;
3182 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003183 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 return;
3185
3186end:
3187 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003188 if (psessionEntry != NULL)
3189 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003191 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3192 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003194
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003195 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003196 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303197 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003198 vos_mem_free(pAddBssParams);
3199 pAddBssParams = NULL;
3200 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003201 }
3202
3203 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3204 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303205 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003206 if (psessionEntry != NULL)
3207 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003208 else
3209 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003210
3211 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3212}
Jeff Johnson295189b2012-06-20 16:38:30 -07003213#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003214/**
3215 * limProcessStaMlmAddBssRsp()
3216 *
3217 *FUNCTION:
3218 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3219 * Upon receipt of this message from HAL, MLME -
3220 * > Validates the result of WDA_ADD_BSS_REQ
3221 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3222 *
3223 *LOGIC:
3224 * MLME had sent WDA_ADD_BSS_REQ to HAL
3225 * HAL responded with WDA_ADD_BSS_RSP to MLME
3226 * MLME now sends WDA_ADD_STA_REQ to HAL
3227 *
3228 *ASSUMPTIONS:
3229 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3230 * tSirMsgQ.body will now be freed by this routine
3231 *
3232 *NOTE:
3233 *
3234 * @param pMac Pointer to Global MAC structure
3235 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3236 *
3237 * @return None
3238 */
3239static void
3240limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3241{
3242 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3243 tLimMlmAssocCnf mlmAssocCnf;
3244 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3245 tANI_U32 subType = LIM_ASSOC;
3246 tpDphHashNode pStaDs = NULL;
3247 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3248 tANI_U8 updateSta = false;
3249 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3250
3251 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3252 {
3253 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303254 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3255 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3257 goto end;
3258 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303259
3260 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3261 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 {
3263 mesgType = LIM_MLM_REASSOC_CNF;
3264 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303265 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3266 //to update the existing STA entry.
3267 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3268 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3269 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 {
3271 staIdx = psessionEntry->staId;
3272 updateSta = true;
3273 }
3274 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003275
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003276 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003277 goto end;
3278
Jeff Johnson295189b2012-06-20 16:38:30 -07003279 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3280 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003281#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3283 {
3284#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003285 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 psessionEntry->limMlmState,
3287 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3288#endif
3289 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3290 goto end;
3291 }
3292#endif /* WLAN_FEATURE_VOWIFI_11R */
3293
3294 // Set MLME state
3295 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003296 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3298 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303299 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3300 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3302 if (pStaDs == NULL)
3303 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303304 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3305 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3307 }
3308 else
3309 {
3310 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3311 //Success, handle below
3312 pStaDs->bssId = pAddBssParams->bssIdx;
3313 //STA Index(genr by HAL) for the BSS entry is stored here
3314 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3315 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3316 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3317 // Downgrade the EDCA parameters if needed
3318 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3319 // Send the active EDCA parameters to HAL
3320 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3321 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3322 } else {
3323 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3324 }
3325#if defined WLAN_FEATURE_VOWIFI
3326 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3327#endif
3328
3329 if (subType == LIM_REASSOC)
3330 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3331 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3332 {
3333 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303334 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3335 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3337 }
3338 }
3339 }
3340 else
3341 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303342 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3343 psessionEntry->peSessionId, psessionEntry->limMlmState);
Abhishek Singhc0fccd22015-10-19 16:44:00 +05303344 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303346 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3347 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3348 else
3349 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Abhishek Singhde7f0512015-10-23 14:31:15 +05303350 psessionEntry->addBssfailed = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 }
3352
3353 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3354 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303355 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3356 //Set the RXP mode to IDLE, so it starts filtering the frames.
3357 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3358 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3359 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 /* Update PE session Id*/
3361 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3362 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3363 }
3364 end:
3365 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003366 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303367 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303368 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003369 limMsgQ->bodyptr = NULL;
3370 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003371}
3372
3373
3374
3375/**
3376 * limProcessMlmAddBssRsp()
3377 *
3378 *FUNCTION:
3379 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3380 * Upon receipt of this message from HAL, MLME -
3381 * > Determines the "state" in which this message was received
3382 * > Forwards it to the appropriate callback
3383 *
3384 *LOGIC:
3385 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3386 * in the following two states:
3387 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3388 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3389 * Based on these two states, this API will determine where to
3390 * route the message to
3391 *
3392 *ASSUMPTIONS:
3393 *
3394 *NOTE:
3395 *
3396 * @param pMac Pointer to Global MAC structure
3397 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3398 *
3399 * @return None
3400 */
3401void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3402{
3403 tLimMlmStartCnf mlmStartCnf;
3404 tpPESession psessionEntry;
3405 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3406
3407 if(NULL == pAddBssParams )
3408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003409 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 return;
3411 }
3412
3413 //
3414 // TODO & FIXME_GEN4
3415 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3416 //
3417 //we need to process the deferred message since the initiating req. there might be nested request.
3418 //in the case of nested request the new request initiated from the response will take care of resetting
3419 //the deffered flag.
3420 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3421 // Validate SME/LIM state
3422 // Validate MLME state
3423 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3424 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303425 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3426 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003427 if( NULL != pAddBssParams )
3428 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303429 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003430 vos_mem_free(pAddBssParams);
3431 limMsgQ->bodyptr = NULL;
3432 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 return;
3434 }
3435 /* update PE session Id*/
3436 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3437 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3438 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3439 else
3440 {
3441 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3442 {
3443 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3444 {
3445 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303446 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303447 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303448 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003449 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3450 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003451 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303452 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303453 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003454 limMsgQ->bodyptr = NULL;
3455 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3457 }
3458 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3459 {
3460 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3461 }
3462 else
3463 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3464 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303465 else {
3466#ifdef WLAN_FEATURE_LFR_MBB
3467 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
3468 lim_process_sta_mlm_add_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
3469 return;
3470 }
3471#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 /* Called while processing assoc response */
3473 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303474 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003475 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003476
3477 if(limIsInMCC(pMac))
3478 {
3479 WDA_TrafficStatsTimerActivate(TRUE);
3480 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003481
3482#ifdef WLAN_FEATURE_11W
3483 if (psessionEntry->limRmfEnabled)
3484 {
3485 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3486 {
3487 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003488 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003489 }
3490 }
3491#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003492}
3493/**
3494 * limProcessMlmSetKeyRsp()
3495 *
3496 *FUNCTION:
3497 * This function is called to process the following two
3498 * messages from HAL:
3499 * 1) WDA_SET_BSSKEY_RSP
3500 * 2) WDA_SET_STAKEY_RSP
3501 * 3) WDA_SET_STA_BCASTKEY_RSP
3502 * Upon receipt of this message from HAL,
3503 * MLME -
3504 * > Determines the "state" in which this message was received
3505 * > Forwards it to the appropriate callback
3506 *
3507 *LOGIC:
3508 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3509 * received by MLME while in the following state:
3510 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3511 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3512 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3513 * Based on this state, this API will determine where to
3514 * route the message to
3515 *
3516 *ASSUMPTIONS:
3517 * ONLY the MLME state is being taken into account for now.
3518 * This is because, it appears that the handling of the
3519 * SETKEYS REQ is handled symmetrically on both the AP & STA
3520 *
3521 *NOTE:
3522 *
3523 * @param pMac Pointer to Global MAC structure
3524 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3525 *
3526 * @return None
3527 */
3528void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3529{
Jeff Johnsone7245742012-09-05 17:12:55 -07003530 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 tLimMlmSetKeysCnf mlmSetKeysCnf;
3532 tANI_U8 sessionId = 0;
3533 tpPESession psessionEntry;
3534 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303535 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003536 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003537 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003538 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003539 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 return;
3541 }
3542 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3543 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3544 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003545 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303546 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303547 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003548 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003549 return;
3550 }
3551 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3552 {
3553 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303554 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 // There's not much that MLME can do at this stage...
3556 respReqd = 0;
3557 }
3558 else
3559 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3560
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303561 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303562 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003563 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003564 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003566 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003567 if( respReqd )
3568 {
3569 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3570 // Prepare and Send LIM_MLM_SETKEYS_CNF
3571 if( NULL != lpLimMlmSetKeysReq )
3572 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303573 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3574 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3575 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303577 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3578 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303579 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 pMac->lim.gpLimMlmSetKeysReq = NULL;
3581 }
3582 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003583 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003584 }
3585}
3586void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3587{
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003589 tANI_U16 resultCode;
3590 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303592 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3593
Jeff Johnson295189b2012-06-20 16:38:30 -07003594 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303595 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303596 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003597 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003598 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 return;
3600 }
3601 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303602 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303604 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3605 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303606 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303607 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003608 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 return;
3610 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303611 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3613 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303614 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3615 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003616
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3618 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3619 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303620 /* Mesg received from HAL in Invalid state! */
3621 limLog( pMac, LOGW,
3622 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3623 limMsgQ->type, psessionEntry->limMlmState );
3624 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 }
3626 else
3627 mlmSetKeysCnf.resultCode = resultCode;
3628
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303629 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303630 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003631 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003632 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003633 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3634
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303635 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3636 psessionEntry->peSessionId, psessionEntry->limMlmState));
3637 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3638 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003639
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303640 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3641 if( NULL != lpLimMlmSetKeysReq )
3642 {
3643 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3644 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3645 sizeof(tSirMacAddr));
3646 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3647 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3648 sizeof(tLimMlmSetKeysReq));
3649 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3650 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303652 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003653}
3654/**
3655 * limProcessMlmRemoveKeyRsp()
3656 *
3657 *FUNCTION:
3658 *
3659 *LOGIC:
3660 *
3661 *ASSUMPTIONS:
3662 *
3663 *NOTE:
3664 *
3665 * @param pMac Pointer to Global MAC structure
3666 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3667 *
3668 * @return None
3669 */
3670void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3671{
Jeff Johnsone7245742012-09-05 17:12:55 -07003672 tANI_U8 respReqd = 1;
3673 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3674 tANI_U16 resultCode;
3675 tANI_U8 sessionId = 0;
3676 tpPESession psessionEntry;
3677 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303678 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003679
3680 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003682 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003683 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 }
3685
Jeff Johnsone7245742012-09-05 17:12:55 -07003686 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3687 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3688 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3689 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003690
Jeff Johnsone7245742012-09-05 17:12:55 -07003691 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003693 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003694 return;
3695 }
3696
3697 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3698 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3699 else
3700 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3701
3702 // Validate MLME state
3703 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3704 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3705 {
3706 // Mesg received from HAL in Invalid state!
3707 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303708 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003709 limMsgQ->type,
3710 psessionEntry->limMlmState );
3711 respReqd = 0;
3712 }
3713 else
3714 mlmRemoveCnf.resultCode = resultCode;
3715
3716 //
3717 // TODO & FIXME_GEN4
3718 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3719 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303720 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303721 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003722 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003723
3724 // Restore MLME state
3725 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3726 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3727
3728 if( respReqd )
3729 {
3730 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3731 mlmRemoveCnf.sessionId = sessionId;
3732
3733 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3734 if( NULL != lpLimMlmRemoveKeyReq )
3735 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303736 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3737 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3738 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003739 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303740 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003741 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3742 }
3743 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3744 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003745}
3746
Jeff Johnson295189b2012-06-20 16:38:30 -07003747
3748/** ---------------------------------------------------------------------
3749\fn limProcessInitScanRsp
3750\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3751\ message from HAL. If status code is failure, then
3752\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3753\param tpAniSirGlobal pMac
3754\param tANI_U32 body
3755\return none
3756\ ----------------------------------------------------------------------- */
3757void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3758{
3759 tpInitScanParams pInitScanParam;
3760 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3762 pInitScanParam = (tpInitScanParams) body;
3763 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303764 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003765
3766 //Only abort scan if the we are scanning.
3767 if( pMac->lim.abortScan &&
3768 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3769 {
krunal sonid3d60e12013-07-17 13:24:09 -07003770 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003771 pMac->lim.abortScan = 0;
3772 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3773 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3774 //Set the resume channel to Any valid channel (invalid).
3775 //This will instruct HAL to set it to any previous valid channel.
3776 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003777 if (status != eHAL_STATUS_SUCCESS)
3778 {
3779 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3780 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3781 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3782 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3783 return;
3784 }
3785 else
3786 {
3787 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3788 }
3789
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 }
3791 switch(pMac->lim.gLimHalScanState)
3792 {
3793 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3794 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003796 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003797 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3798 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3799 /*
3800 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3801 * another Scan request in the same context (happens when 11d is enabled
3802 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3803 * scan in the same context but with bigger channel list), so the state needs to be
3804 * changed before this response message is sent.
3805 */
3806 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003807 return;
3808 }
3809 else if (status == eHAL_STATUS_SUCCESS)
3810 {
3811 /* since we have successfully triggered a background scan,
3812 * reset the "consecutive bkgnd scan failure" count to 0
3813 */
3814 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3815 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003816 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 }
3818 limContinueChannelScan(pMac);
3819 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003820//WLAN_SUSPEND_LINK Related
3821 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3822 if( pMac->lim.gpLimSuspendCallback )
3823 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303824 if( eHAL_STATUS_SUCCESS == status )
3825 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303827 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303829 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303831 pMac->lim.gLimSystemInScanLearnMode = 0;
3832 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003833
3834 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3835 pMac->lim.gpLimSuspendCallback = NULL;
3836 pMac->lim.gpLimSuspendData = NULL;
3837 }
3838 else
3839 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003840 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 return;
3842 }
3843 break;
3844//end WLAN_SUSPEND_LINK Related
3845 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003846 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003847 pMac->lim.gLimHalScanState);
3848 break;
3849 }
3850 return;
3851}
3852/**
3853 * limProcessSwitchChannelReAssocReq()
3854 *
3855 *FUNCTION:
3856 * This function is called to send the reassoc req mgmt frame after the
3857 * switchChannelRsp message is received from HAL.
3858 *
3859 *LOGIC:
3860 *
3861 *ASSUMPTIONS:
3862 * NA
3863 *
3864 *NOTE:
3865 * NA
3866 *
3867 * @param pMac - Pointer to Global MAC structure.
3868 * @param psessionEntry - session related information.
3869 * @param status - channel switch success/failure.
3870 *
3871 * @return None
3872 */
3873static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3874{
3875 tLimMlmReassocCnf mlmReassocCnf;
3876 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303877#ifdef FEATURE_WLAN_ESE
3878 tANI_U32 val = 0;
3879#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3881 if(pMlmReassocReq == NULL)
3882 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003883 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3885 goto end;
3886 }
3887
3888 if(status != eHAL_STATUS_SUCCESS)
3889 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003890 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003891 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3892 goto end;
3893 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303894
3895#ifdef FEATURE_WLAN_ESE
3896 /*
3897 * In case of Ese Reassociation, change the reassoc timer
3898 * value.
3899 */
3900 val = pMlmReassocReq->reassocFailureTimeout;
3901 if (psessionEntry->isESEconnection)
3902 {
3903 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3904 }
3905 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3906 TX_SUCCESS)
3907 {
3908 limLog(pMac, LOGP,
3909 FL("unable to deactivate Reassoc failure timer"));
3910 }
3911 val = SYS_MS_TO_TICKS(val);
3912 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3913 val, 0) != TX_SUCCESS)
3914 {
3915 limLog(pMac, LOGP,
3916 FL("unable to change Reassociation failure timer"));
3917 }
3918#endif
3919 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003921 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3923 != TX_SUCCESS)
3924 {
3925 /// Could not start reassoc failure timer.
3926 // Log error
3927 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003928 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 // Return Reassoc confirm with
3930 // Resources Unavailable
3931 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3932 goto end;
3933 }
3934 /// Prepare and send Reassociation request frame
3935 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3936 return;
3937end:
3938 // Free up buffer allocated for reassocReq
3939 if(pMlmReassocReq != NULL)
3940 {
3941 /* Update PE session Id*/
3942 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303943 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003944 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 }
3946 else
3947 {
3948 mlmReassocCnf.sessionId = 0;
3949 }
3950
3951 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3952 /* Update PE sessio Id*/
3953 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3954
3955 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3956}
3957/**
3958 * limProcessSwitchChannelJoinReq()
3959 *
3960 *FUNCTION:
3961 * This function is called to send the probe req mgmt frame after the
3962 * switchChannelRsp message is received from HAL.
3963 *
3964 *LOGIC:
3965 *
3966 *ASSUMPTIONS:
3967 * NA
3968 *
3969 *NOTE:
3970 * NA
3971 *
3972 * @param pMac - Pointer to Global MAC structure.
3973 * @param psessionEntry - session related information.
3974 * @param status - channel switch success/failure.
3975 *
3976 * @return None
3977 */
3978static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3979{
3980 tANI_U32 val;
3981 tSirMacSSid ssId;
3982 tLimMlmJoinCnf mlmJoinCnf;
3983 if(status != eHAL_STATUS_SUCCESS)
3984 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003985 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 goto error;
3987 }
3988
3989 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3990 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003991 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 goto error;
3993 }
3994
Jeff Johnsone7245742012-09-05 17:12:55 -07003995
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3997 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3998 {
3999 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
4000 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304001 {
4002 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
4003 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
4004 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304006 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004008
4009 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4010 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004011 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004012 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4013 // Apply previously set configuration at HW
4014 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05304015
4016 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
4017 * disconnection was caused by HB failure.
4018 */
4019 if(pMac->roam.configParam.sendDeauthBeforeCon)
4020 {
4021 int apCount;
4022
4023 for(apCount = 0; apCount < 2; apCount++)
4024 {
4025
4026 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4027 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
4028 {
4029 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
4030 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
4031 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
4032 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
4033
4034 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
4035 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4036 psessionEntry, FALSE );
4037
4038 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
4039 sizeof(tSirMacAddr));
4040 break;
4041 }
4042 }
4043 }
4044
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304046 vos_mem_copy(ssId.ssId,
4047 psessionEntry->ssId.ssId,
4048 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004050
4051 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
4052
4053 //assign appropriate sessionId to the timer object
4054 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05304055 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
4056 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
4057 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304058 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 // include additional IE if there is
4060 limSendProbeReqMgmtFrame( pMac, &ssId,
4061 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
4062 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
4063 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07004064
4065 // Sending mgmt frame is a blocking call activate Join failure timer now
4066 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
4067 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
4068 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004069 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004070 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
4071 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
4072 //memory is freed up below.
4073 psessionEntry->pLimMlmJoinReq = NULL;
4074 goto error;
4075 }
4076
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004077 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
4078 {
Yathish9f22e662012-12-10 14:21:35 -08004079 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004080 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
4081 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004082 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004083 goto error;
4084 }
4085 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004086
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 return;
4088error:
4089 if(NULL != psessionEntry)
4090 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304091 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 psessionEntry->pLimMlmJoinReq = NULL;
4093 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
4094 }
4095 else
4096 {
4097 mlmJoinCnf.sessionId = 0;
4098 }
4099 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4100 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4101 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
4102}
4103
4104/**
4105 * limProcessSwitchChannelRsp()
4106 *
4107 *FUNCTION:
4108 * This function is called to process switchChannelRsp message from HAL.
4109 *
4110 *LOGIC:
4111 *
4112 *ASSUMPTIONS:
4113 * NA
4114 *
4115 *NOTE:
4116 * NA
4117 *
4118 * @param pMac - Pointer to Global MAC structure
4119 * @param body - message body.
4120 *
4121 * @return None
4122 */
4123void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4124{
4125 tpSwitchChannelParams pChnlParams = NULL;
4126 eHalStatus status;
4127 tANI_U16 channelChangeReasonCode;
4128 tANI_U8 peSessionId;
4129 tpPESession psessionEntry;
4130 //we need to process the deferred message since the initiating req. there might be nested request.
4131 //in the case of nested request the new request initiated from the response will take care of resetting
4132 //the deffered flag.
4133 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4134 pChnlParams = (tpSwitchChannelParams) body;
4135 status = pChnlParams->status;
4136 peSessionId = pChnlParams->peSessionId;
4137 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4138 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304139 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004140 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 return;
4142 }
4143#if defined WLAN_FEATURE_VOWIFI
4144 //HAL fills in the tx power used for mgmt frames in this field.
4145 //Store this value to use in TPC report IE.
4146 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4147#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004148 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4149 // initialize it back to invalid id
4150 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05304151 limLog(pMac, LOGE, FL("channelChangeReasonCode %d status %d"),channelChangeReasonCode, pChnlParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004152 switch(channelChangeReasonCode)
4153 {
4154 case LIM_SWITCH_CHANNEL_REASSOC:
4155 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4156 break;
4157 case LIM_SWITCH_CHANNEL_JOIN:
4158 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4159 break;
4160
4161 case LIM_SWITCH_CHANNEL_OPERATION:
4162 /*
4163 * The above code should also use the callback.
4164 * mechanism below, there is scope for cleanup here.
4165 * THat way all this response handler does is call the call back
4166 * We can get rid of the reason code here.
4167 */
4168 if (pMac->lim.gpchangeChannelCallback)
4169 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304170 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004171 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4172 {
4173 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4174 {
4175 if ( psessionEntry && psessionEntry->limSmeState
4176 == eLIM_SME_LINK_EST_STATE )
4177 {
4178 peSetResumeChannel( pMac,
4179 psessionEntry->currentOperChannel,
4180 psessionEntry->htSecondaryChannelOffset);
4181 }
4182 else
4183 {
4184 peSetResumeChannel( pMac, 0, 0);
4185 }
4186 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4187 }
4188 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4190 }
4191 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05304192 case LIM_SWITCH_CHANNEL_SAP_ECSA:
4193 lim_send_sme_ap_channel_switch_resp(pMac,
4194 psessionEntry, pChnlParams);
4195 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 default:
4197 break;
4198 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304199 vos_mem_free(body);
4200 body = NULL;
4201
Jeff Johnson295189b2012-06-20 16:38:30 -07004202}
4203/**
4204 * limProcessStartScanRsp()
4205 *
4206 *FUNCTION:
4207 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4208 * then it will start scan/learn on the next channel.
4209 *
4210 *LOGIC:
4211 *
4212 *ASSUMPTIONS:
4213 * NA
4214 *
4215 *NOTE:
4216 * NA
4217 *
4218 * @param pMac - Pointer to Global MAC structure
4219 * @param body - message body.
4220 *
4221 * @return None
4222 */
4223
4224void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4225{
4226 tpStartScanParams pStartScanParam;
4227 eHalStatus status;
4228 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4229 pStartScanParam = (tpStartScanParams) body;
4230 status = pStartScanParam->status;
4231#if defined WLAN_FEATURE_VOWIFI
4232 //HAL fills in the tx power used for mgmt frames in this field.
4233 //Store this value to use in TPC report IE.
4234 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4235 //Store start TSF of scan start. This will be stored in BSS params.
4236 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4237#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304238 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004239 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004240 if( pMac->lim.abortScan )
4241 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004242 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 pMac->lim.abortScan = 0;
4244 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4245 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4246 //Set the resume channel to Any valid channel (invalid).
4247 //This will instruct HAL to set it to any previous valid channel.
4248 peSetResumeChannel(pMac, 0, 0);
4249 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4250 }
4251 switch(pMac->lim.gLimHalScanState)
4252 {
4253 case eLIM_HAL_START_SCAN_WAIT_STATE:
4254 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4255 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004256 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 //
4258 // FIXME - With this, LIM will try and recover state, but
4259 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4260 // status back to the SME
4261 //
4262 //Set the resume channel to Any valid channel (invalid).
4263 //This will instruct HAL to set it to any previous valid channel.
4264 peSetResumeChannel(pMac, 0, 0);
4265 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4266 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4267 }
4268 else
4269 {
4270 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4271 limContinuePostChannelScan(pMac);
4272 }
4273 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004274 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004275 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 pMac->lim.gLimHalScanState);
4277 break;
4278 }
4279 return;
4280}
4281void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4282{
4283 tpEndScanParams pEndScanParam;
4284 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4286 pEndScanParam = (tpEndScanParams) body;
4287 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304288 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004289 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 switch(pMac->lim.gLimHalScanState)
4291 {
4292 case eLIM_HAL_END_SCAN_WAIT_STATE:
4293 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4294 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004295 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4297 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4298 }
4299 else
4300 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004301 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 limContinueChannelScan(pMac);
4303 }
4304 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004306 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 pMac->lim.gLimHalScanState);
4308 break;
4309 }
4310 return;
4311}
Jeff Johnsone7245742012-09-05 17:12:55 -07004312/**
4313 * limStopTxAndSwitch()
4314 *
4315 *FUNCTION:
4316 * Start channel switch on all sessions that is in channel switch state.
4317 *
4318 * @param pMac - pointer to global adapter context
4319 *
4320 * @return None
4321 *
4322 */
4323static void
4324limStopTxAndSwitch (tpAniSirGlobal pMac)
4325{
4326 tANI_U8 i;
4327
4328 for(i =0; i < pMac->lim.maxBssId; i++)
4329 {
4330 if(pMac->lim.gpSession[i].valid &&
4331 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4332 {
4333 limStopTxAndSwitchChannel(pMac, i);
4334 }
4335 }
4336 return;
4337}
4338/**
4339 * limStartQuietOnSession()
4340 *
4341 *FUNCTION:
4342 * This function is called to start quiet timer after finish scan if there is
4343 * qeuieting on any session.
4344 *
4345 *LOGIC:
4346 *
4347 *ASSUMPTIONS:
4348 * NA
4349 *
4350 *NOTE:
4351 * NA
4352 *
4353 * @param pMac - Pointer to Global MAC structure
4354 *
4355 * @return None
4356 */
4357static void
4358limStartQuietOnSession (tpAniSirGlobal pMac)
4359{
4360 tANI_U8 i;
4361
4362 for(i =0; i < pMac->lim.maxBssId; i++)
4363 {
4364 if(pMac->lim.gpSession[i].valid &&
4365 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4366 {
4367 limStartQuietTimer(pMac, i);
4368 }
4369 }
4370 return;
4371}
Jeff Johnson295189b2012-06-20 16:38:30 -07004372void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4373{
4374 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 eHalStatus status;
4376 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4377 pFinishScanParam = (tpFinishScanParams) body;
4378 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004379
Sushant Kaushik826de802014-05-08 18:04:11 +05304380 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4381 pMac->lim.gLimHalScanState,
4382 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004383
Jeff Johnson295189b2012-06-20 16:38:30 -07004384 switch(pMac->lim.gLimHalScanState)
4385 {
4386 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304387#ifdef FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05304388 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_COMP_EVENT, NULL,
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304389 status, eSIR_SUCCESS);
4390#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004391 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Padma, Santhosh Kumar8eb1d7a2015-07-31 11:35:53 +05304392 if (pMac->lim.abortScan)
4393 pMac->lim.abortScan = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004394 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004395 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 {
4397 /** Right time to stop tx and start the timer for channel switch */
4398 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4399 * be any associated session id
4400 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004401 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004403 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 {
4405 /** Start the quieting */
4406 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4407 * be any associated session id
4408 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004409 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4412 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004413 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 }
4415 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004416//WLAN_SUSPEND_LINK Related
4417 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4418 if( pMac->lim.gpLimResumeCallback )
4419 {
4420 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4421 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4422 pMac->lim.gpLimResumeCallback = NULL;
4423 pMac->lim.gpLimResumeData = NULL;
4424 pMac->lim.gLimSystemInScanLearnMode = 0;
4425 }
4426 else
4427 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004428 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
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 break;
4434//end WLAN_SUSPEND_LINK Related
4435
4436 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004437 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 pMac->lim.gLimHalScanState);
4439 break;
4440 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304441 vos_mem_free(body);
4442 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004443 return;
4444}
4445/**
4446 * @function : limProcessMlmHalAddBARsp
4447 *
4448 * @brief: Process WDA_ADDBA_RSP coming from HAL
4449 *
4450 *
4451 * @param pMac The global tpAniSirGlobal object
4452 *
4453 * @param tSirMsgQ The MsgQ header containing the response buffer
4454 *
4455 * @return none
4456 */
4457void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4458 tpSirMsgQ limMsgQ )
4459{
4460 // Send LIM_MLM_ADDBA_CNF to LIM
4461 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004462 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004464
Jeff Johnson295189b2012-06-20 16:38:30 -07004465 //now LIM can process any defer message.
4466 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4467 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004468 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 return;
4470 }
4471 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4472 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004473 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304474 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004475 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 return;
4477 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004478
4479 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304480 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4481 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004482 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304483 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004484 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004485 return;
4486 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304487 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004488 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304489 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4490 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 // Copy other ADDBA Rsp parameters
4492 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4493 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4494 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4495 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4496 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4497 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4498 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4499 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4500 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4501 else
4502 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304503
4504#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4505 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry,
4506 pAddBAParams->status, pMlmAddBACnf->addBAResultCode);
4507#endif //FEATURE_WLAN_DIAG_SUPPORT
4508
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304509 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004510 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 // Send ADDBA CNF to LIM
4512 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4513}
4514/**
4515 * \brief Process LIM_MLM_ADDBA_CNF
4516 *
4517 * \sa limProcessMlmAddBACnf
4518 *
4519 * \param pMac The global tpAniSirGlobal object
4520 *
4521 * \param tSirMsgQ The MsgQ header containing the response buffer
4522 *
4523 * \return none
4524 */
4525void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4526 tANI_U32 *pMsgBuf )
4527{
4528tpLimMlmAddBACnf pMlmAddBACnf;
4529tpDphHashNode pSta;
4530tANI_U16 aid;
4531tLimBAState curBaState;
4532tpPESession psessionEntry = NULL;
4533if(pMsgBuf == NULL)
4534{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004535 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 return;
4537}
4538pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4539 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004541 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304542 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 return;
4544 }
4545 // First, extract the DPH entry
4546 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4547 if( NULL == pSta )
4548 {
4549 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004550 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304551 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 return;
4553 }
4554 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4555 // Need to validate SME state
4556 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4557 {
4558 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004559 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304561 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 return;
4563 }
4564 // Restore STA BA state
4565 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004566 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 {
4568 // Update LIM internal cache...
4569 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4570 {
4571 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4572 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4573 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4574 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4575 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004576 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4577 // status code. MLME will then send an ADDBA RSP
4578 // over the air to the peer MAC entity
4579 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4580 pMlmAddBACnf->peerMacAddr,
4581 pMlmAddBACnf->addBAResultCode,
4582 pMlmAddBACnf->baDialogToken,
4583 (tANI_U8) pMlmAddBACnf->baTID,
4584 (tANI_U8) pMlmAddBACnf->baPolicy,
4585 pMlmAddBACnf->baBufferSize,
4586 pMlmAddBACnf->baTimeout,psessionEntry))
4587 {
4588 PELOGW(limLog( pMac, LOGW,
4589 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4590 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 }
4593 else
4594 {
4595 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4596 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4597 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4598 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4599 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4600 }
4601 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304603 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004604 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004605}
4606/**
4607 * \brief Process LIM_MLM_DELBA_CNF
4608 *
4609 * \sa limProcessMlmDelBACnf
4610 *
4611 * \param pMac The global tpAniSirGlobal object
4612 *
4613 * \param tSirMsgQ The MsgQ header containing the response buffer
4614 *
4615 * \return none
4616 */
4617void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4618 tANI_U32 *pMsgBuf )
4619{
4620 tpLimMlmDelBACnf pMlmDelBACnf;
4621 tpDphHashNode pSta;
4622 tANI_U16 aid;
4623// tANI_U8 sessionId;
4624 tLimBAState curBaState;
4625 tpPESession psessionEntry;
4626
4627 if(pMsgBuf == NULL)
4628 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004629 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 return;
4631 }
4632 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4633 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4634 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304635 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4636 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304637 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 return;
4639 }
4640 // First, extract the DPH entry
4641 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4642 if( NULL == pSta )
4643 {
4644 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004645 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304646 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 return;
4648 }
4649 if(NULL == pMlmDelBACnf)
4650 {
4651 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004652 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 return;
4654 }
4655 // Need to validate baState
4656 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4657 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4658 {
4659 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004660 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004661 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304662 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 return;
4664 }
4665 // Restore STA BA state
4666 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4667 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304668 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004669}
4670/**
4671 * \brief Process SIR_LIM_DEL_BA_IND
4672 *
4673 * \sa limProcessMlmHalBADeleteInd
4674 *
4675 * \param pMac The global tpAniSirGlobal object
4676 *
4677 * \param tSirMsgQ The MsgQ header containing the indication buffer
4678 *
4679 * \return none
4680 */
4681void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4682 tpSirMsgQ limMsgQ )
4683{
4684 tSirRetStatus status = eSIR_SUCCESS;
4685 tpBADeleteParams pBADeleteParams;
4686 tpDphHashNode pSta;
4687 tANI_U16 aid;
4688 tLimBAState curBaState;
4689 tpPESession psessionEntry;
4690 tANI_U8 sessionId;
4691
4692 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4693
4694 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4695 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004696 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304697 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004698 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 return;
4700 }
4701 // First, extract the DPH entry
4702 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4703 if( NULL == pSta )
4704 {
4705 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004706 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004707 goto returnAfterCleanup;
4708 }
4709
4710 // Need to validate BA state
4711 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4712 if( eLIM_BA_STATE_IDLE != curBaState )
4713 {
4714 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004715 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004716 curBaState );
4717 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304718 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004719
Abhishek Singh66c16762014-08-14 19:13:19 +05304720 // Post DELBA REQ to MLME...
4721 if( eSIR_SUCCESS !=
4722 (status = limPostMlmDelBAReq( pMac,
4723 pSta,
4724 pBADeleteParams->baDirection,
4725 pBADeleteParams->baTID,
4726 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004727 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304728 limLog( pMac, LOGE,
4729 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 }
4731 else
4732 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304733 limLog( pMac, LOGE,
4734 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4735 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4736 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004737 }
4738returnAfterCleanup:
4739 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304740 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004741 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004742}
4743/**
4744 * @function : limProcessSetMimoRsp()
4745 *
4746 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4747 * after Processing the Req from the SME (PMC)
4748 *
4749 * LOGIC:
4750 *
4751 * ASSUMPTIONS:
4752 * NA
4753 *
4754 * NOTE:
4755 * NA
4756 *
4757 * @param pMac - Pointer to Global MAC structure
4758 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4759 * @return None
4760 */
4761
4762void
4763limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4764{
4765#if 0
4766 tSirRetStatus retStatus;
4767 tpSetMIMOPS pMIMO_PSParams;
4768
4769
4770 do {
4771
4772 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4773 if( NULL == pMIMO_PSParams ) {
4774 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4775 return;
4776 }
4777
4778 /** If Updation of the HAL Fail's*/
4779 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004780 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004781 break;
4782 }
4783
4784 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4785 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4786 break;
4787
4788 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4789 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4790
4791 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4792 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4793 * the Action Frame is being sent at first before setting the internal structures
4794 */
4795 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4796 tSirMacAddr macAddr;
4797
4798 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304799 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004800
4801 /** Send Action Frame with the corresponding mode */
4802 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4803 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004804 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004805 break;
4806 }
4807 }
4808 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4809 }while(0);
4810
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304811 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004812#endif
4813}
4814/**
4815 * @function : limHandleDelBssInReAssocContext
4816 * @brief : While Processing the ReAssociation Response Frame in STA,
4817 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4818 * being issued and the end of DelBSS the new BSS is being added.
4819 *
4820 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4821 * change, We need to update CSR with ReAssocCNF Response with the
4822 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4823 * context only
4824 *
4825 * @param : pMac - tpAniSirGlobal
4826 * pStaDs - Station Descriptor
4827 *
4828 * @return : none
4829 */
4830static void
4831limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4832{
4833 tLimMlmReassocCnf mlmReassocCnf;
4834 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4835 /** Set the MlmState to IDLE*/
4836 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 /* Update PE session Id*/
4838 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304839 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004840 case eLIM_SME_WT_REASSOC_STATE :
4841 {
4842 tpSirAssocRsp assocRsp;
4843 tpDphHashNode pStaDs;
4844 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304845 tpSchBeaconStruct pBeaconStruct;
4846 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4847 if (NULL == pBeaconStruct)
4848 {
4849 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4850 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4851 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4852 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4853 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4854 goto Error;
4855 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 /** Delete the older STA Table entry */
4857 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4858 /**
4859 * Add an entry for AP to hash table
4860 * maintained by DPH module
4861 */
4862 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4863 {
4864 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004865 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004866 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4867 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4868 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Abhishek Singh2b055852015-10-07 14:14:13 +05304869 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 goto Error;
4871 }
4872 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4873 * is being stored to be used here for sending ADDBSS
4874 */
4875 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4876 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4877 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 limExtractApCapabilities( pMac,
Abhishek Singhbad2b322016-10-21 11:22:33 +05304879 (tANI_U8 *)
4880 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4881 GET_IE_LEN_IN_BSS(
4882 psessionEntry->pLimReAssocReq->bssDescription.length),
4883 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304885 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4886 if(pBeaconStruct->erpPresent) {
4887 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 psessionEntry->beaconParams.fShortPreamble = 0;
4889 else
4890 psessionEntry->beaconParams.fShortPreamble = 1;
4891 }
4892 //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 +05304893 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004894 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004895 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 retStatus = eSIR_FAILURE;
4897 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 if (retStatus != eSIR_SUCCESS)
4899 {
4900 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4901 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304902 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304903 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004904 pMac->lim.gLimAssocResponseData = NULL;
4905 goto Error;
4906 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304907 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304908 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 psessionEntry->limAssocResponseData = NULL;
4910 }
4911 break;
4912 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4913 {
4914 /** Case wherein the DisAssoc / Deauth
4915 * being sent as response to ReAssoc Req*/
4916 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4917 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4918 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4919 /** Set the SME State back to WT_Reassoc State*/
4920 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4922 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4923 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4924 {
4925 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 }
4927 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4928 }
4929 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004930 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004931 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4933 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4934 goto Error;
4935 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004936 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004937Error:
4938 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4939}
4940
4941/* Added For BT -AMP Support */
4942static void
4943limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4944{
4945 tLimMlmStartCnf mlmStartCnf;
4946 tANI_U32 val;
4947 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4948
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304949 if (NULL == pAddBssParams)
4950 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004951 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304952 goto end;
4953 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4955 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004956 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4958 {
4959 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4960 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4961 goto end;
4962 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4963 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4964 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4965 goto end;
4966 }
4967
4968 // Set MLME state
4969 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4970 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4971 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4972 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004973 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 // Create timers used by LIM
4975 if (!pMac->lim.gLimTimersCreated)
4976 limCreateTimers(pMac);
4977 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4978 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004979 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004980 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4981 // Apply previously set configuration at HW
4982 limApplyConfiguration(pMac,psessionEntry);
4983 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4984 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4985 }
4986 else
4987 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004988 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4990 }
4991 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4992 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4993 end:
4994 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004995 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304996 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304997 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004998 limMsgQ->bodyptr = NULL;
4999 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005000}
5001
5002/**
5003 * @function : limHandleAddBssInReAssocContext
5004 * @brief : While Processing the ReAssociation Response Frame in STA,
5005 * a. immediately after receiving the Reassoc Response the RxCleanUp is
5006 * being issued and the end of DelBSS the new BSS is being added.
5007 *
5008 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
5009 * change, We need to update CSR with ReAssocCNF Response with the
5010 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
5011 * context only
5012 *
5013 * @param : pMac - tpAniSirGlobal
5014 * pStaDs - Station Descriptor
5015 *
5016 * @return : none
5017 */
5018void
5019limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
5020{
5021 tLimMlmReassocCnf mlmReassocCnf;
5022 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
5023 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005024 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
5025 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07005026 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07005027 case eLIM_SME_WT_REASSOC_STATE : {
5028 tpSirAssocRsp assocRsp;
5029 tpDphHashNode pStaDs;
5030 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005031 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305032 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
5033 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005034 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305035 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005036 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5037 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5038 goto Error;
5039 }
5040
Jeff Johnson295189b2012-06-20 16:38:30 -07005041 // Get the AP entry from DPH hash table
5042 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5043 if (pStaDs == NULL )
5044 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005045 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005046 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5047 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305048 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005049 goto Error;
5050 }
5051 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
5052 * is being stored to be used here for sending ADDBSS
5053 */
5054 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
5055 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
5056 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Abhishek Singhbad2b322016-10-21 11:22:33 +05305057 limExtractApCapabilities(pMac,
5058 (tANI_U8 *)
5059 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
5060 GET_IE_LEN_IN_BSS(
5061 psessionEntry->pLimReAssocReq->bssDescription.length),
5062 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005064 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
5065
5066 if(pBeaconStruct->erpPresent)
5067 {
5068 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005069 psessionEntry->beaconParams.fShortPreamble = 0;
5070 else
5071 psessionEntry->beaconParams.fShortPreamble = 1;
5072 }
5073
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005074 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07005075 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005076 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005077 retStatus = eSIR_FAILURE;
5078 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 if (retStatus != eSIR_SUCCESS)
5080 {
5081 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5082 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305083 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005084 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305085 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 goto Error;
5087 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305088 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005089 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305090 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005091 }
5092 break;
5093 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
5094 * being sent as response to ReAssoc Req*/
5095 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
5096 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
5097 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
5098 /** Set the SME State back to WT_Reassoc State*/
5099 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
5100 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
5101 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005102 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005104 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
5105 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005106
5107 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5108 }
5109 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005110 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005111 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005112 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
5113 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
5114 goto Error;
5115 }
5116return;
5117Error:
5118 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5119}
5120
5121#if 0
5122 static void
5123limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
5124{
5125 tSirSmeAssocCnf assocCnf;
5126 tpDphHashNode pStaDs;
5127 tpPESession psessionEntry;
5128 tANI_U8 sessionId;
5129
5130 if(pMsgBuf == NULL)
5131 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005132 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005133 goto end;
5134 }
5135 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
5136 !__limIsSmeAssocCnfValid(&assocCnf))
5137 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005138 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 goto end;
5140 }
5141 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5142 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005143 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005144 goto end;
5145 }
5146 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5147 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5148 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005149 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5151 goto end;
5152 }
5153 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5154 if (pStaDs == NULL)
5155 {
5156 limLog(pMac, LOG1,
5157 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5158 msgType, assocCnf.aid);
5159 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5160 /*
5161 ** send a DISASSOC_IND message to WSM to make sure
5162 ** the state in WSM and LIM is the same
5163 **/
5164 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5165 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5166 goto end;
5167 }
5168 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305169 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005170 (tANI_U8 *) assocCnf.peerMacAddr,
5171 sizeof(tSirMacAddr)) ) ||
5172 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5173 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5174 (msgType != eWNI_SME_ASSOC_CNF)) ||
5175 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5176 (msgType != eWNI_SME_REASSOC_CNF)))))
5177 {
5178 limLog(pMac, LOG1,
5179 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5180 msgType, assocCnf.aid);
5181 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5182 goto end;
5183 }
5184 /*
5185 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5186 ** has been received
5187 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005188 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005189 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5190 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5191 {
5192 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5193 * when it had received Assoc Request frame. Now, PE just needs to send
5194 * Association Response frame to the requesting BTAMP-STA.
5195 */
5196 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005197 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005198 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5199 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5200 goto end;
5201 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5202 else
5203 {
5204 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5205 limRejectAssociation(pMac, pStaDs->staAddr,
5206 pStaDs->mlmStaContext.subType,
5207 true, pStaDs->mlmStaContext.authType,
5208 pStaDs->assocId, true,
5209 assocCnf.statusCode, psessionEntry);
5210 return;
5211 }
5212end:
5213 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5214 {
5215 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5216 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305217 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005218 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5219 }
5220
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305221 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005222 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5223 }
5224} /*** end __limProcessSmeAssocCnfNew() ***/
5225#endif
5226
Jeff Johnson295189b2012-06-20 16:38:30 -07005227void
5228limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5229 tBeaconGenParams *pBeaconGenParams = NULL;
5230 tSirMsgQ limMsg;
5231 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5232 if(psessionEntry == NULL ){
5233 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005234 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 return;
5236 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305237 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5238 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005239 {
5240 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305241 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 return;
5243 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305244 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5245 vos_mem_copy((void *) pBeaconGenParams->bssId,
5246 (void *)psessionEntry->bssId,
5247 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005248 limMsg.bodyptr = pBeaconGenParams;
5249 schProcessPreBeaconInd(pMac, &limMsg);
5250 return;
5251}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305252
5253void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5254 tSirResultCodes reasonCode)
5255{
5256 tANI_U16 scanRspLen = 0;
5257
5258 pMac->lim.gLimSmeScanResultLength +=
5259 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305260 pMac->lim.gLimRspReqd = false;
5261 if ((reasonCode == eSIR_SME_SUCCESS) ||
5262 pMac->lim.gLimSmeScanResultLength) {
5263 scanRspLen = sizeof(tSirSmeScanRsp) +
5264 pMac->lim.gLimSmeScanResultLength -
5265 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305266 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305267 else
5268 scanRspLen = sizeof(tSirSmeScanRsp);
5269
5270 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5271 pMac->lim.gSmeSessionId,
5272 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305273}
5274
5275
5276void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5277{
5278 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5279
5280 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005281 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305282
5283 switch (pScanEvent->event)
5284 {
5285 case SCAN_EVENT_STARTED:
5286 break;
5287 case SCAN_EVENT_START_FAILED:
5288 case SCAN_EVENT_COMPLETED:
5289 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5290 break;
5291 case SCAN_EVENT_BSS_CHANNEL:
5292 case SCAN_EVENT_FOREIGN_CHANNEL:
5293 case SCAN_EVENT_DEQUEUED:
5294 case SCAN_EVENT_PREEMPTED:
5295 default:
5296 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005297 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305298 }
5299}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005300
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305301void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5302{
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305303 tANI_U32 val;
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305304
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305305 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING, &val)
5306 != eSIR_SUCCESS)
5307 {
5308 limLog(pMac, LOGP, FL("fail to Get WNI_CFG_ENABLE_MAC_ADDR_SPOOFING"));
5309 /*If we here means mac spoofing is enable. So enable both Host and
5310 FW spoofing */
5311 val = 1;
5312 }
5313 if ((rspStatus != eSIR_SUCCESS) || (val != 1) ||
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305314 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5315 {
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305316 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing %d"), val);
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305317 pMac->lim.isSpoofingEnabled = FALSE;
5318 } else {
5319 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5320 pMac->lim.isSpoofingEnabled = TRUE;
5321 }
5322
5323 return;
5324}
5325
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005326void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5327 eHalStatus status,
5328 tANI_U32* mlmAddBssRsp)
5329{
5330 if (status != eHAL_STATUS_SUCCESS)
5331 {
5332 limLog(pMac, LOGE,
5333 FL(" CSA failed to get the response for resume link"));
5334 }
5335 return;
5336}