blob: 4357a1e79d91c30ffdadc921a59f4e33f0c75cbe [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;
Abhinav Kumarc00a7842018-06-13 16:07:31 +05301269 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 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);
Abhinav Kumarc00a7842018-06-13 16:07:31 +05301297 msg.type = eWNI_SME_ASSOC_IND;
1298 msg.bodyptr = pSirSmeAssocInd;
1299 msg.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 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,
Abhinav Kumarc00a7842018-06-13 16:07:31 +05301313 msg.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
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301317 limLog(pMac, LOG1,
1318 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 /*
1320 ** turn on a timer to detect the loss of ASSOC CNF
1321 **/
1322 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1323
Abhinav Kumarc00a7842018-06-13 16:07:31 +05301324 if (pMac->lim.sme_msg_callback)
1325 pMac->lim.sme_msg_callback(pMac, &msg);
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301326 else
1327 limLog(pMac, LOGE, FL("Sme msg callback is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1329#ifdef TEST_BTAMP_AP
1330//tANI_U32 *pMsgBuf;
1331{
1332 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301333 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1334 if ( NULL == pSmeAssoccnf )
1335 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1337 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301338 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1339 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1341 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301342 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1343 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301345 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1347 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301348 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001349}
1350#endif
1351
1352
1353} /*** end limProcessMlmAssocInd() ***/
1354
1355
1356
1357
1358/**
1359 * limProcessMlmDisassocInd()
1360 *
1361 *FUNCTION:
1362 * This function is called to processes MLM_DISASSOC_IND
1363 * message from MLM State machine.
1364 *
1365 *LOGIC:
1366 *
1367 *ASSUMPTIONS:
1368 *
1369 *NOTE:
1370 *
1371 * @param pMac Pointer to Global MAC structure
1372 * @param pMsgBuf A pointer to the MLM message buffer
1373 *
1374 * @return None
1375 */
1376void
1377limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1378{
1379 tLimMlmDisassocInd *pMlmDisassocInd;
1380 tpPESession psessionEntry;
1381 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1382 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1383 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001384 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 return;
1386 }
1387 switch (psessionEntry->limSystemRole)
1388 {
1389 case eLIM_STA_IN_IBSS_ROLE:
1390 break;
1391 case eLIM_STA_ROLE:
1392 case eLIM_BT_AMP_STA_ROLE:
1393 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001394 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 break;
1396 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301397 limLog(pMac, LOG1,
1398 FL("*** Peer staId = %d Disassociated ***"),
1399 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 // Send SME_DISASOC_IND after Polaris cleanup
1401 // (after receiving LIM_MLM_PURGE_STA_IND)
1402 break;
1403 } // end switch (psessionEntry->limSystemRole)
1404} /*** end limProcessMlmDisassocInd() ***/
1405
1406/**
1407 * limProcessMlmDisassocCnf()
1408 *
1409 *FUNCTION:
1410 * This function is called to processes MLM_DISASSOC_CNF
1411 * message from MLM State machine.
1412 *
1413 *LOGIC:
1414 *
1415 *ASSUMPTIONS:
1416 *
1417 *NOTE:
1418 *
1419 * @param pMac Pointer to Global MAC structure
1420 * @param pMsgBuf A pointer to the MLM message buffer
1421 *
1422 * @return None
1423 */
1424void
1425limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1426{
1427 tSirResultCodes resultCode;
1428 tLimMlmDisassocCnf *pMlmDisassocCnf;
1429 tpPESession psessionEntry;
1430 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1431 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1432 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001433 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 return;
1435 }
1436 resultCode = (tSirResultCodes)
1437 (pMlmDisassocCnf->disassocTrigger ==
1438 eLIM_LINK_MONITORING_DISASSOC) ?
1439 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1440 pMlmDisassocCnf->resultCode;
1441 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1442 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001443 // Disassociate Confirm from MLM
1444 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1445 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1446 {
1447 /**
1448 * Should not have received
1449 * Disassocate confirm
1450 * from MLM in other states.
1451 * Log error
1452 */
1453 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301454 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 return;
1456 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 if (pMac->lim.gLimRspReqd)
1458 pMac->lim.gLimRspReqd = false;
1459 if (pMlmDisassocCnf->disassocTrigger ==
1460 eLIM_PROMISCUOUS_MODE_DISASSOC)
1461 {
1462 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1463 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1464 else
1465 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001466 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 // Send Promiscuous mode response to host
1468 limSendSmePromiscuousModeRsp(pMac);
1469 }
1470 else
1471 {
1472 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1473 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1474 else
1475 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001476 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1478 resultCode,
1479 pMlmDisassocCnf->disassocTrigger,
1480 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1481 }
1482 }
1483 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1484 {
1485 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1486 resultCode,
1487 pMlmDisassocCnf->disassocTrigger,
1488 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1489 }
1490} /*** end limProcessMlmDisassocCnf() ***/
1491
1492/**
1493 * limProcessMlmDeauthInd()
1494 *
1495 *FUNCTION:
1496 * This function is called to processes MLM_DEAUTH_IND
1497 * message from MLM State machine.
1498 *
1499 *LOGIC:
1500 *
1501 *ASSUMPTIONS:
1502 *
1503 *NOTE:
1504 *
1505 * @param pMac Pointer to Global MAC structure
1506 * @param pMsgBuf A pointer to the MLM message buffer
1507 *
1508 * @return None
1509 */
1510void
1511limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1512{
1513 tLimMlmDeauthInd *pMlmDeauthInd;
1514 tpPESession psessionEntry;
1515 tANI_U8 sessionId;
1516 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1517 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1518 {
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05301519 PELOGE(limLog(pMac, LOGE,FL("session does not exist for Addr:" MAC_ADDRESS_STR),
1520 MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 return;
1522 }
1523 switch (psessionEntry->limSystemRole)
1524 {
1525 case eLIM_STA_IN_IBSS_ROLE:
1526 break;
1527 case eLIM_STA_ROLE:
1528 case eLIM_BT_AMP_STA_ROLE:
1529 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001530 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001531
1532 default: // eLIM_AP_ROLE
1533 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301534 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001535 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301536 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 }
1538 // Send SME_DEAUTH_IND after Polaris cleanup
1539 // (after receiving LIM_MLM_PURGE_STA_IND)
1540 break;
1541 } // end switch (psessionEntry->limSystemRole)
1542} /*** end limProcessMlmDeauthInd() ***/
1543
1544/**
1545 * limProcessMlmDeauthCnf()
1546 *
1547 *FUNCTION:
1548 * This function is called to processes MLM_DEAUTH_CNF
1549 * message from MLM State machine.
1550 *
1551 *LOGIC:
1552 *
1553 *ASSUMPTIONS:
1554 *
1555 *NOTE:
1556 *
1557 * @param pMac Pointer to Global MAC structure
1558 * @param pMsgBuf A pointer to the MLM message buffer
1559 *
1560 * @return None
1561 */
1562void
1563limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1564{
1565 tANI_U16 aid;
1566 tSirResultCodes resultCode;
1567 tLimMlmDeauthCnf *pMlmDeauthCnf;
1568 tpPESession psessionEntry;
1569
1570 if(pMsgBuf == NULL)
1571 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001572 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 return;
1574 }
1575 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1576 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1577 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001578 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 return;
1580 }
1581
1582 resultCode = (tSirResultCodes)
1583 (pMlmDeauthCnf->deauthTrigger ==
1584 eLIM_LINK_MONITORING_DEAUTH) ?
1585 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1586 pMlmDeauthCnf->resultCode;
1587 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1588 pMlmDeauthCnf->aid : 1;
1589 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1590 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 // Deauth Confirm from MLM
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05301592 if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1593 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 {
1595 /**
1596 * Should not have received Deauth confirm
1597 * from MLM in other states.
1598 * Log error
1599 */
1600 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301601 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 psessionEntry->limSmeState);)
1603 return;
1604 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001605 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1606 {
1607 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301608 limLog(pMac, LOG1,
1609 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 }
1611 else
1612 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001613 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001614
1615 if (pMac->lim.gLimRspReqd)
1616 pMac->lim.gLimRspReqd = false;
1617 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1619 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1620 resultCode,
1621 pMlmDeauthCnf->deauthTrigger,
1622 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001623} /*** end limProcessMlmDeauthCnf() ***/
1624
1625/**
1626 * limProcessMlmPurgeStaInd()
1627 *
1628 *FUNCTION:
1629 * This function is called to processes MLM_PURGE_STA_IND
1630 * message from MLM State machine.
1631 *
1632 *LOGIC:
1633 *
1634 *ASSUMPTIONS:
1635 *
1636 *NOTE:
1637 *
1638 * @param pMac Pointer to Global MAC structure
1639 * @param pMsgBuf A pointer to the MLM message buffer
1640 *
1641 * @return None
1642 */
1643void
1644limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1645{
1646 tSirResultCodes resultCode;
1647 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1648 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 if(pMsgBuf == NULL)
1650 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001651 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 return;
1653 }
1654 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1655 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1656 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001657 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 return;
1659 }
1660 // Purge STA indication from MLM
1661 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1662 switch (psessionEntry->limSystemRole)
1663 {
1664 case eLIM_STA_IN_IBSS_ROLE:
1665 break;
1666 case eLIM_STA_ROLE:
1667 case eLIM_BT_AMP_STA_ROLE:
1668 default: // eLIM_AP_ROLE
1669 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1670 (psessionEntry->limSmeState !=
1671 eLIM_SME_WT_DISASSOC_STATE) &&
1672 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1673 {
1674 /**
1675 * Should not have received
1676 * Purge STA indication
1677 * from MLM in other states.
1678 * Log error
1679 */
1680 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301681 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 psessionEntry->limSmeState);)
1683 break;
1684 }
1685 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001686 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 pMlmPurgeStaInd->aid);)
1688 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1689 {
1690 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001691 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001692
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 }
1694 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1695 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001696 limSendSmeDeauthNtf(pMac,
1697 pMlmPurgeStaInd->peerMacAddr,
1698 resultCode,
1699 pMlmPurgeStaInd->purgeTrigger,
1700 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 }
1702 else
1703 limSendSmeDisassocNtf(pMac,
1704 pMlmPurgeStaInd->peerMacAddr,
1705 resultCode,
1706 pMlmPurgeStaInd->purgeTrigger,
1707 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1708 } // end switch (psessionEntry->limSystemRole)
1709} /*** end limProcessMlmPurgeStaInd() ***/
1710
1711/**
1712 * limProcessMlmSetKeysCnf()
1713 *
1714 *FUNCTION:
1715 * This function is called to processes MLM_SETKEYS_CNF
1716 * message from MLM State machine.
1717 *
1718 *LOGIC:
1719 *
1720 *ASSUMPTIONS:
1721 *
1722 *NOTE:
1723 *
1724 * @param pMac Pointer to Global MAC structure
1725 * @param pMsgBuf A pointer to the MLM message buffer
1726 *
1727 * @return None
1728 */
1729void
1730limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1731{
1732 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001733 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301735 tANI_U16 aid;
1736 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001737
1738 if(pMsgBuf == NULL)
1739 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001740 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001741 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 }
1743 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1744 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1745 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001746 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 return;
1748 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301749 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001751 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301753 /* if the status is success keys are installed in the
1754 * Firmware so we can set the protection bit
1755 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301756 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301757 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301758 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1759 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1760 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1761 &psessionEntry->dph.dphHashTable);
1762 if (pStaDs != NULL)
1763 pStaDs->isKeyInstalled = 1;
1764 }
1765 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 limSendSmeSetContextRsp(pMac,
1767 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1770 psessionEntry->transactionId);
1771} /*** end limProcessMlmSetKeysCnf() ***/
1772/**
1773 * limProcessMlmRemoveKeyCnf()
1774 *
1775 *FUNCTION:
1776 * This function is called to processes MLM_REMOVEKEY_CNF
1777 * message from MLM State machine.
1778 *
1779 *LOGIC:
1780 *
1781 *ASSUMPTIONS:
1782 *
1783 *NOTE:
1784 *
1785 * @param pMac Pointer to Global MAC structure
1786 * @param pMsgBuf A pointer to the MLM message buffer
1787 *
1788 * @return None
1789 */
1790void
1791limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1792{
1793 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001794 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 tpPESession psessionEntry;
1796
1797 if(pMsgBuf == NULL)
1798 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001799 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001800 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001801 }
1802 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1803 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001805 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 return;
1807 }
1808 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001809 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 pMlmRemoveKeyCnf->resultCode );
1811 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001812 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1814 psessionEntry->smeSessionId,psessionEntry->transactionId);
1815} /*** end limProcessMlmRemoveKeyCnf() ***/
1816
1817
1818/**
1819 * limHandleSmeJoinResult()
1820 *
1821 *FUNCTION:
1822 * This function is called to process join/auth/assoc failures
1823 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1824 * MLM_ASSOC_CNF with a success code in case of STA role and
1825 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1826 *
1827 *LOGIC:
1828 *
1829 *ASSUMPTIONS:
1830 *
1831 *NOTE:
1832 *
1833 * @param pMac Pointer to Global MAC structure
1834 * @param resultCode Failure code to be sent
1835 *
1836 *
1837 * @return None
1838 */
1839static void
1840limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1841{
1842 tpDphHashNode pStaDs = NULL;
1843 tANI_U8 smesessionId;
1844 tANI_U16 smetransactionId;
1845
1846 /* Newly Added on oct 11 th*/
1847 if(psessionEntry == NULL)
1848 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001849 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 return;
1851 }
1852 smesessionId = psessionEntry->smeSessionId;
1853 smetransactionId = psessionEntry->transactionId;
1854 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1855 if(resultCode != eSIR_SME_SUCCESS)
1856 {
1857 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1858 if (pStaDs != NULL)
1859 {
1860 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1861 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1862 pStaDs->mlmStaContext.resultCode = resultCode;
1863 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1864 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1865 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301866 /* Cleanup if add bss failed */
1867 if(psessionEntry->addBssfailed)
1868 {
1869 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1870 &psessionEntry->dph.dphHashTable);
1871 goto error;
1872 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301873 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001874 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 return;
1876 }
1877 }
1878
Abhishek Singhde7f0512015-10-23 14:31:15 +05301879error:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301880 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 psessionEntry->pLimJoinReq = NULL;
1882 //Delete teh session if JOIN failure occurred.
1883 if(resultCode != eSIR_SME_SUCCESS)
1884 {
1885 if(NULL != psessionEntry)
1886 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001887 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1888 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001889 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 peDeleteSession(pMac,psessionEntry);
1891 psessionEntry = NULL;
1892 }
1893 }
1894 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1895 smesessionId, smetransactionId);
1896} /*** end limHandleSmeJoinResult() ***/
1897
1898/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001899 * limHandleSmeReaasocResult()
1900 *
1901 *FUNCTION:
1902 * This function is called to process reassoc failures
1903 * upon receiving REASSOC_CNF with a failure code or
1904 * MLM_REASSOC_CNF with a success code in case of STA role
1905 *
1906 *LOGIC:
1907 *
1908 *ASSUMPTIONS:
1909 *
1910 *NOTE:
1911 *
1912 * @param pMac Pointer to Global MAC structure
1913 * @param resultCode Failure code to be sent
1914 *
1915 *
1916 * @return None
1917 */
1918static void
1919limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1920{
1921 tpDphHashNode pStaDs = NULL;
1922 tANI_U8 smesessionId;
1923 tANI_U16 smetransactionId;
1924
1925 if(psessionEntry == NULL)
1926 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001927 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001928 return;
1929 }
1930 smesessionId = psessionEntry->smeSessionId;
1931 smetransactionId = psessionEntry->transactionId;
1932 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1933 if(resultCode != eSIR_SME_SUCCESS)
1934 {
1935 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1936 if (pStaDs != NULL)
1937 {
1938 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1939 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1940 pStaDs->mlmStaContext.resultCode = resultCode;
1941 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1942 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Abhishek Singhde7f0512015-10-23 14:31:15 +05301943 /* Cleanup if add bss failed */
1944 if(psessionEntry->addBssfailed)
1945 {
1946 dphDeleteHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,
1947 &psessionEntry->dph.dphHashTable);
1948 goto error;
1949 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001950 return;
1951 }
1952 }
Abhishek Singhde7f0512015-10-23 14:31:15 +05301953error:
Jeff Johnsone7245742012-09-05 17:12:55 -07001954 //Delete teh session if REASSOC failure occurred.
1955 if(resultCode != eSIR_SME_SUCCESS)
1956 {
1957 if(NULL != psessionEntry)
1958 {
1959 peDeleteSession(pMac,psessionEntry);
1960 psessionEntry = NULL;
1961 }
1962 }
1963 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1964 smesessionId, smetransactionId);
1965} /*** end limHandleSmeReassocResult() ***/
1966
1967/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 * limProcessMlmAddStaRsp()
1969 *
1970 *FUNCTION:
1971 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1972 * Upon receipt of this message from HAL, MLME -
1973 * > Determines the "state" in which this message was received
1974 * > Forwards it to the appropriate callback
1975 *
1976 *ASSUMPTIONS:
1977 *
1978 *NOTE:
1979 *
1980 * @param pMac Pointer to Global MAC structure
1981 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1982 *
1983 * @return None
1984 */
1985void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1986{
1987 //we need to process the deferred message since the initiating req. there might be nested request.
1988 //in the case of nested request the new request initiated from the response will take care of resetting
1989 //the deffered flag.
1990 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 )
1994 {
1995 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1996 return;
1997 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05301998#ifdef WLAN_FEATURE_LFR_MBB
1999 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2000 lim_process_sta_mlm_add_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
2001 return;
2002 }
2003#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002005}
2006void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2007{
2008 tLimMlmAssocCnf mlmAssocCnf;
2009 tpDphHashNode pStaDs;
2010 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2011 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
2012
2013 if(NULL == pAddStaParams )
2014 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002015 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 return;
2017 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302018
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302019 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302021 PELOGE(limLog(pMac, LOGE,
2022 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05302023
2024 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
2025 {
2026 PELOGE(limLog(pMac, LOGE,
2027 FL("ADD_STA success, send update result code with"
2028 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
2029 "limMlmState: %d"), pAddStaParams->staIdx,
2030 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302031 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2032 mesgType = LIM_MLM_REASSOC_CNF;
2033 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
2034 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
2035 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05302036 mlmAssocCnf.resultCode =
2037 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302038 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
c_hpothua9dc89c2014-03-22 19:22:31 +05302039 psessionEntry->staId = pAddStaParams->staIdx;
2040 goto end;
2041 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302042 }
2043
2044 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
2045 {
2046 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 {
2048 //TODO: any response to be sent out here ?
2049 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302050 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 psessionEntry->limMlmState);
2052 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2053 goto end;
2054 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302055
2056 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2057 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 //
2059 // Update the DPH Hash Entry for this STA
2060 // with proper state info
2061 //
2062 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2063 if( NULL != pStaDs)
2064 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
2065 else
2066 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002067 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 DPH_STA_HASH_INDEX_PEER);
2069 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002070 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 /*
2072 * Storing the self StaIndex(Generated by HAL) in session context,
2073 * instead of storing it in DPH Hash entry for Self STA.
2074 * DPH entry for the self STA stores the sta index for the BSS entry
2075 * to which the STA is associated.
2076 */
2077 psessionEntry->staId = pAddStaParams->staIdx;
2078 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002079#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2080 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2081#endif
2082 {
2083 limReactivateHeartBeatTimer(pMac, psessionEntry);
2084 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002085 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002086
2087 //assign the sessionId to the timer Object
2088 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2089 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002090 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002091#ifdef WLAN_DEBUG
2092 pMac->lim.gLimNumLinkEsts++;
2093#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002094#ifdef FEATURE_WLAN_TDLS
2095 /* initialize TDLS peer related data */
2096 limInitTdlsData(pMac,psessionEntry);
2097#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 // Return Assoc confirm to SME with success
2099 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2100 // be passed in here....
2101 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2102 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2103 }
2104 else
2105 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302106 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302107 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302108 {
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302109 mesgType = LIM_MLM_REASSOC_CNF;
Sreelakshmi Konamkib3f2b7e2015-12-21 11:45:35 +05302110 mlmAssocCnf.resultCode = (tSirResultCodes)eSIR_SME_FT_REASSOC_FAILURE;
2111 }
2112 else
2113 {
2114 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2115 }
Abhishek Singhc0fccd22015-10-19 16:44:00 +05302116 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 }
2118end:
2119 if( 0 != limMsgQ->bodyptr )
2120 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302121 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002122 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 }
2124 /* Updating PE session Id*/
2125 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2126 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302127 if (true == psessionEntry->fDeauthReceived)
2128 {
2129 psessionEntry->fDeauthReceived = false;
2130 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 return;
2132}
2133void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2134{
2135 //we need to process the deferred message since the initiating req. there might be nested request.
2136 //in the case of nested request the new request initiated from the response will take care of resetting
2137 //the deffered flag.
2138 // tpPESession psessionEntry;
2139 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2140 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2141 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002142 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 // return;
2144 // }
2145 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002146
2147 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2148 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 ) &&
2151 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2152 {
2153 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2154 return;
2155 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002157
2158 if(!limIsInMCC(pMac))
2159 {
2160 WDA_TrafficStatsTimerActivate(FALSE);
2161 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002162
2163#ifdef WLAN_FEATURE_11W
2164 if (psessionEntry->limRmfEnabled)
2165 {
2166 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2167 {
2168 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002169 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002170 }
2171 }
2172#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002173}
2174
2175void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2176{
2177 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2178 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2179 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302180
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302181#ifdef WLAN_FEATURE_LFR_MBB
2182 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2183 lim_process_sta_mlm_del_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
2184 return;
2185 }
2186#endif
2187
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302188 if (NULL == pDelBssParams)
2189 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002190 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302191 goto end;
2192 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2194 {
2195 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002196 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2198 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2199
2200 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002201 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 statusCode = eSIR_SME_REFUSED;
2203 goto end;
2204 }
2205 if(pStaDs == NULL)
2206 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002207 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 statusCode = eSIR_SME_REFUSED;
2209 goto end;
2210 }
2211 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2212 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302213 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 pStaDs->mlmStaContext.mlmState);)
2215 statusCode = eSIR_SME_REFUSED;
2216 goto end;
2217 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302218 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2219 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 }
2221 else
2222 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302223 /* If DelBSS response is failure, go ahead and
2224 * post response to SME
2225 */
2226 limLog( pMac, LOGE, FL( "DEL BSS failed! Status:%d" ),
2227 pDelBssParams->status );
2228 statusCode = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302230
2231end:
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 if( 0 != limMsgQ->bodyptr )
2233 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302234 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002235 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 }
2237 if(pStaDs == NULL)
2238 return;
2239 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2240 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2241 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2242 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2243 {
2244 /** The Case where the DelBss is invoked from
2245 * context of other than normal DisAssoc / Deauth OR
2246 * as part of Join Failure.
2247 */
2248 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2249 return;
2250 }
2251 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2252 return;
2253}
2254
Jeff Johnson295189b2012-06-20 16:38:30 -07002255void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2256{
2257 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002258 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2260 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2261
2262 if(psessionEntry == NULL)
2263 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002264 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002265 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002266 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302267 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002268 limMsgQ->bodyptr = NULL;
2269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 return;
2271 }
2272
2273 if (pDelBss == NULL)
2274 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002275 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 rc = eSIR_SME_REFUSED;
2277 goto end;
2278 }
2279 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002280 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2281
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2283 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002284 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302285 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002286 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002287 rc = eSIR_SME_REFUSED;
2288 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 }
2290 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2291 {
2292 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2293 pDelBss->status, pDelBss->bssIdx);
2294 rc = eSIR_SME_STOP_BSS_FAILURE;
2295 goto end;
2296 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002297 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002299 if (status != eSIR_SUCCESS)
2300 {
2301 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002303 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 /** Softmac may send all the buffered packets right after resuming the transmission hence
2305 * to occupy the medium during non channel occupancy period. So resume the transmission after
2306 * HAL gives back the response.
2307 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002308#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 if (LIM_IS_RADAR_DETECTED(pMac))
2310 {
2311 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2312 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2313 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002314#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2316 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002318 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 end:
2320 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2321 peDeleteSession(pMac, psessionEntry);
2322
2323 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002324 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302325 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002326 limMsgQ->bodyptr = NULL;
2327 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002328}
2329
2330void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2331{
2332 //we need to process the deferred message since the initiating req. there might be nested request.
2333 //in the case of nested request the new request initiated from the response will take care of resetting
2334 //the deffered flag.
2335
2336 tpPESession psessionEntry;
2337 tpDeleteStaParams pDeleteStaParams;
2338 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2339 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302340
2341 if(NULL == pDeleteStaParams ||
2342 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002343 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002344 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002345 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002346 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302347 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002348 limMsgQ->bodyptr = NULL;
2349 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 return;
2351 }
2352
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 )
2356 {
2357 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2358 return;
2359 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002361}
2362
Jeff Johnson295189b2012-06-20 16:38:30 -07002363void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2364{
2365 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2366 tpDphHashNode pStaDs;
2367 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2368 if(limMsgQ->bodyptr == NULL)
2369 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302370 limLog( pMac, LOGE,
2371 FL( "limMsgQ->bodyptry NULL"));
2372 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2375 if(pStaDs == NULL)
2376 {
2377 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302378 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302380 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002381 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002382
2383 return;
2384 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302385 limLog( pMac, LOG1,
2386 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2387 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2389 {
2390 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302391 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002392
2393 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2394 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2395 {
2396 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002397 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2399 statusCode = eSIR_SME_REFUSED;
2400 goto end;
2401 }
2402
2403 limLog( pMac, LOG1,
2404 FL("Deleted STA AssocID %d staId %d MAC "),
2405 pStaDs->assocId, pStaDs->staIndex);
2406 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2407 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2408 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302409 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002410 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002411 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 {
2413 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002414 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 pStaDs->assocId);)
2416 // delete the TS if it has already been added.
2417 // send the response with error status.
2418 if(pStaDs->qos.addtsPresent)
2419 {
2420 tpLimTspecInfo pTspecInfo;
2421 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2422 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2423 {
2424 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2425 NULL, &pTspecInfo->idx);
2426 }
2427 }
2428 limRejectAssociation(pMac,
2429 pStaDs->staAddr,
2430 pStaDs->mlmStaContext.subType,
2431 true, pStaDs->mlmStaContext.authType,
2432 pStaDs->assocId, true,
2433 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2434 psessionEntry);
2435 }
2436 return;
2437 }
2438 }
2439 else
2440 {
2441 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002442 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 statusCode = eSIR_SME_REFUSED;
2444 }
2445 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302446 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002447 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2449 {
2450 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2451 }
2452 return;
2453}
2454
2455void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2456{
2457 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2458 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2459 tpDphHashNode pStaDs = NULL;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302460
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302461#ifdef WLAN_FEATURE_LFR_MBB
2462 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
2463 lim_process_sta_mlm_del_sta_rsp_mbb(pMac, limMsgQ, psessionEntry);
2464 return;
2465 }
2466#endif
2467
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 if(NULL == pDelStaParams )
2469 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002470 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 goto end;
2472 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302473
2474 limLog(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"),
2475 pDelStaParams->status, pDelStaParams->assocId);
2476
2477 if (eHAL_STATUS_SUCCESS != pDelStaParams->status)
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302479 limLog(pMac, LOGE, FL("Del STA failed! Status:%d, still proceeding"
2480 "with Del BSS"), pDelStaParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302482
2483 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2484
2485 if (pStaDs == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302487 //TODO: any response to be sent out here ?
2488 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
2489 pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 statusCode = eSIR_SME_REFUSED;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302491 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302493
2494 if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2495 {
2496 //TODO: any response to be sent out here ?
2497 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
2498 limMlmStateStr(psessionEntry->limMlmState));
2499 statusCode = eSIR_SME_REFUSED;
2500 goto end;
2501 }
2502
2503 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2504 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2505
2506 //we must complete all cleanup related to delSta before calling limDelBSS.
2507 if (0 != limMsgQ->bodyptr )
2508 {
2509 vos_mem_free(pDelStaParams);
2510 limMsgQ->bodyptr = NULL;
2511 }
2512
2513 // Proceed to do DelBSS even if DelSta resulted in failure
2514 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2515 return;
2516
Jeff Johnson295189b2012-06-20 16:38:30 -07002517end:
2518 if( 0 != limMsgQ->bodyptr )
2519 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302520 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002521 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 }
2523 return;
2524}
2525
Jeff Johnson295189b2012-06-20 16:38:30 -07002526void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2527{
2528 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302529 tpDphHashNode pStaDs = NULL;
2530
2531 if (NULL == pAddStaParams)
2532 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002533 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302534 goto end;
2535 }
2536
2537 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 if(pStaDs == NULL)
2539 {
2540 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002541 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 goto end;
2543 }
2544 //
2545 // TODO & FIXME_GEN4
2546 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2547 //
2548 //TODO: any check for pMac->lim.gLimMlmState ?
2549 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2550 {
2551 //TODO: any response to be sent out here ?
2552 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302553 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 pStaDs->mlmStaContext.mlmState);
2555 goto end;
2556 }
2557 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2558 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002559 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 limRejectAssociation(pMac, pStaDs->staAddr,
2561 pStaDs->mlmStaContext.subType,
2562 true, pStaDs->mlmStaContext.authType,
2563 pStaDs->assocId, true,
2564 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2565 psessionEntry);
2566 goto end;
2567 }
2568 pStaDs->bssId = pAddStaParams->bssIdx;
2569 pStaDs->staIndex = pAddStaParams->staIdx;
2570 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2571 pStaDs->valid = 1;
2572 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2573 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302574 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002575 pStaDs->assocId,
2576 pStaDs->staIndex);
2577 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2578
2579 /* For BTAMP-AP, the flow sequence shall be:
2580 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2581 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2582 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2583 */
2584 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2585 // fall though to reclaim the original Add STA Response message
2586end:
2587 if( 0 != limMsgQ->bodyptr )
2588 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302589 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002590 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 }
2592 return;
2593}
2594
2595/**
2596 * limProcessApMlmAddBssRsp()
2597 *
2598 *FUNCTION:
2599 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2600 * Upon receipt of this message from HAL, MLME -
2601 * > Validates the result of WDA_ADD_BSS_REQ
2602 * > Init other remaining LIM variables
2603 * > Init the AID pool, for that BSSID
2604 * > Init the Pre-AUTH list, for that BSSID
2605 * > Create LIM timers, specific to that BSSID
2606 * > Init DPH related parameters that are specific to that BSSID
2607 * > TODO - When do we do the actual change channel?
2608 *
2609 *LOGIC:
2610 * SME sends eWNI_SME_START_BSS_REQ to LIM
2611 * LIM sends LIM_MLM_START_REQ to MLME
2612 * MLME sends WDA_ADD_BSS_REQ to HAL
2613 * HAL responds with WDA_ADD_BSS_RSP to MLME
2614 * MLME responds with LIM_MLM_START_CNF to LIM
2615 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2616 *
2617 *ASSUMPTIONS:
2618 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2619 * tSirMsgQ.body will now be freed by this routine
2620 *
2621 *NOTE:
2622 *
2623 * @param pMac Pointer to Global MAC structure
2624 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2625 *
2626 * @return None
2627 */
2628static void
2629limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2630{
2631 tLimMlmStartCnf mlmStartCnf;
2632 tANI_U32 val;
2633 tpPESession psessionEntry;
2634// tANI_U8 sessionId;
2635 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2636 if(NULL == pAddBssParams )
2637 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002638 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 goto end;
2640 }
2641 //TBD: free the memory before returning, do it for all places where lookup fails.
2642 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2643 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002644 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002645 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002646 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302647 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302648 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002649 limMsgQ->bodyptr = NULL;
2650 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 return;
2652 }
2653 /* Update PE session Id*/
2654 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2655 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2656 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302657 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2659 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2660 goto end;
2661 // Set MLME state
2662 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002663 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002664 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2665 {
2666 /** IBSS is 'active' when we receive
2667 * Beacon frames from other STAs that are part of same IBSS.
2668 * Mark internal state as inactive until then.
2669 */
2670 psessionEntry->limIbssActive = false;
2671 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2672 limResetHBPktCount( psessionEntry );
2673 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002674 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002675 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002676 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 }
2678 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2679
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002681
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2683 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2684 else
2685 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002686 schEdcaProfileUpdate(pMac, psessionEntry);
2687 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002688 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 // Create timers used by LIM
2690 if (!pMac->lim.gLimTimersCreated)
2691 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002692
2693 // Start OLBC timer
2694 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2695 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002696 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002697 }
2698
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2700 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002701 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2703 // Apply previously set configuration at HW
2704 limApplyConfiguration(pMac,psessionEntry);
2705 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2706 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2707 }
2708 else
2709 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002710 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2712 }
2713 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2714 end:
2715 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002716 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302717 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302718 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002719 limMsgQ->bodyptr = NULL;
2720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002721}
2722
2723
2724/**
2725 * limProcessIbssMlmAddBssRsp()
2726 *
2727 *FUNCTION:
2728 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2729 * Upon receipt of this message from HAL, MLME -
2730 * > Validates the result of WDA_ADD_BSS_REQ
2731 * > Init other remaining LIM variables
2732 * > Init the AID pool, for that BSSID
2733 * > Init the Pre-AUTH list, for that BSSID
2734 * > Create LIM timers, specific to that BSSID
2735 * > Init DPH related parameters that are specific to that BSSID
2736 * > TODO - When do we do the actual change channel?
2737 *
2738 *LOGIC:
2739 * SME sends eWNI_SME_START_BSS_REQ to LIM
2740 * LIM sends LIM_MLM_START_REQ to MLME
2741 * MLME sends WDA_ADD_BSS_REQ to HAL
2742 * HAL responds with WDA_ADD_BSS_RSP to MLME
2743 * MLME responds with LIM_MLM_START_CNF to LIM
2744 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2745 *
2746 *ASSUMPTIONS:
2747 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2748 * tSirMsgQ.body will now be freed by this routine
2749 *
2750 *NOTE:
2751 *
2752 * @param pMac Pointer to Global MAC structure
2753 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2754 *
2755 * @return None
2756 */
2757static void
2758limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2759{
2760 tLimMlmStartCnf mlmStartCnf;
2761 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2762 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302763
2764 if (NULL == pAddBssParams)
2765 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002766 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302767 goto end;
2768 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2770 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302771 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002772 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2773 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2774 goto end;
2775 // Set MLME state
2776 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002777 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 /** IBSS is 'active' when we receive
2779 * Beacon frames from other STAs that are part of same IBSS.
2780 * Mark internal state as inactive until then.
2781 */
2782 psessionEntry->limIbssActive = false;
2783 limResetHBPktCount( psessionEntry );
2784 /* Timer related functions are not modified for BT-AMP : To be Done */
2785 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002786 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002787 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002788 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002789 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2790 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2791 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2792 schEdcaProfileUpdate(pMac, psessionEntry);
2793 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2794 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002795 if (0 == psessionEntry->freePeerIdxHead)
2796 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 // Create timers used by LIM
2798#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2799 if (!pMac->lim.gLimTimersCreated)
2800 limCreateTimers(pMac);
2801#endif
2802 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2803 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002804 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002805 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2806 // Apply previously set configuration at HW
2807 limApplyConfiguration(pMac,psessionEntry);
2808 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2809 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2810 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2811 if(true == pMac->lim.gLimIbssCoalescingHappened)
2812 {
2813 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2814 goto end;
2815 }
2816 }
2817 else
2818 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002819 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 pAddBssParams->status );
2821 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2822 }
2823 //Send this message to SME, when ADD_BSS is initiated by SME
2824 //If ADD_BSS is done as part of coalescing, this won't happen.
2825 /* Update PE session Id*/
2826 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2827 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2828 end:
2829 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002830 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302831 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302832 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002833 limMsgQ->bodyptr = NULL;
2834 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002835}
2836
2837static void
2838limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2839{
2840 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2841 tAniAuthType cfgAuthType, authMode;
2842 tLimMlmAuthReq *pMlmAuthReq;
2843 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302844
2845 if (NULL == pAddBssParams)
2846 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002847 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302848 goto joinFailure;
2849 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2851 {
2852 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2853 {
2854 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002855 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2857 goto joinFailure;
2858 }
2859 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2860 //Success, handle below
2861 pStaDs->bssId = pAddBssParams->bssIdx;
2862 //STA Index(genr by HAL) for the BSS entry is stored here
2863 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2864 // Trigger Authentication with AP
2865 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2866 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2867 {
2868 /**
2869 * Could not get AuthType from CFG.
2870 * Log error.
2871 */
2872 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002873 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 }
2875 if (cfgAuthType == eSIR_AUTO_SWITCH)
Hu Wang0650dbc2015-12-07 13:44:57 +08002876 authMode = eSIR_SHARED_KEY; // Try Shared Authentication first
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 else
2878 authMode = cfgAuthType;
2879
2880 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302881 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2882 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002883 {
2884 // Log error
2885 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302886 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 return;
2888 }
2889 #if 0
2890 val = sizeof(tSirMacAddr);
2891 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2892 pMlmAuthReq->peerMacAddr,
2893 &val) != eSIR_SUCCESS)
2894 {
2895 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002896 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002897 }
2898 #endif //TO SUPPORT BT-AMP
2899 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2900
2901 pMlmAuthReq->authType = authMode;
2902 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2903 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2904 != eSIR_SUCCESS)
2905 {
2906 /**
2907 * Could not get AuthFailureTimeout
2908 * value from CFG. Log error.
2909 */
2910 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002911 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 }
2913 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2914 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2915 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002916 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2918 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2919 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2920 // remember staId in case of assoc timeout/failure handling
2921 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2922
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302923 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2924 psessionEntry->peSessionId, psessionEntry->limSmeState));
2925 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2926 "with limSmeState:%d",psessionEntry->peSessionId,
2927 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 limPostMlmMessage(pMac,
2929 LIM_MLM_AUTH_REQ,
2930 (tANI_U32 *) pMlmAuthReq);
2931 return;
2932 }
2933
2934joinFailure:
2935 {
2936 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002937 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002938
2939 /// Send Join response to Host
2940 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2941
2942 }
2943
2944}
2945
2946#ifdef WLAN_FEATURE_VOWIFI_11R
2947/*------------------------------------------------------------------------------------------
2948 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002949 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2950 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002951 *
2952 *
2953 *------------------------------------------------------------------------------------------
2954 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002955static inline void
2956limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002957{
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002959 tpDphHashNode pStaDs = NULL;
2960 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002961 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002962 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002963 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302964#ifdef FEATURE_WLAN_ESE
2965 tLimMlmReassocReq *pMlmReassocReq;
2966 tANI_U32 val = 0;
2967#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002968
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002969 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002970
2971 if (pAddBssParams == NULL)
2972 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002973 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002974 goto end;
2975 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002976 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2977 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002978 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002979 goto end;
2980 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002981 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2982 {
2983 goto end;
2984 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002985
2986 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2987 &psessionEntry->dph.dphHashTable)) == NULL)
2988 {
2989 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002990 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2992 goto end;
2993 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302994 if (pMac->roam.configParam.roamDelayStatsEnabled)
2995 {
2996 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2997 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 // Prepare and send Reassociation request frame
2999 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05303000
3001
3002#ifdef FEATURE_WLAN_ESE
3003 /*
3004 * In case of Ese Reassociation, change the reassoc timer
3005 * value.
3006 */
3007 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3008 if (pMlmReassocReq == NULL)
3009 {
3010 limLog(pMac, LOGE,
3011 FL("Invalid pMlmReassocReq"));
3012 goto end;
3013 }
3014 val = pMlmReassocReq->reassocFailureTimeout;
3015 if (psessionEntry->isESEconnection)
3016 {
3017 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3018 }
3019 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3020 TX_SUCCESS)
3021 {
3022 limLog(pMac, LOGP,
3023 FL("unable to deactivate Reassoc failure timer"));
3024 }
3025 val = SYS_MS_TO_TICKS(val);
3026 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3027 val, 0) != TX_SUCCESS)
3028 {
3029 limLog(pMac, LOGP,
3030 FL("unable to change Reassociation failure timer"));
3031 }
3032#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
3034 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003035 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3037 != TX_SUCCESS)
3038 {
3039 /// Could not start reassoc failure timer.
3040 // Log error
3041 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003042 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 // Return Reassoc confirm with
3044 // Resources Unavailable
3045 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3046 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3047 goto end;
3048 }
Mihir Shete63561c82014-08-23 16:58:07 +05303049 // remember staId
3050 psessionEntry->staId = pAddBssParams->staContext.staIdx;
3051
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003052#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003053 pMac->lim.pSessionEntry = psessionEntry;
3054 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
3055 {
3056 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303057 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
3058 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
3059 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
3060 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
3061 psessionEntry->pLimMlmReassocReq,
3062 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003063 }
3064 pMac->lim.reAssocRetryAttempt = 0;
3065#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05303067 if (pMac->roam.configParam.roamDelayStatsEnabled)
3068 {
3069 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
3070 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
3072 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08003073 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003074 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 psessionEntry->limMlmState, psessionEntry->peSessionId);)
3076
3077 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3078
3079 //Success, handle below
3080 pStaDs->bssId = pAddBssParams->bssIdx;
3081 //STA Index(genr by HAL) for the BSS entry is stored here
3082 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3083 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3084 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3085
Jeff Johnson295189b2012-06-20 16:38:30 -07003086#if defined WLAN_FEATURE_VOWIFI
3087 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3088#endif
3089
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303090 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
3091 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303093 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07003094 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303096 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003097
3098 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303099 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
3100 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003101
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303102 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3103 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003104
3105 // Update this when we get reassoc rsp , with success.
3106 // pAddStaParams->assocId = psessionEntry->limAID;
3107
3108 pAddStaParams->staType = STA_ENTRY_SELF;
3109 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3110 pAddStaParams->respReqd = 1;
3111
3112 /* Update PE session ID */
3113 pAddStaParams->sessionId = psessionEntry->peSessionId;
3114
3115 // This will indicate HAL to "allocate" a new STA index
3116 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3117 pAddStaParams->updateSta = FALSE;
3118
3119 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003120#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003121 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003122#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003123 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003124#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003125
Jeff Johnsone7245742012-09-05 17:12:55 -07003126 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003128 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003129#ifdef WLAN_FEATURE_11AC
3130 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3131 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3132#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003133#ifdef DISABLE_GF_FOR_INTEROP
3134 /*
3135 * To resolve the interop problem with Broadcom AP,
3136 * where TQ STA could not pass traffic with GF enabled,
3137 * TQ STA will do Greenfield only with TQ AP, for
3138 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003139 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3141 {
3142 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3143 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3144 }
3145 else
3146#endif
3147
Jeff Johnson295189b2012-06-20 16:38:30 -07003148 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003149 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3150 {
3151 pAddStaParams->txChannelWidthSet =
3152 pMac->roam.configParam.channelBondingMode24GHz;
3153 }
3154 else
3155 {
3156 pAddStaParams->txChannelWidthSet =
3157 pMac->roam.configParam.channelBondingMode5GHz;
3158 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3160 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3161 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3162 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3163 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3164 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3165 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3166 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3167 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3168 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 }
3170
3171 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003172 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003174 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3175 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 // Lets save this for when we receive the Reassoc Rsp
3177 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003178
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003179 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003180 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303181 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003182 vos_mem_free(pAddBssParams);
3183 pAddBssParams = NULL;
3184 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003185 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003186 return;
3187
3188end:
3189 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003190 if (psessionEntry != NULL)
3191 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003193 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3194 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003196
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003197 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003198 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303199 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003200 vos_mem_free(pAddBssParams);
3201 pAddBssParams = NULL;
3202 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003203 }
3204
3205 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3206 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303207 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003208 if (psessionEntry != NULL)
3209 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003210 else
3211 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003212
3213 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3214}
Jeff Johnson295189b2012-06-20 16:38:30 -07003215#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003216/**
3217 * limProcessStaMlmAddBssRsp()
3218 *
3219 *FUNCTION:
3220 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3221 * Upon receipt of this message from HAL, MLME -
3222 * > Validates the result of WDA_ADD_BSS_REQ
3223 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3224 *
3225 *LOGIC:
3226 * MLME had sent WDA_ADD_BSS_REQ to HAL
3227 * HAL responded with WDA_ADD_BSS_RSP to MLME
3228 * MLME now sends WDA_ADD_STA_REQ to HAL
3229 *
3230 *ASSUMPTIONS:
3231 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3232 * tSirMsgQ.body will now be freed by this routine
3233 *
3234 *NOTE:
3235 *
3236 * @param pMac Pointer to Global MAC structure
3237 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3238 *
3239 * @return None
3240 */
3241static void
3242limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3243{
3244 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3245 tLimMlmAssocCnf mlmAssocCnf;
3246 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3247 tANI_U32 subType = LIM_ASSOC;
3248 tpDphHashNode pStaDs = NULL;
3249 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3250 tANI_U8 updateSta = false;
3251 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3252
3253 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3254 {
3255 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303256 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3257 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003258 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3259 goto end;
3260 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303261
3262 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3263 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 {
3265 mesgType = LIM_MLM_REASSOC_CNF;
3266 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303267 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3268 //to update the existing STA entry.
3269 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3270 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3271 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 {
3273 staIdx = psessionEntry->staId;
3274 updateSta = true;
3275 }
3276 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003277
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003278 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003279 goto end;
3280
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3282 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003283#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3285 {
3286#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003287 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 psessionEntry->limMlmState,
3289 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3290#endif
3291 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3292 goto end;
3293 }
3294#endif /* WLAN_FEATURE_VOWIFI_11R */
3295
3296 // Set MLME state
3297 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003298 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003299 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3300 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303301 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3302 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3304 if (pStaDs == NULL)
3305 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303306 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3307 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3309 }
3310 else
3311 {
3312 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3313 //Success, handle below
3314 pStaDs->bssId = pAddBssParams->bssIdx;
3315 //STA Index(genr by HAL) for the BSS entry is stored here
3316 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3317 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3318 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3319 // Downgrade the EDCA parameters if needed
3320 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3321 // Send the active EDCA parameters to HAL
3322 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3323 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3324 } else {
3325 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3326 }
3327#if defined WLAN_FEATURE_VOWIFI
3328 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3329#endif
3330
3331 if (subType == LIM_REASSOC)
3332 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3333 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3334 {
3335 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303336 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3337 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3339 }
3340 }
3341 }
3342 else
3343 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303344 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3345 psessionEntry->peSessionId, psessionEntry->limMlmState);
Abhishek Singhc0fccd22015-10-19 16:44:00 +05303346 mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303348 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3349 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3350 else
3351 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Abhishek Singhde7f0512015-10-23 14:31:15 +05303352 psessionEntry->addBssfailed = true;
Jeff Johnson295189b2012-06-20 16:38:30 -07003353 }
3354
3355 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3356 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303357 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3358 //Set the RXP mode to IDLE, so it starts filtering the frames.
3359 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3360 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3361 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 /* Update PE session Id*/
3363 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3364 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3365 }
3366 end:
3367 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003368 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303369 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303370 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003371 limMsgQ->bodyptr = NULL;
3372 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003373}
3374
3375
3376
3377/**
3378 * limProcessMlmAddBssRsp()
3379 *
3380 *FUNCTION:
3381 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3382 * Upon receipt of this message from HAL, MLME -
3383 * > Determines the "state" in which this message was received
3384 * > Forwards it to the appropriate callback
3385 *
3386 *LOGIC:
3387 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3388 * in the following two states:
3389 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3390 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3391 * Based on these two states, this API will determine where to
3392 * route the message to
3393 *
3394 *ASSUMPTIONS:
3395 *
3396 *NOTE:
3397 *
3398 * @param pMac Pointer to Global MAC structure
3399 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3400 *
3401 * @return None
3402 */
3403void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3404{
3405 tLimMlmStartCnf mlmStartCnf;
3406 tpPESession psessionEntry;
3407 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3408
3409 if(NULL == pAddBssParams )
3410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003411 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 return;
3413 }
3414
3415 //
3416 // TODO & FIXME_GEN4
3417 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3418 //
3419 //we need to process the deferred message since the initiating req. there might be nested request.
3420 //in the case of nested request the new request initiated from the response will take care of resetting
3421 //the deffered flag.
3422 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3423 // Validate SME/LIM state
3424 // Validate MLME state
3425 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3426 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303427 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3428 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003429 if( NULL != pAddBssParams )
3430 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303431 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003432 vos_mem_free(pAddBssParams);
3433 limMsgQ->bodyptr = NULL;
3434 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003435 return;
3436 }
3437 /* update PE session Id*/
3438 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3439 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3440 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3441 else
3442 {
3443 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3444 {
3445 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3446 {
3447 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303448 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303449 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303450 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3452 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003453 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303454 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303455 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003456 limMsgQ->bodyptr = NULL;
3457 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003458 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3459 }
3460 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3461 {
3462 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3463 }
3464 else
3465 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3466 }
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303467 else {
3468#ifdef WLAN_FEATURE_LFR_MBB
3469 if (pMac->ft.ftSmeContext.is_preauth_lfr_mbb) {
3470 lim_process_sta_mlm_add_bss_rsp_mbb(pMac, limMsgQ, psessionEntry);
3471 return;
3472 }
3473#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 /* Called while processing assoc response */
3475 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
Padma, Santhosh Kumar7cdb5242017-01-11 19:19:08 +05303476 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003478
3479 if(limIsInMCC(pMac))
3480 {
3481 WDA_TrafficStatsTimerActivate(TRUE);
3482 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003483
3484#ifdef WLAN_FEATURE_11W
3485 if (psessionEntry->limRmfEnabled)
3486 {
3487 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3488 {
3489 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003490 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003491 }
3492 }
3493#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003494}
3495/**
3496 * limProcessMlmSetKeyRsp()
3497 *
3498 *FUNCTION:
3499 * This function is called to process the following two
3500 * messages from HAL:
3501 * 1) WDA_SET_BSSKEY_RSP
3502 * 2) WDA_SET_STAKEY_RSP
3503 * 3) WDA_SET_STA_BCASTKEY_RSP
3504 * Upon receipt of this message from HAL,
3505 * MLME -
3506 * > Determines the "state" in which this message was received
3507 * > Forwards it to the appropriate callback
3508 *
3509 *LOGIC:
3510 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3511 * received by MLME while in the following state:
3512 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3513 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3514 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3515 * Based on this state, this API will determine where to
3516 * route the message to
3517 *
3518 *ASSUMPTIONS:
3519 * ONLY the MLME state is being taken into account for now.
3520 * This is because, it appears that the handling of the
3521 * SETKEYS REQ is handled symmetrically on both the AP & STA
3522 *
3523 *NOTE:
3524 *
3525 * @param pMac Pointer to Global MAC structure
3526 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3527 *
3528 * @return None
3529 */
3530void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3531{
Jeff Johnsone7245742012-09-05 17:12:55 -07003532 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003533 tLimMlmSetKeysCnf mlmSetKeysCnf;
3534 tANI_U8 sessionId = 0;
3535 tpPESession psessionEntry;
3536 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303537 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003538 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003539 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003541 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003542 return;
3543 }
3544 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3545 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003547 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303548 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303549 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003550 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 return;
3552 }
3553 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3554 {
3555 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303556 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 // There's not much that MLME can do at this stage...
3558 respReqd = 0;
3559 }
3560 else
3561 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3562
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303563 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303564 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003565 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003566 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003567 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003568 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 if( respReqd )
3570 {
3571 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3572 // Prepare and Send LIM_MLM_SETKEYS_CNF
3573 if( NULL != lpLimMlmSetKeysReq )
3574 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303575 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3576 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3577 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003578 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303579 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3580 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303581 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 pMac->lim.gpLimMlmSetKeysReq = NULL;
3583 }
3584 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003585 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 }
3587}
3588void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3589{
Jeff Johnson295189b2012-06-20 16:38:30 -07003590 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003591 tANI_U16 resultCode;
3592 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303594 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3595
Jeff Johnson295189b2012-06-20 16:38:30 -07003596 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303597 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303598 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003600 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003601 return;
3602 }
3603 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303604 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303606 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3607 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303608 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303609 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003610 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 return;
3612 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303613 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3615 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303616 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3617 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003618
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3620 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3621 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303622 /* Mesg received from HAL in Invalid state! */
3623 limLog( pMac, LOGW,
3624 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3625 limMsgQ->type, psessionEntry->limMlmState );
3626 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 }
3628 else
3629 mlmSetKeysCnf.resultCode = resultCode;
3630
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303631 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303632 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003633 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003635 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3636
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303637 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3638 psessionEntry->peSessionId, psessionEntry->limMlmState));
3639 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3640 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003641
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303642 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3643 if( NULL != lpLimMlmSetKeysReq )
3644 {
3645 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3646 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3647 sizeof(tSirMacAddr));
3648 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3649 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3650 sizeof(tLimMlmSetKeysReq));
3651 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3652 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003653 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303654 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003655}
3656/**
3657 * limProcessMlmRemoveKeyRsp()
3658 *
3659 *FUNCTION:
3660 *
3661 *LOGIC:
3662 *
3663 *ASSUMPTIONS:
3664 *
3665 *NOTE:
3666 *
3667 * @param pMac Pointer to Global MAC structure
3668 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3669 *
3670 * @return None
3671 */
3672void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3673{
Jeff Johnsone7245742012-09-05 17:12:55 -07003674 tANI_U8 respReqd = 1;
3675 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3676 tANI_U16 resultCode;
3677 tANI_U8 sessionId = 0;
3678 tpPESession psessionEntry;
3679 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303680 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003681
3682 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003684 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003685 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 }
3687
Jeff Johnsone7245742012-09-05 17:12:55 -07003688 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3689 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3690 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3691 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003692
Jeff Johnsone7245742012-09-05 17:12:55 -07003693 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003695 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003696 return;
3697 }
3698
3699 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3700 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3701 else
3702 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3703
3704 // Validate MLME state
3705 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3706 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3707 {
3708 // Mesg received from HAL in Invalid state!
3709 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303710 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003711 limMsgQ->type,
3712 psessionEntry->limMlmState );
3713 respReqd = 0;
3714 }
3715 else
3716 mlmRemoveCnf.resultCode = resultCode;
3717
3718 //
3719 // TODO & FIXME_GEN4
3720 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3721 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303722 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303723 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003724 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003725
3726 // Restore MLME state
3727 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3728 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3729
3730 if( respReqd )
3731 {
3732 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3733 mlmRemoveCnf.sessionId = sessionId;
3734
3735 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3736 if( NULL != lpLimMlmRemoveKeyReq )
3737 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303738 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3739 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3740 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003741 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303742 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003743 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3744 }
3745 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3746 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003747}
3748
Jeff Johnson295189b2012-06-20 16:38:30 -07003749
3750/** ---------------------------------------------------------------------
3751\fn limProcessInitScanRsp
3752\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3753\ message from HAL. If status code is failure, then
3754\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3755\param tpAniSirGlobal pMac
3756\param tANI_U32 body
3757\return none
3758\ ----------------------------------------------------------------------- */
3759void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3760{
3761 tpInitScanParams pInitScanParam;
3762 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3764 pInitScanParam = (tpInitScanParams) body;
3765 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303766 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003767
3768 //Only abort scan if the we are scanning.
3769 if( pMac->lim.abortScan &&
3770 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3771 {
krunal sonid3d60e12013-07-17 13:24:09 -07003772 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 pMac->lim.abortScan = 0;
3774 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3775 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3776 //Set the resume channel to Any valid channel (invalid).
3777 //This will instruct HAL to set it to any previous valid channel.
3778 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003779 if (status != eHAL_STATUS_SUCCESS)
3780 {
3781 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3782 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3783 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3784 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3785 return;
3786 }
3787 else
3788 {
3789 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3790 }
3791
Jeff Johnson295189b2012-06-20 16:38:30 -07003792 }
3793 switch(pMac->lim.gLimHalScanState)
3794 {
3795 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3796 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3797 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003798 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3800 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3801 /*
3802 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3803 * another Scan request in the same context (happens when 11d is enabled
3804 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3805 * scan in the same context but with bigger channel list), so the state needs to be
3806 * changed before this response message is sent.
3807 */
3808 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 return;
3810 }
3811 else if (status == eHAL_STATUS_SUCCESS)
3812 {
3813 /* since we have successfully triggered a background scan,
3814 * reset the "consecutive bkgnd scan failure" count to 0
3815 */
3816 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3817 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003818 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 }
3820 limContinueChannelScan(pMac);
3821 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003822//WLAN_SUSPEND_LINK Related
3823 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3824 if( pMac->lim.gpLimSuspendCallback )
3825 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303826 if( eHAL_STATUS_SUCCESS == status )
3827 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303829 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303831 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303833 pMac->lim.gLimSystemInScanLearnMode = 0;
3834 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003835
3836 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3837 pMac->lim.gpLimSuspendCallback = NULL;
3838 pMac->lim.gpLimSuspendData = NULL;
3839 }
3840 else
3841 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003842 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 return;
3844 }
3845 break;
3846//end WLAN_SUSPEND_LINK Related
3847 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003848 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 pMac->lim.gLimHalScanState);
3850 break;
3851 }
3852 return;
3853}
3854/**
3855 * limProcessSwitchChannelReAssocReq()
3856 *
3857 *FUNCTION:
3858 * This function is called to send the reassoc req mgmt frame after the
3859 * switchChannelRsp message is received from HAL.
3860 *
3861 *LOGIC:
3862 *
3863 *ASSUMPTIONS:
3864 * NA
3865 *
3866 *NOTE:
3867 * NA
3868 *
3869 * @param pMac - Pointer to Global MAC structure.
3870 * @param psessionEntry - session related information.
3871 * @param status - channel switch success/failure.
3872 *
3873 * @return None
3874 */
3875static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3876{
3877 tLimMlmReassocCnf mlmReassocCnf;
3878 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303879#ifdef FEATURE_WLAN_ESE
3880 tANI_U32 val = 0;
3881#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3883 if(pMlmReassocReq == NULL)
3884 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003885 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3887 goto end;
3888 }
3889
3890 if(status != eHAL_STATUS_SUCCESS)
3891 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003892 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3894 goto end;
3895 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303896
3897#ifdef FEATURE_WLAN_ESE
3898 /*
3899 * In case of Ese Reassociation, change the reassoc timer
3900 * value.
3901 */
3902 val = pMlmReassocReq->reassocFailureTimeout;
3903 if (psessionEntry->isESEconnection)
3904 {
3905 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3906 }
3907 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3908 TX_SUCCESS)
3909 {
3910 limLog(pMac, LOGP,
3911 FL("unable to deactivate Reassoc failure timer"));
3912 }
3913 val = SYS_MS_TO_TICKS(val);
3914 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3915 val, 0) != TX_SUCCESS)
3916 {
3917 limLog(pMac, LOGP,
3918 FL("unable to change Reassociation failure timer"));
3919 }
3920#endif
3921 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003923 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3925 != TX_SUCCESS)
3926 {
3927 /// Could not start reassoc failure timer.
3928 // Log error
3929 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003930 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 // Return Reassoc confirm with
3932 // Resources Unavailable
3933 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3934 goto end;
3935 }
3936 /// Prepare and send Reassociation request frame
3937 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3938 return;
3939end:
3940 // Free up buffer allocated for reassocReq
3941 if(pMlmReassocReq != NULL)
3942 {
3943 /* Update PE session Id*/
3944 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303945 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003946 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 }
3948 else
3949 {
3950 mlmReassocCnf.sessionId = 0;
3951 }
3952
3953 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3954 /* Update PE sessio Id*/
3955 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3956
3957 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3958}
3959/**
3960 * limProcessSwitchChannelJoinReq()
3961 *
3962 *FUNCTION:
3963 * This function is called to send the probe req mgmt frame after the
3964 * switchChannelRsp message is received from HAL.
3965 *
3966 *LOGIC:
3967 *
3968 *ASSUMPTIONS:
3969 * NA
3970 *
3971 *NOTE:
3972 * NA
3973 *
3974 * @param pMac - Pointer to Global MAC structure.
3975 * @param psessionEntry - session related information.
3976 * @param status - channel switch success/failure.
3977 *
3978 * @return None
3979 */
3980static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3981{
3982 tANI_U32 val;
3983 tSirMacSSid ssId;
3984 tLimMlmJoinCnf mlmJoinCnf;
3985 if(status != eHAL_STATUS_SUCCESS)
3986 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003987 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 goto error;
3989 }
3990
3991 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3992 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003993 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003994 goto error;
3995 }
3996
Jeff Johnsone7245742012-09-05 17:12:55 -07003997
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3999 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4000 {
4001 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
4002 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304003 {
4004 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
4005 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
4006 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304008 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004010
4011 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4012 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004013 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4015 // Apply previously set configuration at HW
4016 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05304017
4018 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
4019 * disconnection was caused by HB failure.
4020 */
4021 if(pMac->roam.configParam.sendDeauthBeforeCon)
4022 {
4023 int apCount;
4024
4025 for(apCount = 0; apCount < 2; apCount++)
4026 {
4027
4028 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4029 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
4030 {
4031 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
4032 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
4033 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
4034 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
4035
4036 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
4037 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
4038 psessionEntry, FALSE );
4039
4040 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
4041 sizeof(tSirMacAddr));
4042 break;
4043 }
4044 }
4045 }
4046
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304048 vos_mem_copy(ssId.ssId,
4049 psessionEntry->ssId.ssId,
4050 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004052
4053 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
4054
4055 //assign appropriate sessionId to the timer object
4056 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05304057 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
4058 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
4059 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304060 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 // include additional IE if there is
4062 limSendProbeReqMgmtFrame( pMac, &ssId,
4063 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
4064 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
4065 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07004066
4067 // Sending mgmt frame is a blocking call activate Join failure timer now
4068 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
4069 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
4070 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004071 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004072 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
4073 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
4074 //memory is freed up below.
4075 psessionEntry->pLimMlmJoinReq = NULL;
4076 goto error;
4077 }
4078
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004079 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
4080 {
Yathish9f22e662012-12-10 14:21:35 -08004081 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004082 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
4083 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004084 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004085 goto error;
4086 }
4087 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004088
Jeff Johnson295189b2012-06-20 16:38:30 -07004089 return;
4090error:
4091 if(NULL != psessionEntry)
4092 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304093 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 psessionEntry->pLimMlmJoinReq = NULL;
4095 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
4096 }
4097 else
4098 {
4099 mlmJoinCnf.sessionId = 0;
4100 }
4101 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4102 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4103 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
4104}
4105
4106/**
4107 * limProcessSwitchChannelRsp()
4108 *
4109 *FUNCTION:
4110 * This function is called to process switchChannelRsp message from HAL.
4111 *
4112 *LOGIC:
4113 *
4114 *ASSUMPTIONS:
4115 * NA
4116 *
4117 *NOTE:
4118 * NA
4119 *
4120 * @param pMac - Pointer to Global MAC structure
4121 * @param body - message body.
4122 *
4123 * @return None
4124 */
4125void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4126{
4127 tpSwitchChannelParams pChnlParams = NULL;
4128 eHalStatus status;
4129 tANI_U16 channelChangeReasonCode;
4130 tANI_U8 peSessionId;
4131 tpPESession psessionEntry;
4132 //we need to process the deferred message since the initiating req. there might be nested request.
4133 //in the case of nested request the new request initiated from the response will take care of resetting
4134 //the deffered flag.
4135 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4136 pChnlParams = (tpSwitchChannelParams) body;
4137 status = pChnlParams->status;
4138 peSessionId = pChnlParams->peSessionId;
4139 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4140 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304141 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004142 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004143 return;
4144 }
4145#if defined WLAN_FEATURE_VOWIFI
4146 //HAL fills in the tx power used for mgmt frames in this field.
4147 //Store this value to use in TPC report IE.
4148 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4149#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4151 // initialize it back to invalid id
4152 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singh39ae47e2017-10-30 17:39:50 +05304153 limLog(pMac, LOGE, FL("channelChangeReasonCode %d status %d"),channelChangeReasonCode, pChnlParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 switch(channelChangeReasonCode)
4155 {
4156 case LIM_SWITCH_CHANNEL_REASSOC:
4157 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4158 break;
4159 case LIM_SWITCH_CHANNEL_JOIN:
4160 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4161 break;
4162
4163 case LIM_SWITCH_CHANNEL_OPERATION:
4164 /*
4165 * The above code should also use the callback.
4166 * mechanism below, there is scope for cleanup here.
4167 * THat way all this response handler does is call the call back
4168 * We can get rid of the reason code here.
4169 */
4170 if (pMac->lim.gpchangeChannelCallback)
4171 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304172 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004173 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4174 {
4175 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4176 {
4177 if ( psessionEntry && psessionEntry->limSmeState
4178 == eLIM_SME_LINK_EST_STATE )
4179 {
4180 peSetResumeChannel( pMac,
4181 psessionEntry->currentOperChannel,
4182 psessionEntry->htSecondaryChannelOffset);
4183 }
4184 else
4185 {
4186 peSetResumeChannel( pMac, 0, 0);
4187 }
4188 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4189 }
4190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4192 }
4193 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05304194 case LIM_SWITCH_CHANNEL_SAP_ECSA:
4195 lim_send_sme_ap_channel_switch_resp(pMac,
4196 psessionEntry, pChnlParams);
4197 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 default:
4199 break;
4200 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304201 vos_mem_free(body);
4202 body = NULL;
4203
Jeff Johnson295189b2012-06-20 16:38:30 -07004204}
4205/**
4206 * limProcessStartScanRsp()
4207 *
4208 *FUNCTION:
4209 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4210 * then it will start scan/learn on the next channel.
4211 *
4212 *LOGIC:
4213 *
4214 *ASSUMPTIONS:
4215 * NA
4216 *
4217 *NOTE:
4218 * NA
4219 *
4220 * @param pMac - Pointer to Global MAC structure
4221 * @param body - message body.
4222 *
4223 * @return None
4224 */
4225
4226void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4227{
4228 tpStartScanParams pStartScanParam;
4229 eHalStatus status;
4230 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4231 pStartScanParam = (tpStartScanParams) body;
4232 status = pStartScanParam->status;
4233#if defined WLAN_FEATURE_VOWIFI
4234 //HAL fills in the tx power used for mgmt frames in this field.
4235 //Store this value to use in TPC report IE.
4236 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4237 //Store start TSF of scan start. This will be stored in BSS params.
4238 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4239#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304240 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004241 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 if( pMac->lim.abortScan )
4243 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004244 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004245 pMac->lim.abortScan = 0;
4246 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4247 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4248 //Set the resume channel to Any valid channel (invalid).
4249 //This will instruct HAL to set it to any previous valid channel.
4250 peSetResumeChannel(pMac, 0, 0);
4251 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4252 }
4253 switch(pMac->lim.gLimHalScanState)
4254 {
4255 case eLIM_HAL_START_SCAN_WAIT_STATE:
4256 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4257 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004258 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 //
4260 // FIXME - With this, LIM will try and recover state, but
4261 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4262 // status back to the SME
4263 //
4264 //Set the resume channel to Any valid channel (invalid).
4265 //This will instruct HAL to set it to any previous valid channel.
4266 peSetResumeChannel(pMac, 0, 0);
4267 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4268 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4269 }
4270 else
4271 {
4272 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4273 limContinuePostChannelScan(pMac);
4274 }
4275 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004277 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004278 pMac->lim.gLimHalScanState);
4279 break;
4280 }
4281 return;
4282}
4283void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4284{
4285 tpEndScanParams pEndScanParam;
4286 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4288 pEndScanParam = (tpEndScanParams) body;
4289 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304290 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004291 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 switch(pMac->lim.gLimHalScanState)
4293 {
4294 case eLIM_HAL_END_SCAN_WAIT_STATE:
4295 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4296 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004297 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4299 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4300 }
4301 else
4302 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004303 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 limContinueChannelScan(pMac);
4305 }
4306 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004308 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 pMac->lim.gLimHalScanState);
4310 break;
4311 }
4312 return;
4313}
Jeff Johnsone7245742012-09-05 17:12:55 -07004314/**
4315 * limStopTxAndSwitch()
4316 *
4317 *FUNCTION:
4318 * Start channel switch on all sessions that is in channel switch state.
4319 *
4320 * @param pMac - pointer to global adapter context
4321 *
4322 * @return None
4323 *
4324 */
4325static void
4326limStopTxAndSwitch (tpAniSirGlobal pMac)
4327{
4328 tANI_U8 i;
4329
4330 for(i =0; i < pMac->lim.maxBssId; i++)
4331 {
4332 if(pMac->lim.gpSession[i].valid &&
4333 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4334 {
4335 limStopTxAndSwitchChannel(pMac, i);
4336 }
4337 }
4338 return;
4339}
4340/**
4341 * limStartQuietOnSession()
4342 *
4343 *FUNCTION:
4344 * This function is called to start quiet timer after finish scan if there is
4345 * qeuieting on any session.
4346 *
4347 *LOGIC:
4348 *
4349 *ASSUMPTIONS:
4350 * NA
4351 *
4352 *NOTE:
4353 * NA
4354 *
4355 * @param pMac - Pointer to Global MAC structure
4356 *
4357 * @return None
4358 */
4359static void
4360limStartQuietOnSession (tpAniSirGlobal pMac)
4361{
4362 tANI_U8 i;
4363
4364 for(i =0; i < pMac->lim.maxBssId; i++)
4365 {
4366 if(pMac->lim.gpSession[i].valid &&
4367 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4368 {
4369 limStartQuietTimer(pMac, i);
4370 }
4371 }
4372 return;
4373}
Jeff Johnson295189b2012-06-20 16:38:30 -07004374void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4375{
4376 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 eHalStatus status;
4378 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4379 pFinishScanParam = (tpFinishScanParams) body;
4380 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004381
Sushant Kaushik826de802014-05-08 18:04:11 +05304382 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4383 pMac->lim.gLimHalScanState,
4384 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004385
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 switch(pMac->lim.gLimHalScanState)
4387 {
4388 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304389#ifdef FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05304390 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_COMP_EVENT, NULL,
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304391 status, eSIR_SUCCESS);
4392#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004393 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Padma, Santhosh Kumar8eb1d7a2015-07-31 11:35:53 +05304394 if (pMac->lim.abortScan)
4395 pMac->lim.abortScan = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004397 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 {
4399 /** Right time to stop tx and start the timer for channel switch */
4400 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4401 * be any associated session id
4402 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004403 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004405 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 {
4407 /** Start the quieting */
4408 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4409 * be any associated session id
4410 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004411 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4414 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004415 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 }
4417 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004418//WLAN_SUSPEND_LINK Related
4419 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4420 if( pMac->lim.gpLimResumeCallback )
4421 {
4422 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4423 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4424 pMac->lim.gpLimResumeCallback = NULL;
4425 pMac->lim.gpLimResumeData = NULL;
4426 pMac->lim.gLimSystemInScanLearnMode = 0;
4427 }
4428 else
4429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004430 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304431 vos_mem_free(body);
4432 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 return;
4434 }
4435 break;
4436//end WLAN_SUSPEND_LINK Related
4437
4438 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004439 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 pMac->lim.gLimHalScanState);
4441 break;
4442 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304443 vos_mem_free(body);
4444 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004445 return;
4446}
4447/**
4448 * @function : limProcessMlmHalAddBARsp
4449 *
4450 * @brief: Process WDA_ADDBA_RSP coming from HAL
4451 *
4452 *
4453 * @param pMac The global tpAniSirGlobal object
4454 *
4455 * @param tSirMsgQ The MsgQ header containing the response buffer
4456 *
4457 * @return none
4458 */
4459void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4460 tpSirMsgQ limMsgQ )
4461{
4462 // Send LIM_MLM_ADDBA_CNF to LIM
4463 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004464 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004465 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004466
Jeff Johnson295189b2012-06-20 16:38:30 -07004467 //now LIM can process any defer message.
4468 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4469 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004470 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004471 return;
4472 }
4473 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4474 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004475 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304476 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004477 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 return;
4479 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004480
4481 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304482 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4483 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004484 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304485 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004486 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 return;
4488 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304489 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304491 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4492 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 // Copy other ADDBA Rsp parameters
4494 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4495 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4496 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4497 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4498 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4499 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4500 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4501 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4502 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4503 else
4504 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304505
4506#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4507 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry,
4508 pAddBAParams->status, pMlmAddBACnf->addBAResultCode);
4509#endif //FEATURE_WLAN_DIAG_SUPPORT
4510
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304511 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004512 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 // Send ADDBA CNF to LIM
4514 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4515}
4516/**
4517 * \brief Process LIM_MLM_ADDBA_CNF
4518 *
4519 * \sa limProcessMlmAddBACnf
4520 *
4521 * \param pMac The global tpAniSirGlobal object
4522 *
4523 * \param tSirMsgQ The MsgQ header containing the response buffer
4524 *
4525 * \return none
4526 */
4527void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4528 tANI_U32 *pMsgBuf )
4529{
4530tpLimMlmAddBACnf pMlmAddBACnf;
4531tpDphHashNode pSta;
4532tANI_U16 aid;
4533tLimBAState curBaState;
4534tpPESession psessionEntry = NULL;
4535if(pMsgBuf == NULL)
4536{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004537 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 return;
4539}
4540pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4541 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4542 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004543 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304544 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 return;
4546 }
4547 // First, extract the DPH entry
4548 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4549 if( NULL == pSta )
4550 {
4551 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004552 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304553 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 return;
4555 }
4556 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4557 // Need to validate SME state
4558 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4559 {
4560 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004561 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304563 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 return;
4565 }
4566 // Restore STA BA state
4567 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004568 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 {
4570 // Update LIM internal cache...
4571 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4572 {
4573 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4574 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4575 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4576 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4577 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004578 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4579 // status code. MLME will then send an ADDBA RSP
4580 // over the air to the peer MAC entity
4581 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4582 pMlmAddBACnf->peerMacAddr,
4583 pMlmAddBACnf->addBAResultCode,
4584 pMlmAddBACnf->baDialogToken,
4585 (tANI_U8) pMlmAddBACnf->baTID,
4586 (tANI_U8) pMlmAddBACnf->baPolicy,
4587 pMlmAddBACnf->baBufferSize,
4588 pMlmAddBACnf->baTimeout,psessionEntry))
4589 {
4590 PELOGW(limLog( pMac, LOGW,
4591 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4592 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4593 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 }
4595 else
4596 {
4597 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4598 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4599 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4600 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4601 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4602 }
4603 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304605 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004606 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004607}
4608/**
4609 * \brief Process LIM_MLM_DELBA_CNF
4610 *
4611 * \sa limProcessMlmDelBACnf
4612 *
4613 * \param pMac The global tpAniSirGlobal object
4614 *
4615 * \param tSirMsgQ The MsgQ header containing the response buffer
4616 *
4617 * \return none
4618 */
4619void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4620 tANI_U32 *pMsgBuf )
4621{
4622 tpLimMlmDelBACnf pMlmDelBACnf;
4623 tpDphHashNode pSta;
4624 tANI_U16 aid;
4625// tANI_U8 sessionId;
4626 tLimBAState curBaState;
4627 tpPESession psessionEntry;
4628
4629 if(pMsgBuf == NULL)
4630 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004631 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004632 return;
4633 }
4634 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4635 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4636 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304637 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4638 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304639 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 return;
4641 }
4642 // First, extract the DPH entry
4643 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4644 if( NULL == pSta )
4645 {
4646 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004647 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304648 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 return;
4650 }
4651 if(NULL == pMlmDelBACnf)
4652 {
4653 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004654 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004655 return;
4656 }
4657 // Need to validate baState
4658 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4659 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4660 {
4661 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004662 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304664 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 return;
4666 }
4667 // Restore STA BA state
4668 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4669 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304670 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004671}
4672/**
4673 * \brief Process SIR_LIM_DEL_BA_IND
4674 *
4675 * \sa limProcessMlmHalBADeleteInd
4676 *
4677 * \param pMac The global tpAniSirGlobal object
4678 *
4679 * \param tSirMsgQ The MsgQ header containing the indication buffer
4680 *
4681 * \return none
4682 */
4683void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4684 tpSirMsgQ limMsgQ )
4685{
4686 tSirRetStatus status = eSIR_SUCCESS;
4687 tpBADeleteParams pBADeleteParams;
4688 tpDphHashNode pSta;
4689 tANI_U16 aid;
4690 tLimBAState curBaState;
4691 tpPESession psessionEntry;
4692 tANI_U8 sessionId;
4693
4694 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4695
4696 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4697 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004698 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304699 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004700 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 return;
4702 }
4703 // First, extract the DPH entry
4704 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4705 if( NULL == pSta )
4706 {
4707 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004708 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004709 goto returnAfterCleanup;
4710 }
4711
4712 // Need to validate BA state
4713 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4714 if( eLIM_BA_STATE_IDLE != curBaState )
4715 {
4716 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004717 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004718 curBaState );
4719 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304720 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004721
Abhishek Singh66c16762014-08-14 19:13:19 +05304722 // Post DELBA REQ to MLME...
4723 if( eSIR_SUCCESS !=
4724 (status = limPostMlmDelBAReq( pMac,
4725 pSta,
4726 pBADeleteParams->baDirection,
4727 pBADeleteParams->baTID,
4728 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004729 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304730 limLog( pMac, LOGE,
4731 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004732 }
4733 else
4734 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304735 limLog( pMac, LOGE,
4736 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4737 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4738 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 }
4740returnAfterCleanup:
4741 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304742 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004743 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004744}
4745/**
4746 * @function : limProcessSetMimoRsp()
4747 *
4748 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4749 * after Processing the Req from the SME (PMC)
4750 *
4751 * LOGIC:
4752 *
4753 * ASSUMPTIONS:
4754 * NA
4755 *
4756 * NOTE:
4757 * NA
4758 *
4759 * @param pMac - Pointer to Global MAC structure
4760 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4761 * @return None
4762 */
4763
4764void
4765limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4766{
4767#if 0
4768 tSirRetStatus retStatus;
4769 tpSetMIMOPS pMIMO_PSParams;
4770
4771
4772 do {
4773
4774 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4775 if( NULL == pMIMO_PSParams ) {
4776 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4777 return;
4778 }
4779
4780 /** If Updation of the HAL Fail's*/
4781 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004782 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004783 break;
4784 }
4785
4786 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4787 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4788 break;
4789
4790 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4791 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4792
4793 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4794 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4795 * the Action Frame is being sent at first before setting the internal structures
4796 */
4797 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4798 tSirMacAddr macAddr;
4799
4800 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304801 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004802
4803 /** Send Action Frame with the corresponding mode */
4804 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4805 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004806 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 break;
4808 }
4809 }
4810 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4811 }while(0);
4812
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304813 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004814#endif
4815}
4816/**
4817 * @function : limHandleDelBssInReAssocContext
4818 * @brief : While Processing the ReAssociation Response Frame in STA,
4819 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4820 * being issued and the end of DelBSS the new BSS is being added.
4821 *
4822 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4823 * change, We need to update CSR with ReAssocCNF Response with the
4824 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4825 * context only
4826 *
4827 * @param : pMac - tpAniSirGlobal
4828 * pStaDs - Station Descriptor
4829 *
4830 * @return : none
4831 */
4832static void
4833limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4834{
4835 tLimMlmReassocCnf mlmReassocCnf;
4836 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4837 /** Set the MlmState to IDLE*/
4838 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 /* Update PE session Id*/
4840 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304841 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 case eLIM_SME_WT_REASSOC_STATE :
4843 {
4844 tpSirAssocRsp assocRsp;
4845 tpDphHashNode pStaDs;
4846 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304847 tpSchBeaconStruct pBeaconStruct;
4848 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4849 if (NULL == pBeaconStruct)
4850 {
4851 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4852 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4853 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4854 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4855 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4856 goto Error;
4857 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 /** Delete the older STA Table entry */
4859 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4860 /**
4861 * Add an entry for AP to hash table
4862 * maintained by DPH module
4863 */
4864 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4865 {
4866 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004867 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004868 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4869 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4870 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Abhishek Singh2b055852015-10-07 14:14:13 +05304871 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 goto Error;
4873 }
4874 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4875 * is being stored to be used here for sending ADDBSS
4876 */
4877 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4878 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4879 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 limExtractApCapabilities( pMac,
Abhishek Singhbad2b322016-10-21 11:22:33 +05304881 (tANI_U8 *)
4882 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4883 GET_IE_LEN_IN_BSS(
4884 psessionEntry->pLimReAssocReq->bssDescription.length),
4885 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304887 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4888 if(pBeaconStruct->erpPresent) {
4889 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004890 psessionEntry->beaconParams.fShortPreamble = 0;
4891 else
4892 psessionEntry->beaconParams.fShortPreamble = 1;
4893 }
4894 //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 +05304895 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004897 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 retStatus = eSIR_FAILURE;
4899 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 if (retStatus != eSIR_SUCCESS)
4901 {
4902 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4903 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304904 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304905 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 pMac->lim.gLimAssocResponseData = NULL;
4907 goto Error;
4908 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304909 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304910 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 psessionEntry->limAssocResponseData = NULL;
4912 }
4913 break;
4914 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4915 {
4916 /** Case wherein the DisAssoc / Deauth
4917 * being sent as response to ReAssoc Req*/
4918 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4919 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4920 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4921 /** Set the SME State back to WT_Reassoc State*/
4922 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004923 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4924 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4925 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4926 {
4927 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 }
4929 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4930 }
4931 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004933 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4935 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4936 goto Error;
4937 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004938 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004939Error:
4940 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4941}
4942
4943/* Added For BT -AMP Support */
4944static void
4945limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4946{
4947 tLimMlmStartCnf mlmStartCnf;
4948 tANI_U32 val;
4949 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4950
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304951 if (NULL == pAddBssParams)
4952 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004953 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304954 goto end;
4955 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004956 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004958 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4960 {
4961 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4962 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4963 goto end;
4964 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4965 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4966 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4967 goto end;
4968 }
4969
4970 // Set MLME state
4971 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4972 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4973 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4974 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004975 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 // Create timers used by LIM
4977 if (!pMac->lim.gLimTimersCreated)
4978 limCreateTimers(pMac);
4979 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4980 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004981 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4983 // Apply previously set configuration at HW
4984 limApplyConfiguration(pMac,psessionEntry);
4985 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4986 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4987 }
4988 else
4989 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004990 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4992 }
4993 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4994 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4995 end:
4996 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004997 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304998 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304999 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08005000 limMsgQ->bodyptr = NULL;
5001 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005002}
5003
5004/**
5005 * @function : limHandleAddBssInReAssocContext
5006 * @brief : While Processing the ReAssociation Response Frame in STA,
5007 * a. immediately after receiving the Reassoc Response the RxCleanUp is
5008 * being issued and the end of DelBSS the new BSS is being added.
5009 *
5010 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
5011 * change, We need to update CSR with ReAssocCNF Response with the
5012 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
5013 * context only
5014 *
5015 * @param : pMac - tpAniSirGlobal
5016 * pStaDs - Station Descriptor
5017 *
5018 * @return : none
5019 */
5020void
5021limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
5022{
5023 tLimMlmReassocCnf mlmReassocCnf;
5024 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
5025 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005026 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
5027 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07005028 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 case eLIM_SME_WT_REASSOC_STATE : {
5030 tpSirAssocRsp assocRsp;
5031 tpDphHashNode pStaDs;
5032 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005033 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305034 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
5035 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005036 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305037 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005038 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5039 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5040 goto Error;
5041 }
5042
Jeff Johnson295189b2012-06-20 16:38:30 -07005043 // Get the AP entry from DPH hash table
5044 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
5045 if (pStaDs == NULL )
5046 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005047 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005048 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5049 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305050 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005051 goto Error;
5052 }
5053 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
5054 * is being stored to be used here for sending ADDBSS
5055 */
5056 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
5057 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
5058 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Abhishek Singhbad2b322016-10-21 11:22:33 +05305059 limExtractApCapabilities(pMac,
5060 (tANI_U8 *)
5061 psessionEntry->pLimReAssocReq->bssDescription.ieFields,
5062 GET_IE_LEN_IN_BSS(
5063 psessionEntry->pLimReAssocReq->bssDescription.length),
5064 pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005065 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005066 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
5067
5068 if(pBeaconStruct->erpPresent)
5069 {
5070 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07005071 psessionEntry->beaconParams.fShortPreamble = 0;
5072 else
5073 psessionEntry->beaconParams.fShortPreamble = 1;
5074 }
5075
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07005076 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07005077 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005078 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005079 retStatus = eSIR_FAILURE;
5080 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 if (retStatus != eSIR_SUCCESS)
5082 {
5083 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
5084 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305085 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305087 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005088 goto Error;
5089 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305090 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005091 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305092 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 }
5094 break;
5095 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
5096 * being sent as response to ReAssoc Req*/
5097 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
5098 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
5099 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
5100 /** Set the SME State back to WT_Reassoc State*/
5101 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
5102 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
5103 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005104 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005105 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005106 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
5107 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005108
5109 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5110 }
5111 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005112 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005113 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005114 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
5115 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
5116 goto Error;
5117 }
5118return;
5119Error:
5120 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5121}
5122
5123#if 0
5124 static void
5125limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
5126{
5127 tSirSmeAssocCnf assocCnf;
5128 tpDphHashNode pStaDs;
5129 tpPESession psessionEntry;
5130 tANI_U8 sessionId;
5131
5132 if(pMsgBuf == NULL)
5133 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005134 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005135 goto end;
5136 }
5137 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
5138 !__limIsSmeAssocCnfValid(&assocCnf))
5139 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005140 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005141 goto end;
5142 }
5143 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5144 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005145 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005146 goto end;
5147 }
5148 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5149 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5150 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005151 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5153 goto end;
5154 }
5155 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5156 if (pStaDs == NULL)
5157 {
5158 limLog(pMac, LOG1,
5159 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5160 msgType, assocCnf.aid);
5161 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5162 /*
5163 ** send a DISASSOC_IND message to WSM to make sure
5164 ** the state in WSM and LIM is the same
5165 **/
5166 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5167 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5168 goto end;
5169 }
5170 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305171 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 (tANI_U8 *) assocCnf.peerMacAddr,
5173 sizeof(tSirMacAddr)) ) ||
5174 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5175 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5176 (msgType != eWNI_SME_ASSOC_CNF)) ||
5177 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5178 (msgType != eWNI_SME_REASSOC_CNF)))))
5179 {
5180 limLog(pMac, LOG1,
5181 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5182 msgType, assocCnf.aid);
5183 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5184 goto end;
5185 }
5186 /*
5187 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5188 ** has been received
5189 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005190 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005191 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5192 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5193 {
5194 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5195 * when it had received Assoc Request frame. Now, PE just needs to send
5196 * Association Response frame to the requesting BTAMP-STA.
5197 */
5198 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005199 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005200 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5201 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5202 goto end;
5203 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5204 else
5205 {
5206 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5207 limRejectAssociation(pMac, pStaDs->staAddr,
5208 pStaDs->mlmStaContext.subType,
5209 true, pStaDs->mlmStaContext.authType,
5210 pStaDs->assocId, true,
5211 assocCnf.statusCode, psessionEntry);
5212 return;
5213 }
5214end:
5215 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5216 {
5217 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5218 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305219 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005220 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5221 }
5222
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305223 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005224 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5225 }
5226} /*** end __limProcessSmeAssocCnfNew() ***/
5227#endif
5228
Jeff Johnson295189b2012-06-20 16:38:30 -07005229void
5230limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5231 tBeaconGenParams *pBeaconGenParams = NULL;
5232 tSirMsgQ limMsg;
5233 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5234 if(psessionEntry == NULL ){
5235 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005236 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005237 return;
5238 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305239 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5240 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005241 {
5242 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305243 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 return;
5245 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305246 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5247 vos_mem_copy((void *) pBeaconGenParams->bssId,
5248 (void *)psessionEntry->bssId,
5249 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005250 limMsg.bodyptr = pBeaconGenParams;
5251 schProcessPreBeaconInd(pMac, &limMsg);
5252 return;
5253}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305254
5255void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5256 tSirResultCodes reasonCode)
5257{
5258 tANI_U16 scanRspLen = 0;
5259
5260 pMac->lim.gLimSmeScanResultLength +=
5261 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305262 pMac->lim.gLimRspReqd = false;
5263 if ((reasonCode == eSIR_SME_SUCCESS) ||
5264 pMac->lim.gLimSmeScanResultLength) {
5265 scanRspLen = sizeof(tSirSmeScanRsp) +
5266 pMac->lim.gLimSmeScanResultLength -
5267 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305268 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305269 else
5270 scanRspLen = sizeof(tSirSmeScanRsp);
5271
5272 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5273 pMac->lim.gSmeSessionId,
5274 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305275}
5276
5277
5278void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5279{
5280 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5281
5282 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005283 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305284
5285 switch (pScanEvent->event)
5286 {
5287 case SCAN_EVENT_STARTED:
5288 break;
5289 case SCAN_EVENT_START_FAILED:
5290 case SCAN_EVENT_COMPLETED:
5291 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5292 break;
5293 case SCAN_EVENT_BSS_CHANNEL:
5294 case SCAN_EVENT_FOREIGN_CHANNEL:
5295 case SCAN_EVENT_DEQUEUED:
5296 case SCAN_EVENT_PREEMPTED:
5297 default:
5298 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005299 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305300 }
5301}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005302
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305303void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5304{
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305305 tANI_U32 val;
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305306
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305307 if (wlan_cfgGetInt(pMac, WNI_CFG_ENABLE_MAC_ADDR_SPOOFING, &val)
5308 != eSIR_SUCCESS)
5309 {
5310 limLog(pMac, LOGP, FL("fail to Get WNI_CFG_ENABLE_MAC_ADDR_SPOOFING"));
5311 /*If we here means mac spoofing is enable. So enable both Host and
5312 FW spoofing */
5313 val = 1;
5314 }
5315 if ((rspStatus != eSIR_SUCCESS) || (val != 1) ||
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305316 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5317 {
Hanumantha Reddy Pothulaca1d1cc2015-10-26 15:37:35 +05305318 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing %d"), val);
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305319 pMac->lim.isSpoofingEnabled = FALSE;
5320 } else {
5321 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5322 pMac->lim.isSpoofingEnabled = TRUE;
5323 }
5324
5325 return;
5326}
5327
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005328void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5329 eHalStatus status,
5330 tANI_U32* mlmAddBssRsp)
5331{
5332 if (status != eHAL_STATUS_SUCCESS)
5333 {
5334 limLog(pMac, LOGE,
5335 FL(" CSA failed to get the response for resume link"));
5336 }
5337 return;
5338}