blob: 7e4965741b442d50003d827e599292926bfaa8fd [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 }
550 /// Process AUTH confirm from MLM
551 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
552 {
553 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
554 {
555 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
556 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
557 {
558 /**
559 * Could not get AuthType value from CFG.
560 * Log error.
561 */
562 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700563 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 }
565 }
566 else
567 cfgAuthType = pMac->lim.gLimPreAuthType;
568
569 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
570 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
571 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
572 {
573 /**
574 * When Open authentication fails with reason code "13" and
575 * authType set to 'auto switch', Try with Shared Authentication
576 */
577 authMode = eSIR_SHARED_KEY;
578 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530579 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
580 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 {
582 // Log error
583 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530584 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 return;
586 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530587 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 val = sizeof(tSirMacAddr);
589 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
590 {
591 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
592 }
593 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530594 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
595 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 sizeof(tSirMacAddr));
597 pMlmAuthReq->authType = authMode;
598 /* Update PE session Id*/
599 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
600 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
601 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
602 != eSIR_SUCCESS)
603 {
604 /**
605 * Could not get AuthFailureTimeout value from CFG.
606 * Log error.
607 */
608 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700609 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 }
611 limPostMlmMessage(pMac,
612 LIM_MLM_AUTH_REQ,
613 (tANI_U32 *) pMlmAuthReq);
614 return;
615 }
616 else
617 {
618 // MAC based authentication failure
619 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
620 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700621 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700623 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700625 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
626
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 /**
628 * Need to send Join response with
629 * auth failure to Host.
630 */
631 limHandleSmeJoinResult(pMac,
632 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
633 }
634 else
635 {
636 /**
637 * Pre-authentication failure.
638 * Send Pre-auth failure response to host
639 */
640 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700641 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 limSendSmeAuthRsp(
643 pMac,
644 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
645 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
646 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
647 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
648 }
649 } // end if (cfgAuthType == eAUTO_SWITCH)
650 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
651 else
652 {
653 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
654 {
655 /**
656 * Successful MAC based authentication
657 * Trigger Association with BSS
658 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530659 limLog(pMac, LOG1,
660 FL("SessionId: %d Authenticated with BSS"),
661 psessionEntry->peSessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530662 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
663 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700664 {
665 // Log error
666 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530667 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 return;
669 }
670 val = sizeof(tSirMacAddr);
671 #if 0
672 if (cfgGetStr(pMac, WNI_CFG_BSSID,
673 pMlmAssocReq->peerMacAddr,
674 &val) != eSIR_SUCCESS)
675 {
676 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700677 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700678 }
679 #endif //SUPPORT BT-AMP
680 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
681 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
682 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
683 != eSIR_SUCCESS)
684 {
685 /**
686 * Could not get AssocFailureTimeout value
687 * from CFG. Log error.
688 */
689 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700690 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 }
692 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
693 {
694 /**
695 * Could not get Capabilities value
696 * from CFG. Log error.
697 */
698 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700699 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 }
701 /*Clear spectrum management bit if AP doesn't support it*/
702 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
703 {
704 /*AP doesn't support spectrum management clear spectrum management bit*/
705 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
706 }
707
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530708 /* Clear rrm bit if AP doesn't support it */
709 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
710 & LIM_RRM_BIT_MASK))
711 {
712 caps &= (~LIM_RRM_BIT_MASK);
713 }
714
Chandrasekaran, Manishekarc949a8b2014-06-27 12:34:09 +0530715 /* Clear short preamble bit if AP does not support it */
716 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
717 (LIM_SHORT_PREAMBLE_BIT_MASK)))
718 {
719 caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
720 limLog(pMac, LOG1, FL("Clearing short preamble:no AP support"));
721 }
722
723 /* Clear immediate block ack bit if AP does not support it */
724 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
725 (LIM_IMMEDIATE_BLOCK_ACK_MASK)))
726 {
727 caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
728 limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
729 }
730
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 pMlmAssocReq->capabilityInfo = caps;
732 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700733 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700735 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
736 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700737
738 /* If telescopic beaconing is enabled, set listen interval to
739 WNI_CFG_TELE_BCN_MAX_LI */
740 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
741 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700742 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
744 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
745
746 if(teleBcnEn)
747 {
748 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
749 eSIR_SUCCESS)
750 {
751 /**
752 * Could not get ListenInterval value
753 * from CFG. Log error.
754 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700755 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 }
757 }
758 else
759 {
760 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
761 {
762 /**
763 * Could not get ListenInterval value
764 * from CFG. Log error.
765 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700766 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 }
768 }
769
770 pMlmAssocReq->listenInterval = (tANI_U16)val;
771 /* Update PE session ID*/
772 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
773 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
774 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700775 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530776 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
777 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 limPostMlmMessage(pMac,
779 LIM_MLM_ASSOC_REQ,
780 (tANI_U32 *) pMlmAssocReq);
781 }
782 else
783 {
784 /**
785 * Successful Pre-authentication.
786 * Send Pre-auth response to host
787 */
788 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700789 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 limSendSmeAuthRsp(
791 pMac,
792 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
793 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
794 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
795 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
796 }
797 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
798} /*** end limProcessMlmAuthCnf() ***/
799
800/**
801 * limProcessMlmAssocCnf()
802 *
803 *FUNCTION:
804 * This function is called to processes MLM_ASSOC_CNF
805 * message from MLM State machine.
806 *
807 *LOGIC:
808 *
809 *ASSUMPTIONS:
810 *
811 *NOTE:
812 *
813 * @param pMac Pointer to Global MAC structure
814 * @param pMsgBuf A pointer to the MLM message buffer
815 *
816 * @return None
817 */
818void
819limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
820{
821 tpPESession psessionEntry;
822 tLimMlmAssocCnf *pLimMlmAssocCnf;
823
824 if(pMsgBuf == NULL)
825 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700826 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 return;
828 }
829 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
830 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
831 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530832 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
833 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 return;
835 }
836 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
837 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
838 {
839 /**
840 * Should not have received Assocication confirm
841 * from MLM in other states OR on AP.
842 * Log error
843 */
844 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530845 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %d"),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530846 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 return;
848 }
849 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
850 {
851 // Association failure
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530852 limLog(pMac, LOG1,
853 FL("SessionId: %d Association failure resultCode: %d"
854 "limSmeState: %d"), psessionEntry->peSessionId,
c_hpothua9dc89c2014-03-22 19:22:31 +0530855 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530856 psessionEntry->limSmeState);
c_hpothua9dc89c2014-03-22 19:22:31 +0530857
858 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
859 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
860 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
861 */
862 if(((tLimMlmAssocCnf *) pMsgBuf)->resultCode
863 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
864 {
865 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
866 }
867 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
868 pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 /**
870 * Need to send Join response with
871 * Association failure to Host.
872 */
873 limHandleSmeJoinResult(pMac,
874 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
875 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
876 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
877 else
878 {
879 // Successful Association
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530880 limLog(pMac, LOG1, FL("SessionId: %d Associated with BSS"),
881 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700882 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700883 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 /**
885 * Need to send Join response with
886 * Association success to Host.
887 */
888 limHandleSmeJoinResult(pMac,
889 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
890 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
891 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
892} /*** end limProcessMlmAssocCnf() ***/
893
894/**
895 * limProcessMlmReassocCnf()
896 *
897 *FUNCTION:
898 * This function is called to processes MLM_REASSOC_CNF
899 * message from MLM State machine.
900 *
901 *LOGIC:
902 *
903 *ASSUMPTIONS:
904 *
905 *NOTE:
906 *
907 * @param pMac Pointer to Global MAC structure
908 * @param pMsgBuf A pointer to the MLM message buffer
909 *
910 * @return None
911 */
912void
913limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
914{
915 tpPESession psessionEntry;
916 tLimMlmReassocCnf *pLimMlmReassocCnf;
917
918 if(pMsgBuf == NULL)
919 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700920 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 return;
922 }
923 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
924 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
925 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700926 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 return;
928 }
929 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
930 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
931 {
932 /**
933 * Should not have received Reassocication confirm
934 * from MLM in other states OR on AP.
935 * Log error
936 */
937 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +0530938 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
940 return;
941 }
942 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530943 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 psessionEntry->pLimReAssocReq = NULL;
945 }
946
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530947 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
949 // Successful Reassociation
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530950 limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700951
952 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700953 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700954
955 /**
956 * Need to send Reassoc response with
957 * Reassociation success to Host.
958 */
959 limSendSmeJoinReassocRsp(
960 pMac, eWNI_SME_REASSOC_RSP,
961 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
962 psessionEntry->smeSessionId,psessionEntry->transactionId);
963 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
964 /** Reassociation failure With the New AP
965 * but we still have the link with the Older AP
966 */
967 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700968 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700969
970 /**
971 * Need to send Reassoc response with
972 * Association failure to Host.
973 */
974 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
975 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
976 psessionEntry->smeSessionId,psessionEntry->transactionId);
977 }else {
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530978 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
979 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
980 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
981 */
982 if(pLimMlmReassocCnf->resultCode
983 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
984 {
985 // Reassociation failure
986 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
987 }
988 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 /**
990 * Need to send Reassoc response with
991 * Association failure to Host.
992 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700993 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 }
995} /*** end limProcessMlmReassocCnf() ***/
996
997/**
998 * limProcessMlmReassocInd()
999 *
1000 *FUNCTION:
1001 * This function is called to processes MLM_REASSOC_IND
1002 * message from MLM State machine.
1003 *
1004 *LOGIC:
1005 *
1006 *ASSUMPTIONS:
1007 *
1008 *NOTE:
1009 *
1010 * @param pMac Pointer to Global MAC structure
1011 * @param pMsgBuf A pointer to the MLM message buffer
1012 *
1013 * @return None
1014 */
1015void
1016limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1017{
1018 tANI_U32 len;
1019 tSirMsgQ msgQ;
1020 tSirSmeReassocInd *pSirSmeReassocInd;
1021 tpDphHashNode pStaDs=0;
1022 tpPESession psessionEntry;
1023 tANI_U8 sessionId;
1024 if(pMsgBuf == NULL)
1025 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001026 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 return;
1028 }
1029 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1030 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001031 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 return;
1033 }
1034 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301036 pSirSmeReassocInd = vos_mem_malloc(len);
1037 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 {
1039 // Log error
1040 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301041 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 return;
1043
1044 }
1045 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1046 eWNI_SME_REASSOC_IND);
1047 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1048 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1049
1050 // Required for indicating the frames to upper layer
1051 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1052 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1053 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1054 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1055
1056 msgQ.type = eWNI_SME_REASSOC_IND;
1057 msgQ.bodyptr = pSirSmeReassocInd;
1058 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001059 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001060#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1061 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1062#endif //FEATURE_WLAN_DIAG_SUPPORT
1063 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1064 if (! pStaDs)
1065 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001066 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301068 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 return;
1070 }
1071
1072 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301073 limLog(pMac, LOG1,
1074 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 /*
1076 ** turn on a timer to detect the loss of REASSOC CNF
1077 **/
1078 limActivateCnfTimer(pMac,
1079 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1080} /*** end limProcessMlmReassocInd() ***/
1081
1082/**
1083 * limProcessMlmAuthInd()
1084 *
1085 *FUNCTION:
1086 * This function is called to processes MLM_AUTH_IND
1087 * message from MLM State machine.
1088 *
1089 *LOGIC:
1090 *
1091 *ASSUMPTIONS:
1092 *
1093 *NOTE:
1094 *
1095 * @param pMac Pointer to Global MAC structure
1096 * @param pMsgBuf A pointer to the MLM message buffer
1097 *
1098 * @return None
1099 */
1100void
1101limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1102{
1103 tSirMsgQ msgQ;
1104 tSirSmeAuthInd *pSirSmeAuthInd;
1105
1106 if(pMsgBuf == NULL)
1107 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001108 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 return;
1110 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301111 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1112 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 {
1114 // Log error
1115 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301116 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001117 }
1118 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1119 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1120 (tANI_U8 *) &(pSirSmeAuthInd->length));
1121 msgQ.type = eWNI_SME_AUTH_IND;
1122 msgQ.bodyptr = pSirSmeAuthInd;
1123 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001124 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001125#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1126 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1127#endif //FEATURE_WLAN_DIAG_SUPPORT
1128 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1129} /*** end limProcessMlmAuthInd() ***/
1130
1131
1132
1133
1134void
1135limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1136 tSirSmeAssocInd *pSirSmeAssocInd,
1137 tpPESession psessionEntry)
1138{
1139 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1140 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1141
1142 // Required for indicating the frames to upper layer
1143 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1144 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1145
1146 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1147 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1148
1149 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301150 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1151 sizeof(tSirMacAddr));
1152
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 // Fill in aid
1154 pSirSmeAssocInd->aid = pAssocInd->aid;
1155 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301156 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 // Fill in staId
1158 //pSirSmeAssocInd->staId = psessionEntry->staId;
1159 // Fill in authType
1160 pSirSmeAssocInd->authType = pAssocInd->authType;
1161 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301162 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1163 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301165 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1166 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1167 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001168
1169 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301170 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1171 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1172 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001173
1174 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001175 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1176 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1177 {
1178 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1179 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1180 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301181 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301183 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 // Fill in WmmInfo
1186 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301187#ifdef WLAN_FEATURE_AP_HT40_24G
1188 pSirSmeAssocInd->HT40MHzIntoEnabledSta = pAssocInd->HT40MHzIntoPresent;
1189 limLog(pMac, LOGW, FL("HT40MHzIntoPresent: %d \n"),
1190 pSirSmeAssocInd->HT40MHzIntoEnabledSta);
1191#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001192} /*** end limAssocIndSerDes() ***/
1193
1194
1195
1196/**
1197 * limProcessMlmAssocInd()
1198 *
1199 *FUNCTION:
1200 * This function is called to processes MLM_ASSOC_IND
1201 * message from MLM State machine.
1202 *
1203 *LOGIC:
1204 *
1205 *ASSUMPTIONS:
1206 *
1207 *NOTE:
1208 *
1209 * @param pMac Pointer to Global MAC structure
1210 * @param pMsgBuf A pointer to the MLM message buffer
1211 *
1212 * @return None
1213 */
1214void
1215limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1216{
1217 tANI_U32 len;
1218 tSirMsgQ msgQ;
1219 tSirSmeAssocInd *pSirSmeAssocInd;
1220 tpDphHashNode pStaDs=0;
1221 tpPESession psessionEntry;
1222 if(pMsgBuf == NULL)
1223 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001224 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 return;
1226 }
1227 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1228 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001229 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 return;
1231 }
1232 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301234 pSirSmeAssocInd = vos_mem_malloc(len);
1235 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 {
1237 // Log error
1238 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301239 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001240 return;
1241 }
1242
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1244 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 msgQ.type = eWNI_SME_ASSOC_IND;
1246 msgQ.bodyptr = pSirSmeAssocInd;
1247 msgQ.bodyval = 0;
1248 pStaDs = dphGetHashEntry(pMac,
1249 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1250 if (! pStaDs)
1251 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001252 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301254 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001255
1256 return;
1257 }
1258 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001260 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001261#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1262 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1263#endif //FEATURE_WLAN_DIAG_SUPPORT
1264 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1265
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301266 limLog(pMac, LOG1,
1267 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 /*
1269 ** turn on a timer to detect the loss of ASSOC CNF
1270 **/
1271 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1272
1273// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1274#ifdef TEST_BTAMP_AP
1275//tANI_U32 *pMsgBuf;
1276{
1277 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301278 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1279 if ( NULL == pSmeAssoccnf )
1280 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1282 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301283 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1284 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1286 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301287 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1288 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301290 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1292 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301293 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001294}
1295#endif
1296
1297
1298} /*** end limProcessMlmAssocInd() ***/
1299
1300
1301
1302
1303/**
1304 * limProcessMlmDisassocInd()
1305 *
1306 *FUNCTION:
1307 * This function is called to processes MLM_DISASSOC_IND
1308 * message from MLM State machine.
1309 *
1310 *LOGIC:
1311 *
1312 *ASSUMPTIONS:
1313 *
1314 *NOTE:
1315 *
1316 * @param pMac Pointer to Global MAC structure
1317 * @param pMsgBuf A pointer to the MLM message buffer
1318 *
1319 * @return None
1320 */
1321void
1322limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1323{
1324 tLimMlmDisassocInd *pMlmDisassocInd;
1325 tpPESession psessionEntry;
1326 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1327 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1328 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001329 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 return;
1331 }
1332 switch (psessionEntry->limSystemRole)
1333 {
1334 case eLIM_STA_IN_IBSS_ROLE:
1335 break;
1336 case eLIM_STA_ROLE:
1337 case eLIM_BT_AMP_STA_ROLE:
1338 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001339 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 break;
1341 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301342 limLog(pMac, LOG1,
1343 FL("*** Peer staId = %d Disassociated ***"),
1344 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 // Send SME_DISASOC_IND after Polaris cleanup
1346 // (after receiving LIM_MLM_PURGE_STA_IND)
1347 break;
1348 } // end switch (psessionEntry->limSystemRole)
1349} /*** end limProcessMlmDisassocInd() ***/
1350
1351/**
1352 * limProcessMlmDisassocCnf()
1353 *
1354 *FUNCTION:
1355 * This function is called to processes MLM_DISASSOC_CNF
1356 * message from MLM State machine.
1357 *
1358 *LOGIC:
1359 *
1360 *ASSUMPTIONS:
1361 *
1362 *NOTE:
1363 *
1364 * @param pMac Pointer to Global MAC structure
1365 * @param pMsgBuf A pointer to the MLM message buffer
1366 *
1367 * @return None
1368 */
1369void
1370limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1371{
1372 tSirResultCodes resultCode;
1373 tLimMlmDisassocCnf *pMlmDisassocCnf;
1374 tpPESession psessionEntry;
1375 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1376 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1377 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001378 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 return;
1380 }
1381 resultCode = (tSirResultCodes)
1382 (pMlmDisassocCnf->disassocTrigger ==
1383 eLIM_LINK_MONITORING_DISASSOC) ?
1384 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1385 pMlmDisassocCnf->resultCode;
1386 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1387 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 // Disassociate Confirm from MLM
1389 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1390 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1391 {
1392 /**
1393 * Should not have received
1394 * Disassocate confirm
1395 * from MLM in other states.
1396 * Log error
1397 */
1398 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301399 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 return;
1401 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 if (pMac->lim.gLimRspReqd)
1403 pMac->lim.gLimRspReqd = false;
1404 if (pMlmDisassocCnf->disassocTrigger ==
1405 eLIM_PROMISCUOUS_MODE_DISASSOC)
1406 {
1407 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1408 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1409 else
1410 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001411 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 // Send Promiscuous mode response to host
1413 limSendSmePromiscuousModeRsp(pMac);
1414 }
1415 else
1416 {
1417 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1418 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1419 else
1420 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001421 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1423 resultCode,
1424 pMlmDisassocCnf->disassocTrigger,
1425 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1426 }
1427 }
1428 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1429 {
1430 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1431 resultCode,
1432 pMlmDisassocCnf->disassocTrigger,
1433 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1434 }
1435} /*** end limProcessMlmDisassocCnf() ***/
1436
1437/**
1438 * limProcessMlmDeauthInd()
1439 *
1440 *FUNCTION:
1441 * This function is called to processes MLM_DEAUTH_IND
1442 * message from MLM State machine.
1443 *
1444 *LOGIC:
1445 *
1446 *ASSUMPTIONS:
1447 *
1448 *NOTE:
1449 *
1450 * @param pMac Pointer to Global MAC structure
1451 * @param pMsgBuf A pointer to the MLM message buffer
1452 *
1453 * @return None
1454 */
1455void
1456limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1457{
1458 tLimMlmDeauthInd *pMlmDeauthInd;
1459 tpPESession psessionEntry;
1460 tANI_U8 sessionId;
1461 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1462 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1463 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001464 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 return;
1466 }
1467 switch (psessionEntry->limSystemRole)
1468 {
1469 case eLIM_STA_IN_IBSS_ROLE:
1470 break;
1471 case eLIM_STA_ROLE:
1472 case eLIM_BT_AMP_STA_ROLE:
1473 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001474 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001475
1476 default: // eLIM_AP_ROLE
1477 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301478 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001479 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301480 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 }
1482 // Send SME_DEAUTH_IND after Polaris cleanup
1483 // (after receiving LIM_MLM_PURGE_STA_IND)
1484 break;
1485 } // end switch (psessionEntry->limSystemRole)
1486} /*** end limProcessMlmDeauthInd() ***/
1487
1488/**
1489 * limProcessMlmDeauthCnf()
1490 *
1491 *FUNCTION:
1492 * This function is called to processes MLM_DEAUTH_CNF
1493 * message from MLM State machine.
1494 *
1495 *LOGIC:
1496 *
1497 *ASSUMPTIONS:
1498 *
1499 *NOTE:
1500 *
1501 * @param pMac Pointer to Global MAC structure
1502 * @param pMsgBuf A pointer to the MLM message buffer
1503 *
1504 * @return None
1505 */
1506void
1507limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1508{
1509 tANI_U16 aid;
1510 tSirResultCodes resultCode;
1511 tLimMlmDeauthCnf *pMlmDeauthCnf;
1512 tpPESession psessionEntry;
1513
1514 if(pMsgBuf == NULL)
1515 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001516 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 return;
1518 }
1519 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1520 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1521 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001522 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 return;
1524 }
1525
1526 resultCode = (tSirResultCodes)
1527 (pMlmDeauthCnf->deauthTrigger ==
1528 eLIM_LINK_MONITORING_DEAUTH) ?
1529 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1530 pMlmDeauthCnf->resultCode;
1531 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1532 pMlmDeauthCnf->aid : 1;
1533 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1534 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 // Deauth Confirm from MLM
1536 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1537 {
1538 /**
1539 * Should not have received Deauth confirm
1540 * from MLM in other states.
1541 * Log error
1542 */
1543 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301544 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 psessionEntry->limSmeState);)
1546 return;
1547 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1549 {
1550 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301551 limLog(pMac, LOG1,
1552 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 }
1554 else
1555 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001556 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001557
1558 if (pMac->lim.gLimRspReqd)
1559 pMac->lim.gLimRspReqd = false;
1560 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1562 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1563 resultCode,
1564 pMlmDeauthCnf->deauthTrigger,
1565 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001566} /*** end limProcessMlmDeauthCnf() ***/
1567
1568/**
1569 * limProcessMlmPurgeStaInd()
1570 *
1571 *FUNCTION:
1572 * This function is called to processes MLM_PURGE_STA_IND
1573 * message from MLM State machine.
1574 *
1575 *LOGIC:
1576 *
1577 *ASSUMPTIONS:
1578 *
1579 *NOTE:
1580 *
1581 * @param pMac Pointer to Global MAC structure
1582 * @param pMsgBuf A pointer to the MLM message buffer
1583 *
1584 * @return None
1585 */
1586void
1587limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1588{
1589 tSirResultCodes resultCode;
1590 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1591 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 if(pMsgBuf == NULL)
1593 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001594 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 return;
1596 }
1597 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1598 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1599 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001600 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 return;
1602 }
1603 // Purge STA indication from MLM
1604 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1605 switch (psessionEntry->limSystemRole)
1606 {
1607 case eLIM_STA_IN_IBSS_ROLE:
1608 break;
1609 case eLIM_STA_ROLE:
1610 case eLIM_BT_AMP_STA_ROLE:
1611 default: // eLIM_AP_ROLE
1612 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1613 (psessionEntry->limSmeState !=
1614 eLIM_SME_WT_DISASSOC_STATE) &&
1615 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1616 {
1617 /**
1618 * Should not have received
1619 * Purge STA indication
1620 * from MLM in other states.
1621 * Log error
1622 */
1623 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301624 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001625 psessionEntry->limSmeState);)
1626 break;
1627 }
1628 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001629 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 pMlmPurgeStaInd->aid);)
1631 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1632 {
1633 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001634 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001635
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 }
1637 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1638 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 limSendSmeDeauthNtf(pMac,
1640 pMlmPurgeStaInd->peerMacAddr,
1641 resultCode,
1642 pMlmPurgeStaInd->purgeTrigger,
1643 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 }
1645 else
1646 limSendSmeDisassocNtf(pMac,
1647 pMlmPurgeStaInd->peerMacAddr,
1648 resultCode,
1649 pMlmPurgeStaInd->purgeTrigger,
1650 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1651 } // end switch (psessionEntry->limSystemRole)
1652} /*** end limProcessMlmPurgeStaInd() ***/
1653
1654/**
1655 * limProcessMlmSetKeysCnf()
1656 *
1657 *FUNCTION:
1658 * This function is called to processes MLM_SETKEYS_CNF
1659 * message from MLM State machine.
1660 *
1661 *LOGIC:
1662 *
1663 *ASSUMPTIONS:
1664 *
1665 *NOTE:
1666 *
1667 * @param pMac Pointer to Global MAC structure
1668 * @param pMsgBuf A pointer to the MLM message buffer
1669 *
1670 * @return None
1671 */
1672void
1673limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1674{
1675 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001676 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301678 tANI_U16 aid;
1679 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
1681 if(pMsgBuf == NULL)
1682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001683 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001684 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 }
1686 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1687 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1688 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001689 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 return;
1691 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301692 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001694 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001695 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301696 /* if the status is success keys are installed in the
1697 * Firmware so we can set the protection bit
1698 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301699 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301700 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301701 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1702 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1703 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1704 &psessionEntry->dph.dphHashTable);
1705 if (pStaDs != NULL)
1706 pStaDs->isKeyInstalled = 1;
1707 }
1708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001709 limSendSmeSetContextRsp(pMac,
1710 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1713 psessionEntry->transactionId);
1714} /*** end limProcessMlmSetKeysCnf() ***/
1715/**
1716 * limProcessMlmRemoveKeyCnf()
1717 *
1718 *FUNCTION:
1719 * This function is called to processes MLM_REMOVEKEY_CNF
1720 * message from MLM State machine.
1721 *
1722 *LOGIC:
1723 *
1724 *ASSUMPTIONS:
1725 *
1726 *NOTE:
1727 *
1728 * @param pMac Pointer to Global MAC structure
1729 * @param pMsgBuf A pointer to the MLM message buffer
1730 *
1731 * @return None
1732 */
1733void
1734limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1735{
1736 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001737 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 tpPESession psessionEntry;
1739
1740 if(pMsgBuf == NULL)
1741 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001742 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001743 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 }
1745 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1746 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1747 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001748 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 return;
1750 }
1751 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001752 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 pMlmRemoveKeyCnf->resultCode );
1754 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001755 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1757 psessionEntry->smeSessionId,psessionEntry->transactionId);
1758} /*** end limProcessMlmRemoveKeyCnf() ***/
1759
1760
1761/**
1762 * limHandleSmeJoinResult()
1763 *
1764 *FUNCTION:
1765 * This function is called to process join/auth/assoc failures
1766 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1767 * MLM_ASSOC_CNF with a success code in case of STA role and
1768 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1769 *
1770 *LOGIC:
1771 *
1772 *ASSUMPTIONS:
1773 *
1774 *NOTE:
1775 *
1776 * @param pMac Pointer to Global MAC structure
1777 * @param resultCode Failure code to be sent
1778 *
1779 *
1780 * @return None
1781 */
1782static void
1783limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1784{
1785 tpDphHashNode pStaDs = NULL;
1786 tANI_U8 smesessionId;
1787 tANI_U16 smetransactionId;
1788
1789 /* Newly Added on oct 11 th*/
1790 if(psessionEntry == NULL)
1791 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001792 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 return;
1794 }
1795 smesessionId = psessionEntry->smeSessionId;
1796 smetransactionId = psessionEntry->transactionId;
1797 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1798 if(resultCode != eSIR_SME_SUCCESS)
1799 {
1800 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1801 if (pStaDs != NULL)
1802 {
1803 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1804 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1805 pStaDs->mlmStaContext.resultCode = resultCode;
1806 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1807 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1808 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301809 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001810 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 return;
1812 }
1813 }
1814
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301815 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 psessionEntry->pLimJoinReq = NULL;
1817 //Delete teh session if JOIN failure occurred.
1818 if(resultCode != eSIR_SME_SUCCESS)
1819 {
1820 if(NULL != psessionEntry)
1821 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001822 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1823 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001824 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 peDeleteSession(pMac,psessionEntry);
1826 psessionEntry = NULL;
1827 }
1828 }
1829 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1830 smesessionId, smetransactionId);
1831} /*** end limHandleSmeJoinResult() ***/
1832
1833/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001834 * limHandleSmeReaasocResult()
1835 *
1836 *FUNCTION:
1837 * This function is called to process reassoc failures
1838 * upon receiving REASSOC_CNF with a failure code or
1839 * MLM_REASSOC_CNF with a success code in case of STA role
1840 *
1841 *LOGIC:
1842 *
1843 *ASSUMPTIONS:
1844 *
1845 *NOTE:
1846 *
1847 * @param pMac Pointer to Global MAC structure
1848 * @param resultCode Failure code to be sent
1849 *
1850 *
1851 * @return None
1852 */
1853static void
1854limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1855{
1856 tpDphHashNode pStaDs = NULL;
1857 tANI_U8 smesessionId;
1858 tANI_U16 smetransactionId;
1859
1860 if(psessionEntry == NULL)
1861 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001862 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001863 return;
1864 }
1865 smesessionId = psessionEntry->smeSessionId;
1866 smetransactionId = psessionEntry->transactionId;
1867 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1868 if(resultCode != eSIR_SME_SUCCESS)
1869 {
1870 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1871 if (pStaDs != NULL)
1872 {
1873 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1874 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1875 pStaDs->mlmStaContext.resultCode = resultCode;
1876 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1877 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1878 return;
1879 }
1880 }
1881
1882 //Delete teh session if REASSOC failure occurred.
1883 if(resultCode != eSIR_SME_SUCCESS)
1884 {
1885 if(NULL != psessionEntry)
1886 {
1887 peDeleteSession(pMac,psessionEntry);
1888 psessionEntry = NULL;
1889 }
1890 }
1891 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1892 smesessionId, smetransactionId);
1893} /*** end limHandleSmeReassocResult() ***/
1894
1895/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 * limProcessMlmAddStaRsp()
1897 *
1898 *FUNCTION:
1899 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1900 * Upon receipt of this message from HAL, MLME -
1901 * > Determines the "state" in which this message was received
1902 * > Forwards it to the appropriate callback
1903 *
1904 *ASSUMPTIONS:
1905 *
1906 *NOTE:
1907 *
1908 * @param pMac Pointer to Global MAC structure
1909 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1910 *
1911 * @return None
1912 */
1913void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1914{
1915 //we need to process the deferred message since the initiating req. there might be nested request.
1916 //in the case of nested request the new request initiated from the response will take care of resetting
1917 //the deffered flag.
1918 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001921 )
1922 {
1923 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1924 return;
1925 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001927}
1928void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1929{
1930 tLimMlmAssocCnf mlmAssocCnf;
1931 tpDphHashNode pStaDs;
1932 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1933 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1934
1935 if(NULL == pAddStaParams )
1936 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001937 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 return;
1939 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301940
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301941 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301943 PELOGE(limLog(pMac, LOGE,
1944 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05301945
1946 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
1947 {
1948 PELOGE(limLog(pMac, LOGE,
1949 FL("ADD_STA success, send update result code with"
1950 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
1951 "limMlmState: %d"), pAddStaParams->staIdx,
1952 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301953 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1954 mesgType = LIM_MLM_REASSOC_CNF;
1955 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
1956 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
1957 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05301958 mlmAssocCnf.resultCode =
1959 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
1960 psessionEntry->staId = pAddStaParams->staIdx;
1961 goto end;
1962 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301963 }
1964
1965 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1966 {
1967 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 {
1969 //TODO: any response to be sent out here ?
1970 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301971 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 psessionEntry->limMlmState);
1973 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1974 goto end;
1975 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301976
1977 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1978 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 //
1980 // Update the DPH Hash Entry for this STA
1981 // with proper state info
1982 //
1983 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1984 if( NULL != pStaDs)
1985 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1986 else
1987 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001988 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 DPH_STA_HASH_INDEX_PEER);
1990 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001991 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 /*
1993 * Storing the self StaIndex(Generated by HAL) in session context,
1994 * instead of storing it in DPH Hash entry for Self STA.
1995 * DPH entry for the self STA stores the sta index for the BSS entry
1996 * to which the STA is associated.
1997 */
1998 psessionEntry->staId = pAddStaParams->staIdx;
1999 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002000#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2001 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2002#endif
2003 {
2004 limReactivateHeartBeatTimer(pMac, psessionEntry);
2005 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002006 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002007
2008 //assign the sessionId to the timer Object
2009 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2010 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002011 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002012#ifdef WLAN_DEBUG
2013 pMac->lim.gLimNumLinkEsts++;
2014#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002015#ifdef FEATURE_WLAN_TDLS
2016 /* initialize TDLS peer related data */
2017 limInitTdlsData(pMac,psessionEntry);
2018#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 // Return Assoc confirm to SME with success
2020 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2021 // be passed in here....
2022 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2023 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2024 }
2025 else
2026 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302027 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302028 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2029 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2031 }
2032end:
2033 if( 0 != limMsgQ->bodyptr )
2034 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302035 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002036 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 }
2038 /* Updating PE session Id*/
2039 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2040 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302041 if (true == psessionEntry->fDeauthReceived)
2042 {
2043 psessionEntry->fDeauthReceived = false;
2044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 return;
2046}
2047void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2048{
2049 //we need to process the deferred message since the initiating req. there might be nested request.
2050 //in the case of nested request the new request initiated from the response will take care of resetting
2051 //the deffered flag.
2052 // tpPESession psessionEntry;
2053 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2054 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2055 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002056 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 // return;
2058 // }
2059 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002060
2061 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2062 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 ) &&
2065 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2066 {
2067 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2068 return;
2069 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002071
2072 if(!limIsInMCC(pMac))
2073 {
2074 WDA_TrafficStatsTimerActivate(FALSE);
2075 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002076
2077#ifdef WLAN_FEATURE_11W
2078 if (psessionEntry->limRmfEnabled)
2079 {
2080 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2081 {
2082 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002083 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002084 }
2085 }
2086#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002087}
2088
2089void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2090{
2091 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2092 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2093 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302094
2095 if (NULL == pDelBssParams)
2096 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002097 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302098 goto end;
2099 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2101 {
2102 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002103 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2105 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2106
2107 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002108 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 statusCode = eSIR_SME_REFUSED;
2110 goto end;
2111 }
2112 if(pStaDs == NULL)
2113 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002114 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 statusCode = eSIR_SME_REFUSED;
2116 goto end;
2117 }
2118 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2119 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302120 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 pStaDs->mlmStaContext.mlmState);)
2122 statusCode = eSIR_SME_REFUSED;
2123 goto end;
2124 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302125 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2126 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 }
2128 else
2129 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302130 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302131 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002132 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 return;
2134 }
2135 end:
2136 if( 0 != limMsgQ->bodyptr )
2137 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302138 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002139 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 }
2141 if(pStaDs == NULL)
2142 return;
2143 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2144 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2145 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2146 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2147 {
2148 /** The Case where the DelBss is invoked from
2149 * context of other than normal DisAssoc / Deauth OR
2150 * as part of Join Failure.
2151 */
2152 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2153 return;
2154 }
2155 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2156 return;
2157}
2158
Jeff Johnson295189b2012-06-20 16:38:30 -07002159void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2160{
2161 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002162 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2164 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2165
2166 if(psessionEntry == NULL)
2167 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002168 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002169 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002170 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302171 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002172 limMsgQ->bodyptr = NULL;
2173 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 return;
2175 }
2176
2177 if (pDelBss == NULL)
2178 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002179 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 rc = eSIR_SME_REFUSED;
2181 goto end;
2182 }
2183 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002184 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2185
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2187 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002188 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302189 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002190 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002191 rc = eSIR_SME_REFUSED;
2192 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 }
2194 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2195 {
2196 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2197 pDelBss->status, pDelBss->bssIdx);
2198 rc = eSIR_SME_STOP_BSS_FAILURE;
2199 goto end;
2200 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002201 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002203 if (status != eSIR_SUCCESS)
2204 {
2205 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 /** Softmac may send all the buffered packets right after resuming the transmission hence
2209 * to occupy the medium during non channel occupancy period. So resume the transmission after
2210 * HAL gives back the response.
2211 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002212#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 if (LIM_IS_RADAR_DETECTED(pMac))
2214 {
2215 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2216 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2217 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2220 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002222 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 end:
2224 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2225 peDeleteSession(pMac, psessionEntry);
2226
2227 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002228 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302229 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002230 limMsgQ->bodyptr = NULL;
2231 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002232}
2233
2234void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2235{
2236 //we need to process the deferred message since the initiating req. there might be nested request.
2237 //in the case of nested request the new request initiated from the response will take care of resetting
2238 //the deffered flag.
2239
2240 tpPESession psessionEntry;
2241 tpDeleteStaParams pDeleteStaParams;
2242 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2243 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302244
2245 if(NULL == pDeleteStaParams ||
2246 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002248 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002249 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002250 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302251 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002252 limMsgQ->bodyptr = NULL;
2253 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 return;
2255 }
2256
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 )
2260 {
2261 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2262 return;
2263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002265}
2266
Jeff Johnson295189b2012-06-20 16:38:30 -07002267void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2268{
2269 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2270 tpDphHashNode pStaDs;
2271 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2272 if(limMsgQ->bodyptr == NULL)
2273 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302274 limLog( pMac, LOGE,
2275 FL( "limMsgQ->bodyptry NULL"));
2276 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2279 if(pStaDs == NULL)
2280 {
2281 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302282 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302284 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002285 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002286
2287 return;
2288 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302289 limLog( pMac, LOG1,
2290 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2291 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2293 {
2294 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302295 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2298 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2299 {
2300 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002301 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2303 statusCode = eSIR_SME_REFUSED;
2304 goto end;
2305 }
2306
2307 limLog( pMac, LOG1,
2308 FL("Deleted STA AssocID %d staId %d MAC "),
2309 pStaDs->assocId, pStaDs->staIndex);
2310 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2311 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2312 {
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;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002315 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 {
2317 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002318 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 pStaDs->assocId);)
2320 // delete the TS if it has already been added.
2321 // send the response with error status.
2322 if(pStaDs->qos.addtsPresent)
2323 {
2324 tpLimTspecInfo pTspecInfo;
2325 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2326 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2327 {
2328 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2329 NULL, &pTspecInfo->idx);
2330 }
2331 }
2332 limRejectAssociation(pMac,
2333 pStaDs->staAddr,
2334 pStaDs->mlmStaContext.subType,
2335 true, pStaDs->mlmStaContext.authType,
2336 pStaDs->assocId, true,
2337 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2338 psessionEntry);
2339 }
2340 return;
2341 }
2342 }
2343 else
2344 {
2345 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002346 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 statusCode = eSIR_SME_REFUSED;
2348 }
2349 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302350 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002351 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2353 {
2354 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2355 }
2356 return;
2357}
2358
2359void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2360{
2361 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2362 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2363 tpDphHashNode pStaDs = NULL;
2364 if(NULL == pDelStaParams )
2365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002366 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 goto end;
2368 }
2369 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2370 {
2371 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2372 if (pStaDs == NULL)
2373 {
2374 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002375 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 pDelStaParams->assocId);
2377 statusCode = eSIR_SME_REFUSED;
2378 goto end;
2379 }
2380 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2381 {
2382 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002383 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 limMlmStateStr(psessionEntry->limMlmState));
2385 statusCode = eSIR_SME_REFUSED;
2386 goto end;
2387 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302388 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2389 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002390 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 //we must complete all cleanup related to delSta before calling limDelBSS.
2392 if( 0 != limMsgQ->bodyptr )
2393 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302394 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002395 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 }
2397 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2398 return;
2399 }
2400 else
2401 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002402 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 statusCode = eSIR_SME_REFUSED;
2404 }
2405end:
2406 if( 0 != limMsgQ->bodyptr )
2407 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302408 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002409 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 }
2411 return;
2412}
2413
Jeff Johnson295189b2012-06-20 16:38:30 -07002414void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2415{
2416 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302417 tpDphHashNode pStaDs = NULL;
2418
2419 if (NULL == pAddStaParams)
2420 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002421 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302422 goto end;
2423 }
2424
2425 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 if(pStaDs == NULL)
2427 {
2428 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002429 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 goto end;
2431 }
2432 //
2433 // TODO & FIXME_GEN4
2434 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2435 //
2436 //TODO: any check for pMac->lim.gLimMlmState ?
2437 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2438 {
2439 //TODO: any response to be sent out here ?
2440 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302441 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 pStaDs->mlmStaContext.mlmState);
2443 goto end;
2444 }
2445 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2446 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002447 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 limRejectAssociation(pMac, pStaDs->staAddr,
2449 pStaDs->mlmStaContext.subType,
2450 true, pStaDs->mlmStaContext.authType,
2451 pStaDs->assocId, true,
2452 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2453 psessionEntry);
2454 goto end;
2455 }
2456 pStaDs->bssId = pAddStaParams->bssIdx;
2457 pStaDs->staIndex = pAddStaParams->staIdx;
2458 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2459 pStaDs->valid = 1;
2460 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2461 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302462 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 pStaDs->assocId,
2464 pStaDs->staIndex);
2465 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2466
2467 /* For BTAMP-AP, the flow sequence shall be:
2468 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2469 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2470 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2471 */
2472 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2473 // fall though to reclaim the original Add STA Response message
2474end:
2475 if( 0 != limMsgQ->bodyptr )
2476 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302477 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002478 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 }
2480 return;
2481}
2482
2483/**
2484 * limProcessApMlmAddBssRsp()
2485 *
2486 *FUNCTION:
2487 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2488 * Upon receipt of this message from HAL, MLME -
2489 * > Validates the result of WDA_ADD_BSS_REQ
2490 * > Init other remaining LIM variables
2491 * > Init the AID pool, for that BSSID
2492 * > Init the Pre-AUTH list, for that BSSID
2493 * > Create LIM timers, specific to that BSSID
2494 * > Init DPH related parameters that are specific to that BSSID
2495 * > TODO - When do we do the actual change channel?
2496 *
2497 *LOGIC:
2498 * SME sends eWNI_SME_START_BSS_REQ to LIM
2499 * LIM sends LIM_MLM_START_REQ to MLME
2500 * MLME sends WDA_ADD_BSS_REQ to HAL
2501 * HAL responds with WDA_ADD_BSS_RSP to MLME
2502 * MLME responds with LIM_MLM_START_CNF to LIM
2503 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2504 *
2505 *ASSUMPTIONS:
2506 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2507 * tSirMsgQ.body will now be freed by this routine
2508 *
2509 *NOTE:
2510 *
2511 * @param pMac Pointer to Global MAC structure
2512 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2513 *
2514 * @return None
2515 */
2516static void
2517limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2518{
2519 tLimMlmStartCnf mlmStartCnf;
2520 tANI_U32 val;
2521 tpPESession psessionEntry;
2522// tANI_U8 sessionId;
2523 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2524 if(NULL == pAddBssParams )
2525 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002526 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 goto end;
2528 }
2529 //TBD: free the memory before returning, do it for all places where lookup fails.
2530 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2531 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002532 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002533 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002534 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302535 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302536 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002537 limMsgQ->bodyptr = NULL;
2538 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 return;
2540 }
2541 /* Update PE session Id*/
2542 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2543 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2544 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302545 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002546 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2547 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2548 goto end;
2549 // Set MLME state
2550 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002551 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2553 {
2554 /** IBSS is 'active' when we receive
2555 * Beacon frames from other STAs that are part of same IBSS.
2556 * Mark internal state as inactive until then.
2557 */
2558 psessionEntry->limIbssActive = false;
2559 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2560 limResetHBPktCount( psessionEntry );
2561 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002562 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002563 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 }
2566 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2567
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002569
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2571 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2572 else
2573 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 schEdcaProfileUpdate(pMac, psessionEntry);
2575 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002576 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 // Create timers used by LIM
2578 if (!pMac->lim.gLimTimersCreated)
2579 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002580
2581 // Start OLBC timer
2582 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2583 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002584 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002585 }
2586
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2588 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002589 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2591 // Apply previously set configuration at HW
2592 limApplyConfiguration(pMac,psessionEntry);
2593 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2594 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2595 }
2596 else
2597 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002598 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2600 }
2601 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2602 end:
2603 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002604 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302605 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302606 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002607 limMsgQ->bodyptr = NULL;
2608 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002609}
2610
2611
2612/**
2613 * limProcessIbssMlmAddBssRsp()
2614 *
2615 *FUNCTION:
2616 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2617 * Upon receipt of this message from HAL, MLME -
2618 * > Validates the result of WDA_ADD_BSS_REQ
2619 * > Init other remaining LIM variables
2620 * > Init the AID pool, for that BSSID
2621 * > Init the Pre-AUTH list, for that BSSID
2622 * > Create LIM timers, specific to that BSSID
2623 * > Init DPH related parameters that are specific to that BSSID
2624 * > TODO - When do we do the actual change channel?
2625 *
2626 *LOGIC:
2627 * SME sends eWNI_SME_START_BSS_REQ to LIM
2628 * LIM sends LIM_MLM_START_REQ to MLME
2629 * MLME sends WDA_ADD_BSS_REQ to HAL
2630 * HAL responds with WDA_ADD_BSS_RSP to MLME
2631 * MLME responds with LIM_MLM_START_CNF to LIM
2632 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2633 *
2634 *ASSUMPTIONS:
2635 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2636 * tSirMsgQ.body will now be freed by this routine
2637 *
2638 *NOTE:
2639 *
2640 * @param pMac Pointer to Global MAC structure
2641 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2642 *
2643 * @return None
2644 */
2645static void
2646limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2647{
2648 tLimMlmStartCnf mlmStartCnf;
2649 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2650 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302651
2652 if (NULL == pAddBssParams)
2653 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002654 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302655 goto end;
2656 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2658 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302659 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2661 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2662 goto end;
2663 // Set MLME state
2664 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002665 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 /** IBSS is 'active' when we receive
2667 * Beacon frames from other STAs that are part of same IBSS.
2668 * Mark internal state as inactive until then.
2669 */
2670 psessionEntry->limIbssActive = false;
2671 limResetHBPktCount( psessionEntry );
2672 /* Timer related functions are not modified for BT-AMP : To be Done */
2673 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002674 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002675 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002676 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2678 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2679 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2680 schEdcaProfileUpdate(pMac, psessionEntry);
2681 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2682 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002683 if (0 == psessionEntry->freePeerIdxHead)
2684 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 // Create timers used by LIM
2686#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2687 if (!pMac->lim.gLimTimersCreated)
2688 limCreateTimers(pMac);
2689#endif
2690 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2691 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002692 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2694 // Apply previously set configuration at HW
2695 limApplyConfiguration(pMac,psessionEntry);
2696 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2697 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2698 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2699 if(true == pMac->lim.gLimIbssCoalescingHappened)
2700 {
2701 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2702 goto end;
2703 }
2704 }
2705 else
2706 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002707 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 pAddBssParams->status );
2709 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2710 }
2711 //Send this message to SME, when ADD_BSS is initiated by SME
2712 //If ADD_BSS is done as part of coalescing, this won't happen.
2713 /* Update PE session Id*/
2714 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2715 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2716 end:
2717 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002718 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302719 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302720 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002721 limMsgQ->bodyptr = NULL;
2722 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002723}
2724
2725static void
2726limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2727{
2728 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2729 tAniAuthType cfgAuthType, authMode;
2730 tLimMlmAuthReq *pMlmAuthReq;
2731 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302732
2733 if (NULL == pAddBssParams)
2734 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002735 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302736 goto joinFailure;
2737 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2739 {
2740 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2741 {
2742 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002743 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2745 goto joinFailure;
2746 }
2747 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2748 //Success, handle below
2749 pStaDs->bssId = pAddBssParams->bssIdx;
2750 //STA Index(genr by HAL) for the BSS entry is stored here
2751 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2752 // Trigger Authentication with AP
2753 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2754 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2755 {
2756 /**
2757 * Could not get AuthType from CFG.
2758 * Log error.
2759 */
2760 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002761 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 }
2763 if (cfgAuthType == eSIR_AUTO_SWITCH)
2764 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2765 else
2766 authMode = cfgAuthType;
2767
2768 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302769 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2770 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 {
2772 // Log error
2773 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302774 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 return;
2776 }
2777 #if 0
2778 val = sizeof(tSirMacAddr);
2779 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2780 pMlmAuthReq->peerMacAddr,
2781 &val) != eSIR_SUCCESS)
2782 {
2783 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002784 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 }
2786 #endif //TO SUPPORT BT-AMP
2787 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2788
2789 pMlmAuthReq->authType = authMode;
2790 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2791 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2792 != eSIR_SUCCESS)
2793 {
2794 /**
2795 * Could not get AuthFailureTimeout
2796 * value from CFG. Log error.
2797 */
2798 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002799 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 }
2801 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2802 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2803 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002804 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002805 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2806 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2807 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2808 // remember staId in case of assoc timeout/failure handling
2809 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2810
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302811 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2812 psessionEntry->peSessionId, psessionEntry->limSmeState));
2813 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2814 "with limSmeState:%d",psessionEntry->peSessionId,
2815 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 limPostMlmMessage(pMac,
2817 LIM_MLM_AUTH_REQ,
2818 (tANI_U32 *) pMlmAuthReq);
2819 return;
2820 }
2821
2822joinFailure:
2823 {
2824 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002825 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002826
2827 /// Send Join response to Host
2828 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2829
2830 }
2831
2832}
2833
2834#ifdef WLAN_FEATURE_VOWIFI_11R
2835/*------------------------------------------------------------------------------------------
2836 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002837 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2838 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 *
2840 *
2841 *------------------------------------------------------------------------------------------
2842 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002843static inline void
2844limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002845{
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002847 tpDphHashNode pStaDs = NULL;
2848 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002849 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002850 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002851 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302852#ifdef FEATURE_WLAN_ESE
2853 tLimMlmReassocReq *pMlmReassocReq;
2854 tANI_U32 val = 0;
2855#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002856
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002857 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002858
2859 if (pAddBssParams == NULL)
2860 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002861 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002862 goto end;
2863 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002864 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2865 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002866 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002867 goto end;
2868 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002869 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2870 {
2871 goto end;
2872 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002873
2874 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2875 &psessionEntry->dph.dphHashTable)) == NULL)
2876 {
2877 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002878 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2880 goto end;
2881 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302882 if (pMac->roam.configParam.roamDelayStatsEnabled)
2883 {
2884 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002886 // Prepare and send Reassociation request frame
2887 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05302888
2889
2890#ifdef FEATURE_WLAN_ESE
2891 /*
2892 * In case of Ese Reassociation, change the reassoc timer
2893 * value.
2894 */
2895 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2896 if (pMlmReassocReq == NULL)
2897 {
2898 limLog(pMac, LOGE,
2899 FL("Invalid pMlmReassocReq"));
2900 goto end;
2901 }
2902 val = pMlmReassocReq->reassocFailureTimeout;
2903 if (psessionEntry->isESEconnection)
2904 {
2905 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
2906 }
2907 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
2908 TX_SUCCESS)
2909 {
2910 limLog(pMac, LOGP,
2911 FL("unable to deactivate Reassoc failure timer"));
2912 }
2913 val = SYS_MS_TO_TICKS(val);
2914 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
2915 val, 0) != TX_SUCCESS)
2916 {
2917 limLog(pMac, LOGP,
2918 FL("unable to change Reassociation failure timer"));
2919 }
2920#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2922 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002923 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002924 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2925 != TX_SUCCESS)
2926 {
2927 /// Could not start reassoc failure timer.
2928 // Log error
2929 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002930 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002931 // Return Reassoc confirm with
2932 // Resources Unavailable
2933 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2934 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2935 goto end;
2936 }
Mihir Shete63561c82014-08-23 16:58:07 +05302937 // remember staId
2938 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2939
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002940#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002941 pMac->lim.pSessionEntry = psessionEntry;
2942 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2943 {
2944 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302945 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2946 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2947 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2948 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2949 psessionEntry->pLimMlmReassocReq,
2950 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002951 }
2952 pMac->lim.reAssocRetryAttempt = 0;
2953#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05302955 if (pMac->roam.configParam.roamDelayStatsEnabled)
2956 {
2957 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
2958 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2960 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002961 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002962 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2964
2965 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2966
2967 //Success, handle below
2968 pStaDs->bssId = pAddBssParams->bssIdx;
2969 //STA Index(genr by HAL) for the BSS entry is stored here
2970 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2971 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2972 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2973
Jeff Johnson295189b2012-06-20 16:38:30 -07002974#if defined WLAN_FEATURE_VOWIFI
2975 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2976#endif
2977
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302978 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2979 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302981 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002982 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302984 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002985
2986 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302987 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2988 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002989
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302990 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2991 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002992
2993 // Update this when we get reassoc rsp , with success.
2994 // pAddStaParams->assocId = psessionEntry->limAID;
2995
2996 pAddStaParams->staType = STA_ENTRY_SELF;
2997 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2998 pAddStaParams->respReqd = 1;
2999
3000 /* Update PE session ID */
3001 pAddStaParams->sessionId = psessionEntry->peSessionId;
3002
3003 // This will indicate HAL to "allocate" a new STA index
3004 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3005 pAddStaParams->updateSta = FALSE;
3006
3007 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003008#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003009 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003010#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003011 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003012#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003013
Jeff Johnsone7245742012-09-05 17:12:55 -07003014 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003016 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003017#ifdef WLAN_FEATURE_11AC
3018 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3019 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3020#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003021#ifdef DISABLE_GF_FOR_INTEROP
3022 /*
3023 * To resolve the interop problem with Broadcom AP,
3024 * where TQ STA could not pass traffic with GF enabled,
3025 * TQ STA will do Greenfield only with TQ AP, for
3026 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003027 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3029 {
3030 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3031 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3032 }
3033 else
3034#endif
3035
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003037 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3038 {
3039 pAddStaParams->txChannelWidthSet =
3040 pMac->roam.configParam.channelBondingMode24GHz;
3041 }
3042 else
3043 {
3044 pAddStaParams->txChannelWidthSet =
3045 pMac->roam.configParam.channelBondingMode5GHz;
3046 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3048 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3049 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3050 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3051 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3052 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3053 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3054 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3055 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3056 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 }
3058
3059 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003060 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003062 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3063 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 // Lets save this for when we receive the Reassoc Rsp
3065 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003066
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003067 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003068 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303069 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003070 vos_mem_free(pAddBssParams);
3071 pAddBssParams = NULL;
3072 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003073 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 return;
3075
3076end:
3077 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003078 if (psessionEntry != NULL)
3079 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003081 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3082 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003084
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003085 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003086 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303087 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003088 vos_mem_free(pAddBssParams);
3089 pAddBssParams = NULL;
3090 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003091 }
3092
3093 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3094 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303095 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003096 if (psessionEntry != NULL)
3097 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003098 else
3099 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003100
3101 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3102}
Jeff Johnson295189b2012-06-20 16:38:30 -07003103#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003104/**
3105 * limProcessStaMlmAddBssRsp()
3106 *
3107 *FUNCTION:
3108 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3109 * Upon receipt of this message from HAL, MLME -
3110 * > Validates the result of WDA_ADD_BSS_REQ
3111 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3112 *
3113 *LOGIC:
3114 * MLME had sent WDA_ADD_BSS_REQ to HAL
3115 * HAL responded with WDA_ADD_BSS_RSP to MLME
3116 * MLME now sends WDA_ADD_STA_REQ to HAL
3117 *
3118 *ASSUMPTIONS:
3119 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3120 * tSirMsgQ.body will now be freed by this routine
3121 *
3122 *NOTE:
3123 *
3124 * @param pMac Pointer to Global MAC structure
3125 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3126 *
3127 * @return None
3128 */
3129static void
3130limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3131{
3132 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3133 tLimMlmAssocCnf mlmAssocCnf;
3134 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3135 tANI_U32 subType = LIM_ASSOC;
3136 tpDphHashNode pStaDs = NULL;
3137 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3138 tANI_U8 updateSta = false;
3139 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3140
3141 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3142 {
3143 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303144 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3145 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003146 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3147 goto end;
3148 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303149
3150 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3151 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003152 {
3153 mesgType = LIM_MLM_REASSOC_CNF;
3154 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303155 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3156 //to update the existing STA entry.
3157 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3158 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3159 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 {
3161 staIdx = psessionEntry->staId;
3162 updateSta = true;
3163 }
3164 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003165
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003166 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003167 goto end;
3168
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3170 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003171#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003172 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3173 {
3174#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003175 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 psessionEntry->limMlmState,
3177 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3178#endif
3179 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3180 goto end;
3181 }
3182#endif /* WLAN_FEATURE_VOWIFI_11R */
3183
3184 // Set MLME state
3185 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003186 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003187 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3188 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303189 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3190 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3192 if (pStaDs == NULL)
3193 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303194 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3195 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3197 }
3198 else
3199 {
3200 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3201 //Success, handle below
3202 pStaDs->bssId = pAddBssParams->bssIdx;
3203 //STA Index(genr by HAL) for the BSS entry is stored here
3204 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3205 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3206 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3207 // Downgrade the EDCA parameters if needed
3208 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3209 // Send the active EDCA parameters to HAL
3210 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3211 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3212 } else {
3213 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3214 }
3215#if defined WLAN_FEATURE_VOWIFI
3216 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3217#endif
3218
3219 if (subType == LIM_REASSOC)
3220 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3221 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3222 {
3223 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303224 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3225 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3227 }
3228 }
3229 }
3230 else
3231 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303232 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3233 psessionEntry->peSessionId, psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303235 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3236 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3237 else
3238 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 }
3240
3241 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3242 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303243 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3244 //Set the RXP mode to IDLE, so it starts filtering the frames.
3245 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3246 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3247 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 /* Update PE session Id*/
3249 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3250 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3251 }
3252 end:
3253 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003254 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303255 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303256 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003257 limMsgQ->bodyptr = NULL;
3258 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003259}
3260
3261
3262
3263/**
3264 * limProcessMlmAddBssRsp()
3265 *
3266 *FUNCTION:
3267 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3268 * Upon receipt of this message from HAL, MLME -
3269 * > Determines the "state" in which this message was received
3270 * > Forwards it to the appropriate callback
3271 *
3272 *LOGIC:
3273 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3274 * in the following two states:
3275 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3276 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3277 * Based on these two states, this API will determine where to
3278 * route the message to
3279 *
3280 *ASSUMPTIONS:
3281 *
3282 *NOTE:
3283 *
3284 * @param pMac Pointer to Global MAC structure
3285 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3286 *
3287 * @return None
3288 */
3289void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3290{
3291 tLimMlmStartCnf mlmStartCnf;
3292 tpPESession psessionEntry;
3293 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3294
3295 if(NULL == pAddBssParams )
3296 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003297 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 return;
3299 }
3300
3301 //
3302 // TODO & FIXME_GEN4
3303 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3304 //
3305 //we need to process the deferred message since the initiating req. there might be nested request.
3306 //in the case of nested request the new request initiated from the response will take care of resetting
3307 //the deffered flag.
3308 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3309 // Validate SME/LIM state
3310 // Validate MLME state
3311 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3312 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303313 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3314 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003315 if( NULL != pAddBssParams )
3316 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303317 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003318 vos_mem_free(pAddBssParams);
3319 limMsgQ->bodyptr = NULL;
3320 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 return;
3322 }
3323 /* update PE session Id*/
3324 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3325 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3326 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3327 else
3328 {
3329 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3330 {
3331 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3332 {
3333 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303334 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303335 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303336 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3338 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003339 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303340 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303341 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003342 limMsgQ->bodyptr = NULL;
3343 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3345 }
3346 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3347 {
3348 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3349 }
3350 else
3351 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3352 }
3353 else
3354 /* Called while processing assoc response */
3355 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3356 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003357
3358 if(limIsInMCC(pMac))
3359 {
3360 WDA_TrafficStatsTimerActivate(TRUE);
3361 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003362
3363#ifdef WLAN_FEATURE_11W
3364 if (psessionEntry->limRmfEnabled)
3365 {
3366 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3367 {
3368 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003369 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003370 }
3371 }
3372#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003373}
3374/**
3375 * limProcessMlmSetKeyRsp()
3376 *
3377 *FUNCTION:
3378 * This function is called to process the following two
3379 * messages from HAL:
3380 * 1) WDA_SET_BSSKEY_RSP
3381 * 2) WDA_SET_STAKEY_RSP
3382 * 3) WDA_SET_STA_BCASTKEY_RSP
3383 * Upon receipt of this message from HAL,
3384 * MLME -
3385 * > Determines the "state" in which this message was received
3386 * > Forwards it to the appropriate callback
3387 *
3388 *LOGIC:
3389 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3390 * received by MLME while in the following state:
3391 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3392 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3393 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3394 * Based on this state, this API will determine where to
3395 * route the message to
3396 *
3397 *ASSUMPTIONS:
3398 * ONLY the MLME state is being taken into account for now.
3399 * This is because, it appears that the handling of the
3400 * SETKEYS REQ is handled symmetrically on both the AP & STA
3401 *
3402 *NOTE:
3403 *
3404 * @param pMac Pointer to Global MAC structure
3405 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3406 *
3407 * @return None
3408 */
3409void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3410{
Jeff Johnsone7245742012-09-05 17:12:55 -07003411 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 tLimMlmSetKeysCnf mlmSetKeysCnf;
3413 tANI_U8 sessionId = 0;
3414 tpPESession psessionEntry;
3415 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303416 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003418 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003420 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 return;
3422 }
3423 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3424 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3425 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003426 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303427 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303428 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003429 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 return;
3431 }
3432 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3433 {
3434 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303435 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 // There's not much that MLME can do at this stage...
3437 respReqd = 0;
3438 }
3439 else
3440 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3441
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303442 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303443 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003444 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003445 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 if( respReqd )
3449 {
3450 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3451 // Prepare and Send LIM_MLM_SETKEYS_CNF
3452 if( NULL != lpLimMlmSetKeysReq )
3453 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303454 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3455 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3456 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003457 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303458 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3459 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303460 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003461 pMac->lim.gpLimMlmSetKeysReq = NULL;
3462 }
3463 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003464 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 }
3466}
3467void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3468{
Jeff Johnson295189b2012-06-20 16:38:30 -07003469 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003470 tANI_U16 resultCode;
3471 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303473 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3474
Jeff Johnson295189b2012-06-20 16:38:30 -07003475 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303476 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303477 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003478 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003479 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 return;
3481 }
3482 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303483 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003484 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303485 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3486 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303487 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303488 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003489 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 return;
3491 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303492 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003493 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3494 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303495 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3496 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003497
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3499 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3500 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303501 /* Mesg received from HAL in Invalid state! */
3502 limLog( pMac, LOGW,
3503 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3504 limMsgQ->type, psessionEntry->limMlmState );
3505 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 }
3507 else
3508 mlmSetKeysCnf.resultCode = resultCode;
3509
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303510 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303511 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003512 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3515
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303516 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3517 psessionEntry->peSessionId, psessionEntry->limMlmState));
3518 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3519 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003520
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303521 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3522 if( NULL != lpLimMlmSetKeysReq )
3523 {
3524 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3525 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3526 sizeof(tSirMacAddr));
3527 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3528 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3529 sizeof(tLimMlmSetKeysReq));
3530 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3531 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303533 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003534}
3535/**
3536 * limProcessMlmRemoveKeyRsp()
3537 *
3538 *FUNCTION:
3539 *
3540 *LOGIC:
3541 *
3542 *ASSUMPTIONS:
3543 *
3544 *NOTE:
3545 *
3546 * @param pMac Pointer to Global MAC structure
3547 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3548 *
3549 * @return None
3550 */
3551void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3552{
Jeff Johnsone7245742012-09-05 17:12:55 -07003553 tANI_U8 respReqd = 1;
3554 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3555 tANI_U16 resultCode;
3556 tANI_U8 sessionId = 0;
3557 tpPESession psessionEntry;
3558 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303559 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003560
3561 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003563 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003564 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 }
3566
Jeff Johnsone7245742012-09-05 17:12:55 -07003567 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3568 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3569 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3570 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003571
Jeff Johnsone7245742012-09-05 17:12:55 -07003572 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003573 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003574 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003575 return;
3576 }
3577
3578 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3579 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3580 else
3581 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3582
3583 // Validate MLME state
3584 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3585 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3586 {
3587 // Mesg received from HAL in Invalid state!
3588 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303589 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003590 limMsgQ->type,
3591 psessionEntry->limMlmState );
3592 respReqd = 0;
3593 }
3594 else
3595 mlmRemoveCnf.resultCode = resultCode;
3596
3597 //
3598 // TODO & FIXME_GEN4
3599 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3600 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303601 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303602 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003603 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003604
3605 // Restore MLME state
3606 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3607 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3608
3609 if( respReqd )
3610 {
3611 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3612 mlmRemoveCnf.sessionId = sessionId;
3613
3614 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3615 if( NULL != lpLimMlmRemoveKeyReq )
3616 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303617 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3618 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3619 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003620 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303621 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003622 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3623 }
3624 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3625 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003626}
3627
Jeff Johnson295189b2012-06-20 16:38:30 -07003628
3629/** ---------------------------------------------------------------------
3630\fn limProcessInitScanRsp
3631\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3632\ message from HAL. If status code is failure, then
3633\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3634\param tpAniSirGlobal pMac
3635\param tANI_U32 body
3636\return none
3637\ ----------------------------------------------------------------------- */
3638void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3639{
3640 tpInitScanParams pInitScanParam;
3641 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003642 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3643 pInitScanParam = (tpInitScanParams) body;
3644 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303645 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003646
3647 //Only abort scan if the we are scanning.
3648 if( pMac->lim.abortScan &&
3649 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3650 {
krunal sonid3d60e12013-07-17 13:24:09 -07003651 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 pMac->lim.abortScan = 0;
3653 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3654 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3655 //Set the resume channel to Any valid channel (invalid).
3656 //This will instruct HAL to set it to any previous valid channel.
3657 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003658 if (status != eHAL_STATUS_SUCCESS)
3659 {
3660 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3661 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3662 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3663 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3664 return;
3665 }
3666 else
3667 {
3668 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3669 }
3670
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 }
3672 switch(pMac->lim.gLimHalScanState)
3673 {
3674 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3675 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3676 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003677 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3679 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3680 /*
3681 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3682 * another Scan request in the same context (happens when 11d is enabled
3683 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3684 * scan in the same context but with bigger channel list), so the state needs to be
3685 * changed before this response message is sent.
3686 */
3687 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 return;
3689 }
3690 else if (status == eHAL_STATUS_SUCCESS)
3691 {
3692 /* since we have successfully triggered a background scan,
3693 * reset the "consecutive bkgnd scan failure" count to 0
3694 */
3695 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3696 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003697 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003698 }
3699 limContinueChannelScan(pMac);
3700 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003701//WLAN_SUSPEND_LINK Related
3702 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3703 if( pMac->lim.gpLimSuspendCallback )
3704 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303705 if( eHAL_STATUS_SUCCESS == status )
3706 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303708 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003709 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303710 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303712 pMac->lim.gLimSystemInScanLearnMode = 0;
3713 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003714
3715 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3716 pMac->lim.gpLimSuspendCallback = NULL;
3717 pMac->lim.gpLimSuspendData = NULL;
3718 }
3719 else
3720 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003721 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003722 return;
3723 }
3724 break;
3725//end WLAN_SUSPEND_LINK Related
3726 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003727 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 pMac->lim.gLimHalScanState);
3729 break;
3730 }
3731 return;
3732}
3733/**
3734 * limProcessSwitchChannelReAssocReq()
3735 *
3736 *FUNCTION:
3737 * This function is called to send the reassoc req mgmt frame after the
3738 * switchChannelRsp message is received from HAL.
3739 *
3740 *LOGIC:
3741 *
3742 *ASSUMPTIONS:
3743 * NA
3744 *
3745 *NOTE:
3746 * NA
3747 *
3748 * @param pMac - Pointer to Global MAC structure.
3749 * @param psessionEntry - session related information.
3750 * @param status - channel switch success/failure.
3751 *
3752 * @return None
3753 */
3754static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3755{
3756 tLimMlmReassocCnf mlmReassocCnf;
3757 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303758#ifdef FEATURE_WLAN_ESE
3759 tANI_U32 val = 0;
3760#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3762 if(pMlmReassocReq == NULL)
3763 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003764 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003765 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3766 goto end;
3767 }
3768
3769 if(status != eHAL_STATUS_SUCCESS)
3770 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003771 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3773 goto end;
3774 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303775
3776#ifdef FEATURE_WLAN_ESE
3777 /*
3778 * In case of Ese Reassociation, change the reassoc timer
3779 * value.
3780 */
3781 val = pMlmReassocReq->reassocFailureTimeout;
3782 if (psessionEntry->isESEconnection)
3783 {
3784 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3785 }
3786 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3787 TX_SUCCESS)
3788 {
3789 limLog(pMac, LOGP,
3790 FL("unable to deactivate Reassoc failure timer"));
3791 }
3792 val = SYS_MS_TO_TICKS(val);
3793 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3794 val, 0) != TX_SUCCESS)
3795 {
3796 limLog(pMac, LOGP,
3797 FL("unable to change Reassociation failure timer"));
3798 }
3799#endif
3800 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003802 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003803 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3804 != TX_SUCCESS)
3805 {
3806 /// Could not start reassoc failure timer.
3807 // Log error
3808 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003809 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 // Return Reassoc confirm with
3811 // Resources Unavailable
3812 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3813 goto end;
3814 }
3815 /// Prepare and send Reassociation request frame
3816 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3817 return;
3818end:
3819 // Free up buffer allocated for reassocReq
3820 if(pMlmReassocReq != NULL)
3821 {
3822 /* Update PE session Id*/
3823 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303824 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003825 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 }
3827 else
3828 {
3829 mlmReassocCnf.sessionId = 0;
3830 }
3831
3832 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3833 /* Update PE sessio Id*/
3834 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3835
3836 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3837}
3838/**
3839 * limProcessSwitchChannelJoinReq()
3840 *
3841 *FUNCTION:
3842 * This function is called to send the probe req mgmt frame after the
3843 * switchChannelRsp message is received from HAL.
3844 *
3845 *LOGIC:
3846 *
3847 *ASSUMPTIONS:
3848 * NA
3849 *
3850 *NOTE:
3851 * NA
3852 *
3853 * @param pMac - Pointer to Global MAC structure.
3854 * @param psessionEntry - session related information.
3855 * @param status - channel switch success/failure.
3856 *
3857 * @return None
3858 */
3859static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3860{
3861 tANI_U32 val;
3862 tSirMacSSid ssId;
3863 tLimMlmJoinCnf mlmJoinCnf;
3864 if(status != eHAL_STATUS_SUCCESS)
3865 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003866 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 goto error;
3868 }
3869
3870 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3871 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003872 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003873 goto error;
3874 }
3875
Jeff Johnsone7245742012-09-05 17:12:55 -07003876
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3878 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3879 {
3880 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3881 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303882 {
3883 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3884 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3885 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303887 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003889
3890 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3891 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003892 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3894 // Apply previously set configuration at HW
3895 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05303896
3897 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
3898 * disconnection was caused by HB failure.
3899 */
3900 if(pMac->roam.configParam.sendDeauthBeforeCon)
3901 {
3902 int apCount;
3903
3904 for(apCount = 0; apCount < 2; apCount++)
3905 {
3906
3907 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3908 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
3909 {
3910 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
3911 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
3912 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
3913 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
3914
3915 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
3916 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3917 psessionEntry, FALSE );
3918
3919 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
3920 sizeof(tSirMacAddr));
3921 break;
3922 }
3923 }
3924 }
3925
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303927 vos_mem_copy(ssId.ssId,
3928 psessionEntry->ssId.ssId,
3929 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003931
3932 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3933
3934 //assign appropriate sessionId to the timer object
3935 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05303936 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
3937 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
3938 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303939 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 // include additional IE if there is
3941 limSendProbeReqMgmtFrame( pMac, &ssId,
3942 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3943 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3944 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003945
3946 // Sending mgmt frame is a blocking call activate Join failure timer now
3947 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3948 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3949 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003950 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003951 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3952 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3953 //memory is freed up below.
3954 psessionEntry->pLimMlmJoinReq = NULL;
3955 goto error;
3956 }
3957
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003958 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3959 {
Yathish9f22e662012-12-10 14:21:35 -08003960 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003961 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3962 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003963 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003964 goto error;
3965 }
3966 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003967
Jeff Johnson295189b2012-06-20 16:38:30 -07003968 return;
3969error:
3970 if(NULL != psessionEntry)
3971 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303972 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 psessionEntry->pLimMlmJoinReq = NULL;
3974 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3975 }
3976 else
3977 {
3978 mlmJoinCnf.sessionId = 0;
3979 }
3980 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3981 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3982 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3983}
3984
3985/**
3986 * limProcessSwitchChannelRsp()
3987 *
3988 *FUNCTION:
3989 * This function is called to process switchChannelRsp message from HAL.
3990 *
3991 *LOGIC:
3992 *
3993 *ASSUMPTIONS:
3994 * NA
3995 *
3996 *NOTE:
3997 * NA
3998 *
3999 * @param pMac - Pointer to Global MAC structure
4000 * @param body - message body.
4001 *
4002 * @return None
4003 */
4004void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4005{
4006 tpSwitchChannelParams pChnlParams = NULL;
4007 eHalStatus status;
4008 tANI_U16 channelChangeReasonCode;
4009 tANI_U8 peSessionId;
4010 tpPESession psessionEntry;
4011 //we need to process the deferred message since the initiating req. there might be nested request.
4012 //in the case of nested request the new request initiated from the response will take care of resetting
4013 //the deffered flag.
4014 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4015 pChnlParams = (tpSwitchChannelParams) body;
4016 status = pChnlParams->status;
4017 peSessionId = pChnlParams->peSessionId;
4018 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4019 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304020 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004021 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004022 return;
4023 }
4024#if defined WLAN_FEATURE_VOWIFI
4025 //HAL fills in the tx power used for mgmt frames in this field.
4026 //Store this value to use in TPC report IE.
4027 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4028#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4030 // initialize it back to invalid id
4031 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304032 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 switch(channelChangeReasonCode)
4034 {
4035 case LIM_SWITCH_CHANNEL_REASSOC:
4036 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4037 break;
4038 case LIM_SWITCH_CHANNEL_JOIN:
4039 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4040 break;
4041
4042 case LIM_SWITCH_CHANNEL_OPERATION:
4043 /*
4044 * The above code should also use the callback.
4045 * mechanism below, there is scope for cleanup here.
4046 * THat way all this response handler does is call the call back
4047 * We can get rid of the reason code here.
4048 */
4049 if (pMac->lim.gpchangeChannelCallback)
4050 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304051 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004052 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4053 {
4054 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4055 {
4056 if ( psessionEntry && psessionEntry->limSmeState
4057 == eLIM_SME_LINK_EST_STATE )
4058 {
4059 peSetResumeChannel( pMac,
4060 psessionEntry->currentOperChannel,
4061 psessionEntry->htSecondaryChannelOffset);
4062 }
4063 else
4064 {
4065 peSetResumeChannel( pMac, 0, 0);
4066 }
4067 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4068 }
4069 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4071 }
4072 break;
4073 default:
4074 break;
4075 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304076 vos_mem_free(body);
4077 body = NULL;
4078
Jeff Johnson295189b2012-06-20 16:38:30 -07004079}
4080/**
4081 * limProcessStartScanRsp()
4082 *
4083 *FUNCTION:
4084 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4085 * then it will start scan/learn on the next channel.
4086 *
4087 *LOGIC:
4088 *
4089 *ASSUMPTIONS:
4090 * NA
4091 *
4092 *NOTE:
4093 * NA
4094 *
4095 * @param pMac - Pointer to Global MAC structure
4096 * @param body - message body.
4097 *
4098 * @return None
4099 */
4100
4101void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4102{
4103 tpStartScanParams pStartScanParam;
4104 eHalStatus status;
4105 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4106 pStartScanParam = (tpStartScanParams) body;
4107 status = pStartScanParam->status;
4108#if defined WLAN_FEATURE_VOWIFI
4109 //HAL fills in the tx power used for mgmt frames in this field.
4110 //Store this value to use in TPC report IE.
4111 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4112 //Store start TSF of scan start. This will be stored in BSS params.
4113 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4114#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304115 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004116 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 if( pMac->lim.abortScan )
4118 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004119 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004120 pMac->lim.abortScan = 0;
4121 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4122 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4123 //Set the resume channel to Any valid channel (invalid).
4124 //This will instruct HAL to set it to any previous valid channel.
4125 peSetResumeChannel(pMac, 0, 0);
4126 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4127 }
4128 switch(pMac->lim.gLimHalScanState)
4129 {
4130 case eLIM_HAL_START_SCAN_WAIT_STATE:
4131 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4132 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004133 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 //
4135 // FIXME - With this, LIM will try and recover state, but
4136 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4137 // status back to the SME
4138 //
4139 //Set the resume channel to Any valid channel (invalid).
4140 //This will instruct HAL to set it to any previous valid channel.
4141 peSetResumeChannel(pMac, 0, 0);
4142 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4143 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4144 }
4145 else
4146 {
4147 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4148 limContinuePostChannelScan(pMac);
4149 }
4150 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004152 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 pMac->lim.gLimHalScanState);
4154 break;
4155 }
4156 return;
4157}
4158void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4159{
4160 tpEndScanParams pEndScanParam;
4161 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4163 pEndScanParam = (tpEndScanParams) body;
4164 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304165 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004166 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004167 switch(pMac->lim.gLimHalScanState)
4168 {
4169 case eLIM_HAL_END_SCAN_WAIT_STATE:
4170 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4171 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004172 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004173 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4174 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4175 }
4176 else
4177 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004178 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 limContinueChannelScan(pMac);
4180 }
4181 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004183 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 pMac->lim.gLimHalScanState);
4185 break;
4186 }
4187 return;
4188}
Jeff Johnsone7245742012-09-05 17:12:55 -07004189/**
4190 * limStopTxAndSwitch()
4191 *
4192 *FUNCTION:
4193 * Start channel switch on all sessions that is in channel switch state.
4194 *
4195 * @param pMac - pointer to global adapter context
4196 *
4197 * @return None
4198 *
4199 */
4200static void
4201limStopTxAndSwitch (tpAniSirGlobal pMac)
4202{
4203 tANI_U8 i;
4204
4205 for(i =0; i < pMac->lim.maxBssId; i++)
4206 {
4207 if(pMac->lim.gpSession[i].valid &&
4208 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4209 {
4210 limStopTxAndSwitchChannel(pMac, i);
4211 }
4212 }
4213 return;
4214}
4215/**
4216 * limStartQuietOnSession()
4217 *
4218 *FUNCTION:
4219 * This function is called to start quiet timer after finish scan if there is
4220 * qeuieting on any session.
4221 *
4222 *LOGIC:
4223 *
4224 *ASSUMPTIONS:
4225 * NA
4226 *
4227 *NOTE:
4228 * NA
4229 *
4230 * @param pMac - Pointer to Global MAC structure
4231 *
4232 * @return None
4233 */
4234static void
4235limStartQuietOnSession (tpAniSirGlobal pMac)
4236{
4237 tANI_U8 i;
4238
4239 for(i =0; i < pMac->lim.maxBssId; i++)
4240 {
4241 if(pMac->lim.gpSession[i].valid &&
4242 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4243 {
4244 limStartQuietTimer(pMac, i);
4245 }
4246 }
4247 return;
4248}
Jeff Johnson295189b2012-06-20 16:38:30 -07004249void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4250{
4251 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 eHalStatus status;
4253 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4254 pFinishScanParam = (tpFinishScanParams) body;
4255 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004256
Sushant Kaushik826de802014-05-08 18:04:11 +05304257 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4258 pMac->lim.gLimHalScanState,
4259 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004260
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 switch(pMac->lim.gLimHalScanState)
4262 {
4263 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4264 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4265 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004266 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 {
4268 /** Right time to stop tx and start the timer for channel switch */
4269 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4270 * be any associated session id
4271 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004272 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004274 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004275 {
4276 /** Start the quieting */
4277 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4278 * be any associated session id
4279 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004280 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4283 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004284 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 }
4286 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004287//WLAN_SUSPEND_LINK Related
4288 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4289 if( pMac->lim.gpLimResumeCallback )
4290 {
4291 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4292 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4293 pMac->lim.gpLimResumeCallback = NULL;
4294 pMac->lim.gpLimResumeData = NULL;
4295 pMac->lim.gLimSystemInScanLearnMode = 0;
4296 }
4297 else
4298 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004299 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304300 vos_mem_free(body);
4301 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 return;
4303 }
4304 break;
4305//end WLAN_SUSPEND_LINK Related
4306
4307 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004308 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 pMac->lim.gLimHalScanState);
4310 break;
4311 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304312 vos_mem_free(body);
4313 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 return;
4315}
4316/**
4317 * @function : limProcessMlmHalAddBARsp
4318 *
4319 * @brief: Process WDA_ADDBA_RSP coming from HAL
4320 *
4321 *
4322 * @param pMac The global tpAniSirGlobal object
4323 *
4324 * @param tSirMsgQ The MsgQ header containing the response buffer
4325 *
4326 * @return none
4327 */
4328void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4329 tpSirMsgQ limMsgQ )
4330{
4331 // Send LIM_MLM_ADDBA_CNF to LIM
4332 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004333 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004335
Jeff Johnson295189b2012-06-20 16:38:30 -07004336 //now LIM can process any defer message.
4337 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4338 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004339 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004340 return;
4341 }
4342 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4343 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004344 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304345 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004346 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 return;
4348 }
4349#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4350 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4351#endif //FEATURE_WLAN_DIAG_SUPPORT
4352
4353 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304354 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4355 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004356 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304357 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004358 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004359 return;
4360 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304361 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304363 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4364 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004365 // Copy other ADDBA Rsp parameters
4366 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4367 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4368 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4369 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4370 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4371 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4372 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4373 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4374 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4375 else
4376 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304377 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004378 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 // Send ADDBA CNF to LIM
4380 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4381}
4382/**
4383 * \brief Process LIM_MLM_ADDBA_CNF
4384 *
4385 * \sa limProcessMlmAddBACnf
4386 *
4387 * \param pMac The global tpAniSirGlobal object
4388 *
4389 * \param tSirMsgQ The MsgQ header containing the response buffer
4390 *
4391 * \return none
4392 */
4393void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4394 tANI_U32 *pMsgBuf )
4395{
4396tpLimMlmAddBACnf pMlmAddBACnf;
4397tpDphHashNode pSta;
4398tANI_U16 aid;
4399tLimBAState curBaState;
4400tpPESession psessionEntry = NULL;
4401if(pMsgBuf == NULL)
4402{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004403 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 return;
4405}
4406pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4407 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004409 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304410 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 return;
4412 }
4413 // First, extract the DPH entry
4414 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4415 if( NULL == pSta )
4416 {
4417 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004418 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304419 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 return;
4421 }
4422 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4423 // Need to validate SME state
4424 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4425 {
4426 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004427 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304429 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 return;
4431 }
4432 // Restore STA BA state
4433 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004434 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 {
4436 // Update LIM internal cache...
4437 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4438 {
4439 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4440 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4441 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4442 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4443 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004444 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4445 // status code. MLME will then send an ADDBA RSP
4446 // over the air to the peer MAC entity
4447 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4448 pMlmAddBACnf->peerMacAddr,
4449 pMlmAddBACnf->addBAResultCode,
4450 pMlmAddBACnf->baDialogToken,
4451 (tANI_U8) pMlmAddBACnf->baTID,
4452 (tANI_U8) pMlmAddBACnf->baPolicy,
4453 pMlmAddBACnf->baBufferSize,
4454 pMlmAddBACnf->baTimeout,psessionEntry))
4455 {
4456 PELOGW(limLog( pMac, LOGW,
4457 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4458 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4459 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 }
4461 else
4462 {
4463 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4464 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4465 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4466 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4467 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4468 }
4469 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004470 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304471 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004472 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004473}
4474/**
4475 * \brief Process LIM_MLM_DELBA_CNF
4476 *
4477 * \sa limProcessMlmDelBACnf
4478 *
4479 * \param pMac The global tpAniSirGlobal object
4480 *
4481 * \param tSirMsgQ The MsgQ header containing the response buffer
4482 *
4483 * \return none
4484 */
4485void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4486 tANI_U32 *pMsgBuf )
4487{
4488 tpLimMlmDelBACnf pMlmDelBACnf;
4489 tpDphHashNode pSta;
4490 tANI_U16 aid;
4491// tANI_U8 sessionId;
4492 tLimBAState curBaState;
4493 tpPESession psessionEntry;
4494
4495 if(pMsgBuf == NULL)
4496 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004497 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 return;
4499 }
4500 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4501 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4502 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304503 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4504 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304505 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 return;
4507 }
4508 // First, extract the DPH entry
4509 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4510 if( NULL == pSta )
4511 {
4512 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004513 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304514 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 return;
4516 }
4517 if(NULL == pMlmDelBACnf)
4518 {
4519 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004520 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004521 return;
4522 }
4523 // Need to validate baState
4524 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4525 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4526 {
4527 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004528 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304530 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 return;
4532 }
4533 // Restore STA BA state
4534 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4535 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304536 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004537}
4538/**
4539 * \brief Process SIR_LIM_DEL_BA_IND
4540 *
4541 * \sa limProcessMlmHalBADeleteInd
4542 *
4543 * \param pMac The global tpAniSirGlobal object
4544 *
4545 * \param tSirMsgQ The MsgQ header containing the indication buffer
4546 *
4547 * \return none
4548 */
4549void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4550 tpSirMsgQ limMsgQ )
4551{
4552 tSirRetStatus status = eSIR_SUCCESS;
4553 tpBADeleteParams pBADeleteParams;
4554 tpDphHashNode pSta;
4555 tANI_U16 aid;
4556 tLimBAState curBaState;
4557 tpPESession psessionEntry;
4558 tANI_U8 sessionId;
4559
4560 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4561
4562 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004564 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304565 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004566 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004567 return;
4568 }
4569 // First, extract the DPH entry
4570 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4571 if( NULL == pSta )
4572 {
4573 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004574 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004575 goto returnAfterCleanup;
4576 }
4577
4578 // Need to validate BA state
4579 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4580 if( eLIM_BA_STATE_IDLE != curBaState )
4581 {
4582 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004583 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 curBaState );
4585 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304586 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004587
Abhishek Singh66c16762014-08-14 19:13:19 +05304588 // Post DELBA REQ to MLME...
4589 if( eSIR_SUCCESS !=
4590 (status = limPostMlmDelBAReq( pMac,
4591 pSta,
4592 pBADeleteParams->baDirection,
4593 pBADeleteParams->baTID,
4594 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304596 limLog( pMac, LOGE,
4597 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 }
4599 else
4600 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304601 limLog( pMac, LOGE,
4602 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4603 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4604 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 }
4606returnAfterCleanup:
4607 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304608 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004609 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004610}
4611/**
4612 * @function : limProcessSetMimoRsp()
4613 *
4614 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4615 * after Processing the Req from the SME (PMC)
4616 *
4617 * LOGIC:
4618 *
4619 * ASSUMPTIONS:
4620 * NA
4621 *
4622 * NOTE:
4623 * NA
4624 *
4625 * @param pMac - Pointer to Global MAC structure
4626 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4627 * @return None
4628 */
4629
4630void
4631limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4632{
4633#if 0
4634 tSirRetStatus retStatus;
4635 tpSetMIMOPS pMIMO_PSParams;
4636
4637
4638 do {
4639
4640 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4641 if( NULL == pMIMO_PSParams ) {
4642 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4643 return;
4644 }
4645
4646 /** If Updation of the HAL Fail's*/
4647 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004648 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 break;
4650 }
4651
4652 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4653 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4654 break;
4655
4656 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4657 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4658
4659 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4660 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4661 * the Action Frame is being sent at first before setting the internal structures
4662 */
4663 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4664 tSirMacAddr macAddr;
4665
4666 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304667 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004668
4669 /** Send Action Frame with the corresponding mode */
4670 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4671 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004672 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 break;
4674 }
4675 }
4676 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4677 }while(0);
4678
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304679 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004680#endif
4681}
4682/**
4683 * @function : limHandleDelBssInReAssocContext
4684 * @brief : While Processing the ReAssociation Response Frame in STA,
4685 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4686 * being issued and the end of DelBSS the new BSS is being added.
4687 *
4688 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4689 * change, We need to update CSR with ReAssocCNF Response with the
4690 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4691 * context only
4692 *
4693 * @param : pMac - tpAniSirGlobal
4694 * pStaDs - Station Descriptor
4695 *
4696 * @return : none
4697 */
4698static void
4699limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4700{
4701 tLimMlmReassocCnf mlmReassocCnf;
4702 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4703 /** Set the MlmState to IDLE*/
4704 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 /* Update PE session Id*/
4706 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304707 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 case eLIM_SME_WT_REASSOC_STATE :
4709 {
4710 tpSirAssocRsp assocRsp;
4711 tpDphHashNode pStaDs;
4712 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304713 tpSchBeaconStruct pBeaconStruct;
4714 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4715 if (NULL == pBeaconStruct)
4716 {
4717 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4718 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4719 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4720 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4721 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4722 goto Error;
4723 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 /** Delete the older STA Table entry */
4725 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4726 /**
4727 * Add an entry for AP to hash table
4728 * maintained by DPH module
4729 */
4730 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4731 {
4732 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004733 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004734 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4735 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4736 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4737 goto Error;
4738 }
4739 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4740 * is being stored to be used here for sending ADDBSS
4741 */
4742 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4743 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4744 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 limExtractApCapabilities( pMac,
4746 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4747 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Sushant Kaushik374fd052015-03-12 16:47:53 +05304748 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304750 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4751 if(pBeaconStruct->erpPresent) {
4752 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004753 psessionEntry->beaconParams.fShortPreamble = 0;
4754 else
4755 psessionEntry->beaconParams.fShortPreamble = 1;
4756 }
4757 //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 +05304758 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004759 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004760 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004761 retStatus = eSIR_FAILURE;
4762 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004763 if (retStatus != eSIR_SUCCESS)
4764 {
4765 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4766 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304767 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304768 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004769 pMac->lim.gLimAssocResponseData = NULL;
4770 goto Error;
4771 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304772 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304773 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 psessionEntry->limAssocResponseData = NULL;
4775 }
4776 break;
4777 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4778 {
4779 /** Case wherein the DisAssoc / Deauth
4780 * being sent as response to ReAssoc Req*/
4781 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4782 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4783 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4784 /** Set the SME State back to WT_Reassoc State*/
4785 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4787 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4788 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4789 {
4790 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 }
4792 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4793 }
4794 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004795 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004796 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4798 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4799 goto Error;
4800 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004801 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004802Error:
4803 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4804}
4805
4806/* Added For BT -AMP Support */
4807static void
4808limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4809{
4810 tLimMlmStartCnf mlmStartCnf;
4811 tANI_U32 val;
4812 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4813
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304814 if (NULL == pAddBssParams)
4815 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004816 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304817 goto end;
4818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004819 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4820 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004821 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4823 {
4824 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4825 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4826 goto end;
4827 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4828 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4829 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4830 goto end;
4831 }
4832
4833 // Set MLME state
4834 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4835 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4836 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4837 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004838 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 // Create timers used by LIM
4840 if (!pMac->lim.gLimTimersCreated)
4841 limCreateTimers(pMac);
4842 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4843 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004844 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4846 // Apply previously set configuration at HW
4847 limApplyConfiguration(pMac,psessionEntry);
4848 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4849 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4850 }
4851 else
4852 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004853 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004854 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4855 }
4856 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4857 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4858 end:
4859 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004860 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304861 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304862 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004863 limMsgQ->bodyptr = NULL;
4864 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004865}
4866
4867/**
4868 * @function : limHandleAddBssInReAssocContext
4869 * @brief : While Processing the ReAssociation Response Frame in STA,
4870 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4871 * being issued and the end of DelBSS the new BSS is being added.
4872 *
4873 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4874 * change, We need to update CSR with ReAssocCNF Response with the
4875 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4876 * context only
4877 *
4878 * @param : pMac - tpAniSirGlobal
4879 * pStaDs - Station Descriptor
4880 *
4881 * @return : none
4882 */
4883void
4884limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4885{
4886 tLimMlmReassocCnf mlmReassocCnf;
4887 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4888 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004889 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4890 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004892 case eLIM_SME_WT_REASSOC_STATE : {
4893 tpSirAssocRsp assocRsp;
4894 tpDphHashNode pStaDs;
4895 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004896 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304897 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4898 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004899 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304900 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004901 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4902 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4903 goto Error;
4904 }
4905
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 // Get the AP entry from DPH hash table
4907 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4908 if (pStaDs == NULL )
4909 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004910 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4912 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304913 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 goto Error;
4915 }
4916 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4917 * is being stored to be used here for sending ADDBSS
4918 */
4919 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4920 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4921 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 limExtractApCapabilities( pMac,
4923 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4924 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004925 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004927 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4928
4929 if(pBeaconStruct->erpPresent)
4930 {
4931 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 psessionEntry->beaconParams.fShortPreamble = 0;
4933 else
4934 psessionEntry->beaconParams.fShortPreamble = 1;
4935 }
4936
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004937 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004939 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004940 retStatus = eSIR_FAILURE;
4941 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004942 if (retStatus != eSIR_SUCCESS)
4943 {
4944 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4945 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304946 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004947 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304948 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004949 goto Error;
4950 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304951 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004952 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304953 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004954 }
4955 break;
4956 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4957 * being sent as response to ReAssoc Req*/
4958 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4959 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4960 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4961 /** Set the SME State back to WT_Reassoc State*/
4962 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4963 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4964 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004965 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004967 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4968 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004969
4970 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4971 }
4972 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004974 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004975 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4976 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4977 goto Error;
4978 }
4979return;
4980Error:
4981 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4982}
4983
4984#if 0
4985 static void
4986limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4987{
4988 tSirSmeAssocCnf assocCnf;
4989 tpDphHashNode pStaDs;
4990 tpPESession psessionEntry;
4991 tANI_U8 sessionId;
4992
4993 if(pMsgBuf == NULL)
4994 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004995 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004996 goto end;
4997 }
4998 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4999 !__limIsSmeAssocCnfValid(&assocCnf))
5000 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005001 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 goto end;
5003 }
5004 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5005 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005006 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005007 goto end;
5008 }
5009 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5010 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5011 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005012 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5014 goto end;
5015 }
5016 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5017 if (pStaDs == NULL)
5018 {
5019 limLog(pMac, LOG1,
5020 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5021 msgType, assocCnf.aid);
5022 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5023 /*
5024 ** send a DISASSOC_IND message to WSM to make sure
5025 ** the state in WSM and LIM is the same
5026 **/
5027 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5028 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5029 goto end;
5030 }
5031 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305032 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005033 (tANI_U8 *) assocCnf.peerMacAddr,
5034 sizeof(tSirMacAddr)) ) ||
5035 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5036 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5037 (msgType != eWNI_SME_ASSOC_CNF)) ||
5038 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5039 (msgType != eWNI_SME_REASSOC_CNF)))))
5040 {
5041 limLog(pMac, LOG1,
5042 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5043 msgType, assocCnf.aid);
5044 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5045 goto end;
5046 }
5047 /*
5048 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5049 ** has been received
5050 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005051 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5053 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5054 {
5055 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5056 * when it had received Assoc Request frame. Now, PE just needs to send
5057 * Association Response frame to the requesting BTAMP-STA.
5058 */
5059 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005060 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005061 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5062 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5063 goto end;
5064 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5065 else
5066 {
5067 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5068 limRejectAssociation(pMac, pStaDs->staAddr,
5069 pStaDs->mlmStaContext.subType,
5070 true, pStaDs->mlmStaContext.authType,
5071 pStaDs->assocId, true,
5072 assocCnf.statusCode, psessionEntry);
5073 return;
5074 }
5075end:
5076 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5077 {
5078 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5079 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305080 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5082 }
5083
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305084 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005085 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5086 }
5087} /*** end __limProcessSmeAssocCnfNew() ***/
5088#endif
5089
Jeff Johnson295189b2012-06-20 16:38:30 -07005090void
5091limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5092 tBeaconGenParams *pBeaconGenParams = NULL;
5093 tSirMsgQ limMsg;
5094 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5095 if(psessionEntry == NULL ){
5096 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005097 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005098 return;
5099 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305100 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5101 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005102 {
5103 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305104 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005105 return;
5106 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305107 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5108 vos_mem_copy((void *) pBeaconGenParams->bssId,
5109 (void *)psessionEntry->bssId,
5110 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005111 limMsg.bodyptr = pBeaconGenParams;
5112 schProcessPreBeaconInd(pMac, &limMsg);
5113 return;
5114}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305115
5116void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5117 tSirResultCodes reasonCode)
5118{
5119 tANI_U16 scanRspLen = 0;
5120
5121 pMac->lim.gLimSmeScanResultLength +=
5122 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305123 pMac->lim.gLimRspReqd = false;
5124 if ((reasonCode == eSIR_SME_SUCCESS) ||
5125 pMac->lim.gLimSmeScanResultLength) {
5126 scanRspLen = sizeof(tSirSmeScanRsp) +
5127 pMac->lim.gLimSmeScanResultLength -
5128 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305129 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305130 else
5131 scanRspLen = sizeof(tSirSmeScanRsp);
5132
5133 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5134 pMac->lim.gSmeSessionId,
5135 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305136}
5137
5138
5139void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5140{
5141 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5142
5143 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005144 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305145
5146 switch (pScanEvent->event)
5147 {
5148 case SCAN_EVENT_STARTED:
5149 break;
5150 case SCAN_EVENT_START_FAILED:
5151 case SCAN_EVENT_COMPLETED:
5152 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5153 break;
5154 case SCAN_EVENT_BSS_CHANNEL:
5155 case SCAN_EVENT_FOREIGN_CHANNEL:
5156 case SCAN_EVENT_DEQUEUED:
5157 case SCAN_EVENT_PREEMPTED:
5158 default:
5159 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005160 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305161 }
5162}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005163
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305164void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5165{
5166
5167 if ((rspStatus != eSIR_SUCCESS) ||
5168 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5169 {
5170 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing"));
5171 pMac->lim.isSpoofingEnabled = FALSE;
5172 } else {
5173 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5174 pMac->lim.isSpoofingEnabled = TRUE;
5175 }
5176
5177 return;
5178}
5179
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005180void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5181 eHalStatus status,
5182 tANI_U32* mlmAddBssRsp)
5183{
5184 if (status != eHAL_STATUS_SUCCESS)
5185 {
5186 limLog(pMac, LOGE,
5187 FL(" CSA failed to get the response for resume link"));
5188 }
5189 return;
5190}