blob: 2ff3ffdc6848aa998a7f1ae97029f8f6ea30815e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 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
Jeff Johnson295189b2012-06-20 16:38:30 -070064static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070065static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070066void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070067#ifdef FEATURE_OEM_DATA_SUPPORT
68void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
69#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070070void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
71void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
72void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
73void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
74void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
86void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
87static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
88void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
89static void
90limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080091
92void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
93 eHalStatus status, tANI_U32* mlmAddBssRsp);
94
Jeff Johnson295189b2012-06-20 16:38:30 -070095/**
96 * limProcessMlmRspMessages()
97 *
98 *FUNCTION:
99 * This function is called to processes various MLM response (CNF/IND
100 * messages from MLM State machine.
101 *
102 *LOGIC:
103 *
104 *ASSUMPTIONS:
105 *
106 *NOTE:
107 *
108 * @param pMac Pointer to Global MAC structure
109 * @param msgType Indicates the MLM message type
110 * @param *pMsgBuf A pointer to the MLM message buffer
111 *
112 * @return None
113 */
114void
115limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
116{
117
118 if(pMsgBuf == NULL)
119 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700120 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700121 return;
122 }
Abhishek Singh82a7a5b2014-10-07 13:05:12 +0530123 MTRACE(macTrace(pMac, TRACE_CODE_TX_LIM_MSG, 0, msgType));
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 switch (msgType)
125 {
126 case LIM_MLM_SCAN_CNF:
127 limProcessMlmScanCnf(pMac, pMsgBuf);
128 break;
129
Jeff Johnsone7245742012-09-05 17:12:55 -0700130#ifdef FEATURE_OEM_DATA_SUPPORT
131 case LIM_MLM_OEM_DATA_CNF:
132 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800133 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700134 break;
135#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700136
137 case LIM_MLM_AUTH_CNF:
138 limProcessMlmAuthCnf(pMac, pMsgBuf);
139 break;
140 case LIM_MLM_AUTH_IND:
141 limProcessMlmAuthInd(pMac, pMsgBuf);
142 break;
143 case LIM_MLM_ASSOC_CNF:
144 limProcessMlmAssocCnf(pMac, pMsgBuf);
145 break;
146 case LIM_MLM_START_CNF:
147 limProcessMlmStartCnf(pMac, pMsgBuf);
148 break;
149 case LIM_MLM_JOIN_CNF:
150 limProcessMlmJoinCnf(pMac, pMsgBuf);
151 break;
152 case LIM_MLM_ASSOC_IND:
153 limProcessMlmAssocInd(pMac, pMsgBuf);
154 break;
155 case LIM_MLM_REASSOC_CNF:
156 limProcessMlmReassocCnf(pMac, pMsgBuf);
157 break;
158 case LIM_MLM_REASSOC_IND:
159 limProcessMlmReassocInd(pMac, pMsgBuf);
160 break;
161 case LIM_MLM_DISASSOC_CNF:
162 limProcessMlmDisassocCnf(pMac, pMsgBuf);
163 break;
164 case LIM_MLM_DISASSOC_IND:
165 limProcessMlmDisassocInd(pMac, pMsgBuf);
166 break;
167 case LIM_MLM_PURGE_STA_IND:
168 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
169 break;
170 case LIM_MLM_DEAUTH_CNF:
171 limProcessMlmDeauthCnf(pMac, pMsgBuf);
172 break;
173 case LIM_MLM_DEAUTH_IND:
174 limProcessMlmDeauthInd(pMac, pMsgBuf);
175 break;
176 case LIM_MLM_SETKEYS_CNF:
177 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
178 break;
179 case LIM_MLM_REMOVEKEY_CNF:
180 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
181 break;
182 case LIM_MLM_TSPEC_CNF:
183 break;
184 case LIM_MLM_ADDBA_CNF:
185 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800186 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 break;
188 case LIM_MLM_DELBA_CNF:
189 limProcessMlmDelBACnf( 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 default:
193 break;
194 } // switch (msgType)
195 return;
196} /*** end limProcessMlmRspMessages() ***/
197
198/**
199 * limProcessMlmScanCnf()
200 *
201 *FUNCTION:
202 * This function is called to processes MLM_SCAN_CNF
203 * message from MLM State machine.
204 *
205 *LOGIC:
206 *
207 *ASSUMPTIONS:
208 *
209 *NOTE:
210 *
211 * @param pMac Pointer to Global MAC structure
212 * @param pMsgBuf A pointer to the MLM message buffer
213 *
214 * @return None
215 */
216void
217limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
218{
219 switch(pMac->lim.gLimSmeState)
220 {
221 case eLIM_SME_WT_SCAN_STATE:
222 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
223 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
224 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700225 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700226 pMac->lim.gLimSystemInScanLearnMode = 0;
227 break;
228 default:
229 /**
230 * Should not have received scan confirm
231 * from MLM in other states.
232 * Log error
233 */
234 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530235 FL("received unexpected MLM_SCAN_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 pMac->lim.gLimSmeState);)
237 return;
238 }
239
240 /// Process received scan confirm
241 /// Increment length of cached scan results
242 pMac->lim.gLimSmeScanResultLength +=
243 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
244 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
245 {
246 tANI_U16 scanRspLen = 0;
247 /// Need to send response to Host
248 pMac->lim.gLimRspReqd = false;
249 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
250 eSIR_SME_SUCCESS) ||
251 pMac->lim.gLimSmeScanResultLength)
252 {
253 scanRspLen = sizeof(tSirSmeScanRsp) +
254 pMac->lim.gLimSmeScanResultLength -
255 sizeof(tSirBssDescription);
256 }
257 else
258 {
259 scanRspLen = sizeof(tSirSmeScanRsp);
260 }
261 if(pMac->lim.gLimReportBackgroundScanResults)
262 {
263 pMac->lim.gLimBackgroundScanTerminate = TRUE;
264 }
265 if (pMac->lim.gLimSmeScanResultLength == 0)
266 {
267 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
268 }
269 else
270 {
271 limSendSmeScanRsp(pMac, scanRspLen,
272 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
273 }
274 } // if (pMac->lim.gLimRspReqd)
275 //check to see whether we need to run bgScan timer
276 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
277 {
278 if (tx_timer_activate(
279 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
280 {
281 /// Could not activate background scan timer.
282 // Log error
283 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700284 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 pMac->lim.gLimBackgroundScanStarted = FALSE;
286 }
287 else
288 {
289 pMac->lim.gLimBackgroundScanStarted = TRUE;
290 }
291 }
292} /*** end limProcessMlmScanCnf() ***/
293
Jeff Johnsone7245742012-09-05 17:12:55 -0700294#ifdef FEATURE_OEM_DATA_SUPPORT
295
296/**
297 * limProcessMlmOemDataReqCnf()
298 *
299 *FUNCTION:
300 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
301 * message from MLM State machine.
302 *
303 *LOGIC:
304 *
305 *ASSUMPTIONS:
306 *
307 *NOTE:
308 *
309 * @param pMac Pointer to Global MAC structure
310 * @param pMsgBuf A pointer to the MLM message buffer
311 *
312 * @return None
313 */
314
315void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
316{
317 tLimMlmOemDataRsp* measRsp;
318
319 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
320
321 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
322
323 //Now send the meas confirm message to the sme
324 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
325
326 //Dont free the memory here. It will be freed up by the callee
327
328 return;
329}
330#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700331
332/**
333 * limProcessMlmStartCnf()
334 *
335 *FUNCTION:
336 * This function is called to processes MLM_START_CNF
337 * message from MLM State machine.
338 *
339 *LOGIC:
340 *
341 *ASSUMPTIONS:
342 *
343 *NOTE:
344 *
345 * @param pMac Pointer to Global MAC structure
346 * @param pMsgBuf A pointer to the MLM message buffer
347 *
348 * @return None
349 */
350void
351limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
352{
353 tpPESession psessionEntry = NULL;
354 tLimMlmStartCnf *pLimMlmStartCnf;
355 tANI_U8 smesessionId;
356 tANI_U16 smetransactionId;
357
358 if(pMsgBuf == NULL)
359 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700360 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 return;
362 }
363 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
364 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700366 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 return;
368 }
369 smesessionId = psessionEntry->smeSessionId;
370 smetransactionId = psessionEntry->transactionId;
371
372 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
373 {
374 /**
375 * Should not have received Start confirm from MLM
376 * in other states.
377 * Log error
378 */
379 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530380 FL("received unexpected MLM_START_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 psessionEntry->limSmeState);)
382 return;
383 }
384 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
385 eSIR_SME_SUCCESS)
386 {
387
388 /**
389 * Update global SME state so that Beacon Generation
390 * module starts writing Beacon frames into TFP's
391 * Beacon file register.
392 */
393 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700394 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
396 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700397 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 }
399 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
400 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700401 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
404 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700405 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530408 limLog(pMac, LOG1, FL("*** Started BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 }
410 else
411 {
412 /// Start BSS is a failure
413 peDeleteSession(pMac,psessionEntry);
414 psessionEntry = NULL;
Leela Venkata Kiran Kumar Reddy Chiralac7a12152014-02-03 11:20:14 -0800415 PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 }
417 /// Send response to Host
418 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
419 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
420 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
422 {
423 //Configure beacon and send beacons to HAL
424 limSendBeaconInd(pMac, psessionEntry);
425 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700426}
427
428 /*** end limProcessMlmStartCnf() ***/
429
430/**
431 * limProcessMlmJoinCnf()
432 *
433 *FUNCTION:
434 * This function is called to processes MLM_JOIN_CNF
435 * message from MLM State machine.
436 *
437 *LOGIC:
438 *
439 *ASSUMPTIONS:
440 *
441 *NOTE:
442 *
443 * @param pMac Pointer to Global MAC structure
444 * @param pMsgBuf A pointer to the MLM message buffer
445 *
446 * @return None
447 */
448void
449limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
450{
451 tSirResultCodes resultCode;
452 tLimMlmJoinCnf *pLimMlmJoinCnf;
453 tpPESession psessionEntry;
454 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
455 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
456 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530457 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
458 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 return;
460 }
461
462 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
463 {
464 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530465 FL("received unexpected MLM_JOIN_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 psessionEntry->limSmeState);)
467 return;
468 }
469
470 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
471 /// Process Join confirm from MLM
472 if (resultCode == eSIR_SME_SUCCESS)
473 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530474 limLog(pMac, LOG1, FL("***SessionId: %d Joined ESS ***"),
475 pLimMlmJoinCnf->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
478 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
479 return;
480 else
481 resultCode = eSIR_SME_REFUSED;
482 }
483 {
484 /// Join failure
485 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700486 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 /// Send Join response to Host
488 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
489 }
490} /*** end limProcessMlmJoinCnf() ***/
491
492/**
493 * limProcessMlmAuthCnf()
494 *
495 *FUNCTION:
496 * This function is called to processes MLM_AUTH_CNF
497 * message from MLM State machine.
498 *
499 *LOGIC:
500 *
501 *ASSUMPTIONS:
502 *
503 *NOTE:
504 *
505 * @param pMac Pointer to Global MAC structure
506 * @param pMsgBuf A pointer to the MLM message buffer
507 *
508 * @return None
509 */
510void
511limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
512{
513 tANI_U16 caps;
514 tANI_U32 val;
515 tAniAuthType cfgAuthType, authMode;
516 tLimMlmAuthReq *pMlmAuthReq;
517 tLimMlmAssocReq *pMlmAssocReq;
518 tLimMlmAuthCnf *pMlmAuthCnf;
519 tpPESession psessionEntry;
520 tANI_U32 teleBcnEn = 0;
521// tANI_U8 sessionId;
522
523 if(pMsgBuf == NULL)
524 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700525 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 return;
527 }
528 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
529 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
530 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530531 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),
532 pMlmAuthCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 return;
534 }
535
536 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
537 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
538 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
539 {
540 /**
541 * Should not have received AUTH confirm
542 * from MLM in other states or on AP.
543 * Log error
544 */
545 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530546 FL("SessionId:%d received unexpected MLM_AUTH_CNF in state %d"),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530547 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 return;
549 }
Sushant Kaushikb97a0082015-08-31 12:36:45 +0530550#ifdef FEATURE_WLAN_DIAG_SUPPORT
551 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_COMP_EVENT, psessionEntry,
552 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
553 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode);
554#endif
555
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 /// Process AUTH confirm from MLM
557 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
558 {
559 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
560 {
561 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
562 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
563 {
564 /**
565 * Could not get AuthType value from CFG.
566 * Log error.
567 */
568 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700569 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 }
571 }
572 else
573 cfgAuthType = pMac->lim.gLimPreAuthType;
574
575 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
576 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
577 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
578 {
579 /**
580 * When Open authentication fails with reason code "13" and
581 * authType set to 'auto switch', Try with Shared Authentication
582 */
583 authMode = eSIR_SHARED_KEY;
584 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530585 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
586 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 {
588 // Log error
589 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530590 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 return;
592 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530593 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 val = sizeof(tSirMacAddr);
595 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
596 {
597 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
598 }
599 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530600 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
601 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 sizeof(tSirMacAddr));
603 pMlmAuthReq->authType = authMode;
604 /* Update PE session Id*/
605 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
606 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
607 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
608 != eSIR_SUCCESS)
609 {
610 /**
611 * Could not get AuthFailureTimeout value from CFG.
612 * Log error.
613 */
614 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700615 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 }
617 limPostMlmMessage(pMac,
618 LIM_MLM_AUTH_REQ,
619 (tANI_U32 *) pMlmAuthReq);
620 return;
621 }
622 else
623 {
624 // MAC based authentication failure
625 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
626 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700627 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700629 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700631 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
632
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 /**
634 * Need to send Join response with
635 * auth failure to Host.
636 */
637 limHandleSmeJoinResult(pMac,
638 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
639 }
640 else
641 {
642 /**
643 * Pre-authentication failure.
644 * Send Pre-auth failure response to host
645 */
646 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700647 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 limSendSmeAuthRsp(
649 pMac,
650 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
651 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
652 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
653 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
654 }
655 } // end if (cfgAuthType == eAUTO_SWITCH)
656 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
657 else
658 {
659 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
660 {
661 /**
662 * Successful MAC based authentication
663 * Trigger Association with BSS
664 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530665 limLog(pMac, LOG1,
666 FL("SessionId: %d Authenticated with BSS"),
667 psessionEntry->peSessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530668 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
669 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 {
671 // Log error
672 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530673 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 return;
675 }
676 val = sizeof(tSirMacAddr);
677 #if 0
678 if (cfgGetStr(pMac, WNI_CFG_BSSID,
679 pMlmAssocReq->peerMacAddr,
680 &val) != eSIR_SUCCESS)
681 {
682 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700683 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 }
685 #endif //SUPPORT BT-AMP
686 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
687 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
688 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
689 != eSIR_SUCCESS)
690 {
691 /**
692 * Could not get AssocFailureTimeout value
693 * from CFG. Log error.
694 */
695 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700696 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 }
698 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
699 {
700 /**
701 * Could not get Capabilities value
702 * from CFG. Log error.
703 */
704 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700705 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 }
707 /*Clear spectrum management bit if AP doesn't support it*/
708 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
709 {
710 /*AP doesn't support spectrum management clear spectrum management bit*/
711 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
712 }
713
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530714 /* Clear rrm bit if AP doesn't support it */
715 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
716 & LIM_RRM_BIT_MASK))
717 {
718 caps &= (~LIM_RRM_BIT_MASK);
719 }
720
Chandrasekaran, Manishekarc949a8b2014-06-27 12:34:09 +0530721 /* Clear short preamble bit if AP does not support it */
722 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
723 (LIM_SHORT_PREAMBLE_BIT_MASK)))
724 {
725 caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
726 limLog(pMac, LOG1, FL("Clearing short preamble:no AP support"));
727 }
728
729 /* Clear immediate block ack bit if AP does not support it */
730 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
731 (LIM_IMMEDIATE_BLOCK_ACK_MASK)))
732 {
733 caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
734 limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
735 }
736
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 pMlmAssocReq->capabilityInfo = caps;
738 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700739 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700741 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
742 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
744 /* If telescopic beaconing is enabled, set listen interval to
745 WNI_CFG_TELE_BCN_MAX_LI */
746 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
747 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700748 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700749
750 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
751
752 if(teleBcnEn)
753 {
754 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
755 eSIR_SUCCESS)
756 {
757 /**
758 * Could not get ListenInterval value
759 * from CFG. Log error.
760 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700761 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 }
763 }
764 else
765 {
766 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
767 {
768 /**
769 * Could not get ListenInterval value
770 * from CFG. Log error.
771 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700772 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 }
774 }
775
776 pMlmAssocReq->listenInterval = (tANI_U16)val;
777 /* Update PE session ID*/
778 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
779 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
780 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700781 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530782 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
783 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 limPostMlmMessage(pMac,
785 LIM_MLM_ASSOC_REQ,
786 (tANI_U32 *) pMlmAssocReq);
787 }
788 else
789 {
790 /**
791 * Successful Pre-authentication.
792 * Send Pre-auth response to host
793 */
794 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700795 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 limSendSmeAuthRsp(
797 pMac,
798 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
799 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
800 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
801 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
802 }
803 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
804} /*** end limProcessMlmAuthCnf() ***/
805
806/**
807 * limProcessMlmAssocCnf()
808 *
809 *FUNCTION:
810 * This function is called to processes MLM_ASSOC_CNF
811 * message from MLM State machine.
812 *
813 *LOGIC:
814 *
815 *ASSUMPTIONS:
816 *
817 *NOTE:
818 *
819 * @param pMac Pointer to Global MAC structure
820 * @param pMsgBuf A pointer to the MLM message buffer
821 *
822 * @return None
823 */
824void
825limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
826{
827 tpPESession psessionEntry;
828 tLimMlmAssocCnf *pLimMlmAssocCnf;
829
830 if(pMsgBuf == NULL)
831 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700832 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 return;
834 }
835 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
836 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
837 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530838 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
839 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 return;
841 }
842 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
843 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
844 {
845 /**
846 * Should not have received Assocication confirm
847 * from MLM in other states OR on AP.
848 * Log error
849 */
850 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530851 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %d"),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530852 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 return;
854 }
855 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
856 {
857 // Association failure
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530858 limLog(pMac, LOG1,
859 FL("SessionId: %d Association failure resultCode: %d"
860 "limSmeState: %d"), psessionEntry->peSessionId,
c_hpothua9dc89c2014-03-22 19:22:31 +0530861 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530862 psessionEntry->limSmeState);
c_hpothua9dc89c2014-03-22 19:22:31 +0530863
864 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
865 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
866 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
867 */
868 if(((tLimMlmAssocCnf *) pMsgBuf)->resultCode
869 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
870 {
871 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
872 }
873 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
874 pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700875 /**
876 * Need to send Join response with
877 * Association failure to Host.
878 */
879 limHandleSmeJoinResult(pMac,
880 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
881 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
882 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
883 else
884 {
885 // Successful Association
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530886 limLog(pMac, LOG1, FL("SessionId: %d Associated with BSS"),
887 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700889 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 /**
891 * Need to send Join response with
892 * Association success to Host.
893 */
894 limHandleSmeJoinResult(pMac,
895 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
896 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
897 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
898} /*** end limProcessMlmAssocCnf() ***/
899
900/**
901 * limProcessMlmReassocCnf()
902 *
903 *FUNCTION:
904 * This function is called to processes MLM_REASSOC_CNF
905 * message from MLM State machine.
906 *
907 *LOGIC:
908 *
909 *ASSUMPTIONS:
910 *
911 *NOTE:
912 *
913 * @param pMac Pointer to Global MAC structure
914 * @param pMsgBuf A pointer to the MLM message buffer
915 *
916 * @return None
917 */
918void
919limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
920{
921 tpPESession psessionEntry;
922 tLimMlmReassocCnf *pLimMlmReassocCnf;
923
924 if(pMsgBuf == NULL)
925 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700926 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 return;
928 }
929 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
930 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
931 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700932 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 return;
934 }
935 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
936 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
937 {
938 /**
939 * Should not have received Reassocication confirm
940 * from MLM in other states OR on AP.
941 * Log error
942 */
943 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530944 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700945 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
946 return;
947 }
948 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530949 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 psessionEntry->pLimReAssocReq = NULL;
951 }
952
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530953 /* Upon Reassoc success or failure, freeup the cached
954 * preauth request, to ensure that channel switch is now
955 * allowed following any change in HT params.
956 */
957 if (pMac->ft.ftPEContext.pFTPreAuthReq)
958 {
959 limLog(pMac, LOG1, "%s: Freeing pFTPreAuthReq= %p", __func__,
960 pMac->ft.ftPEContext.pFTPreAuthReq);
961 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
962 {
963 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
964 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
965 }
966 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
967 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
968 }
969
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530970 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
972 // Successful Reassociation
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530973 limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700974
975 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700976 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700977
978 /**
979 * Need to send Reassoc response with
980 * Reassociation success to Host.
981 */
982 limSendSmeJoinReassocRsp(
983 pMac, eWNI_SME_REASSOC_RSP,
984 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
985 psessionEntry->smeSessionId,psessionEntry->transactionId);
986 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
987 /** Reassociation failure With the New AP
988 * but we still have the link with the Older AP
989 */
990 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700991 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700992
993 /**
994 * Need to send Reassoc response with
995 * Association failure to Host.
996 */
997 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
998 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
999 psessionEntry->smeSessionId,psessionEntry->transactionId);
1000 }else {
Mukul Sharmaa052e3d2014-09-08 23:47:06 +05301001 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
1002 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
1003 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
1004 */
1005 if(pLimMlmReassocCnf->resultCode
1006 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
1007 {
1008 // Reassociation failure
1009 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
1010 }
1011 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 /**
1013 * Need to send Reassoc response with
1014 * Association failure to Host.
1015 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001016 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 }
1018} /*** end limProcessMlmReassocCnf() ***/
1019
1020/**
1021 * limProcessMlmReassocInd()
1022 *
1023 *FUNCTION:
1024 * This function is called to processes MLM_REASSOC_IND
1025 * message from MLM State machine.
1026 *
1027 *LOGIC:
1028 *
1029 *ASSUMPTIONS:
1030 *
1031 *NOTE:
1032 *
1033 * @param pMac Pointer to Global MAC structure
1034 * @param pMsgBuf A pointer to the MLM message buffer
1035 *
1036 * @return None
1037 */
1038void
1039limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1040{
1041 tANI_U32 len;
1042 tSirMsgQ msgQ;
1043 tSirSmeReassocInd *pSirSmeReassocInd;
1044 tpDphHashNode pStaDs=0;
1045 tpPESession psessionEntry;
1046 tANI_U8 sessionId;
1047 if(pMsgBuf == NULL)
1048 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001049 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 return;
1051 }
1052 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1053 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001054 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 return;
1056 }
1057 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301059 pSirSmeReassocInd = vos_mem_malloc(len);
1060 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 {
1062 // Log error
1063 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301064 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 return;
1066
1067 }
1068 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1069 eWNI_SME_REASSOC_IND);
1070 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1071 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1072
1073 // Required for indicating the frames to upper layer
1074 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1075 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1076 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1077 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1078
1079 msgQ.type = eWNI_SME_REASSOC_IND;
1080 msgQ.bodyptr = pSirSmeReassocInd;
1081 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301082 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001083#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1084 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1085#endif //FEATURE_WLAN_DIAG_SUPPORT
1086 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1087 if (! pStaDs)
1088 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001089 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301091 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 return;
1093 }
1094
1095 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301096 limLog(pMac, LOG1,
1097 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 /*
1099 ** turn on a timer to detect the loss of REASSOC CNF
1100 **/
1101 limActivateCnfTimer(pMac,
1102 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1103} /*** end limProcessMlmReassocInd() ***/
1104
1105/**
1106 * limProcessMlmAuthInd()
1107 *
1108 *FUNCTION:
1109 * This function is called to processes MLM_AUTH_IND
1110 * message from MLM State machine.
1111 *
1112 *LOGIC:
1113 *
1114 *ASSUMPTIONS:
1115 *
1116 *NOTE:
1117 *
1118 * @param pMac Pointer to Global MAC structure
1119 * @param pMsgBuf A pointer to the MLM message buffer
1120 *
1121 * @return None
1122 */
1123void
1124limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1125{
1126 tSirMsgQ msgQ;
1127 tSirSmeAuthInd *pSirSmeAuthInd;
1128
1129 if(pMsgBuf == NULL)
1130 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001131 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 return;
1133 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301134 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1135 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 {
1137 // Log error
1138 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301139 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 }
1141 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1142 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1143 (tANI_U8 *) &(pSirSmeAuthInd->length));
1144 msgQ.type = eWNI_SME_AUTH_IND;
1145 msgQ.bodyptr = pSirSmeAuthInd;
1146 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301147 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001148#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1149 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1150#endif //FEATURE_WLAN_DIAG_SUPPORT
1151 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1152} /*** end limProcessMlmAuthInd() ***/
1153
1154
1155
1156
1157void
1158limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1159 tSirSmeAssocInd *pSirSmeAssocInd,
1160 tpPESession psessionEntry)
1161{
1162 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1163 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1164
1165 // Required for indicating the frames to upper layer
1166 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1167 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1168
1169 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1170 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1171
1172 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301173 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1174 sizeof(tSirMacAddr));
1175
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 // Fill in aid
1177 pSirSmeAssocInd->aid = pAssocInd->aid;
1178 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301179 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 // Fill in staId
1181 //pSirSmeAssocInd->staId = psessionEntry->staId;
1182 // Fill in authType
1183 pSirSmeAssocInd->authType = pAssocInd->authType;
1184 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301185 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1186 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301188 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1189 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1190 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301193 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1194 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1195 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001196
1197 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1199 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1200 {
1201 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1202 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1203 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301204 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301206 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 // Fill in WmmInfo
1209 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301210#ifdef WLAN_FEATURE_AP_HT40_24G
1211 pSirSmeAssocInd->HT40MHzIntoEnabledSta = pAssocInd->HT40MHzIntoPresent;
Sushant Kaushik87787972015-09-11 16:05:00 +05301212 limLog(pMac, LOGW, FL("HT40MHzIntoPresent: %d"),
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301213 pSirSmeAssocInd->HT40MHzIntoEnabledSta);
1214#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001215} /*** end limAssocIndSerDes() ***/
1216
1217
1218
1219/**
1220 * limProcessMlmAssocInd()
1221 *
1222 *FUNCTION:
1223 * This function is called to processes MLM_ASSOC_IND
1224 * message from MLM State machine.
1225 *
1226 *LOGIC:
1227 *
1228 *ASSUMPTIONS:
1229 *
1230 *NOTE:
1231 *
1232 * @param pMac Pointer to Global MAC structure
1233 * @param pMsgBuf A pointer to the MLM message buffer
1234 *
1235 * @return None
1236 */
1237void
1238limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1239{
1240 tANI_U32 len;
1241 tSirMsgQ msgQ;
1242 tSirSmeAssocInd *pSirSmeAssocInd;
1243 tpDphHashNode pStaDs=0;
1244 tpPESession psessionEntry;
1245 if(pMsgBuf == NULL)
1246 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001247 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 return;
1249 }
1250 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1251 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001252 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 return;
1254 }
1255 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001256 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301257 pSirSmeAssocInd = vos_mem_malloc(len);
1258 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 {
1260 // Log error
1261 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301262 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 return;
1264 }
1265
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1267 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 msgQ.type = eWNI_SME_ASSOC_IND;
1269 msgQ.bodyptr = pSirSmeAssocInd;
1270 msgQ.bodyval = 0;
1271 pStaDs = dphGetHashEntry(pMac,
1272 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1273 if (! pStaDs)
1274 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001275 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301277 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001278
1279 return;
1280 }
1281 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301283 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1284 msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1286 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1287#endif //FEATURE_WLAN_DIAG_SUPPORT
1288 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1289
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301290 limLog(pMac, LOG1,
1291 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 /*
1293 ** turn on a timer to detect the loss of ASSOC CNF
1294 **/
1295 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1296
1297// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1298#ifdef TEST_BTAMP_AP
1299//tANI_U32 *pMsgBuf;
1300{
1301 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301302 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1303 if ( NULL == pSmeAssoccnf )
1304 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1306 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301307 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1308 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1310 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301311 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1312 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301314 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1316 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301317 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001318}
1319#endif
1320
1321
1322} /*** end limProcessMlmAssocInd() ***/
1323
1324
1325
1326
1327/**
1328 * limProcessMlmDisassocInd()
1329 *
1330 *FUNCTION:
1331 * This function is called to processes MLM_DISASSOC_IND
1332 * message from MLM State machine.
1333 *
1334 *LOGIC:
1335 *
1336 *ASSUMPTIONS:
1337 *
1338 *NOTE:
1339 *
1340 * @param pMac Pointer to Global MAC structure
1341 * @param pMsgBuf A pointer to the MLM message buffer
1342 *
1343 * @return None
1344 */
1345void
1346limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1347{
1348 tLimMlmDisassocInd *pMlmDisassocInd;
1349 tpPESession psessionEntry;
1350 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1351 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1352 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001353 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 return;
1355 }
1356 switch (psessionEntry->limSystemRole)
1357 {
1358 case eLIM_STA_IN_IBSS_ROLE:
1359 break;
1360 case eLIM_STA_ROLE:
1361 case eLIM_BT_AMP_STA_ROLE:
1362 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001363 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 break;
1365 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301366 limLog(pMac, LOG1,
1367 FL("*** Peer staId = %d Disassociated ***"),
1368 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 // Send SME_DISASOC_IND after Polaris cleanup
1370 // (after receiving LIM_MLM_PURGE_STA_IND)
1371 break;
1372 } // end switch (psessionEntry->limSystemRole)
1373} /*** end limProcessMlmDisassocInd() ***/
1374
1375/**
1376 * limProcessMlmDisassocCnf()
1377 *
1378 *FUNCTION:
1379 * This function is called to processes MLM_DISASSOC_CNF
1380 * message from MLM State machine.
1381 *
1382 *LOGIC:
1383 *
1384 *ASSUMPTIONS:
1385 *
1386 *NOTE:
1387 *
1388 * @param pMac Pointer to Global MAC structure
1389 * @param pMsgBuf A pointer to the MLM message buffer
1390 *
1391 * @return None
1392 */
1393void
1394limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1395{
1396 tSirResultCodes resultCode;
1397 tLimMlmDisassocCnf *pMlmDisassocCnf;
1398 tpPESession psessionEntry;
1399 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1400 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1401 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001402 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 return;
1404 }
1405 resultCode = (tSirResultCodes)
1406 (pMlmDisassocCnf->disassocTrigger ==
1407 eLIM_LINK_MONITORING_DISASSOC) ?
1408 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1409 pMlmDisassocCnf->resultCode;
1410 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1411 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 // Disassociate Confirm from MLM
1413 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1414 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1415 {
1416 /**
1417 * Should not have received
1418 * Disassocate confirm
1419 * from MLM in other states.
1420 * Log error
1421 */
1422 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301423 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 return;
1425 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 if (pMac->lim.gLimRspReqd)
1427 pMac->lim.gLimRspReqd = false;
1428 if (pMlmDisassocCnf->disassocTrigger ==
1429 eLIM_PROMISCUOUS_MODE_DISASSOC)
1430 {
1431 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1432 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1433 else
1434 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001435 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 // Send Promiscuous mode response to host
1437 limSendSmePromiscuousModeRsp(pMac);
1438 }
1439 else
1440 {
1441 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1442 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1443 else
1444 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001445 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001446 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1447 resultCode,
1448 pMlmDisassocCnf->disassocTrigger,
1449 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1450 }
1451 }
1452 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1453 {
1454 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1455 resultCode,
1456 pMlmDisassocCnf->disassocTrigger,
1457 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1458 }
1459} /*** end limProcessMlmDisassocCnf() ***/
1460
1461/**
1462 * limProcessMlmDeauthInd()
1463 *
1464 *FUNCTION:
1465 * This function is called to processes MLM_DEAUTH_IND
1466 * message from MLM State machine.
1467 *
1468 *LOGIC:
1469 *
1470 *ASSUMPTIONS:
1471 *
1472 *NOTE:
1473 *
1474 * @param pMac Pointer to Global MAC structure
1475 * @param pMsgBuf A pointer to the MLM message buffer
1476 *
1477 * @return None
1478 */
1479void
1480limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1481{
1482 tLimMlmDeauthInd *pMlmDeauthInd;
1483 tpPESession psessionEntry;
1484 tANI_U8 sessionId;
1485 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1486 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1487 {
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05301488 PELOGE(limLog(pMac, LOGE,FL("session does not exist for Addr:" MAC_ADDRESS_STR),
1489 MAC_ADDR_ARRAY(pMlmDeauthInd->peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 return;
1491 }
1492 switch (psessionEntry->limSystemRole)
1493 {
1494 case eLIM_STA_IN_IBSS_ROLE:
1495 break;
1496 case eLIM_STA_ROLE:
1497 case eLIM_BT_AMP_STA_ROLE:
1498 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001499 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001500
1501 default: // eLIM_AP_ROLE
1502 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301503 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001504 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301505 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 }
1507 // Send SME_DEAUTH_IND after Polaris cleanup
1508 // (after receiving LIM_MLM_PURGE_STA_IND)
1509 break;
1510 } // end switch (psessionEntry->limSystemRole)
1511} /*** end limProcessMlmDeauthInd() ***/
1512
1513/**
1514 * limProcessMlmDeauthCnf()
1515 *
1516 *FUNCTION:
1517 * This function is called to processes MLM_DEAUTH_CNF
1518 * message from MLM State machine.
1519 *
1520 *LOGIC:
1521 *
1522 *ASSUMPTIONS:
1523 *
1524 *NOTE:
1525 *
1526 * @param pMac Pointer to Global MAC structure
1527 * @param pMsgBuf A pointer to the MLM message buffer
1528 *
1529 * @return None
1530 */
1531void
1532limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1533{
1534 tANI_U16 aid;
1535 tSirResultCodes resultCode;
1536 tLimMlmDeauthCnf *pMlmDeauthCnf;
1537 tpPESession psessionEntry;
1538
1539 if(pMsgBuf == NULL)
1540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001541 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 return;
1543 }
1544 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1545 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001547 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 return;
1549 }
1550
1551 resultCode = (tSirResultCodes)
1552 (pMlmDeauthCnf->deauthTrigger ==
1553 eLIM_LINK_MONITORING_DEAUTH) ?
1554 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1555 pMlmDeauthCnf->resultCode;
1556 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1557 pMlmDeauthCnf->aid : 1;
1558 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1559 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 // Deauth Confirm from MLM
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05301561 if ((psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1562 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 {
1564 /**
1565 * Should not have received Deauth confirm
1566 * from MLM in other states.
1567 * Log error
1568 */
1569 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301570 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 psessionEntry->limSmeState);)
1572 return;
1573 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1575 {
1576 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301577 limLog(pMac, LOG1,
1578 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 }
1580 else
1581 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001582 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001583
1584 if (pMac->lim.gLimRspReqd)
1585 pMac->lim.gLimRspReqd = false;
1586 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1588 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1589 resultCode,
1590 pMlmDeauthCnf->deauthTrigger,
1591 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001592} /*** end limProcessMlmDeauthCnf() ***/
1593
1594/**
1595 * limProcessMlmPurgeStaInd()
1596 *
1597 *FUNCTION:
1598 * This function is called to processes MLM_PURGE_STA_IND
1599 * message from MLM State machine.
1600 *
1601 *LOGIC:
1602 *
1603 *ASSUMPTIONS:
1604 *
1605 *NOTE:
1606 *
1607 * @param pMac Pointer to Global MAC structure
1608 * @param pMsgBuf A pointer to the MLM message buffer
1609 *
1610 * @return None
1611 */
1612void
1613limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1614{
1615 tSirResultCodes resultCode;
1616 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1617 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 if(pMsgBuf == NULL)
1619 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001620 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 return;
1622 }
1623 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1624 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1625 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001626 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 return;
1628 }
1629 // Purge STA indication from MLM
1630 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1631 switch (psessionEntry->limSystemRole)
1632 {
1633 case eLIM_STA_IN_IBSS_ROLE:
1634 break;
1635 case eLIM_STA_ROLE:
1636 case eLIM_BT_AMP_STA_ROLE:
1637 default: // eLIM_AP_ROLE
1638 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1639 (psessionEntry->limSmeState !=
1640 eLIM_SME_WT_DISASSOC_STATE) &&
1641 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1642 {
1643 /**
1644 * Should not have received
1645 * Purge STA indication
1646 * from MLM in other states.
1647 * Log error
1648 */
1649 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301650 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001651 psessionEntry->limSmeState);)
1652 break;
1653 }
1654 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001655 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 pMlmPurgeStaInd->aid);)
1657 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1658 {
1659 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001660 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001661
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 }
1663 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1664 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 limSendSmeDeauthNtf(pMac,
1666 pMlmPurgeStaInd->peerMacAddr,
1667 resultCode,
1668 pMlmPurgeStaInd->purgeTrigger,
1669 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 }
1671 else
1672 limSendSmeDisassocNtf(pMac,
1673 pMlmPurgeStaInd->peerMacAddr,
1674 resultCode,
1675 pMlmPurgeStaInd->purgeTrigger,
1676 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1677 } // end switch (psessionEntry->limSystemRole)
1678} /*** end limProcessMlmPurgeStaInd() ***/
1679
1680/**
1681 * limProcessMlmSetKeysCnf()
1682 *
1683 *FUNCTION:
1684 * This function is called to processes MLM_SETKEYS_CNF
1685 * message from MLM State machine.
1686 *
1687 *LOGIC:
1688 *
1689 *ASSUMPTIONS:
1690 *
1691 *NOTE:
1692 *
1693 * @param pMac Pointer to Global MAC structure
1694 * @param pMsgBuf A pointer to the MLM message buffer
1695 *
1696 * @return None
1697 */
1698void
1699limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1700{
1701 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001702 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301704 tANI_U16 aid;
1705 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001706
1707 if(pMsgBuf == NULL)
1708 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001709 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001710 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 }
1712 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1713 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1714 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001715 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 return;
1717 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301718 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001720 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301722 /* if the status is success keys are installed in the
1723 * Firmware so we can set the protection bit
1724 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301725 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301726 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301727 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1728 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1729 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1730 &psessionEntry->dph.dphHashTable);
1731 if (pStaDs != NULL)
1732 pStaDs->isKeyInstalled = 1;
1733 }
1734 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 limSendSmeSetContextRsp(pMac,
1736 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1739 psessionEntry->transactionId);
1740} /*** end limProcessMlmSetKeysCnf() ***/
1741/**
1742 * limProcessMlmRemoveKeyCnf()
1743 *
1744 *FUNCTION:
1745 * This function is called to processes MLM_REMOVEKEY_CNF
1746 * message from MLM State machine.
1747 *
1748 *LOGIC:
1749 *
1750 *ASSUMPTIONS:
1751 *
1752 *NOTE:
1753 *
1754 * @param pMac Pointer to Global MAC structure
1755 * @param pMsgBuf A pointer to the MLM message buffer
1756 *
1757 * @return None
1758 */
1759void
1760limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1761{
1762 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001763 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 tpPESession psessionEntry;
1765
1766 if(pMsgBuf == NULL)
1767 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001768 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001769 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 }
1771 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1772 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1773 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001774 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 return;
1776 }
1777 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001778 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 pMlmRemoveKeyCnf->resultCode );
1780 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001781 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1783 psessionEntry->smeSessionId,psessionEntry->transactionId);
1784} /*** end limProcessMlmRemoveKeyCnf() ***/
1785
1786
1787/**
1788 * limHandleSmeJoinResult()
1789 *
1790 *FUNCTION:
1791 * This function is called to process join/auth/assoc failures
1792 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1793 * MLM_ASSOC_CNF with a success code in case of STA role and
1794 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1795 *
1796 *LOGIC:
1797 *
1798 *ASSUMPTIONS:
1799 *
1800 *NOTE:
1801 *
1802 * @param pMac Pointer to Global MAC structure
1803 * @param resultCode Failure code to be sent
1804 *
1805 *
1806 * @return None
1807 */
1808static void
1809limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1810{
1811 tpDphHashNode pStaDs = NULL;
1812 tANI_U8 smesessionId;
1813 tANI_U16 smetransactionId;
1814
1815 /* Newly Added on oct 11 th*/
1816 if(psessionEntry == NULL)
1817 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001818 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 return;
1820 }
1821 smesessionId = psessionEntry->smeSessionId;
1822 smetransactionId = psessionEntry->transactionId;
1823 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1824 if(resultCode != eSIR_SME_SUCCESS)
1825 {
1826 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1827 if (pStaDs != NULL)
1828 {
1829 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1830 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1831 pStaDs->mlmStaContext.resultCode = resultCode;
1832 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1833 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1834 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301835 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001836 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 return;
1838 }
1839 }
1840
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301841 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 psessionEntry->pLimJoinReq = NULL;
1843 //Delete teh session if JOIN failure occurred.
1844 if(resultCode != eSIR_SME_SUCCESS)
1845 {
1846 if(NULL != psessionEntry)
1847 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001848 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1849 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001850 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 peDeleteSession(pMac,psessionEntry);
1852 psessionEntry = NULL;
1853 }
1854 }
1855 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1856 smesessionId, smetransactionId);
1857} /*** end limHandleSmeJoinResult() ***/
1858
1859/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001860 * limHandleSmeReaasocResult()
1861 *
1862 *FUNCTION:
1863 * This function is called to process reassoc failures
1864 * upon receiving REASSOC_CNF with a failure code or
1865 * MLM_REASSOC_CNF with a success code in case of STA role
1866 *
1867 *LOGIC:
1868 *
1869 *ASSUMPTIONS:
1870 *
1871 *NOTE:
1872 *
1873 * @param pMac Pointer to Global MAC structure
1874 * @param resultCode Failure code to be sent
1875 *
1876 *
1877 * @return None
1878 */
1879static void
1880limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1881{
1882 tpDphHashNode pStaDs = NULL;
1883 tANI_U8 smesessionId;
1884 tANI_U16 smetransactionId;
1885
1886 if(psessionEntry == NULL)
1887 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001888 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001889 return;
1890 }
1891 smesessionId = psessionEntry->smeSessionId;
1892 smetransactionId = psessionEntry->transactionId;
1893 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1894 if(resultCode != eSIR_SME_SUCCESS)
1895 {
1896 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1897 if (pStaDs != NULL)
1898 {
1899 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1900 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1901 pStaDs->mlmStaContext.resultCode = resultCode;
1902 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1903 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1904 return;
1905 }
1906 }
1907
1908 //Delete teh session if REASSOC failure occurred.
1909 if(resultCode != eSIR_SME_SUCCESS)
1910 {
1911 if(NULL != psessionEntry)
1912 {
1913 peDeleteSession(pMac,psessionEntry);
1914 psessionEntry = NULL;
1915 }
1916 }
1917 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1918 smesessionId, smetransactionId);
1919} /*** end limHandleSmeReassocResult() ***/
1920
1921/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 * limProcessMlmAddStaRsp()
1923 *
1924 *FUNCTION:
1925 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1926 * Upon receipt of this message from HAL, MLME -
1927 * > Determines the "state" in which this message was received
1928 * > Forwards it to the appropriate callback
1929 *
1930 *ASSUMPTIONS:
1931 *
1932 *NOTE:
1933 *
1934 * @param pMac Pointer to Global MAC structure
1935 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1936 *
1937 * @return None
1938 */
1939void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1940{
1941 //we need to process the deferred message since the initiating req. there might be nested request.
1942 //in the case of nested request the new request initiated from the response will take care of resetting
1943 //the deffered flag.
1944 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 )
1948 {
1949 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1950 return;
1951 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001953}
1954void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1955{
1956 tLimMlmAssocCnf mlmAssocCnf;
1957 tpDphHashNode pStaDs;
1958 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1959 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1960
1961 if(NULL == pAddStaParams )
1962 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001963 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 return;
1965 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301966
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301967 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301969 PELOGE(limLog(pMac, LOGE,
1970 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05301971
1972 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
1973 {
1974 PELOGE(limLog(pMac, LOGE,
1975 FL("ADD_STA success, send update result code with"
1976 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
1977 "limMlmState: %d"), pAddStaParams->staIdx,
1978 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301979 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1980 mesgType = LIM_MLM_REASSOC_CNF;
1981 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
1982 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
1983 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05301984 mlmAssocCnf.resultCode =
1985 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
1986 psessionEntry->staId = pAddStaParams->staIdx;
1987 goto end;
1988 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301989 }
1990
1991 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1992 {
1993 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 {
1995 //TODO: any response to be sent out here ?
1996 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301997 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001998 psessionEntry->limMlmState);
1999 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2000 goto end;
2001 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05302002
2003 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2004 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 //
2006 // Update the DPH Hash Entry for this STA
2007 // with proper state info
2008 //
2009 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2010 if( NULL != pStaDs)
2011 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
2012 else
2013 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002014 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 DPH_STA_HASH_INDEX_PEER);
2016 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002017 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 /*
2019 * Storing the self StaIndex(Generated by HAL) in session context,
2020 * instead of storing it in DPH Hash entry for Self STA.
2021 * DPH entry for the self STA stores the sta index for the BSS entry
2022 * to which the STA is associated.
2023 */
2024 psessionEntry->staId = pAddStaParams->staIdx;
2025 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002026#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2027 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2028#endif
2029 {
2030 limReactivateHeartBeatTimer(pMac, psessionEntry);
2031 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002032 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002033
2034 //assign the sessionId to the timer Object
2035 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2036 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002037 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002038#ifdef WLAN_DEBUG
2039 pMac->lim.gLimNumLinkEsts++;
2040#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002041#ifdef FEATURE_WLAN_TDLS
2042 /* initialize TDLS peer related data */
2043 limInitTdlsData(pMac,psessionEntry);
2044#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 // Return Assoc confirm to SME with success
2046 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2047 // be passed in here....
2048 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2049 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2050 }
2051 else
2052 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302053 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302054 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2055 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2057 }
2058end:
2059 if( 0 != limMsgQ->bodyptr )
2060 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302061 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002062 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 }
2064 /* Updating PE session Id*/
2065 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2066 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302067 if (true == psessionEntry->fDeauthReceived)
2068 {
2069 psessionEntry->fDeauthReceived = false;
2070 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 return;
2072}
2073void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2074{
2075 //we need to process the deferred message since the initiating req. there might be nested request.
2076 //in the case of nested request the new request initiated from the response will take care of resetting
2077 //the deffered flag.
2078 // tpPESession psessionEntry;
2079 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2080 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2081 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002082 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 // return;
2084 // }
2085 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002086
2087 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2088 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 ) &&
2091 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2092 {
2093 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2094 return;
2095 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002097
2098 if(!limIsInMCC(pMac))
2099 {
2100 WDA_TrafficStatsTimerActivate(FALSE);
2101 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002102
2103#ifdef WLAN_FEATURE_11W
2104 if (psessionEntry->limRmfEnabled)
2105 {
2106 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2107 {
2108 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002109 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002110 }
2111 }
2112#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002113}
2114
2115void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2116{
2117 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2118 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2119 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302120
2121 if (NULL == pDelBssParams)
2122 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002123 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302124 goto end;
2125 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2127 {
2128 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002129 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2131 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2132
2133 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002134 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 statusCode = eSIR_SME_REFUSED;
2136 goto end;
2137 }
2138 if(pStaDs == NULL)
2139 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002140 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 statusCode = eSIR_SME_REFUSED;
2142 goto end;
2143 }
2144 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2145 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302146 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 pStaDs->mlmStaContext.mlmState);)
2148 statusCode = eSIR_SME_REFUSED;
2149 goto end;
2150 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302151 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2152 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 }
2154 else
2155 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302156 /* If DelBSS response is failure, go ahead and
2157 * post response to SME
2158 */
2159 limLog( pMac, LOGE, FL( "DEL BSS failed! Status:%d" ),
2160 pDelBssParams->status );
2161 statusCode = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302163
2164end:
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 if( 0 != limMsgQ->bodyptr )
2166 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302167 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002168 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 }
2170 if(pStaDs == NULL)
2171 return;
2172 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2173 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2174 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2175 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2176 {
2177 /** The Case where the DelBss is invoked from
2178 * context of other than normal DisAssoc / Deauth OR
2179 * as part of Join Failure.
2180 */
2181 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2182 return;
2183 }
2184 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2185 return;
2186}
2187
Jeff Johnson295189b2012-06-20 16:38:30 -07002188void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2189{
2190 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002191 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2193 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2194
2195 if(psessionEntry == NULL)
2196 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002197 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002198 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002199 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302200 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002201 limMsgQ->bodyptr = NULL;
2202 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 return;
2204 }
2205
2206 if (pDelBss == NULL)
2207 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002208 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 rc = eSIR_SME_REFUSED;
2210 goto end;
2211 }
2212 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002213 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2214
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2216 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002217 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302218 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002219 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002220 rc = eSIR_SME_REFUSED;
2221 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 }
2223 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2224 {
2225 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2226 pDelBss->status, pDelBss->bssIdx);
2227 rc = eSIR_SME_STOP_BSS_FAILURE;
2228 goto end;
2229 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002230 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002232 if (status != eSIR_SUCCESS)
2233 {
2234 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002236 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 /** Softmac may send all the buffered packets right after resuming the transmission hence
2238 * to occupy the medium during non channel occupancy period. So resume the transmission after
2239 * HAL gives back the response.
2240 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002241#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 if (LIM_IS_RADAR_DETECTED(pMac))
2243 {
2244 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2245 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2246 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002247#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2249 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002251 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 end:
2253 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2254 peDeleteSession(pMac, psessionEntry);
2255
2256 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002257 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302258 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002259 limMsgQ->bodyptr = NULL;
2260 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002261}
2262
2263void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2264{
2265 //we need to process the deferred message since the initiating req. there might be nested request.
2266 //in the case of nested request the new request initiated from the response will take care of resetting
2267 //the deffered flag.
2268
2269 tpPESession psessionEntry;
2270 tpDeleteStaParams pDeleteStaParams;
2271 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2272 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302273
2274 if(NULL == pDeleteStaParams ||
2275 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002277 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002278 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002279 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302280 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002281 limMsgQ->bodyptr = NULL;
2282 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 return;
2284 }
2285
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 )
2289 {
2290 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2291 return;
2292 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002294}
2295
Jeff Johnson295189b2012-06-20 16:38:30 -07002296void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2297{
2298 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2299 tpDphHashNode pStaDs;
2300 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2301 if(limMsgQ->bodyptr == NULL)
2302 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302303 limLog( pMac, LOGE,
2304 FL( "limMsgQ->bodyptry NULL"));
2305 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2308 if(pStaDs == NULL)
2309 {
2310 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302311 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302313 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002314 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002315
2316 return;
2317 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302318 limLog( pMac, LOG1,
2319 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2320 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2322 {
2323 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302324 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002325
2326 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2327 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2328 {
2329 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002330 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2332 statusCode = eSIR_SME_REFUSED;
2333 goto end;
2334 }
2335
2336 limLog( pMac, LOG1,
2337 FL("Deleted STA AssocID %d staId %d MAC "),
2338 pStaDs->assocId, pStaDs->staIndex);
2339 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2340 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2341 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302342 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002343 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002344 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 {
2346 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002347 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 pStaDs->assocId);)
2349 // delete the TS if it has already been added.
2350 // send the response with error status.
2351 if(pStaDs->qos.addtsPresent)
2352 {
2353 tpLimTspecInfo pTspecInfo;
2354 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2355 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2356 {
2357 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2358 NULL, &pTspecInfo->idx);
2359 }
2360 }
2361 limRejectAssociation(pMac,
2362 pStaDs->staAddr,
2363 pStaDs->mlmStaContext.subType,
2364 true, pStaDs->mlmStaContext.authType,
2365 pStaDs->assocId, true,
2366 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2367 psessionEntry);
2368 }
2369 return;
2370 }
2371 }
2372 else
2373 {
2374 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002375 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 statusCode = eSIR_SME_REFUSED;
2377 }
2378 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302379 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002380 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2382 {
2383 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2384 }
2385 return;
2386}
2387
2388void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2389{
2390 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2391 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2392 tpDphHashNode pStaDs = NULL;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302393
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 if(NULL == pDelStaParams )
2395 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002396 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 goto end;
2398 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302399
2400 limLog(pMac, LOG1, FL("Del STA RSP received. Status:%d AssocID:%d"),
2401 pDelStaParams->status, pDelStaParams->assocId);
2402
2403 if (eHAL_STATUS_SUCCESS != pDelStaParams->status)
Jeff Johnson295189b2012-06-20 16:38:30 -07002404 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302405 limLog(pMac, LOGE, FL("Del STA failed! Status:%d, still proceeding"
2406 "with Del BSS"), pDelStaParams->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302408
2409 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2410
2411 if (pStaDs == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 {
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302413 //TODO: any response to be sent out here ?
2414 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
2415 pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 statusCode = eSIR_SME_REFUSED;
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302417 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 }
Kanchanapally, Vidyullatha8bfa41d2015-03-18 15:43:41 +05302419
2420 if (eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2421 {
2422 //TODO: any response to be sent out here ?
2423 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
2424 limMlmStateStr(psessionEntry->limMlmState));
2425 statusCode = eSIR_SME_REFUSED;
2426 goto end;
2427 }
2428
2429 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2430 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2431
2432 //we must complete all cleanup related to delSta before calling limDelBSS.
2433 if (0 != limMsgQ->bodyptr )
2434 {
2435 vos_mem_free(pDelStaParams);
2436 limMsgQ->bodyptr = NULL;
2437 }
2438
2439 // Proceed to do DelBSS even if DelSta resulted in failure
2440 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2441 return;
2442
Jeff Johnson295189b2012-06-20 16:38:30 -07002443end:
2444 if( 0 != limMsgQ->bodyptr )
2445 {
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 }
2449 return;
2450}
2451
Jeff Johnson295189b2012-06-20 16:38:30 -07002452void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2453{
2454 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302455 tpDphHashNode pStaDs = NULL;
2456
2457 if (NULL == pAddStaParams)
2458 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002459 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302460 goto end;
2461 }
2462
2463 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002464 if(pStaDs == NULL)
2465 {
2466 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002467 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 goto end;
2469 }
2470 //
2471 // TODO & FIXME_GEN4
2472 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2473 //
2474 //TODO: any check for pMac->lim.gLimMlmState ?
2475 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2476 {
2477 //TODO: any response to be sent out here ?
2478 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302479 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 pStaDs->mlmStaContext.mlmState);
2481 goto end;
2482 }
2483 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2484 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002485 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 limRejectAssociation(pMac, pStaDs->staAddr,
2487 pStaDs->mlmStaContext.subType,
2488 true, pStaDs->mlmStaContext.authType,
2489 pStaDs->assocId, true,
2490 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2491 psessionEntry);
2492 goto end;
2493 }
2494 pStaDs->bssId = pAddStaParams->bssIdx;
2495 pStaDs->staIndex = pAddStaParams->staIdx;
2496 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2497 pStaDs->valid = 1;
2498 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2499 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302500 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 pStaDs->assocId,
2502 pStaDs->staIndex);
2503 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2504
2505 /* For BTAMP-AP, the flow sequence shall be:
2506 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2507 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2508 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2509 */
2510 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2511 // fall though to reclaim the original Add STA Response message
2512end:
2513 if( 0 != limMsgQ->bodyptr )
2514 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302515 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002516 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 }
2518 return;
2519}
2520
2521/**
2522 * limProcessApMlmAddBssRsp()
2523 *
2524 *FUNCTION:
2525 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2526 * Upon receipt of this message from HAL, MLME -
2527 * > Validates the result of WDA_ADD_BSS_REQ
2528 * > Init other remaining LIM variables
2529 * > Init the AID pool, for that BSSID
2530 * > Init the Pre-AUTH list, for that BSSID
2531 * > Create LIM timers, specific to that BSSID
2532 * > Init DPH related parameters that are specific to that BSSID
2533 * > TODO - When do we do the actual change channel?
2534 *
2535 *LOGIC:
2536 * SME sends eWNI_SME_START_BSS_REQ to LIM
2537 * LIM sends LIM_MLM_START_REQ to MLME
2538 * MLME sends WDA_ADD_BSS_REQ to HAL
2539 * HAL responds with WDA_ADD_BSS_RSP to MLME
2540 * MLME responds with LIM_MLM_START_CNF to LIM
2541 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2542 *
2543 *ASSUMPTIONS:
2544 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2545 * tSirMsgQ.body will now be freed by this routine
2546 *
2547 *NOTE:
2548 *
2549 * @param pMac Pointer to Global MAC structure
2550 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2551 *
2552 * @return None
2553 */
2554static void
2555limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2556{
2557 tLimMlmStartCnf mlmStartCnf;
2558 tANI_U32 val;
2559 tpPESession psessionEntry;
2560// tANI_U8 sessionId;
2561 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2562 if(NULL == pAddBssParams )
2563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 goto end;
2566 }
2567 //TBD: free the memory before returning, do it for all places where lookup fails.
2568 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002570 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002571 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002572 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302573 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302574 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002575 limMsgQ->bodyptr = NULL;
2576 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 return;
2578 }
2579 /* Update PE session Id*/
2580 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2581 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2582 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302583 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002584 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2585 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2586 goto end;
2587 // Set MLME state
2588 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002589 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2591 {
2592 /** IBSS is 'active' when we receive
2593 * Beacon frames from other STAs that are part of same IBSS.
2594 * Mark internal state as inactive until then.
2595 */
2596 psessionEntry->limIbssActive = false;
2597 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2598 limResetHBPktCount( psessionEntry );
2599 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002600 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002601 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002602 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 }
2604 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2605
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002607
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2609 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2610 else
2611 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 schEdcaProfileUpdate(pMac, psessionEntry);
2613 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002614 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 // Create timers used by LIM
2616 if (!pMac->lim.gLimTimersCreated)
2617 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002618
2619 // Start OLBC timer
2620 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2621 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002622 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002623 }
2624
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2626 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002627 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2629 // Apply previously set configuration at HW
2630 limApplyConfiguration(pMac,psessionEntry);
2631 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2632 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2633 }
2634 else
2635 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002636 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2638 }
2639 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2640 end:
2641 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002642 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302643 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302644 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002645 limMsgQ->bodyptr = NULL;
2646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002647}
2648
2649
2650/**
2651 * limProcessIbssMlmAddBssRsp()
2652 *
2653 *FUNCTION:
2654 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2655 * Upon receipt of this message from HAL, MLME -
2656 * > Validates the result of WDA_ADD_BSS_REQ
2657 * > Init other remaining LIM variables
2658 * > Init the AID pool, for that BSSID
2659 * > Init the Pre-AUTH list, for that BSSID
2660 * > Create LIM timers, specific to that BSSID
2661 * > Init DPH related parameters that are specific to that BSSID
2662 * > TODO - When do we do the actual change channel?
2663 *
2664 *LOGIC:
2665 * SME sends eWNI_SME_START_BSS_REQ to LIM
2666 * LIM sends LIM_MLM_START_REQ to MLME
2667 * MLME sends WDA_ADD_BSS_REQ to HAL
2668 * HAL responds with WDA_ADD_BSS_RSP to MLME
2669 * MLME responds with LIM_MLM_START_CNF to LIM
2670 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2671 *
2672 *ASSUMPTIONS:
2673 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2674 * tSirMsgQ.body will now be freed by this routine
2675 *
2676 *NOTE:
2677 *
2678 * @param pMac Pointer to Global MAC structure
2679 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2680 *
2681 * @return None
2682 */
2683static void
2684limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2685{
2686 tLimMlmStartCnf mlmStartCnf;
2687 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2688 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302689
2690 if (NULL == pAddBssParams)
2691 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002692 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302693 goto end;
2694 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2696 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302697 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2699 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2700 goto end;
2701 // Set MLME state
2702 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002703 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 /** IBSS is 'active' when we receive
2705 * Beacon frames from other STAs that are part of same IBSS.
2706 * Mark internal state as inactive until then.
2707 */
2708 psessionEntry->limIbssActive = false;
2709 limResetHBPktCount( psessionEntry );
2710 /* Timer related functions are not modified for BT-AMP : To be Done */
2711 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002712 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002713 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002714 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2716 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2717 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2718 schEdcaProfileUpdate(pMac, psessionEntry);
2719 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2720 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002721 if (0 == psessionEntry->freePeerIdxHead)
2722 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 // Create timers used by LIM
2724#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2725 if (!pMac->lim.gLimTimersCreated)
2726 limCreateTimers(pMac);
2727#endif
2728 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2729 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002730 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2732 // Apply previously set configuration at HW
2733 limApplyConfiguration(pMac,psessionEntry);
2734 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2735 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2736 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2737 if(true == pMac->lim.gLimIbssCoalescingHappened)
2738 {
2739 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2740 goto end;
2741 }
2742 }
2743 else
2744 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002745 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 pAddBssParams->status );
2747 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2748 }
2749 //Send this message to SME, when ADD_BSS is initiated by SME
2750 //If ADD_BSS is done as part of coalescing, this won't happen.
2751 /* Update PE session Id*/
2752 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2753 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2754 end:
2755 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002756 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302757 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302758 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002759 limMsgQ->bodyptr = NULL;
2760 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002761}
2762
2763static void
2764limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2765{
2766 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2767 tAniAuthType cfgAuthType, authMode;
2768 tLimMlmAuthReq *pMlmAuthReq;
2769 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302770
2771 if (NULL == pAddBssParams)
2772 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002773 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302774 goto joinFailure;
2775 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002776 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2777 {
2778 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2779 {
2780 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002781 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2783 goto joinFailure;
2784 }
2785 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2786 //Success, handle below
2787 pStaDs->bssId = pAddBssParams->bssIdx;
2788 //STA Index(genr by HAL) for the BSS entry is stored here
2789 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2790 // Trigger Authentication with AP
2791 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2792 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2793 {
2794 /**
2795 * Could not get AuthType from CFG.
2796 * Log error.
2797 */
2798 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002799 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 }
2801 if (cfgAuthType == eSIR_AUTO_SWITCH)
2802 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2803 else
2804 authMode = cfgAuthType;
2805
2806 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302807 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2808 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 {
2810 // Log error
2811 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302812 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 return;
2814 }
2815 #if 0
2816 val = sizeof(tSirMacAddr);
2817 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2818 pMlmAuthReq->peerMacAddr,
2819 &val) != eSIR_SUCCESS)
2820 {
2821 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002822 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 }
2824 #endif //TO SUPPORT BT-AMP
2825 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2826
2827 pMlmAuthReq->authType = authMode;
2828 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2829 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2830 != eSIR_SUCCESS)
2831 {
2832 /**
2833 * Could not get AuthFailureTimeout
2834 * value from CFG. Log error.
2835 */
2836 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002837 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 }
2839 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2840 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2841 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002842 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2844 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2845 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2846 // remember staId in case of assoc timeout/failure handling
2847 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2848
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302849 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2850 psessionEntry->peSessionId, psessionEntry->limSmeState));
2851 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2852 "with limSmeState:%d",psessionEntry->peSessionId,
2853 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 limPostMlmMessage(pMac,
2855 LIM_MLM_AUTH_REQ,
2856 (tANI_U32 *) pMlmAuthReq);
2857 return;
2858 }
2859
2860joinFailure:
2861 {
2862 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002863 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002864
2865 /// Send Join response to Host
2866 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2867
2868 }
2869
2870}
2871
2872#ifdef WLAN_FEATURE_VOWIFI_11R
2873/*------------------------------------------------------------------------------------------
2874 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002875 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2876 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 *
2878 *
2879 *------------------------------------------------------------------------------------------
2880 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002881static inline void
2882limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002883{
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002885 tpDphHashNode pStaDs = NULL;
2886 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002887 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002888 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002889 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302890#ifdef FEATURE_WLAN_ESE
2891 tLimMlmReassocReq *pMlmReassocReq;
2892 tANI_U32 val = 0;
2893#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002894
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002895 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002896
2897 if (pAddBssParams == NULL)
2898 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002899 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002900 goto end;
2901 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002902 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2903 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002904 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002905 goto end;
2906 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002907 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2908 {
2909 goto end;
2910 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002911
2912 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2913 &psessionEntry->dph.dphHashTable)) == NULL)
2914 {
2915 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002916 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2918 goto end;
2919 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302920 if (pMac->roam.configParam.roamDelayStatsEnabled)
2921 {
2922 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2923 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002924 // Prepare and send Reassociation request frame
2925 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05302926
2927
2928#ifdef FEATURE_WLAN_ESE
2929 /*
2930 * In case of Ese Reassociation, change the reassoc timer
2931 * value.
2932 */
2933 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2934 if (pMlmReassocReq == NULL)
2935 {
2936 limLog(pMac, LOGE,
2937 FL("Invalid pMlmReassocReq"));
2938 goto end;
2939 }
2940 val = pMlmReassocReq->reassocFailureTimeout;
2941 if (psessionEntry->isESEconnection)
2942 {
2943 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
2944 }
2945 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
2946 TX_SUCCESS)
2947 {
2948 limLog(pMac, LOGP,
2949 FL("unable to deactivate Reassoc failure timer"));
2950 }
2951 val = SYS_MS_TO_TICKS(val);
2952 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
2953 val, 0) != TX_SUCCESS)
2954 {
2955 limLog(pMac, LOGP,
2956 FL("unable to change Reassociation failure timer"));
2957 }
2958#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2960 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002961 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002962 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2963 != TX_SUCCESS)
2964 {
2965 /// Could not start reassoc failure timer.
2966 // Log error
2967 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002968 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 // Return Reassoc confirm with
2970 // Resources Unavailable
2971 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2972 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2973 goto end;
2974 }
Mihir Shete63561c82014-08-23 16:58:07 +05302975 // remember staId
2976 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2977
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002978#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002979 pMac->lim.pSessionEntry = psessionEntry;
2980 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2981 {
2982 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302983 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2984 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2985 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2986 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2987 psessionEntry->pLimMlmReassocReq,
2988 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002989 }
2990 pMac->lim.reAssocRetryAttempt = 0;
2991#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05302993 if (pMac->roam.configParam.roamDelayStatsEnabled)
2994 {
2995 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
2996 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2998 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002999 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003000 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 psessionEntry->limMlmState, psessionEntry->peSessionId);)
3002
3003 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3004
3005 //Success, handle below
3006 pStaDs->bssId = pAddBssParams->bssIdx;
3007 //STA Index(genr by HAL) for the BSS entry is stored here
3008 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3009 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3010 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3011
Jeff Johnson295189b2012-06-20 16:38:30 -07003012#if defined WLAN_FEATURE_VOWIFI
3013 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3014#endif
3015
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303016 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
3017 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303019 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07003020 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303022 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003023
3024 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303025 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
3026 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003027
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303028 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3029 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003030
3031 // Update this when we get reassoc rsp , with success.
3032 // pAddStaParams->assocId = psessionEntry->limAID;
3033
3034 pAddStaParams->staType = STA_ENTRY_SELF;
3035 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3036 pAddStaParams->respReqd = 1;
3037
3038 /* Update PE session ID */
3039 pAddStaParams->sessionId = psessionEntry->peSessionId;
3040
3041 // This will indicate HAL to "allocate" a new STA index
3042 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3043 pAddStaParams->updateSta = FALSE;
3044
3045 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003046#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003047 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003048#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003049 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003050#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003051
Jeff Johnsone7245742012-09-05 17:12:55 -07003052 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003054 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003055#ifdef WLAN_FEATURE_11AC
3056 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3057 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3058#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003059#ifdef DISABLE_GF_FOR_INTEROP
3060 /*
3061 * To resolve the interop problem with Broadcom AP,
3062 * where TQ STA could not pass traffic with GF enabled,
3063 * TQ STA will do Greenfield only with TQ AP, for
3064 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003065 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3067 {
3068 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3069 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3070 }
3071 else
3072#endif
3073
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003075 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3076 {
3077 pAddStaParams->txChannelWidthSet =
3078 pMac->roam.configParam.channelBondingMode24GHz;
3079 }
3080 else
3081 {
3082 pAddStaParams->txChannelWidthSet =
3083 pMac->roam.configParam.channelBondingMode5GHz;
3084 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3086 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3087 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3088 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3089 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3090 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3091 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3092 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3093 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3094 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 }
3096
3097 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003098 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003100 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3101 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 // Lets save this for when we receive the Reassoc Rsp
3103 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003104
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003105 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003106 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303107 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003108 vos_mem_free(pAddBssParams);
3109 pAddBssParams = NULL;
3110 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003111 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 return;
3113
3114end:
3115 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003116 if (psessionEntry != NULL)
3117 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003119 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3120 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003122
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003123 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003124 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303125 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003126 vos_mem_free(pAddBssParams);
3127 pAddBssParams = NULL;
3128 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003129 }
3130
3131 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3132 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303133 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003134 if (psessionEntry != NULL)
3135 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003136 else
3137 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003138
3139 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3140}
Jeff Johnson295189b2012-06-20 16:38:30 -07003141#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003142/**
3143 * limProcessStaMlmAddBssRsp()
3144 *
3145 *FUNCTION:
3146 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3147 * Upon receipt of this message from HAL, MLME -
3148 * > Validates the result of WDA_ADD_BSS_REQ
3149 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3150 *
3151 *LOGIC:
3152 * MLME had sent WDA_ADD_BSS_REQ to HAL
3153 * HAL responded with WDA_ADD_BSS_RSP to MLME
3154 * MLME now sends WDA_ADD_STA_REQ to HAL
3155 *
3156 *ASSUMPTIONS:
3157 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3158 * tSirMsgQ.body will now be freed by this routine
3159 *
3160 *NOTE:
3161 *
3162 * @param pMac Pointer to Global MAC structure
3163 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3164 *
3165 * @return None
3166 */
3167static void
3168limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3169{
3170 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3171 tLimMlmAssocCnf mlmAssocCnf;
3172 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3173 tANI_U32 subType = LIM_ASSOC;
3174 tpDphHashNode pStaDs = NULL;
3175 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3176 tANI_U8 updateSta = false;
3177 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3178
3179 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3180 {
3181 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303182 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3183 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3185 goto end;
3186 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303187
3188 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3189 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 {
3191 mesgType = LIM_MLM_REASSOC_CNF;
3192 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303193 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3194 //to update the existing STA entry.
3195 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3196 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3197 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 {
3199 staIdx = psessionEntry->staId;
3200 updateSta = true;
3201 }
3202 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003203
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003204 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003205 goto end;
3206
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3208 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003209#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3211 {
3212#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003213 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 psessionEntry->limMlmState,
3215 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3216#endif
3217 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3218 goto end;
3219 }
3220#endif /* WLAN_FEATURE_VOWIFI_11R */
3221
3222 // Set MLME state
3223 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003224 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3226 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303227 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3228 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003229 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3230 if (pStaDs == NULL)
3231 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303232 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3233 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3235 }
3236 else
3237 {
3238 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3239 //Success, handle below
3240 pStaDs->bssId = pAddBssParams->bssIdx;
3241 //STA Index(genr by HAL) for the BSS entry is stored here
3242 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3243 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3244 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3245 // Downgrade the EDCA parameters if needed
3246 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3247 // Send the active EDCA parameters to HAL
3248 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3249 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3250 } else {
3251 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3252 }
3253#if defined WLAN_FEATURE_VOWIFI
3254 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3255#endif
3256
3257 if (subType == LIM_REASSOC)
3258 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3259 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3260 {
3261 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303262 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3263 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3265 }
3266 }
3267 }
3268 else
3269 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303270 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3271 psessionEntry->peSessionId, psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303273 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3274 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3275 else
3276 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003277 }
3278
3279 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3280 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303281 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3282 //Set the RXP mode to IDLE, so it starts filtering the frames.
3283 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3284 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3285 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 /* Update PE session Id*/
3287 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3288 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3289 }
3290 end:
3291 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003292 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303293 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303294 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003295 limMsgQ->bodyptr = NULL;
3296 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003297}
3298
3299
3300
3301/**
3302 * limProcessMlmAddBssRsp()
3303 *
3304 *FUNCTION:
3305 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3306 * Upon receipt of this message from HAL, MLME -
3307 * > Determines the "state" in which this message was received
3308 * > Forwards it to the appropriate callback
3309 *
3310 *LOGIC:
3311 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3312 * in the following two states:
3313 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3314 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3315 * Based on these two states, this API will determine where to
3316 * route the message to
3317 *
3318 *ASSUMPTIONS:
3319 *
3320 *NOTE:
3321 *
3322 * @param pMac Pointer to Global MAC structure
3323 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3324 *
3325 * @return None
3326 */
3327void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3328{
3329 tLimMlmStartCnf mlmStartCnf;
3330 tpPESession psessionEntry;
3331 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3332
3333 if(NULL == pAddBssParams )
3334 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003335 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 return;
3337 }
3338
3339 //
3340 // TODO & FIXME_GEN4
3341 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3342 //
3343 //we need to process the deferred message since the initiating req. there might be nested request.
3344 //in the case of nested request the new request initiated from the response will take care of resetting
3345 //the deffered flag.
3346 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3347 // Validate SME/LIM state
3348 // Validate MLME state
3349 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3350 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303351 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3352 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003353 if( NULL != pAddBssParams )
3354 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303355 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003356 vos_mem_free(pAddBssParams);
3357 limMsgQ->bodyptr = NULL;
3358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 return;
3360 }
3361 /* update PE session Id*/
3362 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3363 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3364 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3365 else
3366 {
3367 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3368 {
3369 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3370 {
3371 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303372 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303373 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303374 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3376 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003377 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303378 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303379 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003380 limMsgQ->bodyptr = NULL;
3381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3383 }
3384 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3385 {
3386 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3387 }
3388 else
3389 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3390 }
3391 else
3392 /* Called while processing assoc response */
3393 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3394 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003395
3396 if(limIsInMCC(pMac))
3397 {
3398 WDA_TrafficStatsTimerActivate(TRUE);
3399 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003400
3401#ifdef WLAN_FEATURE_11W
3402 if (psessionEntry->limRmfEnabled)
3403 {
3404 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3405 {
3406 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003407 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003408 }
3409 }
3410#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003411}
3412/**
3413 * limProcessMlmSetKeyRsp()
3414 *
3415 *FUNCTION:
3416 * This function is called to process the following two
3417 * messages from HAL:
3418 * 1) WDA_SET_BSSKEY_RSP
3419 * 2) WDA_SET_STAKEY_RSP
3420 * 3) WDA_SET_STA_BCASTKEY_RSP
3421 * Upon receipt of this message from HAL,
3422 * MLME -
3423 * > Determines the "state" in which this message was received
3424 * > Forwards it to the appropriate callback
3425 *
3426 *LOGIC:
3427 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3428 * received by MLME while in the following state:
3429 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3430 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3431 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3432 * Based on this state, this API will determine where to
3433 * route the message to
3434 *
3435 *ASSUMPTIONS:
3436 * ONLY the MLME state is being taken into account for now.
3437 * This is because, it appears that the handling of the
3438 * SETKEYS REQ is handled symmetrically on both the AP & STA
3439 *
3440 *NOTE:
3441 *
3442 * @param pMac Pointer to Global MAC structure
3443 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3444 *
3445 * @return None
3446 */
3447void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3448{
Jeff Johnsone7245742012-09-05 17:12:55 -07003449 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 tLimMlmSetKeysCnf mlmSetKeysCnf;
3451 tANI_U8 sessionId = 0;
3452 tpPESession psessionEntry;
3453 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303454 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003456 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003457 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003458 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 return;
3460 }
3461 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3462 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3463 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003464 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303465 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303466 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003467 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003468 return;
3469 }
3470 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3471 {
3472 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303473 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 // There's not much that MLME can do at this stage...
3475 respReqd = 0;
3476 }
3477 else
3478 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3479
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303480 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303481 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003482 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003484 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003485 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 if( respReqd )
3487 {
3488 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3489 // Prepare and Send LIM_MLM_SETKEYS_CNF
3490 if( NULL != lpLimMlmSetKeysReq )
3491 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303492 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3493 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3494 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303496 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3497 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303498 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 pMac->lim.gpLimMlmSetKeysReq = NULL;
3500 }
3501 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003502 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 }
3504}
3505void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3506{
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003508 tANI_U16 resultCode;
3509 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303511 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3512
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303514 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303515 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003517 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003518 return;
3519 }
3520 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303521 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303523 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3524 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303525 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303526 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003527 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003528 return;
3529 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303530 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3532 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303533 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3534 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003535
Jeff Johnson295189b2012-06-20 16:38:30 -07003536 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3537 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3538 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303539 /* Mesg received from HAL in Invalid state! */
3540 limLog( pMac, LOGW,
3541 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3542 limMsgQ->type, psessionEntry->limMlmState );
3543 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 }
3545 else
3546 mlmSetKeysCnf.resultCode = resultCode;
3547
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303548 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
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 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003552 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3553
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303554 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3555 psessionEntry->peSessionId, psessionEntry->limMlmState));
3556 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3557 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003558
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303559 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3560 if( NULL != lpLimMlmSetKeysReq )
3561 {
3562 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3563 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3564 sizeof(tSirMacAddr));
3565 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3566 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3567 sizeof(tLimMlmSetKeysReq));
3568 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3569 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303571 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003572}
3573/**
3574 * limProcessMlmRemoveKeyRsp()
3575 *
3576 *FUNCTION:
3577 *
3578 *LOGIC:
3579 *
3580 *ASSUMPTIONS:
3581 *
3582 *NOTE:
3583 *
3584 * @param pMac Pointer to Global MAC structure
3585 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3586 *
3587 * @return None
3588 */
3589void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3590{
Jeff Johnsone7245742012-09-05 17:12:55 -07003591 tANI_U8 respReqd = 1;
3592 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3593 tANI_U16 resultCode;
3594 tANI_U8 sessionId = 0;
3595 tpPESession psessionEntry;
3596 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303597 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003598
3599 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003600 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003601 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003602 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 }
3604
Jeff Johnsone7245742012-09-05 17:12:55 -07003605 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3606 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3607 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3608 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003609
Jeff Johnsone7245742012-09-05 17:12:55 -07003610 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003612 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003613 return;
3614 }
3615
3616 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3617 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3618 else
3619 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3620
3621 // Validate MLME state
3622 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3623 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3624 {
3625 // Mesg received from HAL in Invalid state!
3626 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303627 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003628 limMsgQ->type,
3629 psessionEntry->limMlmState );
3630 respReqd = 0;
3631 }
3632 else
3633 mlmRemoveCnf.resultCode = resultCode;
3634
3635 //
3636 // TODO & FIXME_GEN4
3637 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3638 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303639 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303640 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003641 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003642
3643 // Restore MLME state
3644 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3645 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3646
3647 if( respReqd )
3648 {
3649 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3650 mlmRemoveCnf.sessionId = sessionId;
3651
3652 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3653 if( NULL != lpLimMlmRemoveKeyReq )
3654 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303655 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3656 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3657 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003658 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303659 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003660 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3661 }
3662 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3663 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003664}
3665
Jeff Johnson295189b2012-06-20 16:38:30 -07003666
3667/** ---------------------------------------------------------------------
3668\fn limProcessInitScanRsp
3669\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3670\ message from HAL. If status code is failure, then
3671\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3672\param tpAniSirGlobal pMac
3673\param tANI_U32 body
3674\return none
3675\ ----------------------------------------------------------------------- */
3676void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3677{
3678 tpInitScanParams pInitScanParam;
3679 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003680 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3681 pInitScanParam = (tpInitScanParams) body;
3682 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303683 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003684
3685 //Only abort scan if the we are scanning.
3686 if( pMac->lim.abortScan &&
3687 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3688 {
krunal sonid3d60e12013-07-17 13:24:09 -07003689 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 pMac->lim.abortScan = 0;
3691 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3692 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3693 //Set the resume channel to Any valid channel (invalid).
3694 //This will instruct HAL to set it to any previous valid channel.
3695 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003696 if (status != eHAL_STATUS_SUCCESS)
3697 {
3698 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3699 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3700 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3701 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3702 return;
3703 }
3704 else
3705 {
3706 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3707 }
3708
Jeff Johnson295189b2012-06-20 16:38:30 -07003709 }
3710 switch(pMac->lim.gLimHalScanState)
3711 {
3712 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3713 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3714 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003715 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3717 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3718 /*
3719 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3720 * another Scan request in the same context (happens when 11d is enabled
3721 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3722 * scan in the same context but with bigger channel list), so the state needs to be
3723 * changed before this response message is sent.
3724 */
3725 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 return;
3727 }
3728 else if (status == eHAL_STATUS_SUCCESS)
3729 {
3730 /* since we have successfully triggered a background scan,
3731 * reset the "consecutive bkgnd scan failure" count to 0
3732 */
3733 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3734 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003735 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003736 }
3737 limContinueChannelScan(pMac);
3738 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003739//WLAN_SUSPEND_LINK Related
3740 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3741 if( pMac->lim.gpLimSuspendCallback )
3742 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303743 if( eHAL_STATUS_SUCCESS == status )
3744 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303746 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303748 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303750 pMac->lim.gLimSystemInScanLearnMode = 0;
3751 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003752
3753 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3754 pMac->lim.gpLimSuspendCallback = NULL;
3755 pMac->lim.gpLimSuspendData = NULL;
3756 }
3757 else
3758 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003759 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003760 return;
3761 }
3762 break;
3763//end WLAN_SUSPEND_LINK Related
3764 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003765 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 pMac->lim.gLimHalScanState);
3767 break;
3768 }
3769 return;
3770}
3771/**
3772 * limProcessSwitchChannelReAssocReq()
3773 *
3774 *FUNCTION:
3775 * This function is called to send the reassoc req mgmt frame after the
3776 * switchChannelRsp message is received from HAL.
3777 *
3778 *LOGIC:
3779 *
3780 *ASSUMPTIONS:
3781 * NA
3782 *
3783 *NOTE:
3784 * NA
3785 *
3786 * @param pMac - Pointer to Global MAC structure.
3787 * @param psessionEntry - session related information.
3788 * @param status - channel switch success/failure.
3789 *
3790 * @return None
3791 */
3792static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3793{
3794 tLimMlmReassocCnf mlmReassocCnf;
3795 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303796#ifdef FEATURE_WLAN_ESE
3797 tANI_U32 val = 0;
3798#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3800 if(pMlmReassocReq == NULL)
3801 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003802 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003803 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3804 goto end;
3805 }
3806
3807 if(status != eHAL_STATUS_SUCCESS)
3808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003809 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3811 goto end;
3812 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303813
3814#ifdef FEATURE_WLAN_ESE
3815 /*
3816 * In case of Ese Reassociation, change the reassoc timer
3817 * value.
3818 */
3819 val = pMlmReassocReq->reassocFailureTimeout;
3820 if (psessionEntry->isESEconnection)
3821 {
3822 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3823 }
3824 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3825 TX_SUCCESS)
3826 {
3827 limLog(pMac, LOGP,
3828 FL("unable to deactivate Reassoc failure timer"));
3829 }
3830 val = SYS_MS_TO_TICKS(val);
3831 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3832 val, 0) != TX_SUCCESS)
3833 {
3834 limLog(pMac, LOGP,
3835 FL("unable to change Reassociation failure timer"));
3836 }
3837#endif
3838 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003840 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3842 != TX_SUCCESS)
3843 {
3844 /// Could not start reassoc failure timer.
3845 // Log error
3846 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003847 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003848 // Return Reassoc confirm with
3849 // Resources Unavailable
3850 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3851 goto end;
3852 }
3853 /// Prepare and send Reassociation request frame
3854 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3855 return;
3856end:
3857 // Free up buffer allocated for reassocReq
3858 if(pMlmReassocReq != NULL)
3859 {
3860 /* Update PE session Id*/
3861 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303862 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003863 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003864 }
3865 else
3866 {
3867 mlmReassocCnf.sessionId = 0;
3868 }
3869
3870 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3871 /* Update PE sessio Id*/
3872 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3873
3874 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3875}
3876/**
3877 * limProcessSwitchChannelJoinReq()
3878 *
3879 *FUNCTION:
3880 * This function is called to send the probe req mgmt frame after the
3881 * switchChannelRsp message is received from HAL.
3882 *
3883 *LOGIC:
3884 *
3885 *ASSUMPTIONS:
3886 * NA
3887 *
3888 *NOTE:
3889 * NA
3890 *
3891 * @param pMac - Pointer to Global MAC structure.
3892 * @param psessionEntry - session related information.
3893 * @param status - channel switch success/failure.
3894 *
3895 * @return None
3896 */
3897static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3898{
3899 tANI_U32 val;
3900 tSirMacSSid ssId;
3901 tLimMlmJoinCnf mlmJoinCnf;
3902 if(status != eHAL_STATUS_SUCCESS)
3903 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003904 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003905 goto error;
3906 }
3907
3908 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3909 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003910 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 goto error;
3912 }
3913
Jeff Johnsone7245742012-09-05 17:12:55 -07003914
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3916 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3917 {
3918 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3919 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303920 {
3921 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3922 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3923 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303925 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003927
3928 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3929 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003930 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3932 // Apply previously set configuration at HW
3933 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05303934
3935 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
3936 * disconnection was caused by HB failure.
3937 */
3938 if(pMac->roam.configParam.sendDeauthBeforeCon)
3939 {
3940 int apCount;
3941
3942 for(apCount = 0; apCount < 2; apCount++)
3943 {
3944
3945 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3946 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
3947 {
3948 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
3949 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
3950 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
3951 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
3952
3953 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
3954 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3955 psessionEntry, FALSE );
3956
3957 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
3958 sizeof(tSirMacAddr));
3959 break;
3960 }
3961 }
3962 }
3963
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303965 vos_mem_copy(ssId.ssId,
3966 psessionEntry->ssId.ssId,
3967 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003968 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003969
3970 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3971
3972 //assign appropriate sessionId to the timer object
3973 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05303974 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
3975 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
3976 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303977 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 // include additional IE if there is
3979 limSendProbeReqMgmtFrame( pMac, &ssId,
3980 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3981 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3982 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003983
3984 // Sending mgmt frame is a blocking call activate Join failure timer now
3985 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3986 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3987 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003988 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003989 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3990 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3991 //memory is freed up below.
3992 psessionEntry->pLimMlmJoinReq = NULL;
3993 goto error;
3994 }
3995
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003996 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3997 {
Yathish9f22e662012-12-10 14:21:35 -08003998 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003999 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
4000 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004001 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004002 goto error;
4003 }
4004 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08004005
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 return;
4007error:
4008 if(NULL != psessionEntry)
4009 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304010 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 psessionEntry->pLimMlmJoinReq = NULL;
4012 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
4013 }
4014 else
4015 {
4016 mlmJoinCnf.sessionId = 0;
4017 }
4018 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4019 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4020 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
4021}
4022
4023/**
4024 * limProcessSwitchChannelRsp()
4025 *
4026 *FUNCTION:
4027 * This function is called to process switchChannelRsp message from HAL.
4028 *
4029 *LOGIC:
4030 *
4031 *ASSUMPTIONS:
4032 * NA
4033 *
4034 *NOTE:
4035 * NA
4036 *
4037 * @param pMac - Pointer to Global MAC structure
4038 * @param body - message body.
4039 *
4040 * @return None
4041 */
4042void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4043{
4044 tpSwitchChannelParams pChnlParams = NULL;
4045 eHalStatus status;
4046 tANI_U16 channelChangeReasonCode;
4047 tANI_U8 peSessionId;
4048 tpPESession psessionEntry;
4049 //we need to process the deferred message since the initiating req. there might be nested request.
4050 //in the case of nested request the new request initiated from the response will take care of resetting
4051 //the deffered flag.
4052 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4053 pChnlParams = (tpSwitchChannelParams) body;
4054 status = pChnlParams->status;
4055 peSessionId = pChnlParams->peSessionId;
4056 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4057 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304058 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004059 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 return;
4061 }
4062#if defined WLAN_FEATURE_VOWIFI
4063 //HAL fills in the tx power used for mgmt frames in this field.
4064 //Store this value to use in TPC report IE.
4065 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4066#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4068 // initialize it back to invalid id
4069 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304070 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 switch(channelChangeReasonCode)
4072 {
4073 case LIM_SWITCH_CHANNEL_REASSOC:
4074 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4075 break;
4076 case LIM_SWITCH_CHANNEL_JOIN:
4077 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4078 break;
4079
4080 case LIM_SWITCH_CHANNEL_OPERATION:
4081 /*
4082 * The above code should also use the callback.
4083 * mechanism below, there is scope for cleanup here.
4084 * THat way all this response handler does is call the call back
4085 * We can get rid of the reason code here.
4086 */
4087 if (pMac->lim.gpchangeChannelCallback)
4088 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304089 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004090 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4091 {
4092 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4093 {
4094 if ( psessionEntry && psessionEntry->limSmeState
4095 == eLIM_SME_LINK_EST_STATE )
4096 {
4097 peSetResumeChannel( pMac,
4098 psessionEntry->currentOperChannel,
4099 psessionEntry->htSecondaryChannelOffset);
4100 }
4101 else
4102 {
4103 peSetResumeChannel( pMac, 0, 0);
4104 }
4105 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4106 }
4107 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4109 }
4110 break;
4111 default:
4112 break;
4113 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304114 vos_mem_free(body);
4115 body = NULL;
4116
Jeff Johnson295189b2012-06-20 16:38:30 -07004117}
4118/**
4119 * limProcessStartScanRsp()
4120 *
4121 *FUNCTION:
4122 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4123 * then it will start scan/learn on the next channel.
4124 *
4125 *LOGIC:
4126 *
4127 *ASSUMPTIONS:
4128 * NA
4129 *
4130 *NOTE:
4131 * NA
4132 *
4133 * @param pMac - Pointer to Global MAC structure
4134 * @param body - message body.
4135 *
4136 * @return None
4137 */
4138
4139void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4140{
4141 tpStartScanParams pStartScanParam;
4142 eHalStatus status;
4143 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4144 pStartScanParam = (tpStartScanParams) body;
4145 status = pStartScanParam->status;
4146#if defined WLAN_FEATURE_VOWIFI
4147 //HAL fills in the tx power used for mgmt frames in this field.
4148 //Store this value to use in TPC report IE.
4149 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4150 //Store start TSF of scan start. This will be stored in BSS params.
4151 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4152#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304153 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004154 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 if( pMac->lim.abortScan )
4156 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004157 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004158 pMac->lim.abortScan = 0;
4159 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4160 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4161 //Set the resume channel to Any valid channel (invalid).
4162 //This will instruct HAL to set it to any previous valid channel.
4163 peSetResumeChannel(pMac, 0, 0);
4164 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4165 }
4166 switch(pMac->lim.gLimHalScanState)
4167 {
4168 case eLIM_HAL_START_SCAN_WAIT_STATE:
4169 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4170 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004171 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 //
4173 // FIXME - With this, LIM will try and recover state, but
4174 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4175 // status back to the SME
4176 //
4177 //Set the resume channel to Any valid channel (invalid).
4178 //This will instruct HAL to set it to any previous valid channel.
4179 peSetResumeChannel(pMac, 0, 0);
4180 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4181 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4182 }
4183 else
4184 {
4185 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4186 limContinuePostChannelScan(pMac);
4187 }
4188 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004190 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 pMac->lim.gLimHalScanState);
4192 break;
4193 }
4194 return;
4195}
4196void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4197{
4198 tpEndScanParams pEndScanParam;
4199 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4201 pEndScanParam = (tpEndScanParams) body;
4202 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304203 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004204 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004205 switch(pMac->lim.gLimHalScanState)
4206 {
4207 case eLIM_HAL_END_SCAN_WAIT_STATE:
4208 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4209 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004210 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4212 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4213 }
4214 else
4215 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004216 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 limContinueChannelScan(pMac);
4218 }
4219 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004221 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 pMac->lim.gLimHalScanState);
4223 break;
4224 }
4225 return;
4226}
Jeff Johnsone7245742012-09-05 17:12:55 -07004227/**
4228 * limStopTxAndSwitch()
4229 *
4230 *FUNCTION:
4231 * Start channel switch on all sessions that is in channel switch state.
4232 *
4233 * @param pMac - pointer to global adapter context
4234 *
4235 * @return None
4236 *
4237 */
4238static void
4239limStopTxAndSwitch (tpAniSirGlobal pMac)
4240{
4241 tANI_U8 i;
4242
4243 for(i =0; i < pMac->lim.maxBssId; i++)
4244 {
4245 if(pMac->lim.gpSession[i].valid &&
4246 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4247 {
4248 limStopTxAndSwitchChannel(pMac, i);
4249 }
4250 }
4251 return;
4252}
4253/**
4254 * limStartQuietOnSession()
4255 *
4256 *FUNCTION:
4257 * This function is called to start quiet timer after finish scan if there is
4258 * qeuieting on any session.
4259 *
4260 *LOGIC:
4261 *
4262 *ASSUMPTIONS:
4263 * NA
4264 *
4265 *NOTE:
4266 * NA
4267 *
4268 * @param pMac - Pointer to Global MAC structure
4269 *
4270 * @return None
4271 */
4272static void
4273limStartQuietOnSession (tpAniSirGlobal pMac)
4274{
4275 tANI_U8 i;
4276
4277 for(i =0; i < pMac->lim.maxBssId; i++)
4278 {
4279 if(pMac->lim.gpSession[i].valid &&
4280 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4281 {
4282 limStartQuietTimer(pMac, i);
4283 }
4284 }
4285 return;
4286}
Jeff Johnson295189b2012-06-20 16:38:30 -07004287void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4288{
4289 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 eHalStatus status;
4291 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4292 pFinishScanParam = (tpFinishScanParams) body;
4293 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004294
Sushant Kaushik826de802014-05-08 18:04:11 +05304295 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4296 pMac->lim.gLimHalScanState,
4297 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004298
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 switch(pMac->lim.gLimHalScanState)
4300 {
4301 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304302#ifdef FEATURE_WLAN_DIAG_SUPPORT
4303 limDiagEventReport(pMac, WLAN_PE_DIAG_DRIVER_SCAN_COMPLETE, NULL,
4304 status, eSIR_SUCCESS);
4305#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Padma, Santhosh Kumar8eb1d7a2015-07-31 11:35:53 +05304307 if (pMac->lim.abortScan)
4308 pMac->lim.abortScan = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004310 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 {
4312 /** Right time to stop tx and start the timer for channel switch */
4313 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4314 * be any associated session id
4315 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004316 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004318 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 {
4320 /** Start the quieting */
4321 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4322 * be any associated session id
4323 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004324 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4327 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004328 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004329 }
4330 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004331//WLAN_SUSPEND_LINK Related
4332 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4333 if( pMac->lim.gpLimResumeCallback )
4334 {
4335 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4336 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4337 pMac->lim.gpLimResumeCallback = NULL;
4338 pMac->lim.gpLimResumeData = NULL;
4339 pMac->lim.gLimSystemInScanLearnMode = 0;
4340 }
4341 else
4342 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004343 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304344 vos_mem_free(body);
4345 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 return;
4347 }
4348 break;
4349//end WLAN_SUSPEND_LINK Related
4350
4351 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004352 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 pMac->lim.gLimHalScanState);
4354 break;
4355 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304356 vos_mem_free(body);
4357 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004358 return;
4359}
4360/**
4361 * @function : limProcessMlmHalAddBARsp
4362 *
4363 * @brief: Process WDA_ADDBA_RSP coming from HAL
4364 *
4365 *
4366 * @param pMac The global tpAniSirGlobal object
4367 *
4368 * @param tSirMsgQ The MsgQ header containing the response buffer
4369 *
4370 * @return none
4371 */
4372void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4373 tpSirMsgQ limMsgQ )
4374{
4375 // Send LIM_MLM_ADDBA_CNF to LIM
4376 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004377 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004378 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004379
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 //now LIM can process any defer message.
4381 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4382 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004383 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004384 return;
4385 }
4386 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4387 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004388 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304389 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004390 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004391 return;
4392 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004393
4394 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304395 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4396 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004397 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304398 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004399 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 return;
4401 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304402 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004403 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304404 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4405 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 // Copy other ADDBA Rsp parameters
4407 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4408 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4409 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4410 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4411 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4412 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4413 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4414 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4415 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4416 else
4417 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Sushant Kaushikb97a0082015-08-31 12:36:45 +05304418
4419#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4420 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry,
4421 pAddBAParams->status, pMlmAddBACnf->addBAResultCode);
4422#endif //FEATURE_WLAN_DIAG_SUPPORT
4423
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304424 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004425 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 // Send ADDBA CNF to LIM
4427 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4428}
4429/**
4430 * \brief Process LIM_MLM_ADDBA_CNF
4431 *
4432 * \sa limProcessMlmAddBACnf
4433 *
4434 * \param pMac The global tpAniSirGlobal object
4435 *
4436 * \param tSirMsgQ The MsgQ header containing the response buffer
4437 *
4438 * \return none
4439 */
4440void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4441 tANI_U32 *pMsgBuf )
4442{
4443tpLimMlmAddBACnf pMlmAddBACnf;
4444tpDphHashNode pSta;
4445tANI_U16 aid;
4446tLimBAState curBaState;
4447tpPESession psessionEntry = NULL;
4448if(pMsgBuf == NULL)
4449{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004450 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 return;
4452}
4453pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4454 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4455 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004456 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304457 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 return;
4459 }
4460 // First, extract the DPH entry
4461 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4462 if( NULL == pSta )
4463 {
4464 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004465 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304466 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004467 return;
4468 }
4469 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4470 // Need to validate SME state
4471 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4472 {
4473 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004474 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304476 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004477 return;
4478 }
4479 // Restore STA BA state
4480 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004481 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 {
4483 // Update LIM internal cache...
4484 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4485 {
4486 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4487 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4488 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4489 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4490 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004491 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4492 // status code. MLME will then send an ADDBA RSP
4493 // over the air to the peer MAC entity
4494 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4495 pMlmAddBACnf->peerMacAddr,
4496 pMlmAddBACnf->addBAResultCode,
4497 pMlmAddBACnf->baDialogToken,
4498 (tANI_U8) pMlmAddBACnf->baTID,
4499 (tANI_U8) pMlmAddBACnf->baPolicy,
4500 pMlmAddBACnf->baBufferSize,
4501 pMlmAddBACnf->baTimeout,psessionEntry))
4502 {
4503 PELOGW(limLog( pMac, LOGW,
4504 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4505 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4506 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 }
4508 else
4509 {
4510 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4511 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4512 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4513 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4514 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4515 }
4516 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304518 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004519 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004520}
4521/**
4522 * \brief Process LIM_MLM_DELBA_CNF
4523 *
4524 * \sa limProcessMlmDelBACnf
4525 *
4526 * \param pMac The global tpAniSirGlobal object
4527 *
4528 * \param tSirMsgQ The MsgQ header containing the response buffer
4529 *
4530 * \return none
4531 */
4532void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4533 tANI_U32 *pMsgBuf )
4534{
4535 tpLimMlmDelBACnf pMlmDelBACnf;
4536 tpDphHashNode pSta;
4537 tANI_U16 aid;
4538// tANI_U8 sessionId;
4539 tLimBAState curBaState;
4540 tpPESession psessionEntry;
4541
4542 if(pMsgBuf == NULL)
4543 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004544 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 return;
4546 }
4547 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4548 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4549 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304550 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4551 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304552 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004553 return;
4554 }
4555 // First, extract the DPH entry
4556 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4557 if( NULL == pSta )
4558 {
4559 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004560 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304561 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 return;
4563 }
4564 if(NULL == pMlmDelBACnf)
4565 {
4566 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004567 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 return;
4569 }
4570 // Need to validate baState
4571 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4572 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4573 {
4574 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004575 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304577 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 return;
4579 }
4580 // Restore STA BA state
4581 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4582 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304583 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004584}
4585/**
4586 * \brief Process SIR_LIM_DEL_BA_IND
4587 *
4588 * \sa limProcessMlmHalBADeleteInd
4589 *
4590 * \param pMac The global tpAniSirGlobal object
4591 *
4592 * \param tSirMsgQ The MsgQ header containing the indication buffer
4593 *
4594 * \return none
4595 */
4596void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4597 tpSirMsgQ limMsgQ )
4598{
4599 tSirRetStatus status = eSIR_SUCCESS;
4600 tpBADeleteParams pBADeleteParams;
4601 tpDphHashNode pSta;
4602 tANI_U16 aid;
4603 tLimBAState curBaState;
4604 tpPESession psessionEntry;
4605 tANI_U8 sessionId;
4606
4607 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4608
4609 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4610 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004611 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304612 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004613 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 return;
4615 }
4616 // First, extract the DPH entry
4617 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4618 if( NULL == pSta )
4619 {
4620 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004621 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 goto returnAfterCleanup;
4623 }
4624
4625 // Need to validate BA state
4626 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4627 if( eLIM_BA_STATE_IDLE != curBaState )
4628 {
4629 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004630 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 curBaState );
4632 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304633 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004634
Abhishek Singh66c16762014-08-14 19:13:19 +05304635 // Post DELBA REQ to MLME...
4636 if( eSIR_SUCCESS !=
4637 (status = limPostMlmDelBAReq( pMac,
4638 pSta,
4639 pBADeleteParams->baDirection,
4640 pBADeleteParams->baTID,
4641 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304643 limLog( pMac, LOGE,
4644 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 }
4646 else
4647 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304648 limLog( pMac, LOGE,
4649 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4650 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4651 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 }
4653returnAfterCleanup:
4654 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304655 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004656 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004657}
4658/**
4659 * @function : limProcessSetMimoRsp()
4660 *
4661 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4662 * after Processing the Req from the SME (PMC)
4663 *
4664 * LOGIC:
4665 *
4666 * ASSUMPTIONS:
4667 * NA
4668 *
4669 * NOTE:
4670 * NA
4671 *
4672 * @param pMac - Pointer to Global MAC structure
4673 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4674 * @return None
4675 */
4676
4677void
4678limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4679{
4680#if 0
4681 tSirRetStatus retStatus;
4682 tpSetMIMOPS pMIMO_PSParams;
4683
4684
4685 do {
4686
4687 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4688 if( NULL == pMIMO_PSParams ) {
4689 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4690 return;
4691 }
4692
4693 /** If Updation of the HAL Fail's*/
4694 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004695 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 break;
4697 }
4698
4699 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4700 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4701 break;
4702
4703 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4704 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4705
4706 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4707 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4708 * the Action Frame is being sent at first before setting the internal structures
4709 */
4710 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4711 tSirMacAddr macAddr;
4712
4713 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304714 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004715
4716 /** Send Action Frame with the corresponding mode */
4717 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4718 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004719 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004720 break;
4721 }
4722 }
4723 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4724 }while(0);
4725
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304726 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004727#endif
4728}
4729/**
4730 * @function : limHandleDelBssInReAssocContext
4731 * @brief : While Processing the ReAssociation Response Frame in STA,
4732 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4733 * being issued and the end of DelBSS the new BSS is being added.
4734 *
4735 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4736 * change, We need to update CSR with ReAssocCNF Response with the
4737 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4738 * context only
4739 *
4740 * @param : pMac - tpAniSirGlobal
4741 * pStaDs - Station Descriptor
4742 *
4743 * @return : none
4744 */
4745static void
4746limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4747{
4748 tLimMlmReassocCnf mlmReassocCnf;
4749 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4750 /** Set the MlmState to IDLE*/
4751 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 /* Update PE session Id*/
4753 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304754 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004755 case eLIM_SME_WT_REASSOC_STATE :
4756 {
4757 tpSirAssocRsp assocRsp;
4758 tpDphHashNode pStaDs;
4759 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304760 tpSchBeaconStruct pBeaconStruct;
4761 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4762 if (NULL == pBeaconStruct)
4763 {
4764 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4765 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4766 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4767 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4768 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4769 goto Error;
4770 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004771 /** Delete the older STA Table entry */
4772 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4773 /**
4774 * Add an entry for AP to hash table
4775 * maintained by DPH module
4776 */
4777 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4778 {
4779 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004780 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004781 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4782 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4783 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Abhishek Singh2b055852015-10-07 14:14:13 +05304784 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 goto Error;
4786 }
4787 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4788 * is being stored to be used here for sending ADDBSS
4789 */
4790 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4791 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4792 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 limExtractApCapabilities( pMac,
4794 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4795 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Sushant Kaushik374fd052015-03-12 16:47:53 +05304796 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304798 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4799 if(pBeaconStruct->erpPresent) {
4800 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 psessionEntry->beaconParams.fShortPreamble = 0;
4802 else
4803 psessionEntry->beaconParams.fShortPreamble = 1;
4804 }
4805 //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 +05304806 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004808 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004809 retStatus = eSIR_FAILURE;
4810 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 if (retStatus != eSIR_SUCCESS)
4812 {
4813 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4814 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304815 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304816 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 pMac->lim.gLimAssocResponseData = NULL;
4818 goto Error;
4819 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304820 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304821 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 psessionEntry->limAssocResponseData = NULL;
4823 }
4824 break;
4825 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4826 {
4827 /** Case wherein the DisAssoc / Deauth
4828 * being sent as response to ReAssoc Req*/
4829 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4830 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4831 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4832 /** Set the SME State back to WT_Reassoc State*/
4833 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004834 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4835 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4836 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4837 {
4838 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 }
4840 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4841 }
4842 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004843 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004844 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4846 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4847 goto Error;
4848 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004849 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004850Error:
4851 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4852}
4853
4854/* Added For BT -AMP Support */
4855static void
4856limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4857{
4858 tLimMlmStartCnf mlmStartCnf;
4859 tANI_U32 val;
4860 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4861
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304862 if (NULL == pAddBssParams)
4863 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004864 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304865 goto end;
4866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4868 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004869 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4871 {
4872 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4873 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4874 goto end;
4875 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4876 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4877 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4878 goto end;
4879 }
4880
4881 // Set MLME state
4882 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4883 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4884 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4885 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004886 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 // Create timers used by LIM
4888 if (!pMac->lim.gLimTimersCreated)
4889 limCreateTimers(pMac);
4890 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4891 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004892 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004893 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4894 // Apply previously set configuration at HW
4895 limApplyConfiguration(pMac,psessionEntry);
4896 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4897 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4898 }
4899 else
4900 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004901 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4903 }
4904 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4905 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4906 end:
4907 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004908 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304909 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304910 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004911 limMsgQ->bodyptr = NULL;
4912 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004913}
4914
4915/**
4916 * @function : limHandleAddBssInReAssocContext
4917 * @brief : While Processing the ReAssociation Response Frame in STA,
4918 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4919 * being issued and the end of DelBSS the new BSS is being added.
4920 *
4921 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4922 * change, We need to update CSR with ReAssocCNF Response with the
4923 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4924 * context only
4925 *
4926 * @param : pMac - tpAniSirGlobal
4927 * pStaDs - Station Descriptor
4928 *
4929 * @return : none
4930 */
4931void
4932limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4933{
4934 tLimMlmReassocCnf mlmReassocCnf;
4935 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4936 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004937 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4938 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004940 case eLIM_SME_WT_REASSOC_STATE : {
4941 tpSirAssocRsp assocRsp;
4942 tpDphHashNode pStaDs;
4943 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004944 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304945 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4946 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004947 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304948 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004949 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4950 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4951 goto Error;
4952 }
4953
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 // Get the AP entry from DPH hash table
4955 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4956 if (pStaDs == NULL )
4957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004958 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4960 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304961 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 goto Error;
4963 }
4964 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4965 * is being stored to be used here for sending ADDBSS
4966 */
4967 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4968 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4969 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 limExtractApCapabilities( pMac,
4971 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4972 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004973 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004975 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4976
4977 if(pBeaconStruct->erpPresent)
4978 {
4979 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004980 psessionEntry->beaconParams.fShortPreamble = 0;
4981 else
4982 psessionEntry->beaconParams.fShortPreamble = 1;
4983 }
4984
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004985 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004987 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004988 retStatus = eSIR_FAILURE;
4989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 if (retStatus != eSIR_SUCCESS)
4991 {
4992 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4993 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304994 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004995 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304996 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004997 goto Error;
4998 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304999 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07005000 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305001 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 }
5003 break;
5004 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
5005 * being sent as response to ReAssoc Req*/
5006 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
5007 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
5008 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
5009 /** Set the SME State back to WT_Reassoc State*/
5010 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
5011 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
5012 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005013 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005014 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08005015 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
5016 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005017
5018 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5019 }
5020 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005021 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005022 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005023 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
5024 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
5025 goto Error;
5026 }
5027return;
5028Error:
5029 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
5030}
5031
5032#if 0
5033 static void
5034limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
5035{
5036 tSirSmeAssocCnf assocCnf;
5037 tpDphHashNode pStaDs;
5038 tpPESession psessionEntry;
5039 tANI_U8 sessionId;
5040
5041 if(pMsgBuf == NULL)
5042 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005043 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005044 goto end;
5045 }
5046 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
5047 !__limIsSmeAssocCnfValid(&assocCnf))
5048 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005049 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005050 goto end;
5051 }
5052 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5053 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005054 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005055 goto end;
5056 }
5057 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5058 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5059 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005060 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5062 goto end;
5063 }
5064 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5065 if (pStaDs == NULL)
5066 {
5067 limLog(pMac, LOG1,
5068 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5069 msgType, assocCnf.aid);
5070 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5071 /*
5072 ** send a DISASSOC_IND message to WSM to make sure
5073 ** the state in WSM and LIM is the same
5074 **/
5075 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5076 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5077 goto end;
5078 }
5079 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305080 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 (tANI_U8 *) assocCnf.peerMacAddr,
5082 sizeof(tSirMacAddr)) ) ||
5083 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5084 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5085 (msgType != eWNI_SME_ASSOC_CNF)) ||
5086 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5087 (msgType != eWNI_SME_REASSOC_CNF)))))
5088 {
5089 limLog(pMac, LOG1,
5090 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5091 msgType, assocCnf.aid);
5092 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5093 goto end;
5094 }
5095 /*
5096 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5097 ** has been received
5098 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005099 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5101 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5102 {
5103 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5104 * when it had received Assoc Request frame. Now, PE just needs to send
5105 * Association Response frame to the requesting BTAMP-STA.
5106 */
5107 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005108 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005109 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5110 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5111 goto end;
5112 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5113 else
5114 {
5115 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5116 limRejectAssociation(pMac, pStaDs->staAddr,
5117 pStaDs->mlmStaContext.subType,
5118 true, pStaDs->mlmStaContext.authType,
5119 pStaDs->assocId, true,
5120 assocCnf.statusCode, psessionEntry);
5121 return;
5122 }
5123end:
5124 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5125 {
5126 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5127 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305128 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005129 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5130 }
5131
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305132 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005133 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5134 }
5135} /*** end __limProcessSmeAssocCnfNew() ***/
5136#endif
5137
Jeff Johnson295189b2012-06-20 16:38:30 -07005138void
5139limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5140 tBeaconGenParams *pBeaconGenParams = NULL;
5141 tSirMsgQ limMsg;
5142 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5143 if(psessionEntry == NULL ){
5144 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005145 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005146 return;
5147 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305148 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5149 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005150 {
5151 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305152 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 return;
5154 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305155 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5156 vos_mem_copy((void *) pBeaconGenParams->bssId,
5157 (void *)psessionEntry->bssId,
5158 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005159 limMsg.bodyptr = pBeaconGenParams;
5160 schProcessPreBeaconInd(pMac, &limMsg);
5161 return;
5162}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305163
5164void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5165 tSirResultCodes reasonCode)
5166{
5167 tANI_U16 scanRspLen = 0;
5168
5169 pMac->lim.gLimSmeScanResultLength +=
5170 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305171 pMac->lim.gLimRspReqd = false;
5172 if ((reasonCode == eSIR_SME_SUCCESS) ||
5173 pMac->lim.gLimSmeScanResultLength) {
5174 scanRspLen = sizeof(tSirSmeScanRsp) +
5175 pMac->lim.gLimSmeScanResultLength -
5176 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305177 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305178 else
5179 scanRspLen = sizeof(tSirSmeScanRsp);
5180
5181 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5182 pMac->lim.gSmeSessionId,
5183 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305184}
5185
5186
5187void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5188{
5189 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5190
5191 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005192 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305193
5194 switch (pScanEvent->event)
5195 {
5196 case SCAN_EVENT_STARTED:
5197 break;
5198 case SCAN_EVENT_START_FAILED:
5199 case SCAN_EVENT_COMPLETED:
5200 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5201 break;
5202 case SCAN_EVENT_BSS_CHANNEL:
5203 case SCAN_EVENT_FOREIGN_CHANNEL:
5204 case SCAN_EVENT_DEQUEUED:
5205 case SCAN_EVENT_PREEMPTED:
5206 default:
5207 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005208 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305209 }
5210}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005211
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305212void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5213{
5214
5215 if ((rspStatus != eSIR_SUCCESS) ||
5216 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5217 {
5218 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing"));
5219 pMac->lim.isSpoofingEnabled = FALSE;
5220 } else {
5221 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5222 pMac->lim.isSpoofingEnabled = TRUE;
5223 }
5224
5225 return;
5226}
5227
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005228void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5229 eHalStatus status,
5230 tANI_U32* mlmAddBssRsp)
5231{
5232 if (status != eHAL_STATUS_SUCCESS)
5233 {
5234 limLog(pMac, LOGE,
5235 FL(" CSA failed to get the response for resume link"));
5236 }
5237 return;
5238}