blob: 5c698291bf9ce7c5cba29754227dcf9903e6ba4c [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
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530947 /* Upon Reassoc success or failure, freeup the cached
948 * preauth request, to ensure that channel switch is now
949 * allowed following any change in HT params.
950 */
951 if (pMac->ft.ftPEContext.pFTPreAuthReq)
952 {
953 limLog(pMac, LOG1, "%s: Freeing pFTPreAuthReq= %p", __func__,
954 pMac->ft.ftPEContext.pFTPreAuthReq);
955 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
956 {
957 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
958 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
959 }
960 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
961 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
962 }
963
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530964 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700965 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
966 // Successful Reassociation
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530967 limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700968
969 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700970 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700971
972 /**
973 * Need to send Reassoc response with
974 * Reassociation success to Host.
975 */
976 limSendSmeJoinReassocRsp(
977 pMac, eWNI_SME_REASSOC_RSP,
978 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
979 psessionEntry->smeSessionId,psessionEntry->transactionId);
980 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
981 /** Reassociation failure With the New AP
982 * but we still have the link with the Older AP
983 */
984 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700985 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700986
987 /**
988 * Need to send Reassoc response with
989 * Association failure to Host.
990 */
991 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
992 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
993 psessionEntry->smeSessionId,psessionEntry->transactionId);
994 }else {
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530995 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
996 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
997 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
998 */
999 if(pLimMlmReassocCnf->resultCode
1000 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
1001 {
1002 // Reassociation failure
1003 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
1004 }
1005 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 /**
1007 * Need to send Reassoc response with
1008 * Association failure to Host.
1009 */
Jeff Johnsone7245742012-09-05 17:12:55 -07001010 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 }
1012} /*** end limProcessMlmReassocCnf() ***/
1013
1014/**
1015 * limProcessMlmReassocInd()
1016 *
1017 *FUNCTION:
1018 * This function is called to processes MLM_REASSOC_IND
1019 * message from MLM State machine.
1020 *
1021 *LOGIC:
1022 *
1023 *ASSUMPTIONS:
1024 *
1025 *NOTE:
1026 *
1027 * @param pMac Pointer to Global MAC structure
1028 * @param pMsgBuf A pointer to the MLM message buffer
1029 *
1030 * @return None
1031 */
1032void
1033limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1034{
1035 tANI_U32 len;
1036 tSirMsgQ msgQ;
1037 tSirSmeReassocInd *pSirSmeReassocInd;
1038 tpDphHashNode pStaDs=0;
1039 tpPESession psessionEntry;
1040 tANI_U8 sessionId;
1041 if(pMsgBuf == NULL)
1042 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001043 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return;
1045 }
1046 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1047 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001048 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 return;
1050 }
1051 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301053 pSirSmeReassocInd = vos_mem_malloc(len);
1054 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 {
1056 // Log error
1057 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301058 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 return;
1060
1061 }
1062 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1063 eWNI_SME_REASSOC_IND);
1064 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1065 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1066
1067 // Required for indicating the frames to upper layer
1068 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1069 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1070 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1071 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1072
1073 msgQ.type = eWNI_SME_REASSOC_IND;
1074 msgQ.bodyptr = pSirSmeReassocInd;
1075 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001076 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001077#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1078 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1079#endif //FEATURE_WLAN_DIAG_SUPPORT
1080 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1081 if (! pStaDs)
1082 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001083 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301085 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 return;
1087 }
1088
1089 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301090 limLog(pMac, LOG1,
1091 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 /*
1093 ** turn on a timer to detect the loss of REASSOC CNF
1094 **/
1095 limActivateCnfTimer(pMac,
1096 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1097} /*** end limProcessMlmReassocInd() ***/
1098
1099/**
1100 * limProcessMlmAuthInd()
1101 *
1102 *FUNCTION:
1103 * This function is called to processes MLM_AUTH_IND
1104 * message from MLM State machine.
1105 *
1106 *LOGIC:
1107 *
1108 *ASSUMPTIONS:
1109 *
1110 *NOTE:
1111 *
1112 * @param pMac Pointer to Global MAC structure
1113 * @param pMsgBuf A pointer to the MLM message buffer
1114 *
1115 * @return None
1116 */
1117void
1118limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1119{
1120 tSirMsgQ msgQ;
1121 tSirSmeAuthInd *pSirSmeAuthInd;
1122
1123 if(pMsgBuf == NULL)
1124 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001125 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 return;
1127 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301128 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1129 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 {
1131 // Log error
1132 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301133 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 }
1135 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1136 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1137 (tANI_U8 *) &(pSirSmeAuthInd->length));
1138 msgQ.type = eWNI_SME_AUTH_IND;
1139 msgQ.bodyptr = pSirSmeAuthInd;
1140 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001141 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001142#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1143 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1144#endif //FEATURE_WLAN_DIAG_SUPPORT
1145 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1146} /*** end limProcessMlmAuthInd() ***/
1147
1148
1149
1150
1151void
1152limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1153 tSirSmeAssocInd *pSirSmeAssocInd,
1154 tpPESession psessionEntry)
1155{
1156 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1157 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1158
1159 // Required for indicating the frames to upper layer
1160 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1161 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1162
1163 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1164 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1165
1166 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301167 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1168 sizeof(tSirMacAddr));
1169
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 // Fill in aid
1171 pSirSmeAssocInd->aid = pAssocInd->aid;
1172 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301173 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 // Fill in staId
1175 //pSirSmeAssocInd->staId = psessionEntry->staId;
1176 // Fill in authType
1177 pSirSmeAssocInd->authType = pAssocInd->authType;
1178 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301179 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1180 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301182 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1183 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1184 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301187 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1188 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1189 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001190
1191 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1193 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1194 {
1195 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1196 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1197 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301198 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301200 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001202 // Fill in WmmInfo
1203 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Hardik Kantilal Patel1ba630f2014-11-21 04:32:05 +05301204#ifdef WLAN_FEATURE_AP_HT40_24G
1205 pSirSmeAssocInd->HT40MHzIntoEnabledSta = pAssocInd->HT40MHzIntoPresent;
1206 limLog(pMac, LOGW, FL("HT40MHzIntoPresent: %d \n"),
1207 pSirSmeAssocInd->HT40MHzIntoEnabledSta);
1208#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001209} /*** end limAssocIndSerDes() ***/
1210
1211
1212
1213/**
1214 * limProcessMlmAssocInd()
1215 *
1216 *FUNCTION:
1217 * This function is called to processes MLM_ASSOC_IND
1218 * message from MLM State machine.
1219 *
1220 *LOGIC:
1221 *
1222 *ASSUMPTIONS:
1223 *
1224 *NOTE:
1225 *
1226 * @param pMac Pointer to Global MAC structure
1227 * @param pMsgBuf A pointer to the MLM message buffer
1228 *
1229 * @return None
1230 */
1231void
1232limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1233{
1234 tANI_U32 len;
1235 tSirMsgQ msgQ;
1236 tSirSmeAssocInd *pSirSmeAssocInd;
1237 tpDphHashNode pStaDs=0;
1238 tpPESession psessionEntry;
1239 if(pMsgBuf == NULL)
1240 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001241 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return;
1243 }
1244 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1245 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001246 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 return;
1248 }
1249 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301251 pSirSmeAssocInd = vos_mem_malloc(len);
1252 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 {
1254 // Log error
1255 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301256 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 return;
1258 }
1259
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1261 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 msgQ.type = eWNI_SME_ASSOC_IND;
1263 msgQ.bodyptr = pSirSmeAssocInd;
1264 msgQ.bodyval = 0;
1265 pStaDs = dphGetHashEntry(pMac,
1266 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1267 if (! pStaDs)
1268 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001269 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301271 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
1273 return;
1274 }
1275 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001277 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001278#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1279 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1280#endif //FEATURE_WLAN_DIAG_SUPPORT
1281 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1282
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301283 limLog(pMac, LOG1,
1284 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 /*
1286 ** turn on a timer to detect the loss of ASSOC CNF
1287 **/
1288 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1289
1290// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1291#ifdef TEST_BTAMP_AP
1292//tANI_U32 *pMsgBuf;
1293{
1294 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301295 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1296 if ( NULL == pSmeAssoccnf )
1297 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001298 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1299 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301300 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1301 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1303 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301304 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1305 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301307 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1309 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301310 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001311}
1312#endif
1313
1314
1315} /*** end limProcessMlmAssocInd() ***/
1316
1317
1318
1319
1320/**
1321 * limProcessMlmDisassocInd()
1322 *
1323 *FUNCTION:
1324 * This function is called to processes MLM_DISASSOC_IND
1325 * message from MLM State machine.
1326 *
1327 *LOGIC:
1328 *
1329 *ASSUMPTIONS:
1330 *
1331 *NOTE:
1332 *
1333 * @param pMac Pointer to Global MAC structure
1334 * @param pMsgBuf A pointer to the MLM message buffer
1335 *
1336 * @return None
1337 */
1338void
1339limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1340{
1341 tLimMlmDisassocInd *pMlmDisassocInd;
1342 tpPESession psessionEntry;
1343 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1344 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1345 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001346 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 return;
1348 }
1349 switch (psessionEntry->limSystemRole)
1350 {
1351 case eLIM_STA_IN_IBSS_ROLE:
1352 break;
1353 case eLIM_STA_ROLE:
1354 case eLIM_BT_AMP_STA_ROLE:
1355 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001356 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 break;
1358 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301359 limLog(pMac, LOG1,
1360 FL("*** Peer staId = %d Disassociated ***"),
1361 pMlmDisassocInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 // Send SME_DISASOC_IND after Polaris cleanup
1363 // (after receiving LIM_MLM_PURGE_STA_IND)
1364 break;
1365 } // end switch (psessionEntry->limSystemRole)
1366} /*** end limProcessMlmDisassocInd() ***/
1367
1368/**
1369 * limProcessMlmDisassocCnf()
1370 *
1371 *FUNCTION:
1372 * This function is called to processes MLM_DISASSOC_CNF
1373 * message from MLM State machine.
1374 *
1375 *LOGIC:
1376 *
1377 *ASSUMPTIONS:
1378 *
1379 *NOTE:
1380 *
1381 * @param pMac Pointer to Global MAC structure
1382 * @param pMsgBuf A pointer to the MLM message buffer
1383 *
1384 * @return None
1385 */
1386void
1387limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1388{
1389 tSirResultCodes resultCode;
1390 tLimMlmDisassocCnf *pMlmDisassocCnf;
1391 tpPESession psessionEntry;
1392 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1393 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1394 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001395 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 return;
1397 }
1398 resultCode = (tSirResultCodes)
1399 (pMlmDisassocCnf->disassocTrigger ==
1400 eLIM_LINK_MONITORING_DISASSOC) ?
1401 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1402 pMlmDisassocCnf->resultCode;
1403 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1404 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 // Disassociate Confirm from MLM
1406 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1407 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1408 {
1409 /**
1410 * Should not have received
1411 * Disassocate confirm
1412 * from MLM in other states.
1413 * Log error
1414 */
1415 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301416 FL("received unexpected MLM_DISASSOC_CNF in state %d"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 return;
1418 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 if (pMac->lim.gLimRspReqd)
1420 pMac->lim.gLimRspReqd = false;
1421 if (pMlmDisassocCnf->disassocTrigger ==
1422 eLIM_PROMISCUOUS_MODE_DISASSOC)
1423 {
1424 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1425 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1426 else
1427 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001428 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 // Send Promiscuous mode response to host
1430 limSendSmePromiscuousModeRsp(pMac);
1431 }
1432 else
1433 {
1434 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1435 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1436 else
1437 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001438 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1440 resultCode,
1441 pMlmDisassocCnf->disassocTrigger,
1442 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1443 }
1444 }
1445 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1446 {
1447 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1448 resultCode,
1449 pMlmDisassocCnf->disassocTrigger,
1450 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1451 }
1452} /*** end limProcessMlmDisassocCnf() ***/
1453
1454/**
1455 * limProcessMlmDeauthInd()
1456 *
1457 *FUNCTION:
1458 * This function is called to processes MLM_DEAUTH_IND
1459 * message from MLM State machine.
1460 *
1461 *LOGIC:
1462 *
1463 *ASSUMPTIONS:
1464 *
1465 *NOTE:
1466 *
1467 * @param pMac Pointer to Global MAC structure
1468 * @param pMsgBuf A pointer to the MLM message buffer
1469 *
1470 * @return None
1471 */
1472void
1473limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1474{
1475 tLimMlmDeauthInd *pMlmDeauthInd;
1476 tpPESession psessionEntry;
1477 tANI_U8 sessionId;
1478 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1479 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1480 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001481 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 return;
1483 }
1484 switch (psessionEntry->limSystemRole)
1485 {
1486 case eLIM_STA_IN_IBSS_ROLE:
1487 break;
1488 case eLIM_STA_ROLE:
1489 case eLIM_BT_AMP_STA_ROLE:
1490 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001491 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
1493 default: // eLIM_AP_ROLE
1494 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301495 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001496 FL("*** Received Deauthentication from staId=%d ***"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301497 pMlmDeauthInd->aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 }
1499 // Send SME_DEAUTH_IND after Polaris cleanup
1500 // (after receiving LIM_MLM_PURGE_STA_IND)
1501 break;
1502 } // end switch (psessionEntry->limSystemRole)
1503} /*** end limProcessMlmDeauthInd() ***/
1504
1505/**
1506 * limProcessMlmDeauthCnf()
1507 *
1508 *FUNCTION:
1509 * This function is called to processes MLM_DEAUTH_CNF
1510 * message from MLM State machine.
1511 *
1512 *LOGIC:
1513 *
1514 *ASSUMPTIONS:
1515 *
1516 *NOTE:
1517 *
1518 * @param pMac Pointer to Global MAC structure
1519 * @param pMsgBuf A pointer to the MLM message buffer
1520 *
1521 * @return None
1522 */
1523void
1524limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1525{
1526 tANI_U16 aid;
1527 tSirResultCodes resultCode;
1528 tLimMlmDeauthCnf *pMlmDeauthCnf;
1529 tpPESession psessionEntry;
1530
1531 if(pMsgBuf == NULL)
1532 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001533 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 return;
1535 }
1536 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1537 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1538 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001539 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 return;
1541 }
1542
1543 resultCode = (tSirResultCodes)
1544 (pMlmDeauthCnf->deauthTrigger ==
1545 eLIM_LINK_MONITORING_DEAUTH) ?
1546 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1547 pMlmDeauthCnf->resultCode;
1548 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1549 pMlmDeauthCnf->aid : 1;
1550 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1551 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 // Deauth Confirm from MLM
1553 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1554 {
1555 /**
1556 * Should not have received Deauth confirm
1557 * from MLM in other states.
1558 * Log error
1559 */
1560 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301561 FL("received unexpected MLM_DEAUTH_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 psessionEntry->limSmeState);)
1563 return;
1564 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1566 {
1567 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301568 limLog(pMac, LOG1,
1569 FL("*** Deauthenticated with BSS ***"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 }
1571 else
1572 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001573 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001574
1575 if (pMac->lim.gLimRspReqd)
1576 pMac->lim.gLimRspReqd = false;
1577 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1579 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1580 resultCode,
1581 pMlmDeauthCnf->deauthTrigger,
1582 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001583} /*** end limProcessMlmDeauthCnf() ***/
1584
1585/**
1586 * limProcessMlmPurgeStaInd()
1587 *
1588 *FUNCTION:
1589 * This function is called to processes MLM_PURGE_STA_IND
1590 * message from MLM State machine.
1591 *
1592 *LOGIC:
1593 *
1594 *ASSUMPTIONS:
1595 *
1596 *NOTE:
1597 *
1598 * @param pMac Pointer to Global MAC structure
1599 * @param pMsgBuf A pointer to the MLM message buffer
1600 *
1601 * @return None
1602 */
1603void
1604limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1605{
1606 tSirResultCodes resultCode;
1607 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1608 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 if(pMsgBuf == NULL)
1610 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001611 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 return;
1613 }
1614 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1615 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1616 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001617 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 return;
1619 }
1620 // Purge STA indication from MLM
1621 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1622 switch (psessionEntry->limSystemRole)
1623 {
1624 case eLIM_STA_IN_IBSS_ROLE:
1625 break;
1626 case eLIM_STA_ROLE:
1627 case eLIM_BT_AMP_STA_ROLE:
1628 default: // eLIM_AP_ROLE
1629 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1630 (psessionEntry->limSmeState !=
1631 eLIM_SME_WT_DISASSOC_STATE) &&
1632 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1633 {
1634 /**
1635 * Should not have received
1636 * Purge STA indication
1637 * from MLM in other states.
1638 * Log error
1639 */
1640 PELOGE(limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301641 FL("received unexpected MLM_PURGE_STA_IND in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 psessionEntry->limSmeState);)
1643 break;
1644 }
1645 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001646 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 pMlmPurgeStaInd->aid);)
1648 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1649 {
1650 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001651 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 }
1654 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1655 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 limSendSmeDeauthNtf(pMac,
1657 pMlmPurgeStaInd->peerMacAddr,
1658 resultCode,
1659 pMlmPurgeStaInd->purgeTrigger,
1660 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 }
1662 else
1663 limSendSmeDisassocNtf(pMac,
1664 pMlmPurgeStaInd->peerMacAddr,
1665 resultCode,
1666 pMlmPurgeStaInd->purgeTrigger,
1667 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1668 } // end switch (psessionEntry->limSystemRole)
1669} /*** end limProcessMlmPurgeStaInd() ***/
1670
1671/**
1672 * limProcessMlmSetKeysCnf()
1673 *
1674 *FUNCTION:
1675 * This function is called to processes MLM_SETKEYS_CNF
1676 * message from MLM State machine.
1677 *
1678 *LOGIC:
1679 *
1680 *ASSUMPTIONS:
1681 *
1682 *NOTE:
1683 *
1684 * @param pMac Pointer to Global MAC structure
1685 * @param pMsgBuf A pointer to the MLM message buffer
1686 *
1687 * @return None
1688 */
1689void
1690limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1691{
1692 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001693 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 tpPESession psessionEntry;
Abhishek Singh683d7862014-11-05 17:34:31 +05301695 tANI_U16 aid;
1696 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -07001697
1698 if(pMsgBuf == NULL)
1699 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001700 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001701 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 }
1703 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1704 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1705 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001706 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 return;
1708 }
Abhishek Singh28266f02014-11-05 17:22:19 +05301709 psessionEntry->isKeyInstalled = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001711 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 pMlmSetKeysCnf->resultCode );
Abhishek Singh28266f02014-11-05 17:22:19 +05301713 /* if the status is success keys are installed in the
1714 * Firmware so we can set the protection bit
1715 */
Abhishek Singh683d7862014-11-05 17:34:31 +05301716 if (eSIR_SME_SUCCESS == pMlmSetKeysCnf->resultCode) {
Abhishek Singh28266f02014-11-05 17:22:19 +05301717 psessionEntry->isKeyInstalled = 1;
Abhishek Singh683d7862014-11-05 17:34:31 +05301718 if ((psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
1719 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) {
1720 pStaDs = dphLookupHashEntry(pMac, pMlmSetKeysCnf->peerMacAddr, &aid,
1721 &psessionEntry->dph.dphHashTable);
1722 if (pStaDs != NULL)
1723 pStaDs->isKeyInstalled = 1;
1724 }
1725 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 limSendSmeSetContextRsp(pMac,
1727 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1730 psessionEntry->transactionId);
1731} /*** end limProcessMlmSetKeysCnf() ***/
1732/**
1733 * limProcessMlmRemoveKeyCnf()
1734 *
1735 *FUNCTION:
1736 * This function is called to processes MLM_REMOVEKEY_CNF
1737 * message from MLM State machine.
1738 *
1739 *LOGIC:
1740 *
1741 *ASSUMPTIONS:
1742 *
1743 *NOTE:
1744 *
1745 * @param pMac Pointer to Global MAC structure
1746 * @param pMsgBuf A pointer to the MLM message buffer
1747 *
1748 * @return None
1749 */
1750void
1751limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1752{
1753 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001754 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 tpPESession psessionEntry;
1756
1757 if(pMsgBuf == NULL)
1758 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001759 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001760 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 }
1762 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1763 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1764 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001765 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 return;
1767 }
1768 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001769 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 pMlmRemoveKeyCnf->resultCode );
1771 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001772 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1774 psessionEntry->smeSessionId,psessionEntry->transactionId);
1775} /*** end limProcessMlmRemoveKeyCnf() ***/
1776
1777
1778/**
1779 * limHandleSmeJoinResult()
1780 *
1781 *FUNCTION:
1782 * This function is called to process join/auth/assoc failures
1783 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1784 * MLM_ASSOC_CNF with a success code in case of STA role and
1785 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1786 *
1787 *LOGIC:
1788 *
1789 *ASSUMPTIONS:
1790 *
1791 *NOTE:
1792 *
1793 * @param pMac Pointer to Global MAC structure
1794 * @param resultCode Failure code to be sent
1795 *
1796 *
1797 * @return None
1798 */
1799static void
1800limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1801{
1802 tpDphHashNode pStaDs = NULL;
1803 tANI_U8 smesessionId;
1804 tANI_U16 smetransactionId;
1805
1806 /* Newly Added on oct 11 th*/
1807 if(psessionEntry == NULL)
1808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001809 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 return;
1811 }
1812 smesessionId = psessionEntry->smeSessionId;
1813 smetransactionId = psessionEntry->transactionId;
1814 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1815 if(resultCode != eSIR_SME_SUCCESS)
1816 {
1817 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1818 if (pStaDs != NULL)
1819 {
1820 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1821 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1822 pStaDs->mlmStaContext.resultCode = resultCode;
1823 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1824 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1825 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301826 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001827 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 return;
1829 }
1830 }
1831
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301832 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 psessionEntry->pLimJoinReq = NULL;
1834 //Delete teh session if JOIN failure occurred.
1835 if(resultCode != eSIR_SME_SUCCESS)
1836 {
1837 if(NULL != psessionEntry)
1838 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001839 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1840 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001841 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 peDeleteSession(pMac,psessionEntry);
1843 psessionEntry = NULL;
1844 }
1845 }
1846 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1847 smesessionId, smetransactionId);
1848} /*** end limHandleSmeJoinResult() ***/
1849
1850/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001851 * limHandleSmeReaasocResult()
1852 *
1853 *FUNCTION:
1854 * This function is called to process reassoc failures
1855 * upon receiving REASSOC_CNF with a failure code or
1856 * MLM_REASSOC_CNF with a success code in case of STA role
1857 *
1858 *LOGIC:
1859 *
1860 *ASSUMPTIONS:
1861 *
1862 *NOTE:
1863 *
1864 * @param pMac Pointer to Global MAC structure
1865 * @param resultCode Failure code to be sent
1866 *
1867 *
1868 * @return None
1869 */
1870static void
1871limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1872{
1873 tpDphHashNode pStaDs = NULL;
1874 tANI_U8 smesessionId;
1875 tANI_U16 smetransactionId;
1876
1877 if(psessionEntry == NULL)
1878 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001879 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001880 return;
1881 }
1882 smesessionId = psessionEntry->smeSessionId;
1883 smetransactionId = psessionEntry->transactionId;
1884 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1885 if(resultCode != eSIR_SME_SUCCESS)
1886 {
1887 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1888 if (pStaDs != NULL)
1889 {
1890 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1891 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1892 pStaDs->mlmStaContext.resultCode = resultCode;
1893 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1894 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1895 return;
1896 }
1897 }
1898
1899 //Delete teh session if REASSOC failure occurred.
1900 if(resultCode != eSIR_SME_SUCCESS)
1901 {
1902 if(NULL != psessionEntry)
1903 {
1904 peDeleteSession(pMac,psessionEntry);
1905 psessionEntry = NULL;
1906 }
1907 }
1908 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1909 smesessionId, smetransactionId);
1910} /*** end limHandleSmeReassocResult() ***/
1911
1912/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 * limProcessMlmAddStaRsp()
1914 *
1915 *FUNCTION:
1916 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1917 * Upon receipt of this message from HAL, MLME -
1918 * > Determines the "state" in which this message was received
1919 * > Forwards it to the appropriate callback
1920 *
1921 *ASSUMPTIONS:
1922 *
1923 *NOTE:
1924 *
1925 * @param pMac Pointer to Global MAC structure
1926 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1927 *
1928 * @return None
1929 */
1930void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1931{
1932 //we need to process the deferred message since the initiating req. there might be nested request.
1933 //in the case of nested request the new request initiated from the response will take care of resetting
1934 //the deffered flag.
1935 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 )
1939 {
1940 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1941 return;
1942 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001944}
1945void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1946{
1947 tLimMlmAssocCnf mlmAssocCnf;
1948 tpDphHashNode pStaDs;
1949 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1950 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1951
1952 if(NULL == pAddStaParams )
1953 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001954 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 return;
1956 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301957
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301958 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301960 PELOGE(limLog(pMac, LOGE,
1961 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05301962
1963 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
1964 {
1965 PELOGE(limLog(pMac, LOGE,
1966 FL("ADD_STA success, send update result code with"
1967 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
1968 "limMlmState: %d"), pAddStaParams->staIdx,
1969 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301970 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1971 mesgType = LIM_MLM_REASSOC_CNF;
1972 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
1973 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
1974 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05301975 mlmAssocCnf.resultCode =
1976 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
1977 psessionEntry->staId = pAddStaParams->staIdx;
1978 goto end;
1979 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301980 }
1981
1982 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1983 {
1984 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 {
1986 //TODO: any response to be sent out here ?
1987 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05301988 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 psessionEntry->limMlmState);
1990 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1991 goto end;
1992 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301993
1994 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1995 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 //
1997 // Update the DPH Hash Entry for this STA
1998 // with proper state info
1999 //
2000 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2001 if( NULL != pStaDs)
2002 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
2003 else
2004 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002005 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 DPH_STA_HASH_INDEX_PEER);
2007 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002008 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 /*
2010 * Storing the self StaIndex(Generated by HAL) in session context,
2011 * instead of storing it in DPH Hash entry for Self STA.
2012 * DPH entry for the self STA stores the sta index for the BSS entry
2013 * to which the STA is associated.
2014 */
2015 psessionEntry->staId = pAddStaParams->staIdx;
2016 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08002017#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2018 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2019#endif
2020 {
2021 limReactivateHeartBeatTimer(pMac, psessionEntry);
2022 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002023 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002024
2025 //assign the sessionId to the timer Object
2026 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2027 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002028 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002029#ifdef WLAN_DEBUG
2030 pMac->lim.gLimNumLinkEsts++;
2031#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002032#ifdef FEATURE_WLAN_TDLS
2033 /* initialize TDLS peer related data */
2034 limInitTdlsData(pMac,psessionEntry);
2035#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 // Return Assoc confirm to SME with success
2037 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2038 // be passed in here....
2039 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2040 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2041 }
2042 else
2043 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302044 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Abhishek Singh82a7a5b2014-10-07 13:05:12 +05302045 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2046 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2048 }
2049end:
2050 if( 0 != limMsgQ->bodyptr )
2051 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302052 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002053 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 }
2055 /* Updating PE session Id*/
2056 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2057 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302058 if (true == psessionEntry->fDeauthReceived)
2059 {
2060 psessionEntry->fDeauthReceived = false;
2061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 return;
2063}
2064void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2065{
2066 //we need to process the deferred message since the initiating req. there might be nested request.
2067 //in the case of nested request the new request initiated from the response will take care of resetting
2068 //the deffered flag.
2069 // tpPESession psessionEntry;
2070 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2071 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2072 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002073 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 // return;
2075 // }
2076 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002077
2078 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2079 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 ) &&
2082 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2083 {
2084 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2085 return;
2086 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002088
2089 if(!limIsInMCC(pMac))
2090 {
2091 WDA_TrafficStatsTimerActivate(FALSE);
2092 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002093
2094#ifdef WLAN_FEATURE_11W
2095 if (psessionEntry->limRmfEnabled)
2096 {
2097 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2098 {
2099 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002100 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002101 }
2102 }
2103#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002104}
2105
2106void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2107{
2108 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2109 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2110 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302111
2112 if (NULL == pDelBssParams)
2113 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002114 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302115 goto end;
2116 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2118 {
2119 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002120 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2122 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2123
2124 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002125 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 statusCode = eSIR_SME_REFUSED;
2127 goto end;
2128 }
2129 if(pStaDs == NULL)
2130 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002131 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 statusCode = eSIR_SME_REFUSED;
2133 goto end;
2134 }
2135 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2136 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05302137 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 pStaDs->mlmStaContext.mlmState);)
2139 statusCode = eSIR_SME_REFUSED;
2140 goto end;
2141 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302142 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2143 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 }
2145 else
2146 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302147 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302148 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002149 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 return;
2151 }
2152 end:
2153 if( 0 != limMsgQ->bodyptr )
2154 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302155 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002156 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 }
2158 if(pStaDs == NULL)
2159 return;
2160 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2161 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2162 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2163 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2164 {
2165 /** The Case where the DelBss is invoked from
2166 * context of other than normal DisAssoc / Deauth OR
2167 * as part of Join Failure.
2168 */
2169 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2170 return;
2171 }
2172 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2173 return;
2174}
2175
Jeff Johnson295189b2012-06-20 16:38:30 -07002176void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2177{
2178 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002179 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2181 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2182
2183 if(psessionEntry == NULL)
2184 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002185 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002186 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002187 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302188 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002189 limMsgQ->bodyptr = NULL;
2190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 return;
2192 }
2193
2194 if (pDelBss == NULL)
2195 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002196 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 rc = eSIR_SME_REFUSED;
2198 goto end;
2199 }
2200 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002201 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2202
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2204 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002205 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302206 FL( "Received unexpected WDA_DEL_BSS_RSP in state %d" ),
Jeff Johnson43971f52012-07-17 12:26:56 -07002207 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002208 rc = eSIR_SME_REFUSED;
2209 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 }
2211 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2212 {
2213 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2214 pDelBss->status, pDelBss->bssIdx);
2215 rc = eSIR_SME_STOP_BSS_FAILURE;
2216 goto end;
2217 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002218 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002220 if (status != eSIR_SUCCESS)
2221 {
2222 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002224 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 /** Softmac may send all the buffered packets right after resuming the transmission hence
2226 * to occupy the medium during non channel occupancy period. So resume the transmission after
2227 * HAL gives back the response.
2228 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002229#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 if (LIM_IS_RADAR_DETECTED(pMac))
2231 {
2232 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2233 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2234 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002235#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2237 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002239 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 end:
2241 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2242 peDeleteSession(pMac, psessionEntry);
2243
2244 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002245 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302246 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002247 limMsgQ->bodyptr = NULL;
2248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002249}
2250
2251void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2252{
2253 //we need to process the deferred message since the initiating req. there might be nested request.
2254 //in the case of nested request the new request initiated from the response will take care of resetting
2255 //the deffered flag.
2256
2257 tpPESession psessionEntry;
2258 tpDeleteStaParams pDeleteStaParams;
2259 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2260 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302261
2262 if(NULL == pDeleteStaParams ||
2263 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002265 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002266 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002267 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302268 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002269 limMsgQ->bodyptr = NULL;
2270 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 return;
2272 }
2273
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 )
2277 {
2278 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2279 return;
2280 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002282}
2283
Jeff Johnson295189b2012-06-20 16:38:30 -07002284void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2285{
2286 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2287 tpDphHashNode pStaDs;
2288 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2289 if(limMsgQ->bodyptr == NULL)
2290 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302291 limLog( pMac, LOGE,
2292 FL( "limMsgQ->bodyptry NULL"));
2293 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2296 if(pStaDs == NULL)
2297 {
2298 limLog( pMac, LOGE,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302299 FL( "DPH Entry for STA %d missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302301 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002302 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002303
2304 return;
2305 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302306 limLog( pMac, LOG1,
2307 FL( "Received del Sta Rsp in StaD MlmState : %d"),
2308 pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2310 {
2311 limLog( pMac, LOGW,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302312 FL( "AP received the DEL_STA_RSP for assocID: %d."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002313
2314 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2315 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2316 {
2317 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002318 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2320 statusCode = eSIR_SME_REFUSED;
2321 goto end;
2322 }
2323
2324 limLog( pMac, LOG1,
2325 FL("Deleted STA AssocID %d staId %d MAC "),
2326 pStaDs->assocId, pStaDs->staIndex);
2327 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2328 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2329 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302330 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002331 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002332 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 {
2334 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002335 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 pStaDs->assocId);)
2337 // delete the TS if it has already been added.
2338 // send the response with error status.
2339 if(pStaDs->qos.addtsPresent)
2340 {
2341 tpLimTspecInfo pTspecInfo;
2342 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2343 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2344 {
2345 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2346 NULL, &pTspecInfo->idx);
2347 }
2348 }
2349 limRejectAssociation(pMac,
2350 pStaDs->staAddr,
2351 pStaDs->mlmStaContext.subType,
2352 true, pStaDs->mlmStaContext.authType,
2353 pStaDs->assocId, true,
2354 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2355 psessionEntry);
2356 }
2357 return;
2358 }
2359 }
2360 else
2361 {
2362 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002363 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 statusCode = eSIR_SME_REFUSED;
2365 }
2366 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302367 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002368 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2370 {
2371 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2372 }
2373 return;
2374}
2375
2376void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2377{
2378 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2379 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2380 tpDphHashNode pStaDs = NULL;
2381 if(NULL == pDelStaParams )
2382 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002383 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 goto end;
2385 }
2386 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2387 {
2388 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2389 if (pStaDs == NULL)
2390 {
2391 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002392 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 pDelStaParams->assocId);
2394 statusCode = eSIR_SME_REFUSED;
2395 goto end;
2396 }
2397 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2398 {
2399 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002400 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 limMlmStateStr(psessionEntry->limMlmState));
2402 statusCode = eSIR_SME_REFUSED;
2403 goto end;
2404 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302405 limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2406 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002407 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 //we must complete all cleanup related to delSta before calling limDelBSS.
2409 if( 0 != limMsgQ->bodyptr )
2410 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302411 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002412 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 }
2414 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2415 return;
2416 }
2417 else
2418 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002419 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 statusCode = eSIR_SME_REFUSED;
2421 }
2422end:
2423 if( 0 != limMsgQ->bodyptr )
2424 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302425 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002426 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 }
2428 return;
2429}
2430
Jeff Johnson295189b2012-06-20 16:38:30 -07002431void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2432{
2433 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302434 tpDphHashNode pStaDs = NULL;
2435
2436 if (NULL == pAddStaParams)
2437 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002438 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302439 goto end;
2440 }
2441
2442 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 if(pStaDs == NULL)
2444 {
2445 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002446 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 goto end;
2448 }
2449 //
2450 // TODO & FIXME_GEN4
2451 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2452 //
2453 //TODO: any check for pMac->lim.gLimMlmState ?
2454 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2455 {
2456 //TODO: any response to be sent out here ?
2457 limLog( pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302458 FL( "Received unexpected WDA_ADD_STA_RSP in state %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 pStaDs->mlmStaContext.mlmState);
2460 goto end;
2461 }
2462 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2463 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002464 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 limRejectAssociation(pMac, pStaDs->staAddr,
2466 pStaDs->mlmStaContext.subType,
2467 true, pStaDs->mlmStaContext.authType,
2468 pStaDs->assocId, true,
2469 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2470 psessionEntry);
2471 goto end;
2472 }
2473 pStaDs->bssId = pAddStaParams->bssIdx;
2474 pStaDs->staIndex = pAddStaParams->staIdx;
2475 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2476 pStaDs->valid = 1;
2477 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2478 limLog( pMac, LOG1,
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302479 FL("AddStaRsp Success.STA AssocID %d staId %d MAC "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 pStaDs->assocId,
2481 pStaDs->staIndex);
2482 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2483
2484 /* For BTAMP-AP, the flow sequence shall be:
2485 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2486 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2487 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2488 */
2489 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2490 // fall though to reclaim the original Add STA Response message
2491end:
2492 if( 0 != limMsgQ->bodyptr )
2493 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302494 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002495 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 }
2497 return;
2498}
2499
2500/**
2501 * limProcessApMlmAddBssRsp()
2502 *
2503 *FUNCTION:
2504 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2505 * Upon receipt of this message from HAL, MLME -
2506 * > Validates the result of WDA_ADD_BSS_REQ
2507 * > Init other remaining LIM variables
2508 * > Init the AID pool, for that BSSID
2509 * > Init the Pre-AUTH list, for that BSSID
2510 * > Create LIM timers, specific to that BSSID
2511 * > Init DPH related parameters that are specific to that BSSID
2512 * > TODO - When do we do the actual change channel?
2513 *
2514 *LOGIC:
2515 * SME sends eWNI_SME_START_BSS_REQ to LIM
2516 * LIM sends LIM_MLM_START_REQ to MLME
2517 * MLME sends WDA_ADD_BSS_REQ to HAL
2518 * HAL responds with WDA_ADD_BSS_RSP to MLME
2519 * MLME responds with LIM_MLM_START_CNF to LIM
2520 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2521 *
2522 *ASSUMPTIONS:
2523 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2524 * tSirMsgQ.body will now be freed by this routine
2525 *
2526 *NOTE:
2527 *
2528 * @param pMac Pointer to Global MAC structure
2529 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2530 *
2531 * @return None
2532 */
2533static void
2534limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2535{
2536 tLimMlmStartCnf mlmStartCnf;
2537 tANI_U32 val;
2538 tpPESession psessionEntry;
2539// tANI_U8 sessionId;
2540 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2541 if(NULL == pAddBssParams )
2542 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002543 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 goto end;
2545 }
2546 //TBD: free the memory before returning, do it for all places where lookup fails.
2547 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2548 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002549 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002550 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002551 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302552 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302553 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002554 limMsgQ->bodyptr = NULL;
2555 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 return;
2557 }
2558 /* Update PE session Id*/
2559 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2560 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2561 {
Abhishek Singh525045c2014-12-15 17:18:45 +05302562 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2564 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2565 goto end;
2566 // Set MLME state
2567 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002568 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2570 {
2571 /** IBSS is 'active' when we receive
2572 * Beacon frames from other STAs that are part of same IBSS.
2573 * Mark internal state as inactive until then.
2574 */
2575 psessionEntry->limIbssActive = false;
2576 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2577 limResetHBPktCount( psessionEntry );
2578 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002580 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002581 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 }
2583 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2584
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002586
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2588 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2589 else
2590 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 schEdcaProfileUpdate(pMac, psessionEntry);
2592 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002593 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 // Create timers used by LIM
2595 if (!pMac->lim.gLimTimersCreated)
2596 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002597
2598 // Start OLBC timer
2599 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2600 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002601 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002602 }
2603
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2605 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002606 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2608 // Apply previously set configuration at HW
2609 limApplyConfiguration(pMac,psessionEntry);
2610 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2611 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2612 }
2613 else
2614 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002615 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2617 }
2618 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2619 end:
2620 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002621 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302622 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302623 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002624 limMsgQ->bodyptr = NULL;
2625 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002626}
2627
2628
2629/**
2630 * limProcessIbssMlmAddBssRsp()
2631 *
2632 *FUNCTION:
2633 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2634 * Upon receipt of this message from HAL, MLME -
2635 * > Validates the result of WDA_ADD_BSS_REQ
2636 * > Init other remaining LIM variables
2637 * > Init the AID pool, for that BSSID
2638 * > Init the Pre-AUTH list, for that BSSID
2639 * > Create LIM timers, specific to that BSSID
2640 * > Init DPH related parameters that are specific to that BSSID
2641 * > TODO - When do we do the actual change channel?
2642 *
2643 *LOGIC:
2644 * SME sends eWNI_SME_START_BSS_REQ to LIM
2645 * LIM sends LIM_MLM_START_REQ to MLME
2646 * MLME sends WDA_ADD_BSS_REQ to HAL
2647 * HAL responds with WDA_ADD_BSS_RSP to MLME
2648 * MLME responds with LIM_MLM_START_CNF to LIM
2649 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2650 *
2651 *ASSUMPTIONS:
2652 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2653 * tSirMsgQ.body will now be freed by this routine
2654 *
2655 *NOTE:
2656 *
2657 * @param pMac Pointer to Global MAC structure
2658 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2659 *
2660 * @return None
2661 */
2662static void
2663limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2664{
2665 tLimMlmStartCnf mlmStartCnf;
2666 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2667 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302668
2669 if (NULL == pAddBssParams)
2670 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002671 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302672 goto end;
2673 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2675 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302676 limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2678 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2679 goto end;
2680 // Set MLME state
2681 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002682 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 /** IBSS is 'active' when we receive
2684 * Beacon frames from other STAs that are part of same IBSS.
2685 * Mark internal state as inactive until then.
2686 */
2687 psessionEntry->limIbssActive = false;
2688 limResetHBPktCount( psessionEntry );
2689 /* Timer related functions are not modified for BT-AMP : To be Done */
2690 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002691 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002692 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002693 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2695 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2696 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2697 schEdcaProfileUpdate(pMac, psessionEntry);
2698 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2699 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002700 if (0 == psessionEntry->freePeerIdxHead)
2701 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 // Create timers used by LIM
2703#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2704 if (!pMac->lim.gLimTimersCreated)
2705 limCreateTimers(pMac);
2706#endif
2707 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2708 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002709 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002710 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2711 // Apply previously set configuration at HW
2712 limApplyConfiguration(pMac,psessionEntry);
2713 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2714 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2715 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2716 if(true == pMac->lim.gLimIbssCoalescingHappened)
2717 {
2718 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2719 goto end;
2720 }
2721 }
2722 else
2723 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002724 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 pAddBssParams->status );
2726 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2727 }
2728 //Send this message to SME, when ADD_BSS is initiated by SME
2729 //If ADD_BSS is done as part of coalescing, this won't happen.
2730 /* Update PE session Id*/
2731 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2732 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2733 end:
2734 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002735 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302736 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302737 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002738 limMsgQ->bodyptr = NULL;
2739 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002740}
2741
2742static void
2743limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2744{
2745 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2746 tAniAuthType cfgAuthType, authMode;
2747 tLimMlmAuthReq *pMlmAuthReq;
2748 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302749
2750 if (NULL == pAddBssParams)
2751 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002752 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302753 goto joinFailure;
2754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2756 {
2757 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2758 {
2759 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002760 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002761 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2762 goto joinFailure;
2763 }
2764 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2765 //Success, handle below
2766 pStaDs->bssId = pAddBssParams->bssIdx;
2767 //STA Index(genr by HAL) for the BSS entry is stored here
2768 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2769 // Trigger Authentication with AP
2770 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2771 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2772 {
2773 /**
2774 * Could not get AuthType from CFG.
2775 * Log error.
2776 */
2777 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002778 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 }
2780 if (cfgAuthType == eSIR_AUTO_SWITCH)
2781 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2782 else
2783 authMode = cfgAuthType;
2784
2785 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302786 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2787 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 {
2789 // Log error
2790 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302791 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 return;
2793 }
2794 #if 0
2795 val = sizeof(tSirMacAddr);
2796 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2797 pMlmAuthReq->peerMacAddr,
2798 &val) != eSIR_SUCCESS)
2799 {
2800 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002801 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002802 }
2803 #endif //TO SUPPORT BT-AMP
2804 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2805
2806 pMlmAuthReq->authType = authMode;
2807 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2808 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2809 != eSIR_SUCCESS)
2810 {
2811 /**
2812 * Could not get AuthFailureTimeout
2813 * value from CFG. Log error.
2814 */
2815 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002816 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 }
2818 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2819 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2820 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002821 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2823 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2824 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2825 // remember staId in case of assoc timeout/failure handling
2826 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2827
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302828 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2829 psessionEntry->peSessionId, psessionEntry->limSmeState));
2830 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2831 "with limSmeState:%d",psessionEntry->peSessionId,
2832 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 limPostMlmMessage(pMac,
2834 LIM_MLM_AUTH_REQ,
2835 (tANI_U32 *) pMlmAuthReq);
2836 return;
2837 }
2838
2839joinFailure:
2840 {
2841 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002842 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002843
2844 /// Send Join response to Host
2845 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2846
2847 }
2848
2849}
2850
2851#ifdef WLAN_FEATURE_VOWIFI_11R
2852/*------------------------------------------------------------------------------------------
2853 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002854 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2855 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 *
2857 *
2858 *------------------------------------------------------------------------------------------
2859 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002860static inline void
2861limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002862{
Jeff Johnson295189b2012-06-20 16:38:30 -07002863 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002864 tpDphHashNode pStaDs = NULL;
2865 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002866 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002867 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002868 tANI_U32 selfStaDot11Mode = 0;
Sachin Ahuja07a43012015-01-30 17:04:38 +05302869#ifdef FEATURE_WLAN_ESE
2870 tLimMlmReassocReq *pMlmReassocReq;
2871 tANI_U32 val = 0;
2872#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002873
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002874 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002875
2876 if (pAddBssParams == NULL)
2877 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002878 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002879 goto end;
2880 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002881 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2882 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002883 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002884 goto end;
2885 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002886 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2887 {
2888 goto end;
2889 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002890
2891 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2892 &psessionEntry->dph.dphHashTable)) == NULL)
2893 {
2894 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002895 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2897 goto end;
2898 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05302899 if (pMac->roam.configParam.roamDelayStatsEnabled)
2900 {
2901 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2902 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 // Prepare and send Reassociation request frame
2904 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05302905
2906
2907#ifdef FEATURE_WLAN_ESE
2908 /*
2909 * In case of Ese Reassociation, change the reassoc timer
2910 * value.
2911 */
2912 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2913 if (pMlmReassocReq == NULL)
2914 {
2915 limLog(pMac, LOGE,
2916 FL("Invalid pMlmReassocReq"));
2917 goto end;
2918 }
2919 val = pMlmReassocReq->reassocFailureTimeout;
2920 if (psessionEntry->isESEconnection)
2921 {
2922 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
2923 }
2924 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
2925 TX_SUCCESS)
2926 {
2927 limLog(pMac, LOGP,
2928 FL("unable to deactivate Reassoc failure timer"));
2929 }
2930 val = SYS_MS_TO_TICKS(val);
2931 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
2932 val, 0) != TX_SUCCESS)
2933 {
2934 limLog(pMac, LOGP,
2935 FL("unable to change Reassociation failure timer"));
2936 }
2937#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2939 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002940 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2942 != TX_SUCCESS)
2943 {
2944 /// Could not start reassoc failure timer.
2945 // Log error
2946 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002947 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 // Return Reassoc confirm with
2949 // Resources Unavailable
2950 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2951 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2952 goto end;
2953 }
Mihir Shete63561c82014-08-23 16:58:07 +05302954 // remember staId
2955 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2956
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002957#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002958 pMac->lim.pSessionEntry = psessionEntry;
2959 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2960 {
2961 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302962 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2963 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2964 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2965 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2966 psessionEntry->pLimMlmReassocReq,
2967 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002968 }
2969 pMac->lim.reAssocRetryAttempt = 0;
2970#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Girish Gowli1c2fc802015-01-19 16:18:07 +05302972 if (pMac->roam.configParam.roamDelayStatsEnabled)
2973 {
2974 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
2975 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002976 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2977 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002978 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002979 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2981
2982 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2983
2984 //Success, handle below
2985 pStaDs->bssId = pAddBssParams->bssIdx;
2986 //STA Index(genr by HAL) for the BSS entry is stored here
2987 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2988 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2989 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2990
Jeff Johnson295189b2012-06-20 16:38:30 -07002991#if defined WLAN_FEATURE_VOWIFI
2992 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2993#endif
2994
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302995 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2996 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302998 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002999 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303001 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003002
3003 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303004 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
3005 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003006
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303007 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
3008 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003009
3010 // Update this when we get reassoc rsp , with success.
3011 // pAddStaParams->assocId = psessionEntry->limAID;
3012
3013 pAddStaParams->staType = STA_ENTRY_SELF;
3014 pAddStaParams->status = eHAL_STATUS_SUCCESS;
3015 pAddStaParams->respReqd = 1;
3016
3017 /* Update PE session ID */
3018 pAddStaParams->sessionId = psessionEntry->peSessionId;
3019
3020 // This will indicate HAL to "allocate" a new STA index
3021 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
3022 pAddStaParams->updateSta = FALSE;
3023
3024 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07003025#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003026 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07003027#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07003028 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003029#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003030
Jeff Johnsone7245742012-09-05 17:12:55 -07003031 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003033 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003034#ifdef WLAN_FEATURE_11AC
3035 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
3036 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
3037#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003038#ifdef DISABLE_GF_FOR_INTEROP
3039 /*
3040 * To resolve the interop problem with Broadcom AP,
3041 * where TQ STA could not pass traffic with GF enabled,
3042 * TQ STA will do Greenfield only with TQ AP, for
3043 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07003044 */
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
3046 {
3047 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
3048 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
3049 }
3050 else
3051#endif
3052
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003054 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
3055 {
3056 pAddStaParams->txChannelWidthSet =
3057 pMac->roam.configParam.channelBondingMode24GHz;
3058 }
3059 else
3060 {
3061 pAddStaParams->txChannelWidthSet =
3062 pMac->roam.configParam.channelBondingMode5GHz;
3063 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
3065 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
3066 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
3067 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
3068 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
3069 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
3070 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
3071 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
3072 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
3073 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 }
3075
3076 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003077 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08003079 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
3080 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 // Lets save this for when we receive the Reassoc Rsp
3082 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003083
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003084 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003085 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303086 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003087 vos_mem_free(pAddBssParams);
3088 pAddBssParams = NULL;
3089 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003090 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 return;
3092
3093end:
3094 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003095 if (psessionEntry != NULL)
3096 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003097 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003098 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3099 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003100 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003101
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003102 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003103 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303104 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003105 vos_mem_free(pAddBssParams);
3106 pAddBssParams = NULL;
3107 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003108 }
3109
3110 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3111 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303112 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003113 if (psessionEntry != NULL)
3114 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003115 else
3116 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003117
3118 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3119}
Jeff Johnson295189b2012-06-20 16:38:30 -07003120#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003121/**
3122 * limProcessStaMlmAddBssRsp()
3123 *
3124 *FUNCTION:
3125 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3126 * Upon receipt of this message from HAL, MLME -
3127 * > Validates the result of WDA_ADD_BSS_REQ
3128 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3129 *
3130 *LOGIC:
3131 * MLME had sent WDA_ADD_BSS_REQ to HAL
3132 * HAL responded with WDA_ADD_BSS_RSP to MLME
3133 * MLME now sends WDA_ADD_STA_REQ to HAL
3134 *
3135 *ASSUMPTIONS:
3136 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3137 * tSirMsgQ.body will now be freed by this routine
3138 *
3139 *NOTE:
3140 *
3141 * @param pMac Pointer to Global MAC structure
3142 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3143 *
3144 * @return None
3145 */
3146static void
3147limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3148{
3149 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3150 tLimMlmAssocCnf mlmAssocCnf;
3151 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3152 tANI_U32 subType = LIM_ASSOC;
3153 tpDphHashNode pStaDs = NULL;
3154 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3155 tANI_U8 updateSta = false;
3156 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3157
3158 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3159 {
3160 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303161 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3162 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3164 goto end;
3165 }
Mukul Sharma9151bb92014-12-18 16:13:52 +05303166
3167 if(( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState ) ||
3168 ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState ))
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 {
3170 mesgType = LIM_MLM_REASSOC_CNF;
3171 subType = LIM_REASSOC;
Mukul Sharma9151bb92014-12-18 16:13:52 +05303172 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3173 //to update the existing STA entry.
3174 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3175 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3176 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
Jeff Johnson295189b2012-06-20 16:38:30 -07003177 {
3178 staIdx = psessionEntry->staId;
3179 updateSta = true;
3180 }
3181 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003182
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003183 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003184 goto end;
3185
Jeff Johnson295189b2012-06-20 16:38:30 -07003186 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3187 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003188#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3190 {
3191#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003192 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 psessionEntry->limMlmState,
3194 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3195#endif
3196 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3197 goto end;
3198 }
3199#endif /* WLAN_FEATURE_VOWIFI_11R */
3200
3201 // Set MLME state
3202 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003203 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003204 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3205 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303206 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3207 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003208 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3209 if (pStaDs == NULL)
3210 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303211 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3212 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003213 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3214 }
3215 else
3216 {
3217 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3218 //Success, handle below
3219 pStaDs->bssId = pAddBssParams->bssIdx;
3220 //STA Index(genr by HAL) for the BSS entry is stored here
3221 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3222 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3223 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3224 // Downgrade the EDCA parameters if needed
3225 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3226 // Send the active EDCA parameters to HAL
3227 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3228 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3229 } else {
3230 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3231 }
3232#if defined WLAN_FEATURE_VOWIFI
3233 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3234#endif
3235
3236 if (subType == LIM_REASSOC)
3237 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3238 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3239 {
3240 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303241 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3242 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3244 }
3245 }
3246 }
3247 else
3248 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303249 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed! mlmState = %d" ),
3250 psessionEntry->peSessionId, psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 // Return Assoc confirm to SME with failure
Mukul Sharma9151bb92014-12-18 16:13:52 +05303252 if(eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState)
3253 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_FT_REASSOC_FAILURE;
3254 else
3255 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 }
3257
3258 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3259 {
Mukul Sharma9151bb92014-12-18 16:13:52 +05303260 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
3261 //Set the RXP mode to IDLE, so it starts filtering the frames.
3262 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
3263 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3264 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 /* Update PE session Id*/
3266 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3267 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3268 }
3269 end:
3270 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003271 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303272 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303273 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003274 limMsgQ->bodyptr = NULL;
3275 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003276}
3277
3278
3279
3280/**
3281 * limProcessMlmAddBssRsp()
3282 *
3283 *FUNCTION:
3284 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3285 * Upon receipt of this message from HAL, MLME -
3286 * > Determines the "state" in which this message was received
3287 * > Forwards it to the appropriate callback
3288 *
3289 *LOGIC:
3290 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3291 * in the following two states:
3292 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3293 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3294 * Based on these two states, this API will determine where to
3295 * route the message to
3296 *
3297 *ASSUMPTIONS:
3298 *
3299 *NOTE:
3300 *
3301 * @param pMac Pointer to Global MAC structure
3302 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3303 *
3304 * @return None
3305 */
3306void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3307{
3308 tLimMlmStartCnf mlmStartCnf;
3309 tpPESession psessionEntry;
3310 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3311
3312 if(NULL == pAddBssParams )
3313 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003314 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 return;
3316 }
3317
3318 //
3319 // TODO & FIXME_GEN4
3320 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3321 //
3322 //we need to process the deferred message since the initiating req. there might be nested request.
3323 //in the case of nested request the new request initiated from the response will take care of resetting
3324 //the deffered flag.
3325 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3326 // Validate SME/LIM state
3327 // Validate MLME state
3328 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3329 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303330 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3331 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003332 if( NULL != pAddBssParams )
3333 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303334 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003335 vos_mem_free(pAddBssParams);
3336 limMsgQ->bodyptr = NULL;
3337 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 return;
3339 }
3340 /* update PE session Id*/
3341 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3342 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3343 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3344 else
3345 {
3346 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3347 {
3348 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3349 {
3350 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303351 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
Sushant Kaushik1b645382014-10-13 16:39:36 +05303352 "WDA_ADD_BSS_RSP in state %d" ),
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303353 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3355 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003356 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303357 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303358 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003359 limMsgQ->bodyptr = NULL;
3360 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003361 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3362 }
3363 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3364 {
3365 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3366 }
3367 else
3368 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3369 }
3370 else
3371 /* Called while processing assoc response */
3372 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3373 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003374
3375 if(limIsInMCC(pMac))
3376 {
3377 WDA_TrafficStatsTimerActivate(TRUE);
3378 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003379
3380#ifdef WLAN_FEATURE_11W
3381 if (psessionEntry->limRmfEnabled)
3382 {
3383 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3384 {
3385 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003386 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003387 }
3388 }
3389#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003390}
3391/**
3392 * limProcessMlmSetKeyRsp()
3393 *
3394 *FUNCTION:
3395 * This function is called to process the following two
3396 * messages from HAL:
3397 * 1) WDA_SET_BSSKEY_RSP
3398 * 2) WDA_SET_STAKEY_RSP
3399 * 3) WDA_SET_STA_BCASTKEY_RSP
3400 * Upon receipt of this message from HAL,
3401 * MLME -
3402 * > Determines the "state" in which this message was received
3403 * > Forwards it to the appropriate callback
3404 *
3405 *LOGIC:
3406 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3407 * received by MLME while in the following state:
3408 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3409 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3410 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3411 * Based on this state, this API will determine where to
3412 * route the message to
3413 *
3414 *ASSUMPTIONS:
3415 * ONLY the MLME state is being taken into account for now.
3416 * This is because, it appears that the handling of the
3417 * SETKEYS REQ is handled symmetrically on both the AP & STA
3418 *
3419 *NOTE:
3420 *
3421 * @param pMac Pointer to Global MAC structure
3422 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3423 *
3424 * @return None
3425 */
3426void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3427{
Jeff Johnsone7245742012-09-05 17:12:55 -07003428 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 tLimMlmSetKeysCnf mlmSetKeysCnf;
3430 tANI_U8 sessionId = 0;
3431 tpPESession psessionEntry;
3432 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303433 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003435 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003437 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 return;
3439 }
3440 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3441 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3442 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003443 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303444 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303445 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003446 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 return;
3448 }
3449 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3450 {
3451 // Mesg received from HAL in Invalid state!
Sushant Kaushik1b645382014-10-13 16:39:36 +05303452 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %d" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 // There's not much that MLME can do at this stage...
3454 respReqd = 0;
3455 }
3456 else
3457 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3458
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303459 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303460 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003461 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003464 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 if( respReqd )
3466 {
3467 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3468 // Prepare and Send LIM_MLM_SETKEYS_CNF
3469 if( NULL != lpLimMlmSetKeysReq )
3470 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303471 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3472 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3473 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303475 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3476 sizeof(tLimMlmSetKeysReq));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303477 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003478 pMac->lim.gpLimMlmSetKeysReq = NULL;
3479 }
3480 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003481 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003482 }
3483}
3484void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3485{
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003487 tANI_U16 resultCode;
3488 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 tpPESession psessionEntry;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303490 tpLimMlmSetKeysReq lpLimMlmSetKeysReq;
3491
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303493 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303494 if ( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003496 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 return;
3498 }
3499 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303500 if ((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303502 limLog(pMac, LOGE,FL("session does not exist for sessionId %d"),
3503 sessionId);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303504 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303505 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003506 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 return;
3508 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303509 if ( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3511 else
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303512 /* BCAST key also uses tpSetStaKeyParams. Done this way for readabilty */
3513 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003514
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3516 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3517 {
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303518 /* Mesg received from HAL in Invalid state! */
3519 limLog( pMac, LOGW,
3520 FL( "Received unexpected [Mesg Id - %d] in state %d" ),
3521 limMsgQ->type, psessionEntry->limMlmState );
3522 mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 }
3524 else
3525 mlmSetKeysCnf.resultCode = resultCode;
3526
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303527 vos_mem_zero(limMsgQ->bodyptr, sizeof(tSetBssKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303528 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003529 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3532
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303533 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE,
3534 psessionEntry->peSessionId, psessionEntry->limMlmState));
3535 lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3536 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003537
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303538 /* Prepare and Send LIM_MLM_SETKEYS_CNF */
3539 if( NULL != lpLimMlmSetKeysReq )
3540 {
3541 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3542 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3543 sizeof(tSirMacAddr));
3544 /* Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq */
3545 vos_mem_zero(pMac->lim.gpLimMlmSetKeysReq,
3546 sizeof(tLimMlmSetKeysReq));
3547 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
3548 pMac->lim.gpLimMlmSetKeysReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003549 }
Abhishek Singhb0c9c8b2015-01-05 14:32:43 +05303550 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003551}
3552/**
3553 * limProcessMlmRemoveKeyRsp()
3554 *
3555 *FUNCTION:
3556 *
3557 *LOGIC:
3558 *
3559 *ASSUMPTIONS:
3560 *
3561 *NOTE:
3562 *
3563 * @param pMac Pointer to Global MAC structure
3564 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3565 *
3566 * @return None
3567 */
3568void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3569{
Jeff Johnsone7245742012-09-05 17:12:55 -07003570 tANI_U8 respReqd = 1;
3571 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3572 tANI_U16 resultCode;
3573 tANI_U8 sessionId = 0;
3574 tpPESession psessionEntry;
3575 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303576 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003577
3578 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003580 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003581 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 }
3583
Jeff Johnsone7245742012-09-05 17:12:55 -07003584 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3585 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3586 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3587 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003588
Jeff Johnsone7245742012-09-05 17:12:55 -07003589 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003590 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003591 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003592 return;
3593 }
3594
3595 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3596 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3597 else
3598 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3599
3600 // Validate MLME state
3601 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3602 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3603 {
3604 // Mesg received from HAL in Invalid state!
3605 limLog(pMac, LOGW,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303606 FL("Received unexpected [Mesg Id - %d] in state %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003607 limMsgQ->type,
3608 psessionEntry->limMlmState );
3609 respReqd = 0;
3610 }
3611 else
3612 mlmRemoveCnf.resultCode = resultCode;
3613
3614 //
3615 // TODO & FIXME_GEN4
3616 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3617 //
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303618 vos_mem_zero(limMsgQ->bodyptr, sizeof(tRemoveStaKeyParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303619 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003620 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003621
3622 // Restore MLME state
3623 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3624 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3625
3626 if( respReqd )
3627 {
3628 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3629 mlmRemoveCnf.sessionId = sessionId;
3630
3631 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3632 if( NULL != lpLimMlmRemoveKeyReq )
3633 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303634 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3635 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3636 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003637 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303638 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003639 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3640 }
3641 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3642 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003643}
3644
Jeff Johnson295189b2012-06-20 16:38:30 -07003645
3646/** ---------------------------------------------------------------------
3647\fn limProcessInitScanRsp
3648\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3649\ message from HAL. If status code is failure, then
3650\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3651\param tpAniSirGlobal pMac
3652\param tANI_U32 body
3653\return none
3654\ ----------------------------------------------------------------------- */
3655void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3656{
3657 tpInitScanParams pInitScanParam;
3658 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003659 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3660 pInitScanParam = (tpInitScanParams) body;
3661 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303662 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003663
3664 //Only abort scan if the we are scanning.
3665 if( pMac->lim.abortScan &&
3666 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3667 {
krunal sonid3d60e12013-07-17 13:24:09 -07003668 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 pMac->lim.abortScan = 0;
3670 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3671 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3672 //Set the resume channel to Any valid channel (invalid).
3673 //This will instruct HAL to set it to any previous valid channel.
3674 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003675 if (status != eHAL_STATUS_SUCCESS)
3676 {
3677 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3678 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3679 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3680 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3681 return;
3682 }
3683 else
3684 {
3685 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3686 }
3687
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 }
3689 switch(pMac->lim.gLimHalScanState)
3690 {
3691 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3692 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3693 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003694 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3696 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3697 /*
3698 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3699 * another Scan request in the same context (happens when 11d is enabled
3700 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3701 * scan in the same context but with bigger channel list), so the state needs to be
3702 * changed before this response message is sent.
3703 */
3704 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 return;
3706 }
3707 else if (status == eHAL_STATUS_SUCCESS)
3708 {
3709 /* since we have successfully triggered a background scan,
3710 * reset the "consecutive bkgnd scan failure" count to 0
3711 */
3712 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3713 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003714 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003715 }
3716 limContinueChannelScan(pMac);
3717 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003718//WLAN_SUSPEND_LINK Related
3719 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3720 if( pMac->lim.gpLimSuspendCallback )
3721 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303722 if( eHAL_STATUS_SUCCESS == status )
3723 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303725 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303727 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303729 pMac->lim.gLimSystemInScanLearnMode = 0;
3730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003731
3732 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3733 pMac->lim.gpLimSuspendCallback = NULL;
3734 pMac->lim.gpLimSuspendData = NULL;
3735 }
3736 else
3737 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003738 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 return;
3740 }
3741 break;
3742//end WLAN_SUSPEND_LINK Related
3743 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003744 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 pMac->lim.gLimHalScanState);
3746 break;
3747 }
3748 return;
3749}
3750/**
3751 * limProcessSwitchChannelReAssocReq()
3752 *
3753 *FUNCTION:
3754 * This function is called to send the reassoc req mgmt frame after the
3755 * switchChannelRsp message is received from HAL.
3756 *
3757 *LOGIC:
3758 *
3759 *ASSUMPTIONS:
3760 * NA
3761 *
3762 *NOTE:
3763 * NA
3764 *
3765 * @param pMac - Pointer to Global MAC structure.
3766 * @param psessionEntry - session related information.
3767 * @param status - channel switch success/failure.
3768 *
3769 * @return None
3770 */
3771static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3772{
3773 tLimMlmReassocCnf mlmReassocCnf;
3774 tLimMlmReassocReq *pMlmReassocReq;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303775#ifdef FEATURE_WLAN_ESE
3776 tANI_U32 val = 0;
3777#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3779 if(pMlmReassocReq == NULL)
3780 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003781 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3783 goto end;
3784 }
3785
3786 if(status != eHAL_STATUS_SUCCESS)
3787 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003788 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3790 goto end;
3791 }
Sachin Ahuja07a43012015-01-30 17:04:38 +05303792
3793#ifdef FEATURE_WLAN_ESE
3794 /*
3795 * In case of Ese Reassociation, change the reassoc timer
3796 * value.
3797 */
3798 val = pMlmReassocReq->reassocFailureTimeout;
3799 if (psessionEntry->isESEconnection)
3800 {
3801 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3802 }
3803 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3804 TX_SUCCESS)
3805 {
3806 limLog(pMac, LOGP,
3807 FL("unable to deactivate Reassoc failure timer"));
3808 }
3809 val = SYS_MS_TO_TICKS(val);
3810 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3811 val, 0) != TX_SUCCESS)
3812 {
3813 limLog(pMac, LOGP,
3814 FL("unable to change Reassociation failure timer"));
3815 }
3816#endif
3817 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003819 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3821 != TX_SUCCESS)
3822 {
3823 /// Could not start reassoc failure timer.
3824 // Log error
3825 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003826 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003827 // Return Reassoc confirm with
3828 // Resources Unavailable
3829 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3830 goto end;
3831 }
3832 /// Prepare and send Reassociation request frame
3833 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3834 return;
3835end:
3836 // Free up buffer allocated for reassocReq
3837 if(pMlmReassocReq != NULL)
3838 {
3839 /* Update PE session Id*/
3840 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303841 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003842 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 }
3844 else
3845 {
3846 mlmReassocCnf.sessionId = 0;
3847 }
3848
3849 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3850 /* Update PE sessio Id*/
3851 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3852
3853 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3854}
3855/**
3856 * limProcessSwitchChannelJoinReq()
3857 *
3858 *FUNCTION:
3859 * This function is called to send the probe req mgmt frame after the
3860 * switchChannelRsp message is received from HAL.
3861 *
3862 *LOGIC:
3863 *
3864 *ASSUMPTIONS:
3865 * NA
3866 *
3867 *NOTE:
3868 * NA
3869 *
3870 * @param pMac - Pointer to Global MAC structure.
3871 * @param psessionEntry - session related information.
3872 * @param status - channel switch success/failure.
3873 *
3874 * @return None
3875 */
3876static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3877{
3878 tANI_U32 val;
3879 tSirMacSSid ssId;
3880 tLimMlmJoinCnf mlmJoinCnf;
3881 if(status != eHAL_STATUS_SUCCESS)
3882 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003883 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 goto error;
3885 }
3886
3887 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3888 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003889 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 goto error;
3891 }
3892
Jeff Johnsone7245742012-09-05 17:12:55 -07003893
Jeff Johnson295189b2012-06-20 16:38:30 -07003894 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3895 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3896 {
3897 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3898 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303899 {
3900 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3901 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3902 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303904 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003905 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003906
3907 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3908 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003909 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3911 // Apply previously set configuration at HW
3912 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05303913
3914 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
3915 * disconnection was caused by HB failure.
3916 */
3917 if(pMac->roam.configParam.sendDeauthBeforeCon)
3918 {
3919 int apCount;
3920
3921 for(apCount = 0; apCount < 2; apCount++)
3922 {
3923
3924 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3925 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
3926 {
3927 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
3928 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
3929 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
3930 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
3931
3932 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
3933 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3934 psessionEntry, FALSE );
3935
3936 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
3937 sizeof(tSirMacAddr));
3938 break;
3939 }
3940 }
3941 }
3942
Jeff Johnson295189b2012-06-20 16:38:30 -07003943 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303944 vos_mem_copy(ssId.ssId,
3945 psessionEntry->ssId.ssId,
3946 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003948
3949 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3950
3951 //assign appropriate sessionId to the timer object
3952 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05303953 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
3954 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
3955 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303956 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 // include additional IE if there is
3958 limSendProbeReqMgmtFrame( pMac, &ssId,
3959 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3960 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3961 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003962
3963 // Sending mgmt frame is a blocking call activate Join failure timer now
3964 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3965 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3966 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003967 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003968 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3969 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3970 //memory is freed up below.
3971 psessionEntry->pLimMlmJoinReq = NULL;
3972 goto error;
3973 }
3974
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003975 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3976 {
Yathish9f22e662012-12-10 14:21:35 -08003977 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003978 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3979 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003980 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003981 goto error;
3982 }
3983 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003984
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 return;
3986error:
3987 if(NULL != psessionEntry)
3988 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303989 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 psessionEntry->pLimMlmJoinReq = NULL;
3991 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3992 }
3993 else
3994 {
3995 mlmJoinCnf.sessionId = 0;
3996 }
3997 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3998 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3999 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
4000}
4001
4002/**
4003 * limProcessSwitchChannelRsp()
4004 *
4005 *FUNCTION:
4006 * This function is called to process switchChannelRsp message from HAL.
4007 *
4008 *LOGIC:
4009 *
4010 *ASSUMPTIONS:
4011 * NA
4012 *
4013 *NOTE:
4014 * NA
4015 *
4016 * @param pMac - Pointer to Global MAC structure
4017 * @param body - message body.
4018 *
4019 * @return None
4020 */
4021void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
4022{
4023 tpSwitchChannelParams pChnlParams = NULL;
4024 eHalStatus status;
4025 tANI_U16 channelChangeReasonCode;
4026 tANI_U8 peSessionId;
4027 tpPESession psessionEntry;
4028 //we need to process the deferred message since the initiating req. there might be nested request.
4029 //in the case of nested request the new request initiated from the response will take care of resetting
4030 //the deffered flag.
4031 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4032 pChnlParams = (tpSwitchChannelParams) body;
4033 status = pChnlParams->status;
4034 peSessionId = pChnlParams->peSessionId;
4035 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
4036 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304037 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004038 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 return;
4040 }
4041#if defined WLAN_FEATURE_VOWIFI
4042 //HAL fills in the tx power used for mgmt frames in this field.
4043 //Store this value to use in TPC report IE.
4044 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
4045#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
4047 // initialize it back to invalid id
4048 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05304049 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07004050 switch(channelChangeReasonCode)
4051 {
4052 case LIM_SWITCH_CHANNEL_REASSOC:
4053 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
4054 break;
4055 case LIM_SWITCH_CHANNEL_JOIN:
4056 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
4057 break;
4058
4059 case LIM_SWITCH_CHANNEL_OPERATION:
4060 /*
4061 * The above code should also use the callback.
4062 * mechanism below, there is scope for cleanup here.
4063 * THat way all this response handler does is call the call back
4064 * We can get rid of the reason code here.
4065 */
4066 if (pMac->lim.gpchangeChannelCallback)
4067 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304068 limLog( pMac, LOG1, "Channel changed hence invoke registered call back");
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08004069 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
4070 {
4071 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
4072 {
4073 if ( psessionEntry && psessionEntry->limSmeState
4074 == eLIM_SME_LINK_EST_STATE )
4075 {
4076 peSetResumeChannel( pMac,
4077 psessionEntry->currentOperChannel,
4078 psessionEntry->htSecondaryChannelOffset);
4079 }
4080 else
4081 {
4082 peSetResumeChannel( pMac, 0, 0);
4083 }
4084 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
4085 }
4086 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
4088 }
4089 break;
4090 default:
4091 break;
4092 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304093 vos_mem_free(body);
4094 body = NULL;
4095
Jeff Johnson295189b2012-06-20 16:38:30 -07004096}
4097/**
4098 * limProcessStartScanRsp()
4099 *
4100 *FUNCTION:
4101 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
4102 * then it will start scan/learn on the next channel.
4103 *
4104 *LOGIC:
4105 *
4106 *ASSUMPTIONS:
4107 * NA
4108 *
4109 *NOTE:
4110 * NA
4111 *
4112 * @param pMac - Pointer to Global MAC structure
4113 * @param body - message body.
4114 *
4115 * @return None
4116 */
4117
4118void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
4119{
4120 tpStartScanParams pStartScanParam;
4121 eHalStatus status;
4122 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4123 pStartScanParam = (tpStartScanParams) body;
4124 status = pStartScanParam->status;
4125#if defined WLAN_FEATURE_VOWIFI
4126 //HAL fills in the tx power used for mgmt frames in this field.
4127 //Store this value to use in TPC report IE.
4128 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4129 //Store start TSF of scan start. This will be stored in BSS params.
4130 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4131#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304132 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004133 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 if( pMac->lim.abortScan )
4135 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004136 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 pMac->lim.abortScan = 0;
4138 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4139 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4140 //Set the resume channel to Any valid channel (invalid).
4141 //This will instruct HAL to set it to any previous valid channel.
4142 peSetResumeChannel(pMac, 0, 0);
4143 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4144 }
4145 switch(pMac->lim.gLimHalScanState)
4146 {
4147 case eLIM_HAL_START_SCAN_WAIT_STATE:
4148 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4149 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004150 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 //
4152 // FIXME - With this, LIM will try and recover state, but
4153 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4154 // status back to the SME
4155 //
4156 //Set the resume channel to Any valid channel (invalid).
4157 //This will instruct HAL to set it to any previous valid channel.
4158 peSetResumeChannel(pMac, 0, 0);
4159 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4160 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4161 }
4162 else
4163 {
4164 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4165 limContinuePostChannelScan(pMac);
4166 }
4167 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004169 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 pMac->lim.gLimHalScanState);
4171 break;
4172 }
4173 return;
4174}
4175void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4176{
4177 tpEndScanParams pEndScanParam;
4178 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4180 pEndScanParam = (tpEndScanParams) body;
4181 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304182 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004183 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 switch(pMac->lim.gLimHalScanState)
4185 {
4186 case eLIM_HAL_END_SCAN_WAIT_STATE:
4187 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4188 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004189 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4191 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4192 }
4193 else
4194 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004195 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 limContinueChannelScan(pMac);
4197 }
4198 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004200 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 pMac->lim.gLimHalScanState);
4202 break;
4203 }
4204 return;
4205}
Jeff Johnsone7245742012-09-05 17:12:55 -07004206/**
4207 * limStopTxAndSwitch()
4208 *
4209 *FUNCTION:
4210 * Start channel switch on all sessions that is in channel switch state.
4211 *
4212 * @param pMac - pointer to global adapter context
4213 *
4214 * @return None
4215 *
4216 */
4217static void
4218limStopTxAndSwitch (tpAniSirGlobal pMac)
4219{
4220 tANI_U8 i;
4221
4222 for(i =0; i < pMac->lim.maxBssId; i++)
4223 {
4224 if(pMac->lim.gpSession[i].valid &&
4225 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4226 {
4227 limStopTxAndSwitchChannel(pMac, i);
4228 }
4229 }
4230 return;
4231}
4232/**
4233 * limStartQuietOnSession()
4234 *
4235 *FUNCTION:
4236 * This function is called to start quiet timer after finish scan if there is
4237 * qeuieting on any session.
4238 *
4239 *LOGIC:
4240 *
4241 *ASSUMPTIONS:
4242 * NA
4243 *
4244 *NOTE:
4245 * NA
4246 *
4247 * @param pMac - Pointer to Global MAC structure
4248 *
4249 * @return None
4250 */
4251static void
4252limStartQuietOnSession (tpAniSirGlobal pMac)
4253{
4254 tANI_U8 i;
4255
4256 for(i =0; i < pMac->lim.maxBssId; i++)
4257 {
4258 if(pMac->lim.gpSession[i].valid &&
4259 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4260 {
4261 limStartQuietTimer(pMac, i);
4262 }
4263 }
4264 return;
4265}
Jeff Johnson295189b2012-06-20 16:38:30 -07004266void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4267{
4268 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004269 eHalStatus status;
4270 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4271 pFinishScanParam = (tpFinishScanParams) body;
4272 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004273
Sushant Kaushik826de802014-05-08 18:04:11 +05304274 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4275 pMac->lim.gLimHalScanState,
4276 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004277
Jeff Johnson295189b2012-06-20 16:38:30 -07004278 switch(pMac->lim.gLimHalScanState)
4279 {
4280 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4281 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4282 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004283 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 {
4285 /** Right time to stop tx and start the timer for channel switch */
4286 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4287 * be any associated session id
4288 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004289 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004291 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 {
4293 /** Start the quieting */
4294 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4295 * be any associated session id
4296 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004297 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4300 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004301 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 }
4303 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004304//WLAN_SUSPEND_LINK Related
4305 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4306 if( pMac->lim.gpLimResumeCallback )
4307 {
4308 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4309 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4310 pMac->lim.gpLimResumeCallback = NULL;
4311 pMac->lim.gpLimResumeData = NULL;
4312 pMac->lim.gLimSystemInScanLearnMode = 0;
4313 }
4314 else
4315 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004316 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304317 vos_mem_free(body);
4318 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 return;
4320 }
4321 break;
4322//end WLAN_SUSPEND_LINK Related
4323
4324 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004325 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 pMac->lim.gLimHalScanState);
4327 break;
4328 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304329 vos_mem_free(body);
4330 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 return;
4332}
4333/**
4334 * @function : limProcessMlmHalAddBARsp
4335 *
4336 * @brief: Process WDA_ADDBA_RSP coming from HAL
4337 *
4338 *
4339 * @param pMac The global tpAniSirGlobal object
4340 *
4341 * @param tSirMsgQ The MsgQ header containing the response buffer
4342 *
4343 * @return none
4344 */
4345void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4346 tpSirMsgQ limMsgQ )
4347{
4348 // Send LIM_MLM_ADDBA_CNF to LIM
4349 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004350 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004351 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004352
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 //now LIM can process any defer message.
4354 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4355 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004356 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 return;
4358 }
4359 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4360 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004361 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304362 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004363 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 return;
4365 }
4366#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4367 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4368#endif //FEATURE_WLAN_DIAG_SUPPORT
4369
4370 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304371 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4372 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004373 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304374 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004375 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 return;
4377 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304378 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304380 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4381 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 // Copy other ADDBA Rsp parameters
4383 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4384 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4385 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4386 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4387 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4388 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4389 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4390 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4391 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4392 else
4393 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304394 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004395 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 // Send ADDBA CNF to LIM
4397 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4398}
4399/**
4400 * \brief Process LIM_MLM_ADDBA_CNF
4401 *
4402 * \sa limProcessMlmAddBACnf
4403 *
4404 * \param pMac The global tpAniSirGlobal object
4405 *
4406 * \param tSirMsgQ The MsgQ header containing the response buffer
4407 *
4408 * \return none
4409 */
4410void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4411 tANI_U32 *pMsgBuf )
4412{
4413tpLimMlmAddBACnf pMlmAddBACnf;
4414tpDphHashNode pSta;
4415tANI_U16 aid;
4416tLimBAState curBaState;
4417tpPESession psessionEntry = NULL;
4418if(pMsgBuf == NULL)
4419{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004420 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 return;
4422}
4423pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4424 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4425 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004426 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304427 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 return;
4429 }
4430 // First, extract the DPH entry
4431 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4432 if( NULL == pSta )
4433 {
4434 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004435 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304436 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004437 return;
4438 }
4439 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4440 // Need to validate SME state
4441 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4442 {
4443 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004444 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004445 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304446 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004447 return;
4448 }
4449 // Restore STA BA state
4450 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004451 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 {
4453 // Update LIM internal cache...
4454 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4455 {
4456 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4457 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4458 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4459 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4460 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004461 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4462 // status code. MLME will then send an ADDBA RSP
4463 // over the air to the peer MAC entity
4464 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4465 pMlmAddBACnf->peerMacAddr,
4466 pMlmAddBACnf->addBAResultCode,
4467 pMlmAddBACnf->baDialogToken,
4468 (tANI_U8) pMlmAddBACnf->baTID,
4469 (tANI_U8) pMlmAddBACnf->baPolicy,
4470 pMlmAddBACnf->baBufferSize,
4471 pMlmAddBACnf->baTimeout,psessionEntry))
4472 {
4473 PELOGW(limLog( pMac, LOGW,
4474 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4475 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4476 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004477 }
4478 else
4479 {
4480 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4481 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4482 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4483 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4484 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4485 }
4486 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304488 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004489 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004490}
4491/**
4492 * \brief Process LIM_MLM_DELBA_CNF
4493 *
4494 * \sa limProcessMlmDelBACnf
4495 *
4496 * \param pMac The global tpAniSirGlobal object
4497 *
4498 * \param tSirMsgQ The MsgQ header containing the response buffer
4499 *
4500 * \return none
4501 */
4502void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4503 tANI_U32 *pMsgBuf )
4504{
4505 tpLimMlmDelBACnf pMlmDelBACnf;
4506 tpDphHashNode pSta;
4507 tANI_U16 aid;
4508// tANI_U8 sessionId;
4509 tLimBAState curBaState;
4510 tpPESession psessionEntry;
4511
4512 if(pMsgBuf == NULL)
4513 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004514 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004515 return;
4516 }
4517 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4518 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4519 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304520 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4521 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304522 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004523 return;
4524 }
4525 // First, extract the DPH entry
4526 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4527 if( NULL == pSta )
4528 {
4529 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004530 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304531 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 return;
4533 }
4534 if(NULL == pMlmDelBACnf)
4535 {
4536 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004537 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 return;
4539 }
4540 // Need to validate baState
4541 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4542 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4543 {
4544 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004545 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004546 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304547 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 return;
4549 }
4550 // Restore STA BA state
4551 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4552 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304553 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004554}
4555/**
4556 * \brief Process SIR_LIM_DEL_BA_IND
4557 *
4558 * \sa limProcessMlmHalBADeleteInd
4559 *
4560 * \param pMac The global tpAniSirGlobal object
4561 *
4562 * \param tSirMsgQ The MsgQ header containing the indication buffer
4563 *
4564 * \return none
4565 */
4566void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4567 tpSirMsgQ limMsgQ )
4568{
4569 tSirRetStatus status = eSIR_SUCCESS;
4570 tpBADeleteParams pBADeleteParams;
4571 tpDphHashNode pSta;
4572 tANI_U16 aid;
4573 tLimBAState curBaState;
4574 tpPESession psessionEntry;
4575 tANI_U8 sessionId;
4576
4577 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4578
4579 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4580 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004581 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304582 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004583 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 return;
4585 }
4586 // First, extract the DPH entry
4587 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4588 if( NULL == pSta )
4589 {
4590 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004591 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 goto returnAfterCleanup;
4593 }
4594
4595 // Need to validate BA state
4596 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4597 if( eLIM_BA_STATE_IDLE != curBaState )
4598 {
4599 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004600 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004601 curBaState );
4602 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304603 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004604
Abhishek Singh66c16762014-08-14 19:13:19 +05304605 // Post DELBA REQ to MLME...
4606 if( eSIR_SUCCESS !=
4607 (status = limPostMlmDelBAReq( pMac,
4608 pSta,
4609 pBADeleteParams->baDirection,
4610 pBADeleteParams->baTID,
4611 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304613 limLog( pMac, LOGE,
4614 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 }
4616 else
4617 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304618 limLog( pMac, LOGE,
4619 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4620 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4621 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 }
4623returnAfterCleanup:
4624 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304625 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004626 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004627}
4628/**
4629 * @function : limProcessSetMimoRsp()
4630 *
4631 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4632 * after Processing the Req from the SME (PMC)
4633 *
4634 * LOGIC:
4635 *
4636 * ASSUMPTIONS:
4637 * NA
4638 *
4639 * NOTE:
4640 * NA
4641 *
4642 * @param pMac - Pointer to Global MAC structure
4643 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4644 * @return None
4645 */
4646
4647void
4648limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4649{
4650#if 0
4651 tSirRetStatus retStatus;
4652 tpSetMIMOPS pMIMO_PSParams;
4653
4654
4655 do {
4656
4657 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4658 if( NULL == pMIMO_PSParams ) {
4659 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4660 return;
4661 }
4662
4663 /** If Updation of the HAL Fail's*/
4664 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004665 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 break;
4667 }
4668
4669 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4670 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4671 break;
4672
4673 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4674 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4675
4676 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4677 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4678 * the Action Frame is being sent at first before setting the internal structures
4679 */
4680 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4681 tSirMacAddr macAddr;
4682
4683 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304684 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004685
4686 /** Send Action Frame with the corresponding mode */
4687 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4688 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004689 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004690 break;
4691 }
4692 }
4693 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4694 }while(0);
4695
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304696 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004697#endif
4698}
4699/**
4700 * @function : limHandleDelBssInReAssocContext
4701 * @brief : While Processing the ReAssociation Response Frame in STA,
4702 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4703 * being issued and the end of DelBSS the new BSS is being added.
4704 *
4705 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4706 * change, We need to update CSR with ReAssocCNF Response with the
4707 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4708 * context only
4709 *
4710 * @param : pMac - tpAniSirGlobal
4711 * pStaDs - Station Descriptor
4712 *
4713 * @return : none
4714 */
4715static void
4716limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4717{
4718 tLimMlmReassocCnf mlmReassocCnf;
4719 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4720 /** Set the MlmState to IDLE*/
4721 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004722 /* Update PE session Id*/
4723 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304724 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004725 case eLIM_SME_WT_REASSOC_STATE :
4726 {
4727 tpSirAssocRsp assocRsp;
4728 tpDphHashNode pStaDs;
4729 tSirRetStatus retStatus = eSIR_SUCCESS;
Sushant Kaushik374fd052015-03-12 16:47:53 +05304730 tpSchBeaconStruct pBeaconStruct;
4731 pBeaconStruct = vos_mem_vmalloc(sizeof(tSchBeaconStruct));
4732 if (NULL == pBeaconStruct)
4733 {
4734 limLog(pMac, LOGE, FL("beaconStruct allocation failed"));
4735 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4736 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4737 limDeleteDphHashEntry(pMac, psessionEntry->bssId,
4738 DPH_STA_HASH_INDEX_PEER, psessionEntry);
4739 goto Error;
4740 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 /** Delete the older STA Table entry */
4742 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4743 /**
4744 * Add an entry for AP to hash table
4745 * maintained by DPH module
4746 */
4747 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4748 {
4749 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004750 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004751 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4752 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4753 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4754 goto Error;
4755 }
4756 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4757 * is being stored to be used here for sending ADDBSS
4758 */
4759 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4760 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4761 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004762 limExtractApCapabilities( pMac,
4763 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4764 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Sushant Kaushik374fd052015-03-12 16:47:53 +05304765 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Sushant Kaushik374fd052015-03-12 16:47:53 +05304767 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4768 if(pBeaconStruct->erpPresent) {
4769 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 psessionEntry->beaconParams.fShortPreamble = 0;
4771 else
4772 psessionEntry->beaconParams.fShortPreamble = 1;
4773 }
4774 //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 +05304775 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004777 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 retStatus = eSIR_FAILURE;
4779 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 if (retStatus != eSIR_SUCCESS)
4781 {
4782 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4783 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304784 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304785 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 pMac->lim.gLimAssocResponseData = NULL;
4787 goto Error;
4788 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304789 vos_mem_free(assocRsp);
Sushant Kaushik374fd052015-03-12 16:47:53 +05304790 vos_mem_vfree(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 psessionEntry->limAssocResponseData = NULL;
4792 }
4793 break;
4794 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4795 {
4796 /** Case wherein the DisAssoc / Deauth
4797 * being sent as response to ReAssoc Req*/
4798 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4799 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4800 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4801 /** Set the SME State back to WT_Reassoc State*/
4802 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4804 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4805 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4806 {
4807 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004808 }
4809 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4810 }
4811 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004812 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004813 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4815 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4816 goto Error;
4817 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004818 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004819Error:
4820 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4821}
4822
4823/* Added For BT -AMP Support */
4824static void
4825limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4826{
4827 tLimMlmStartCnf mlmStartCnf;
4828 tANI_U32 val;
4829 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4830
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304831 if (NULL == pAddBssParams)
4832 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004833 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304834 goto end;
4835 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004836 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4837 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004838 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4840 {
4841 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4842 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4843 goto end;
4844 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4845 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4846 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4847 goto end;
4848 }
4849
4850 // Set MLME state
4851 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4852 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4853 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4854 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004855 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 // Create timers used by LIM
4857 if (!pMac->lim.gLimTimersCreated)
4858 limCreateTimers(pMac);
4859 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4860 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004861 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4863 // Apply previously set configuration at HW
4864 limApplyConfiguration(pMac,psessionEntry);
4865 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4866 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4867 }
4868 else
4869 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004870 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4872 }
4873 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4874 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4875 end:
4876 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004877 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05304878 vos_mem_zero(pAddBssParams, sizeof(tAddBssParams));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304879 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004880 limMsgQ->bodyptr = NULL;
4881 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004882}
4883
4884/**
4885 * @function : limHandleAddBssInReAssocContext
4886 * @brief : While Processing the ReAssociation Response Frame in STA,
4887 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4888 * being issued and the end of DelBSS the new BSS is being added.
4889 *
4890 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4891 * change, We need to update CSR with ReAssocCNF Response with the
4892 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4893 * context only
4894 *
4895 * @param : pMac - tpAniSirGlobal
4896 * pStaDs - Station Descriptor
4897 *
4898 * @return : none
4899 */
4900void
4901limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4902{
4903 tLimMlmReassocCnf mlmReassocCnf;
4904 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4905 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004906 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4907 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 case eLIM_SME_WT_REASSOC_STATE : {
4910 tpSirAssocRsp assocRsp;
4911 tpDphHashNode pStaDs;
4912 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004913 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304914 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4915 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004916 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304917 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004918 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4919 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4920 goto Error;
4921 }
4922
Jeff Johnson295189b2012-06-20 16:38:30 -07004923 // Get the AP entry from DPH hash table
4924 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4925 if (pStaDs == NULL )
4926 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004927 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4929 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304930 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 goto Error;
4932 }
4933 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4934 * is being stored to be used here for sending ADDBSS
4935 */
4936 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4937 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4938 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 limExtractApCapabilities( pMac,
4940 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4941 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004942 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004944 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4945
4946 if(pBeaconStruct->erpPresent)
4947 {
4948 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004949 psessionEntry->beaconParams.fShortPreamble = 0;
4950 else
4951 psessionEntry->beaconParams.fShortPreamble = 1;
4952 }
4953
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004954 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004956 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 retStatus = eSIR_FAILURE;
4958 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 if (retStatus != eSIR_SUCCESS)
4960 {
4961 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4962 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304963 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004964 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304965 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004966 goto Error;
4967 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304968 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004969 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304970 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004971 }
4972 break;
4973 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4974 * being sent as response to ReAssoc Req*/
4975 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4976 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4977 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4978 /** Set the SME State back to WT_Reassoc State*/
4979 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4980 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4981 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004982 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004983 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004984 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4985 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004986
4987 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4988 }
4989 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004991 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4993 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4994 goto Error;
4995 }
4996return;
4997Error:
4998 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4999}
5000
5001#if 0
5002 static void
5003limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
5004{
5005 tSirSmeAssocCnf assocCnf;
5006 tpDphHashNode pStaDs;
5007 tpPESession psessionEntry;
5008 tANI_U8 sessionId;
5009
5010 if(pMsgBuf == NULL)
5011 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005012 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 goto end;
5014 }
5015 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
5016 !__limIsSmeAssocCnfValid(&assocCnf))
5017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005018 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005019 goto end;
5020 }
5021 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
5022 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005023 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005024 goto end;
5025 }
5026 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
5027 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
5028 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005029 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005030 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
5031 goto end;
5032 }
5033 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
5034 if (pStaDs == NULL)
5035 {
5036 limLog(pMac, LOG1,
5037 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
5038 msgType, assocCnf.aid);
5039 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5040 /*
5041 ** send a DISASSOC_IND message to WSM to make sure
5042 ** the state in WSM and LIM is the same
5043 **/
5044 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
5045 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
5046 goto end;
5047 }
5048 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305049 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07005050 (tANI_U8 *) assocCnf.peerMacAddr,
5051 sizeof(tSirMacAddr)) ) ||
5052 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
5053 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
5054 (msgType != eWNI_SME_ASSOC_CNF)) ||
5055 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
5056 (msgType != eWNI_SME_REASSOC_CNF)))))
5057 {
5058 limLog(pMac, LOG1,
5059 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
5060 msgType, assocCnf.aid);
5061 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
5062 goto end;
5063 }
5064 /*
5065 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
5066 ** has been received
5067 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005068 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005069 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
5070 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
5071 {
5072 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
5073 * when it had received Assoc Request frame. Now, PE just needs to send
5074 * Association Response frame to the requesting BTAMP-STA.
5075 */
5076 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005077 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
5079 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
5080 goto end;
5081 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
5082 else
5083 {
5084 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
5085 limRejectAssociation(pMac, pStaDs->staAddr,
5086 pStaDs->mlmStaContext.subType,
5087 true, pStaDs->mlmStaContext.authType,
5088 pStaDs->assocId, true,
5089 assocCnf.statusCode, psessionEntry);
5090 return;
5091 }
5092end:
5093 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
5094 {
5095 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
5096 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305097 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07005098 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
5099 }
5100
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305101 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005102 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5103 }
5104} /*** end __limProcessSmeAssocCnfNew() ***/
5105#endif
5106
Jeff Johnson295189b2012-06-20 16:38:30 -07005107void
5108limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5109 tBeaconGenParams *pBeaconGenParams = NULL;
5110 tSirMsgQ limMsg;
5111 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5112 if(psessionEntry == NULL ){
5113 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005114 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 return;
5116 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305117 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
5118 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005119 {
5120 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305121 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005122 return;
5123 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05305124 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
5125 vos_mem_copy((void *) pBeaconGenParams->bssId,
5126 (void *)psessionEntry->bssId,
5127 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07005128 limMsg.bodyptr = pBeaconGenParams;
5129 schProcessPreBeaconInd(pMac, &limMsg);
5130 return;
5131}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305132
5133void limSendScanOffloadComplete(tpAniSirGlobal pMac,
5134 tSirResultCodes reasonCode)
5135{
5136 tANI_U16 scanRspLen = 0;
5137
5138 pMac->lim.gLimSmeScanResultLength +=
5139 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305140 pMac->lim.gLimRspReqd = false;
5141 if ((reasonCode == eSIR_SME_SUCCESS) ||
5142 pMac->lim.gLimSmeScanResultLength) {
5143 scanRspLen = sizeof(tSirSmeScanRsp) +
5144 pMac->lim.gLimSmeScanResultLength -
5145 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305146 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305147 else
5148 scanRspLen = sizeof(tSirSmeScanRsp);
5149
5150 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5151 pMac->lim.gSmeSessionId,
5152 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305153}
5154
5155
5156void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5157{
5158 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5159
5160 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005161 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305162
5163 switch (pScanEvent->event)
5164 {
5165 case SCAN_EVENT_STARTED:
5166 break;
5167 case SCAN_EVENT_START_FAILED:
5168 case SCAN_EVENT_COMPLETED:
5169 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5170 break;
5171 case SCAN_EVENT_BSS_CHANNEL:
5172 case SCAN_EVENT_FOREIGN_CHANNEL:
5173 case SCAN_EVENT_DEQUEUED:
5174 case SCAN_EVENT_PREEMPTED:
5175 default:
5176 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005177 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305178 }
5179}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005180
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305181void limProcessMlmSpoofMacAddrRsp(tpAniSirGlobal pMac, tSirRetStatus rspStatus)
5182{
5183
5184 if ((rspStatus != eSIR_SUCCESS) ||
5185 (TRUE == vos_is_macaddr_zero((v_MACADDR_t *)&pMac->lim.spoofMacAddr)))
5186 {
5187 limLog(pMac, LOG1, FL(" LIM Disabling Spoofing"));
5188 pMac->lim.isSpoofingEnabled = FALSE;
5189 } else {
5190 limLog(pMac, LOG1, FL(" LIM Enabling Spoofing"));
5191 pMac->lim.isSpoofingEnabled = TRUE;
5192 }
5193
5194 return;
5195}
5196
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005197void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5198 eHalStatus status,
5199 tANI_U32* mlmAddBssRsp)
5200{
5201 if (status != eHAL_STATUS_SUCCESS)
5202 {
5203 limLog(pMac, LOGE,
5204 FL(" CSA failed to get the response for resume link"));
5205 }
5206 return;
5207}