blob: 1e5b69be3619c67baf7cae5dcd7388854fc0293a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
Gopichand Nakkala2c231c82013-06-11 17:49:16 +053042
Jeff Johnson295189b2012-06-20 16:38:30 -070043/*
Jeff Johnson295189b2012-06-20 16:38:30 -070044 * This file limProcessMlmRspMessages.cc contains the code
45 * for processing response messages from MLM state machine.
46 * Author: Chandra Modumudi
47 * Date: 02/11/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include "cfgApi.h"
56#include "sirApi.h"
57#include "schApi.h"
58#include "utilsApi.h"
59#include "limUtils.h"
60#include "limAssocUtils.h"
61#include "limSecurityUtils.h"
62#include "limSerDesUtils.h"
63#include "limTimerUtils.h"
64#include "limSendMessages.h"
65#include "limAdmitControl.h"
66#include "limSendMessages.h"
67#include "limIbssPeerMgmt.h"
68#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070069#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070070#if defined WLAN_FEATURE_VOWIFI
71#include "rrmApi.h"
72#endif
73#if defined WLAN_FEATURE_VOWIFI_11R
74#include <limFT.h>
75#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070076#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070079static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070080void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070081#ifdef FEATURE_OEM_DATA_SUPPORT
82void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
83#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070084void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
86void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
87void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
88void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
89void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
90void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
91void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
92void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
93void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
94void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
95void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
96void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
97void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
98void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
99void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
100void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
101static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
102void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
103static void
104limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
105/**
106 * limProcessMlmRspMessages()
107 *
108 *FUNCTION:
109 * This function is called to processes various MLM response (CNF/IND
110 * messages from MLM State machine.
111 *
112 *LOGIC:
113 *
114 *ASSUMPTIONS:
115 *
116 *NOTE:
117 *
118 * @param pMac Pointer to Global MAC structure
119 * @param msgType Indicates the MLM message type
120 * @param *pMsgBuf A pointer to the MLM message buffer
121 *
122 * @return None
123 */
124void
125limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
126{
127
128 if(pMsgBuf == NULL)
129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700130 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 return;
132 }
133 switch (msgType)
134 {
135 case LIM_MLM_SCAN_CNF:
136 limProcessMlmScanCnf(pMac, pMsgBuf);
137 break;
138
Jeff Johnsone7245742012-09-05 17:12:55 -0700139#ifdef FEATURE_OEM_DATA_SUPPORT
140 case LIM_MLM_OEM_DATA_CNF:
141 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
142 break;
143#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
145 case LIM_MLM_AUTH_CNF:
146 limProcessMlmAuthCnf(pMac, pMsgBuf);
147 break;
148 case LIM_MLM_AUTH_IND:
149 limProcessMlmAuthInd(pMac, pMsgBuf);
150 break;
151 case LIM_MLM_ASSOC_CNF:
152 limProcessMlmAssocCnf(pMac, pMsgBuf);
153 break;
154 case LIM_MLM_START_CNF:
155 limProcessMlmStartCnf(pMac, pMsgBuf);
156 break;
157 case LIM_MLM_JOIN_CNF:
158 limProcessMlmJoinCnf(pMac, pMsgBuf);
159 break;
160 case LIM_MLM_ASSOC_IND:
161 limProcessMlmAssocInd(pMac, pMsgBuf);
162 break;
163 case LIM_MLM_REASSOC_CNF:
164 limProcessMlmReassocCnf(pMac, pMsgBuf);
165 break;
166 case LIM_MLM_REASSOC_IND:
167 limProcessMlmReassocInd(pMac, pMsgBuf);
168 break;
169 case LIM_MLM_DISASSOC_CNF:
170 limProcessMlmDisassocCnf(pMac, pMsgBuf);
171 break;
172 case LIM_MLM_DISASSOC_IND:
173 limProcessMlmDisassocInd(pMac, pMsgBuf);
174 break;
175 case LIM_MLM_PURGE_STA_IND:
176 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
177 break;
178 case LIM_MLM_DEAUTH_CNF:
179 limProcessMlmDeauthCnf(pMac, pMsgBuf);
180 break;
181 case LIM_MLM_DEAUTH_IND:
182 limProcessMlmDeauthInd(pMac, pMsgBuf);
183 break;
184 case LIM_MLM_SETKEYS_CNF:
185 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
186 break;
187 case LIM_MLM_REMOVEKEY_CNF:
188 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
189 break;
190 case LIM_MLM_TSPEC_CNF:
191 break;
192 case LIM_MLM_ADDBA_CNF:
193 limProcessMlmAddBACnf( pMac, pMsgBuf );
194 break;
195 case LIM_MLM_DELBA_CNF:
196 limProcessMlmDelBACnf( pMac, pMsgBuf );
197 break;
198 default:
199 break;
200 } // switch (msgType)
201 return;
202} /*** end limProcessMlmRspMessages() ***/
203
204/**
205 * limProcessMlmScanCnf()
206 *
207 *FUNCTION:
208 * This function is called to processes MLM_SCAN_CNF
209 * message from MLM State machine.
210 *
211 *LOGIC:
212 *
213 *ASSUMPTIONS:
214 *
215 *NOTE:
216 *
217 * @param pMac Pointer to Global MAC structure
218 * @param pMsgBuf A pointer to the MLM message buffer
219 *
220 * @return None
221 */
222void
223limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
224{
225 switch(pMac->lim.gLimSmeState)
226 {
227 case eLIM_SME_WT_SCAN_STATE:
228 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
229 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
230 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700231 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 pMac->lim.gLimSystemInScanLearnMode = 0;
233 break;
234 default:
235 /**
236 * Should not have received scan confirm
237 * from MLM in other states.
238 * Log error
239 */
240 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700241 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 pMac->lim.gLimSmeState);)
243 return;
244 }
245
246 /// Process received scan confirm
247 /// Increment length of cached scan results
248 pMac->lim.gLimSmeScanResultLength +=
249 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
250 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
251 {
252 tANI_U16 scanRspLen = 0;
253 /// Need to send response to Host
254 pMac->lim.gLimRspReqd = false;
255 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
256 eSIR_SME_SUCCESS) ||
257 pMac->lim.gLimSmeScanResultLength)
258 {
259 scanRspLen = sizeof(tSirSmeScanRsp) +
260 pMac->lim.gLimSmeScanResultLength -
261 sizeof(tSirBssDescription);
262 }
263 else
264 {
265 scanRspLen = sizeof(tSirSmeScanRsp);
266 }
267 if(pMac->lim.gLimReportBackgroundScanResults)
268 {
269 pMac->lim.gLimBackgroundScanTerminate = TRUE;
270 }
271 if (pMac->lim.gLimSmeScanResultLength == 0)
272 {
273 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
274 }
275 else
276 {
277 limSendSmeScanRsp(pMac, scanRspLen,
278 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
279 }
280 } // if (pMac->lim.gLimRspReqd)
281 //check to see whether we need to run bgScan timer
282 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
283 {
284 if (tx_timer_activate(
285 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
286 {
287 /// Could not activate background scan timer.
288 // Log error
289 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700290 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 pMac->lim.gLimBackgroundScanStarted = FALSE;
292 }
293 else
294 {
295 pMac->lim.gLimBackgroundScanStarted = TRUE;
296 }
297 }
298} /*** end limProcessMlmScanCnf() ***/
299
Jeff Johnsone7245742012-09-05 17:12:55 -0700300#ifdef FEATURE_OEM_DATA_SUPPORT
301
302/**
303 * limProcessMlmOemDataReqCnf()
304 *
305 *FUNCTION:
306 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
307 * message from MLM State machine.
308 *
309 *LOGIC:
310 *
311 *ASSUMPTIONS:
312 *
313 *NOTE:
314 *
315 * @param pMac Pointer to Global MAC structure
316 * @param pMsgBuf A pointer to the MLM message buffer
317 *
318 * @return None
319 */
320
321void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
322{
323 tLimMlmOemDataRsp* measRsp;
324
325 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
326
327 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
328
329 //Now send the meas confirm message to the sme
330 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
331
332 //Dont free the memory here. It will be freed up by the callee
333
334 return;
335}
336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700337
338/**
339 * limProcessMlmStartCnf()
340 *
341 *FUNCTION:
342 * This function is called to processes MLM_START_CNF
343 * message from MLM State machine.
344 *
345 *LOGIC:
346 *
347 *ASSUMPTIONS:
348 *
349 *NOTE:
350 *
351 * @param pMac Pointer to Global MAC structure
352 * @param pMsgBuf A pointer to the MLM message buffer
353 *
354 * @return None
355 */
356void
357limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
358{
359 tpPESession psessionEntry = NULL;
360 tLimMlmStartCnf *pLimMlmStartCnf;
361 tANI_U8 smesessionId;
362 tANI_U16 smetransactionId;
363
364 if(pMsgBuf == NULL)
365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700366 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 return;
368 }
369 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
370 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
371 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700372 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 return;
374 }
375 smesessionId = psessionEntry->smeSessionId;
376 smetransactionId = psessionEntry->transactionId;
377
378 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
379 {
380 /**
381 * Should not have received Start confirm from MLM
382 * in other states.
383 * Log error
384 */
385 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700386 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 psessionEntry->limSmeState);)
388 return;
389 }
390 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
391 eSIR_SME_SUCCESS)
392 {
393
394 /**
395 * Update global SME state so that Beacon Generation
396 * module starts writing Beacon frames into TFP's
397 * Beacon file register.
398 */
399 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700400 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700403 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
406 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700407 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700411 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700414 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 }
416 else
417 {
418 /// Start BSS is a failure
419 peDeleteSession(pMac,psessionEntry);
420 psessionEntry = NULL;
421 }
422 /// Send response to Host
423 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
424 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
425 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
427 {
428 //Configure beacon and send beacons to HAL
429 limSendBeaconInd(pMac, psessionEntry);
430 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700431}
432
433 /*** end limProcessMlmStartCnf() ***/
434
435/**
436 * limProcessMlmJoinCnf()
437 *
438 *FUNCTION:
439 * This function is called to processes MLM_JOIN_CNF
440 * message from MLM State machine.
441 *
442 *LOGIC:
443 *
444 *ASSUMPTIONS:
445 *
446 *NOTE:
447 *
448 * @param pMac Pointer to Global MAC structure
449 * @param pMsgBuf A pointer to the MLM message buffer
450 *
451 * @return None
452 */
453void
454limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
455{
456 tSirResultCodes resultCode;
457 tLimMlmJoinCnf *pLimMlmJoinCnf;
458 tpPESession psessionEntry;
459 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
460 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700462 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return;
464 }
465
466 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
467 {
468 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700469 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 psessionEntry->limSmeState);)
471 return;
472 }
473
474 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
475 /// Process Join confirm from MLM
476 if (resultCode == eSIR_SME_SUCCESS)
477 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700478 PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
481 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
482 return;
483 else
484 resultCode = eSIR_SME_REFUSED;
485 }
486 {
487 /// Join failure
488 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700489 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 /// Send Join response to Host
491 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
492 }
493} /*** end limProcessMlmJoinCnf() ***/
494
495/**
496 * limProcessMlmAuthCnf()
497 *
498 *FUNCTION:
499 * This function is called to processes MLM_AUTH_CNF
500 * message from MLM State machine.
501 *
502 *LOGIC:
503 *
504 *ASSUMPTIONS:
505 *
506 *NOTE:
507 *
508 * @param pMac Pointer to Global MAC structure
509 * @param pMsgBuf A pointer to the MLM message buffer
510 *
511 * @return None
512 */
513void
514limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
515{
516 tANI_U16 caps;
517 tANI_U32 val;
518 tAniAuthType cfgAuthType, authMode;
519 tLimMlmAuthReq *pMlmAuthReq;
520 tLimMlmAssocReq *pMlmAssocReq;
521 tLimMlmAuthCnf *pMlmAuthCnf;
522 tpPESession psessionEntry;
523 tANI_U32 teleBcnEn = 0;
524// tANI_U8 sessionId;
525
526 if(pMsgBuf == NULL)
527 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700528 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 return;
530 }
531 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
532 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
533 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700534 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 return;
536 }
537
538 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
539 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
540 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
541 {
542 /**
543 * Should not have received AUTH confirm
544 * from MLM in other states or on AP.
545 * Log error
546 */
547 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700548 FL("received unexpected MLM_AUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 psessionEntry->limSmeState);)
550 return;
551 }
552 /// Process AUTH confirm from MLM
553 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
554 {
555 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
556 {
557 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
558 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
559 {
560 /**
561 * Could not get AuthType value from CFG.
562 * Log error.
563 */
564 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700565 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 }
567 }
568 else
569 cfgAuthType = pMac->lim.gLimPreAuthType;
570
571 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
572 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
573 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
574 {
575 /**
576 * When Open authentication fails with reason code "13" and
577 * authType set to 'auto switch', Try with Shared Authentication
578 */
579 authMode = eSIR_SHARED_KEY;
580 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530581 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
582 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 {
584 // Log error
585 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530586 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 return;
588 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530589 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 val = sizeof(tSirMacAddr);
591 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
592 {
593 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
594 }
595 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530596 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
597 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 sizeof(tSirMacAddr));
599 pMlmAuthReq->authType = authMode;
600 /* Update PE session Id*/
601 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
602 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
603 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
604 != eSIR_SUCCESS)
605 {
606 /**
607 * Could not get AuthFailureTimeout value from CFG.
608 * Log error.
609 */
610 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700611 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 }
613 limPostMlmMessage(pMac,
614 LIM_MLM_AUTH_REQ,
615 (tANI_U32 *) pMlmAuthReq);
616 return;
617 }
618 else
619 {
620 // MAC based authentication failure
621 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
622 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700623 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700625 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700627 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
628
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 /**
630 * Need to send Join response with
631 * auth failure to Host.
632 */
633 limHandleSmeJoinResult(pMac,
634 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
635 }
636 else
637 {
638 /**
639 * Pre-authentication failure.
640 * Send Pre-auth failure response to host
641 */
642 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 limSendSmeAuthRsp(
645 pMac,
646 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
647 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
648 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
649 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
650 }
651 } // end if (cfgAuthType == eAUTO_SWITCH)
652 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
653 else
654 {
655 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
656 {
657 /**
658 * Successful MAC based authentication
659 * Trigger Association with BSS
660 */
661 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700662 FL("*** Authenticated with BSS ***"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530663 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
664 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 {
666 // Log error
667 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530668 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 return;
670 }
671 val = sizeof(tSirMacAddr);
672 #if 0
673 if (cfgGetStr(pMac, WNI_CFG_BSSID,
674 pMlmAssocReq->peerMacAddr,
675 &val) != eSIR_SUCCESS)
676 {
677 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700678 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 }
680 #endif //SUPPORT BT-AMP
681 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
682 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
683 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
684 != eSIR_SUCCESS)
685 {
686 /**
687 * Could not get AssocFailureTimeout value
688 * from CFG. Log error.
689 */
690 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700691 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 }
693 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
694 {
695 /**
696 * Could not get Capabilities value
697 * from CFG. Log error.
698 */
699 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700700 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 }
702 /*Clear spectrum management bit if AP doesn't support it*/
703 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
704 {
705 /*AP doesn't support spectrum management clear spectrum management bit*/
706 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
707 }
708
709 pMlmAssocReq->capabilityInfo = caps;
710 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700711 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700713 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
714 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700715
716 /* If telescopic beaconing is enabled, set listen interval to
717 WNI_CFG_TELE_BCN_MAX_LI */
718 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
719 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700720 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700721
722 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
723
724 if(teleBcnEn)
725 {
726 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
727 eSIR_SUCCESS)
728 {
729 /**
730 * Could not get ListenInterval value
731 * from CFG. Log error.
732 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700733 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 }
735 }
736 else
737 {
738 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
739 {
740 /**
741 * Could not get ListenInterval value
742 * from CFG. Log error.
743 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700744 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 }
746 }
747
748 pMlmAssocReq->listenInterval = (tANI_U16)val;
749 /* Update PE session ID*/
750 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
751 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
752 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700753 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 limPostMlmMessage(pMac,
755 LIM_MLM_ASSOC_REQ,
756 (tANI_U32 *) pMlmAssocReq);
757 }
758 else
759 {
760 /**
761 * Successful Pre-authentication.
762 * Send Pre-auth response to host
763 */
764 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700765 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 limSendSmeAuthRsp(
767 pMac,
768 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
769 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
770 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
771 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
772 }
773 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
774} /*** end limProcessMlmAuthCnf() ***/
775
776/**
777 * limProcessMlmAssocCnf()
778 *
779 *FUNCTION:
780 * This function is called to processes MLM_ASSOC_CNF
781 * message from MLM State machine.
782 *
783 *LOGIC:
784 *
785 *ASSUMPTIONS:
786 *
787 *NOTE:
788 *
789 * @param pMac Pointer to Global MAC structure
790 * @param pMsgBuf A pointer to the MLM message buffer
791 *
792 * @return None
793 */
794void
795limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
796{
797 tpPESession psessionEntry;
798 tLimMlmAssocCnf *pLimMlmAssocCnf;
799
800 if(pMsgBuf == NULL)
801 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700802 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 return;
804 }
805 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
806 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
807 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700808 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 return;
810 }
811 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
812 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
813 {
814 /**
815 * Should not have received Assocication confirm
816 * from MLM in other states OR on AP.
817 * Log error
818 */
819 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700820 FL("received unexpected MLM_ASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 psessionEntry->limSmeState);)
822 return;
823 }
824 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
825 {
826 // Association failure
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700827 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700829 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 /**
831 * Need to send Join response with
832 * Association failure to Host.
833 */
834 limHandleSmeJoinResult(pMac,
835 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
836 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
837 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
838 else
839 {
840 // Successful Association
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700841 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700843 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 /**
845 * Need to send Join response with
846 * Association success to Host.
847 */
848 limHandleSmeJoinResult(pMac,
849 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
850 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
851 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
852} /*** end limProcessMlmAssocCnf() ***/
853
854/**
855 * limProcessMlmReassocCnf()
856 *
857 *FUNCTION:
858 * This function is called to processes MLM_REASSOC_CNF
859 * message from MLM State machine.
860 *
861 *LOGIC:
862 *
863 *ASSUMPTIONS:
864 *
865 *NOTE:
866 *
867 * @param pMac Pointer to Global MAC structure
868 * @param pMsgBuf A pointer to the MLM message buffer
869 *
870 * @return None
871 */
872void
873limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
874{
875 tpPESession psessionEntry;
876 tLimMlmReassocCnf *pLimMlmReassocCnf;
877
878 if(pMsgBuf == NULL)
879 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700880 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 return;
882 }
883 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
884 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700886 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 return;
888 }
889 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
890 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
891 {
892 /**
893 * Should not have received Reassocication confirm
894 * from MLM in other states OR on AP.
895 * Log error
896 */
897 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700898 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
900 return;
901 }
902 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530903 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 psessionEntry->pLimReAssocReq = NULL;
905 }
906
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700907 PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
909 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700910 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700911
912 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700913 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700914
915 /**
916 * Need to send Reassoc response with
917 * Reassociation success to Host.
918 */
919 limSendSmeJoinReassocRsp(
920 pMac, eWNI_SME_REASSOC_RSP,
921 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
922 psessionEntry->smeSessionId,psessionEntry->transactionId);
923 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
924 /** Reassociation failure With the New AP
925 * but we still have the link with the Older AP
926 */
927 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700928 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700929
930 /**
931 * Need to send Reassoc response with
932 * Association failure to Host.
933 */
934 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
935 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
936 psessionEntry->smeSessionId,psessionEntry->transactionId);
937 }else {
938 // Reassociation failure
939 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700940 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 /**
942 * Need to send Reassoc response with
943 * Association failure to Host.
944 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700945 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 }
947} /*** end limProcessMlmReassocCnf() ***/
948
949/**
950 * limProcessMlmReassocInd()
951 *
952 *FUNCTION:
953 * This function is called to processes MLM_REASSOC_IND
954 * message from MLM State machine.
955 *
956 *LOGIC:
957 *
958 *ASSUMPTIONS:
959 *
960 *NOTE:
961 *
962 * @param pMac Pointer to Global MAC structure
963 * @param pMsgBuf A pointer to the MLM message buffer
964 *
965 * @return None
966 */
967void
968limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
969{
970 tANI_U32 len;
971 tSirMsgQ msgQ;
972 tSirSmeReassocInd *pSirSmeReassocInd;
973 tpDphHashNode pStaDs=0;
974 tpPESession psessionEntry;
975 tANI_U8 sessionId;
976 if(pMsgBuf == NULL)
977 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700978 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 return;
980 }
981 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
982 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700983 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 return;
985 }
986 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530988 pSirSmeReassocInd = vos_mem_malloc(len);
989 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 {
991 // Log error
992 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530993 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 return;
995
996 }
997 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
998 eWNI_SME_REASSOC_IND);
999 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1000 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1001
1002 // Required for indicating the frames to upper layer
1003 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1004 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1005 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1006 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1007
1008 msgQ.type = eWNI_SME_REASSOC_IND;
1009 msgQ.bodyptr = pSirSmeReassocInd;
1010 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001011 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001012#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1013 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1014#endif //FEATURE_WLAN_DIAG_SUPPORT
1015 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1016 if (! pStaDs)
1017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001018 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301020 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 return;
1022 }
1023
1024 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1025 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001026 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 /*
1028 ** turn on a timer to detect the loss of REASSOC CNF
1029 **/
1030 limActivateCnfTimer(pMac,
1031 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1032} /*** end limProcessMlmReassocInd() ***/
1033
1034/**
1035 * limProcessMlmAuthInd()
1036 *
1037 *FUNCTION:
1038 * This function is called to processes MLM_AUTH_IND
1039 * message from MLM State machine.
1040 *
1041 *LOGIC:
1042 *
1043 *ASSUMPTIONS:
1044 *
1045 *NOTE:
1046 *
1047 * @param pMac Pointer to Global MAC structure
1048 * @param pMsgBuf A pointer to the MLM message buffer
1049 *
1050 * @return None
1051 */
1052void
1053limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1054{
1055 tSirMsgQ msgQ;
1056 tSirSmeAuthInd *pSirSmeAuthInd;
1057
1058 if(pMsgBuf == NULL)
1059 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001060 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 return;
1062 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301063 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1064 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 {
1066 // Log error
1067 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301068 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 }
1070 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1071 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1072 (tANI_U8 *) &(pSirSmeAuthInd->length));
1073 msgQ.type = eWNI_SME_AUTH_IND;
1074 msgQ.bodyptr = pSirSmeAuthInd;
1075 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001076 MTRACE(macTraceMsgTx(pMac, NO_SESSION, 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_AUTH_IND_EVENT, NULL, 0, 0);
1079#endif //FEATURE_WLAN_DIAG_SUPPORT
1080 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1081} /*** end limProcessMlmAuthInd() ***/
1082
1083
1084
1085
1086void
1087limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1088 tSirSmeAssocInd *pSirSmeAssocInd,
1089 tpPESession psessionEntry)
1090{
1091 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1092 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1093
1094 // Required for indicating the frames to upper layer
1095 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1096 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1097
1098 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1099 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1100
1101 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301102 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1103 sizeof(tSirMacAddr));
1104
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 // Fill in aid
1106 pSirSmeAssocInd->aid = pAssocInd->aid;
1107 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301108 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 // Fill in staId
1110 //pSirSmeAssocInd->staId = psessionEntry->staId;
1111 // Fill in authType
1112 pSirSmeAssocInd->authType = pAssocInd->authType;
1113 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301114 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1115 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301117 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1118 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1119 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001120
1121 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301122 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1123 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1124 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1128 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1129 {
1130 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1131 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1132 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301133 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301135 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 // Fill in WmmInfo
1138 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001139} /*** end limAssocIndSerDes() ***/
1140
1141
1142
1143/**
1144 * limProcessMlmAssocInd()
1145 *
1146 *FUNCTION:
1147 * This function is called to processes MLM_ASSOC_IND
1148 * message from MLM State machine.
1149 *
1150 *LOGIC:
1151 *
1152 *ASSUMPTIONS:
1153 *
1154 *NOTE:
1155 *
1156 * @param pMac Pointer to Global MAC structure
1157 * @param pMsgBuf A pointer to the MLM message buffer
1158 *
1159 * @return None
1160 */
1161void
1162limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1163{
1164 tANI_U32 len;
1165 tSirMsgQ msgQ;
1166 tSirSmeAssocInd *pSirSmeAssocInd;
1167 tpDphHashNode pStaDs=0;
1168 tpPESession psessionEntry;
1169 if(pMsgBuf == NULL)
1170 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001171 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 return;
1173 }
1174 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1175 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001176 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 return;
1178 }
1179 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301181 pSirSmeAssocInd = vos_mem_malloc(len);
1182 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 {
1184 // Log error
1185 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301186 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 return;
1188 }
1189
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1191 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 msgQ.type = eWNI_SME_ASSOC_IND;
1193 msgQ.bodyptr = pSirSmeAssocInd;
1194 msgQ.bodyval = 0;
1195 pStaDs = dphGetHashEntry(pMac,
1196 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1197 if (! pStaDs)
1198 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001199 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301201 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001202
1203 return;
1204 }
1205 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001207 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001208#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1209 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1210#endif //FEATURE_WLAN_DIAG_SUPPORT
1211 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1212
1213 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001214 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 /*
1216 ** turn on a timer to detect the loss of ASSOC CNF
1217 **/
1218 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1219
1220// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1221#ifdef TEST_BTAMP_AP
1222//tANI_U32 *pMsgBuf;
1223{
1224 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301225 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1226 if ( NULL == pSmeAssoccnf )
1227 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1229 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301230 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1231 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1233 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301234 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1235 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301237 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1239 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301240 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001241}
1242#endif
1243
1244
1245} /*** end limProcessMlmAssocInd() ***/
1246
1247
1248
1249
1250/**
1251 * limProcessMlmDisassocInd()
1252 *
1253 *FUNCTION:
1254 * This function is called to processes MLM_DISASSOC_IND
1255 * message from MLM State machine.
1256 *
1257 *LOGIC:
1258 *
1259 *ASSUMPTIONS:
1260 *
1261 *NOTE:
1262 *
1263 * @param pMac Pointer to Global MAC structure
1264 * @param pMsgBuf A pointer to the MLM message buffer
1265 *
1266 * @return None
1267 */
1268void
1269limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1270{
1271 tLimMlmDisassocInd *pMlmDisassocInd;
1272 tpPESession psessionEntry;
1273 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1274 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1275 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001276 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 return;
1278 }
1279 switch (psessionEntry->limSystemRole)
1280 {
1281 case eLIM_STA_IN_IBSS_ROLE:
1282 break;
1283 case eLIM_STA_ROLE:
1284 case eLIM_BT_AMP_STA_ROLE:
1285 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001286 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 break;
1288 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1289 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001290 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 pMlmDisassocInd->aid);)
1292 // Send SME_DISASOC_IND after Polaris cleanup
1293 // (after receiving LIM_MLM_PURGE_STA_IND)
1294 break;
1295 } // end switch (psessionEntry->limSystemRole)
1296} /*** end limProcessMlmDisassocInd() ***/
1297
1298/**
1299 * limProcessMlmDisassocCnf()
1300 *
1301 *FUNCTION:
1302 * This function is called to processes MLM_DISASSOC_CNF
1303 * message from MLM State machine.
1304 *
1305 *LOGIC:
1306 *
1307 *ASSUMPTIONS:
1308 *
1309 *NOTE:
1310 *
1311 * @param pMac Pointer to Global MAC structure
1312 * @param pMsgBuf A pointer to the MLM message buffer
1313 *
1314 * @return None
1315 */
1316void
1317limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1318{
1319 tSirResultCodes resultCode;
1320 tLimMlmDisassocCnf *pMlmDisassocCnf;
1321 tpPESession psessionEntry;
1322 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1323 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1324 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001325 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 return;
1327 }
1328 resultCode = (tSirResultCodes)
1329 (pMlmDisassocCnf->disassocTrigger ==
1330 eLIM_LINK_MONITORING_DISASSOC) ?
1331 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1332 pMlmDisassocCnf->resultCode;
1333 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1334 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 // Disassociate Confirm from MLM
1336 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1337 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1338 {
1339 /**
1340 * Should not have received
1341 * Disassocate confirm
1342 * from MLM in other states.
1343 * Log error
1344 */
1345 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001346 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 return;
1348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 if (pMac->lim.gLimRspReqd)
1350 pMac->lim.gLimRspReqd = false;
1351 if (pMlmDisassocCnf->disassocTrigger ==
1352 eLIM_PROMISCUOUS_MODE_DISASSOC)
1353 {
1354 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1355 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1356 else
1357 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001358 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 // Send Promiscuous mode response to host
1360 limSendSmePromiscuousModeRsp(pMac);
1361 }
1362 else
1363 {
1364 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1365 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1366 else
1367 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001368 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1370 resultCode,
1371 pMlmDisassocCnf->disassocTrigger,
1372 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1373 }
1374 }
1375 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1376 {
1377 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1378 resultCode,
1379 pMlmDisassocCnf->disassocTrigger,
1380 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1381 }
1382} /*** end limProcessMlmDisassocCnf() ***/
1383
1384/**
1385 * limProcessMlmDeauthInd()
1386 *
1387 *FUNCTION:
1388 * This function is called to processes MLM_DEAUTH_IND
1389 * message from MLM State machine.
1390 *
1391 *LOGIC:
1392 *
1393 *ASSUMPTIONS:
1394 *
1395 *NOTE:
1396 *
1397 * @param pMac Pointer to Global MAC structure
1398 * @param pMsgBuf A pointer to the MLM message buffer
1399 *
1400 * @return None
1401 */
1402void
1403limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1404{
1405 tLimMlmDeauthInd *pMlmDeauthInd;
1406 tpPESession psessionEntry;
1407 tANI_U8 sessionId;
1408 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1409 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001411 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 return;
1413 }
1414 switch (psessionEntry->limSystemRole)
1415 {
1416 case eLIM_STA_IN_IBSS_ROLE:
1417 break;
1418 case eLIM_STA_ROLE:
1419 case eLIM_BT_AMP_STA_ROLE:
1420 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001421 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422
1423 default: // eLIM_AP_ROLE
1424 {
1425 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001426 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 pMlmDeauthInd->aid);)
1428 }
1429 // Send SME_DEAUTH_IND after Polaris cleanup
1430 // (after receiving LIM_MLM_PURGE_STA_IND)
1431 break;
1432 } // end switch (psessionEntry->limSystemRole)
1433} /*** end limProcessMlmDeauthInd() ***/
1434
1435/**
1436 * limProcessMlmDeauthCnf()
1437 *
1438 *FUNCTION:
1439 * This function is called to processes MLM_DEAUTH_CNF
1440 * message from MLM State machine.
1441 *
1442 *LOGIC:
1443 *
1444 *ASSUMPTIONS:
1445 *
1446 *NOTE:
1447 *
1448 * @param pMac Pointer to Global MAC structure
1449 * @param pMsgBuf A pointer to the MLM message buffer
1450 *
1451 * @return None
1452 */
1453void
1454limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1455{
1456 tANI_U16 aid;
1457 tSirResultCodes resultCode;
1458 tLimMlmDeauthCnf *pMlmDeauthCnf;
1459 tpPESession psessionEntry;
1460
1461 if(pMsgBuf == NULL)
1462 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001463 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 return;
1465 }
1466 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1467 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1468 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001469 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 return;
1471 }
1472
1473 resultCode = (tSirResultCodes)
1474 (pMlmDeauthCnf->deauthTrigger ==
1475 eLIM_LINK_MONITORING_DEAUTH) ?
1476 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1477 pMlmDeauthCnf->resultCode;
1478 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1479 pMlmDeauthCnf->aid : 1;
1480 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1481 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 // Deauth Confirm from MLM
1483 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1484 {
1485 /**
1486 * Should not have received Deauth confirm
1487 * from MLM in other states.
1488 * Log error
1489 */
1490 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001491 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 psessionEntry->limSmeState);)
1493 return;
1494 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1496 {
1497 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1498 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001499 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 }
1501 else
1502 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001503 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
1505 if (pMac->lim.gLimRspReqd)
1506 pMac->lim.gLimRspReqd = false;
1507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1509 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1510 resultCode,
1511 pMlmDeauthCnf->deauthTrigger,
1512 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001513} /*** end limProcessMlmDeauthCnf() ***/
1514
1515/**
1516 * limProcessMlmPurgeStaInd()
1517 *
1518 *FUNCTION:
1519 * This function is called to processes MLM_PURGE_STA_IND
1520 * message from MLM State machine.
1521 *
1522 *LOGIC:
1523 *
1524 *ASSUMPTIONS:
1525 *
1526 *NOTE:
1527 *
1528 * @param pMac Pointer to Global MAC structure
1529 * @param pMsgBuf A pointer to the MLM message buffer
1530 *
1531 * @return None
1532 */
1533void
1534limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1535{
1536 tSirResultCodes resultCode;
1537 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1538 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 if(pMsgBuf == NULL)
1540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001541 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 return;
1543 }
1544 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1545 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001547 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 return;
1549 }
1550 // Purge STA indication from MLM
1551 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1552 switch (psessionEntry->limSystemRole)
1553 {
1554 case eLIM_STA_IN_IBSS_ROLE:
1555 break;
1556 case eLIM_STA_ROLE:
1557 case eLIM_BT_AMP_STA_ROLE:
1558 default: // eLIM_AP_ROLE
1559 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1560 (psessionEntry->limSmeState !=
1561 eLIM_SME_WT_DISASSOC_STATE) &&
1562 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1563 {
1564 /**
1565 * Should not have received
1566 * Purge STA indication
1567 * from MLM in other states.
1568 * Log error
1569 */
1570 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001571 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 psessionEntry->limSmeState);)
1573 break;
1574 }
1575 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001576 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 pMlmPurgeStaInd->aid);)
1578 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1579 {
1580 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001581 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001582
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 }
1584 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1585 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 limSendSmeDeauthNtf(pMac,
1587 pMlmPurgeStaInd->peerMacAddr,
1588 resultCode,
1589 pMlmPurgeStaInd->purgeTrigger,
1590 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 }
1592 else
1593 limSendSmeDisassocNtf(pMac,
1594 pMlmPurgeStaInd->peerMacAddr,
1595 resultCode,
1596 pMlmPurgeStaInd->purgeTrigger,
1597 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1598 } // end switch (psessionEntry->limSystemRole)
1599} /*** end limProcessMlmPurgeStaInd() ***/
1600
1601/**
1602 * limProcessMlmSetKeysCnf()
1603 *
1604 *FUNCTION:
1605 * This function is called to processes MLM_SETKEYS_CNF
1606 * message from MLM State machine.
1607 *
1608 *LOGIC:
1609 *
1610 *ASSUMPTIONS:
1611 *
1612 *NOTE:
1613 *
1614 * @param pMac Pointer to Global MAC structure
1615 * @param pMsgBuf A pointer to the MLM message buffer
1616 *
1617 * @return None
1618 */
1619void
1620limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1621{
1622 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001623 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001624 tpPESession psessionEntry;
1625
1626 if(pMsgBuf == NULL)
1627 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001628 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001629 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 }
1631 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1632 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001634 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 return;
1636 }
1637 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001638 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 pMlmSetKeysCnf->resultCode );
1640 limSendSmeSetContextRsp(pMac,
1641 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1644 psessionEntry->transactionId);
1645} /*** end limProcessMlmSetKeysCnf() ***/
1646/**
1647 * limProcessMlmRemoveKeyCnf()
1648 *
1649 *FUNCTION:
1650 * This function is called to processes MLM_REMOVEKEY_CNF
1651 * message from MLM State machine.
1652 *
1653 *LOGIC:
1654 *
1655 *ASSUMPTIONS:
1656 *
1657 *NOTE:
1658 *
1659 * @param pMac Pointer to Global MAC structure
1660 * @param pMsgBuf A pointer to the MLM message buffer
1661 *
1662 * @return None
1663 */
1664void
1665limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1666{
1667 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001668 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 tpPESession psessionEntry;
1670
1671 if(pMsgBuf == NULL)
1672 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001673 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001674 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 }
1676 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1677 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1678 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001679 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 return;
1681 }
1682 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001683 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 pMlmRemoveKeyCnf->resultCode );
1685 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001686 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1688 psessionEntry->smeSessionId,psessionEntry->transactionId);
1689} /*** end limProcessMlmRemoveKeyCnf() ***/
1690
1691
1692/**
1693 * limHandleSmeJoinResult()
1694 *
1695 *FUNCTION:
1696 * This function is called to process join/auth/assoc failures
1697 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1698 * MLM_ASSOC_CNF with a success code in case of STA role and
1699 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1700 *
1701 *LOGIC:
1702 *
1703 *ASSUMPTIONS:
1704 *
1705 *NOTE:
1706 *
1707 * @param pMac Pointer to Global MAC structure
1708 * @param resultCode Failure code to be sent
1709 *
1710 *
1711 * @return None
1712 */
1713static void
1714limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1715{
1716 tpDphHashNode pStaDs = NULL;
1717 tANI_U8 smesessionId;
1718 tANI_U16 smetransactionId;
1719
1720 /* Newly Added on oct 11 th*/
1721 if(psessionEntry == NULL)
1722 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001723 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 return;
1725 }
1726 smesessionId = psessionEntry->smeSessionId;
1727 smetransactionId = psessionEntry->transactionId;
1728 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1729 if(resultCode != eSIR_SME_SUCCESS)
1730 {
1731 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1732 if (pStaDs != NULL)
1733 {
1734 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1735 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1736 pStaDs->mlmStaContext.resultCode = resultCode;
1737 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1738 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1739 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301740 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001741 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 return;
1743 }
1744 }
1745
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301746 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 psessionEntry->pLimJoinReq = NULL;
1748 //Delete teh session if JOIN failure occurred.
1749 if(resultCode != eSIR_SME_SUCCESS)
1750 {
1751 if(NULL != psessionEntry)
1752 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001753 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1754 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001755 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 peDeleteSession(pMac,psessionEntry);
1757 psessionEntry = NULL;
1758 }
1759 }
1760 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1761 smesessionId, smetransactionId);
1762} /*** end limHandleSmeJoinResult() ***/
1763
1764/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001765 * limHandleSmeReaasocResult()
1766 *
1767 *FUNCTION:
1768 * This function is called to process reassoc failures
1769 * upon receiving REASSOC_CNF with a failure code or
1770 * MLM_REASSOC_CNF with a success code in case of STA role
1771 *
1772 *LOGIC:
1773 *
1774 *ASSUMPTIONS:
1775 *
1776 *NOTE:
1777 *
1778 * @param pMac Pointer to Global MAC structure
1779 * @param resultCode Failure code to be sent
1780 *
1781 *
1782 * @return None
1783 */
1784static void
1785limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1786{
1787 tpDphHashNode pStaDs = NULL;
1788 tANI_U8 smesessionId;
1789 tANI_U16 smetransactionId;
1790
1791 if(psessionEntry == NULL)
1792 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001793 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001794 return;
1795 }
1796 smesessionId = psessionEntry->smeSessionId;
1797 smetransactionId = psessionEntry->transactionId;
1798 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1799 if(resultCode != eSIR_SME_SUCCESS)
1800 {
1801 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1802 if (pStaDs != NULL)
1803 {
1804 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1805 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1806 pStaDs->mlmStaContext.resultCode = resultCode;
1807 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1808 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1809 return;
1810 }
1811 }
1812
1813 //Delete teh session if REASSOC failure occurred.
1814 if(resultCode != eSIR_SME_SUCCESS)
1815 {
1816 if(NULL != psessionEntry)
1817 {
1818 peDeleteSession(pMac,psessionEntry);
1819 psessionEntry = NULL;
1820 }
1821 }
1822 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1823 smesessionId, smetransactionId);
1824} /*** end limHandleSmeReassocResult() ***/
1825
1826/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 * limProcessMlmAddStaRsp()
1828 *
1829 *FUNCTION:
1830 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1831 * Upon receipt of this message from HAL, MLME -
1832 * > Determines the "state" in which this message was received
1833 * > Forwards it to the appropriate callback
1834 *
1835 *ASSUMPTIONS:
1836 *
1837 *NOTE:
1838 *
1839 * @param pMac Pointer to Global MAC structure
1840 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1841 *
1842 * @return None
1843 */
1844void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1845{
1846 //we need to process the deferred message since the initiating req. there might be nested request.
1847 //in the case of nested request the new request initiated from the response will take care of resetting
1848 //the deffered flag.
1849 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 )
1853 {
1854 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1855 return;
1856 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001858}
1859void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1860{
1861 tLimMlmAssocCnf mlmAssocCnf;
1862 tpDphHashNode pStaDs;
1863 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1864 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1865
1866 if(NULL == pAddStaParams )
1867 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001868 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 return;
1870 }
1871 if( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1872 {
1873 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
1874 {
1875 //TODO: any response to be sent out here ?
1876 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001877 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 psessionEntry->limMlmState);
1879 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1880 goto end;
1881 }
1882 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1883 mesgType = LIM_MLM_REASSOC_CNF;
1884 //
1885 // Update the DPH Hash Entry for this STA
1886 // with proper state info
1887 //
1888 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1889 if( NULL != pStaDs)
1890 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1891 else
1892 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001893 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001894 DPH_STA_HASH_INDEX_PEER);
1895 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001896 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 /*
1898 * Storing the self StaIndex(Generated by HAL) in session context,
1899 * instead of storing it in DPH Hash entry for Self STA.
1900 * DPH entry for the self STA stores the sta index for the BSS entry
1901 * to which the STA is associated.
1902 */
1903 psessionEntry->staId = pAddStaParams->staIdx;
1904 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001905#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1906 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1907#endif
1908 {
1909 limReactivateHeartBeatTimer(pMac, psessionEntry);
1910 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001911 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001912
1913 //assign the sessionId to the timer Object
1914 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1915 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001916 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001917#ifdef WLAN_DEBUG
1918 pMac->lim.gLimNumLinkEsts++;
1919#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001920#ifdef FEATURE_WLAN_TDLS
1921 /* initialize TDLS peer related data */
1922 limInitTdlsData(pMac,psessionEntry);
1923#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 // Return Assoc confirm to SME with success
1925 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1926 // be passed in here....
1927 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1928 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1929 }
1930 else
1931 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301932 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1934 }
1935end:
1936 if( 0 != limMsgQ->bodyptr )
1937 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301938 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 }
1940 /* Updating PE session Id*/
1941 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1942 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
1943 return;
1944}
1945void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1946{
1947 //we need to process the deferred message since the initiating req. there might be nested request.
1948 //in the case of nested request the new request initiated from the response will take care of resetting
1949 //the deffered flag.
1950 // tpPESession psessionEntry;
1951 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1952 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
1953 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001954 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 // return;
1956 // }
1957 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001958
1959 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
1960 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 ) &&
1963 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
1964 {
1965 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
1966 return;
1967 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08001969
1970 if(!limIsInMCC(pMac))
1971 {
1972 WDA_TrafficStatsTimerActivate(FALSE);
1973 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001974
1975#ifdef WLAN_FEATURE_11W
1976 if (psessionEntry->limRmfEnabled)
1977 {
1978 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
1979 {
1980 limLog( pMac, LOGE,
1981 FL( "Could not send down Exclude Unencrypted Indication!" ),
1982 psessionEntry->limMlmState );
1983 }
1984 }
1985#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001986}
1987
1988void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1989{
1990 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
1991 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1992 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05301993
1994 if (NULL == pDelBssParams)
1995 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001996 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05301997 goto end;
1998 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2000 {
2001 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002002 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2004 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2005
2006 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002007 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 statusCode = eSIR_SME_REFUSED;
2009 goto end;
2010 }
2011 if(pStaDs == NULL)
2012 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002013 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 statusCode = eSIR_SME_REFUSED;
2015 goto end;
2016 }
2017 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2018 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002019 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 pStaDs->mlmStaContext.mlmState);)
2021 statusCode = eSIR_SME_REFUSED;
2022 goto end;
2023 }
2024 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2025 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2026 }
2027 else
2028 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302029 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302030 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 return;
2032 }
2033 end:
2034 if( 0 != limMsgQ->bodyptr )
2035 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302036 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 }
2038 if(pStaDs == NULL)
2039 return;
2040 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2041 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2042 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2043 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2044 {
2045 /** The Case where the DelBss is invoked from
2046 * context of other than normal DisAssoc / Deauth OR
2047 * as part of Join Failure.
2048 */
2049 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2050 return;
2051 }
2052 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2053 return;
2054}
2055
Jeff Johnson295189b2012-06-20 16:38:30 -07002056void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2057{
2058 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002059 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2061 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2062
2063 if(psessionEntry == NULL)
2064 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002065 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002066 if(pDelBss != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302067 vos_mem_free(pDelBss);
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 return;
2069 }
2070
2071 if (pDelBss == NULL)
2072 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002073 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 rc = eSIR_SME_REFUSED;
2075 goto end;
2076 }
2077 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002078 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2079
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2081 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002082 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002083 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2084 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002085 rc = eSIR_SME_REFUSED;
2086 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 }
2088 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2089 {
2090 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2091 pDelBss->status, pDelBss->bssIdx);
2092 rc = eSIR_SME_STOP_BSS_FAILURE;
2093 goto end;
2094 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002095 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002097 if (status != eSIR_SUCCESS)
2098 {
2099 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002101 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 /** Softmac may send all the buffered packets right after resuming the transmission hence
2103 * to occupy the medium during non channel occupancy period. So resume the transmission after
2104 * HAL gives back the response.
2105 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002106#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 if (LIM_IS_RADAR_DETECTED(pMac))
2108 {
2109 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2110 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2111 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002112#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2114 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002116 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 end:
2118 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2119 peDeleteSession(pMac, psessionEntry);
2120
2121 if(pDelBss != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302122 vos_mem_free(pDelBss);
Jeff Johnson295189b2012-06-20 16:38:30 -07002123}
2124
2125void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2126{
2127 //we need to process the deferred message since the initiating req. there might be nested request.
2128 //in the case of nested request the new request initiated from the response will take care of resetting
2129 //the deffered flag.
2130
2131 tpPESession psessionEntry;
2132 tpDeleteStaParams pDeleteStaParams;
2133 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2134 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302135
2136 if(NULL == pDeleteStaParams ||
2137 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002139 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002140 if(pDeleteStaParams != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302141 vos_mem_free(pDeleteStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 return;
2143 }
2144
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 )
2148 {
2149 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2150 return;
2151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153}
2154
Jeff Johnson295189b2012-06-20 16:38:30 -07002155void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2156{
2157 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2158 tpDphHashNode pStaDs;
2159 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2160 if(limMsgQ->bodyptr == NULL)
2161 {
2162 return;
2163 }
2164
2165 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2166 if(pStaDs == NULL)
2167 {
2168 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002169 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302171 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002172
2173 return;
2174 }
2175 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2176 {
2177 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002178 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002179
2180 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2181 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2182 {
2183 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002184 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2186 statusCode = eSIR_SME_REFUSED;
2187 goto end;
2188 }
2189
2190 limLog( pMac, LOG1,
2191 FL("Deleted STA AssocID %d staId %d MAC "),
2192 pStaDs->assocId, pStaDs->staIndex);
2193 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2194 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2195 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302196 vos_mem_free(pDelStaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002197 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 {
2199 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002200 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 pStaDs->assocId);)
2202 // delete the TS if it has already been added.
2203 // send the response with error status.
2204 if(pStaDs->qos.addtsPresent)
2205 {
2206 tpLimTspecInfo pTspecInfo;
2207 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2208 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2209 {
2210 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2211 NULL, &pTspecInfo->idx);
2212 }
2213 }
2214 limRejectAssociation(pMac,
2215 pStaDs->staAddr,
2216 pStaDs->mlmStaContext.subType,
2217 true, pStaDs->mlmStaContext.authType,
2218 pStaDs->assocId, true,
2219 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2220 psessionEntry);
2221 }
2222 return;
2223 }
2224 }
2225 else
2226 {
2227 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002228 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 statusCode = eSIR_SME_REFUSED;
2230 }
2231 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302232 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2234 {
2235 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2236 }
2237 return;
2238}
2239
2240void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2241{
2242 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2243 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2244 tpDphHashNode pStaDs = NULL;
2245 if(NULL == pDelStaParams )
2246 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002247 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 goto end;
2249 }
2250 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2251 {
2252 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2253 if (pStaDs == NULL)
2254 {
2255 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002256 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 pDelStaParams->assocId);
2258 statusCode = eSIR_SME_REFUSED;
2259 goto end;
2260 }
2261 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2262 {
2263 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002264 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 limMlmStateStr(psessionEntry->limMlmState));
2266 statusCode = eSIR_SME_REFUSED;
2267 goto end;
2268 }
2269 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2270 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002271 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 //we must complete all cleanup related to delSta before calling limDelBSS.
2273 if( 0 != limMsgQ->bodyptr )
2274 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302275 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 }
2277 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2278 return;
2279 }
2280 else
2281 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002282 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 statusCode = eSIR_SME_REFUSED;
2284 }
2285end:
2286 if( 0 != limMsgQ->bodyptr )
2287 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302288 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 }
2290 return;
2291}
2292
Jeff Johnson295189b2012-06-20 16:38:30 -07002293void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2294{
2295 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302296 tpDphHashNode pStaDs = NULL;
2297
2298 if (NULL == pAddStaParams)
2299 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002300 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302301 goto end;
2302 }
2303
2304 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 if(pStaDs == NULL)
2306 {
2307 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002308 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 goto end;
2310 }
2311 //
2312 // TODO & FIXME_GEN4
2313 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2314 //
2315 //TODO: any check for pMac->lim.gLimMlmState ?
2316 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2317 {
2318 //TODO: any response to be sent out here ?
2319 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002320 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 pStaDs->mlmStaContext.mlmState);
2322 goto end;
2323 }
2324 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2325 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002326 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 limRejectAssociation(pMac, pStaDs->staAddr,
2328 pStaDs->mlmStaContext.subType,
2329 true, pStaDs->mlmStaContext.authType,
2330 pStaDs->assocId, true,
2331 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2332 psessionEntry);
2333 goto end;
2334 }
2335 pStaDs->bssId = pAddStaParams->bssIdx;
2336 pStaDs->staIndex = pAddStaParams->staIdx;
2337 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2338 pStaDs->valid = 1;
2339 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2340 limLog( pMac, LOG1,
2341 FL("STA AssocID %d staId %d MAC "),
2342 pStaDs->assocId,
2343 pStaDs->staIndex);
2344 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2345
2346 /* For BTAMP-AP, the flow sequence shall be:
2347 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2348 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2349 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2350 */
2351 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2352 // fall though to reclaim the original Add STA Response message
2353end:
2354 if( 0 != limMsgQ->bodyptr )
2355 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302356 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 }
2358 return;
2359}
2360
2361/**
2362 * limProcessApMlmAddBssRsp()
2363 *
2364 *FUNCTION:
2365 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2366 * Upon receipt of this message from HAL, MLME -
2367 * > Validates the result of WDA_ADD_BSS_REQ
2368 * > Init other remaining LIM variables
2369 * > Init the AID pool, for that BSSID
2370 * > Init the Pre-AUTH list, for that BSSID
2371 * > Create LIM timers, specific to that BSSID
2372 * > Init DPH related parameters that are specific to that BSSID
2373 * > TODO - When do we do the actual change channel?
2374 *
2375 *LOGIC:
2376 * SME sends eWNI_SME_START_BSS_REQ to LIM
2377 * LIM sends LIM_MLM_START_REQ to MLME
2378 * MLME sends WDA_ADD_BSS_REQ to HAL
2379 * HAL responds with WDA_ADD_BSS_RSP to MLME
2380 * MLME responds with LIM_MLM_START_CNF to LIM
2381 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2382 *
2383 *ASSUMPTIONS:
2384 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2385 * tSirMsgQ.body will now be freed by this routine
2386 *
2387 *NOTE:
2388 *
2389 * @param pMac Pointer to Global MAC structure
2390 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2391 *
2392 * @return None
2393 */
2394static void
2395limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2396{
2397 tLimMlmStartCnf mlmStartCnf;
2398 tANI_U32 val;
2399 tpPESession psessionEntry;
2400// tANI_U8 sessionId;
2401 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2402 if(NULL == pAddBssParams )
2403 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002404 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 goto end;
2406 }
2407 //TBD: free the memory before returning, do it for all places where lookup fails.
2408 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2409 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002410 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002411 if( NULL != pAddBssParams )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302412 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 return;
2414 }
2415 /* Update PE session Id*/
2416 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2417 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2418 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002419 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2421 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2422 goto end;
2423 // Set MLME state
2424 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002425 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2427 {
2428 /** IBSS is 'active' when we receive
2429 * Beacon frames from other STAs that are part of same IBSS.
2430 * Mark internal state as inactive until then.
2431 */
2432 psessionEntry->limIbssActive = false;
2433 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2434 limResetHBPktCount( psessionEntry );
2435 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002436 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002437 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002438 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 }
2440 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2441
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002443
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2445 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2446 else
2447 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 schEdcaProfileUpdate(pMac, psessionEntry);
2449 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002450 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002451 // Create timers used by LIM
2452 if (!pMac->lim.gLimTimersCreated)
2453 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002454
2455 // Start OLBC timer
2456 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2457 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002458 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002459 }
2460
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2462 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002463 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002464 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2465 // Apply previously set configuration at HW
2466 limApplyConfiguration(pMac,psessionEntry);
2467 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2468 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2469 }
2470 else
2471 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002472 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002473 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2474 }
2475 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2476 end:
2477 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302478 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002479}
2480
2481
2482/**
2483 * limProcessIbssMlmAddBssRsp()
2484 *
2485 *FUNCTION:
2486 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2487 * Upon receipt of this message from HAL, MLME -
2488 * > Validates the result of WDA_ADD_BSS_REQ
2489 * > Init other remaining LIM variables
2490 * > Init the AID pool, for that BSSID
2491 * > Init the Pre-AUTH list, for that BSSID
2492 * > Create LIM timers, specific to that BSSID
2493 * > Init DPH related parameters that are specific to that BSSID
2494 * > TODO - When do we do the actual change channel?
2495 *
2496 *LOGIC:
2497 * SME sends eWNI_SME_START_BSS_REQ to LIM
2498 * LIM sends LIM_MLM_START_REQ to MLME
2499 * MLME sends WDA_ADD_BSS_REQ to HAL
2500 * HAL responds with WDA_ADD_BSS_RSP to MLME
2501 * MLME responds with LIM_MLM_START_CNF to LIM
2502 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2503 *
2504 *ASSUMPTIONS:
2505 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2506 * tSirMsgQ.body will now be freed by this routine
2507 *
2508 *NOTE:
2509 *
2510 * @param pMac Pointer to Global MAC structure
2511 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2512 *
2513 * @return None
2514 */
2515static void
2516limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2517{
2518 tLimMlmStartCnf mlmStartCnf;
2519 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2520 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302521
2522 if (NULL == pAddBssParams)
2523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002524 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302525 goto end;
2526 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2528 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002529 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2531 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2532 goto end;
2533 // Set MLME state
2534 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002535 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 /** IBSS is 'active' when we receive
2537 * Beacon frames from other STAs that are part of same IBSS.
2538 * Mark internal state as inactive until then.
2539 */
2540 psessionEntry->limIbssActive = false;
2541 limResetHBPktCount( psessionEntry );
2542 /* Timer related functions are not modified for BT-AMP : To be Done */
2543 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002544 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002545 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002546 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2548 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2549 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2550 schEdcaProfileUpdate(pMac, psessionEntry);
2551 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2552 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002553 if (0 == psessionEntry->freePeerIdxHead)
2554 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 // Create timers used by LIM
2556#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2557 if (!pMac->lim.gLimTimersCreated)
2558 limCreateTimers(pMac);
2559#endif
2560 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2561 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002562 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2564 // Apply previously set configuration at HW
2565 limApplyConfiguration(pMac,psessionEntry);
2566 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2567 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2568 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2569 if(true == pMac->lim.gLimIbssCoalescingHappened)
2570 {
2571 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2572 goto end;
2573 }
2574 }
2575 else
2576 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002577 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 pAddBssParams->status );
2579 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2580 }
2581 //Send this message to SME, when ADD_BSS is initiated by SME
2582 //If ADD_BSS is done as part of coalescing, this won't happen.
2583 /* Update PE session Id*/
2584 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2585 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2586 end:
2587 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302588 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002589}
2590
2591static void
2592limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2593{
2594 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2595 tAniAuthType cfgAuthType, authMode;
2596 tLimMlmAuthReq *pMlmAuthReq;
2597 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302598
2599 if (NULL == pAddBssParams)
2600 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002601 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302602 goto joinFailure;
2603 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2605 {
2606 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2607 {
2608 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002609 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2611 goto joinFailure;
2612 }
2613 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2614 //Success, handle below
2615 pStaDs->bssId = pAddBssParams->bssIdx;
2616 //STA Index(genr by HAL) for the BSS entry is stored here
2617 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2618 // Trigger Authentication with AP
2619 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2620 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2621 {
2622 /**
2623 * Could not get AuthType from CFG.
2624 * Log error.
2625 */
2626 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002627 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 }
2629 if (cfgAuthType == eSIR_AUTO_SWITCH)
2630 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2631 else
2632 authMode = cfgAuthType;
2633
2634 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302635 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2636 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 {
2638 // Log error
2639 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302640 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 return;
2642 }
2643 #if 0
2644 val = sizeof(tSirMacAddr);
2645 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2646 pMlmAuthReq->peerMacAddr,
2647 &val) != eSIR_SUCCESS)
2648 {
2649 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002650 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 }
2652 #endif //TO SUPPORT BT-AMP
2653 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2654
2655 pMlmAuthReq->authType = authMode;
2656 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2657 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2658 != eSIR_SUCCESS)
2659 {
2660 /**
2661 * Could not get AuthFailureTimeout
2662 * value from CFG. Log error.
2663 */
2664 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002665 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 }
2667 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2668 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2669 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002670 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2672 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2673 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2674 // remember staId in case of assoc timeout/failure handling
2675 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2676
Jeff Johnsone7245742012-09-05 17:12:55 -07002677 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 limPostMlmMessage(pMac,
2679 LIM_MLM_AUTH_REQ,
2680 (tANI_U32 *) pMlmAuthReq);
2681 return;
2682 }
2683
2684joinFailure:
2685 {
2686 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002687 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002688
2689 /// Send Join response to Host
2690 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2691
2692 }
2693
2694}
2695
2696#ifdef WLAN_FEATURE_VOWIFI_11R
2697/*------------------------------------------------------------------------------------------
2698 *
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002699 * Function to handle callback after setting link state to post assoc.
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 *
2701 *
2702 *------------------------------------------------------------------------------------------
2703 */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002704void limSetLinkStateForPostAssocCallback(tpAniSirGlobal pMac, void *msgParam )
Jeff Johnson295189b2012-06-20 16:38:30 -07002705{
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002707 tSetLinkCbackParams * pCbackParams = (tSetLinkCbackParams *)msgParam;
2708 tpPESession psessionEntry = NULL;
2709 tpAddBssParams pAddBssParams = NULL;
2710 tpDphHashNode pStaDs = NULL;
2711 tpAddStaParams pAddStaParams = NULL;
2712 tLimMlmReassocReq * pMlmReassocReq = NULL;
2713 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
2714
2715 /* Sanity Checks */
2716 if (pCbackParams == NULL)
2717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002718 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002719 goto end;
2720 }
2721
2722 pAddBssParams = (tpAddBssParams)(pCbackParams->cbackDataPtr);
2723
2724 if (pAddBssParams == NULL)
2725 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002726 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002727 goto end;
2728 }
2729
2730 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2731 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002732 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002733 goto end;
2734 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002735
2736 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2737
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002738 limPrintMacAddr(pMac, pAddBssParams->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002739
2740 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2741 &psessionEntry->dph.dphHashTable)) == NULL)
2742 {
2743 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002744 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2746 goto end;
2747 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 // Prepare and send Reassociation request frame
2749 // start reassoc timer.
2750 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2751 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002752 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2754 != TX_SUCCESS)
2755 {
2756 /// Could not start reassoc failure timer.
2757 // Log error
2758 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002759 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 // Return Reassoc confirm with
2761 // Resources Unavailable
2762 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2763 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2764 goto end;
2765 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002766#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2767 pMac->lim.pSessionEntry = psessionEntry;
2768 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2769 {
2770 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302771 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2772 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2773 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2774 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2775 psessionEntry->pLimMlmReassocReq,
2776 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002777 }
2778 pMac->lim.reAssocRetryAttempt = 0;
2779#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002781
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2783 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002784 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002785 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2787
2788 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2789
2790 //Success, handle below
2791 pStaDs->bssId = pAddBssParams->bssIdx;
2792 //STA Index(genr by HAL) for the BSS entry is stored here
2793 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2794 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2795 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2796
Jeff Johnson295189b2012-06-20 16:38:30 -07002797#if defined WLAN_FEATURE_VOWIFI
2798 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2799#endif
2800
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302801 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2802 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002803 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302804 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002805 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302807 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002808
2809 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302810 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2811 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302813 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2814 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002815
2816 // Update this when we get reassoc rsp , with success.
2817 // pAddStaParams->assocId = psessionEntry->limAID;
2818
2819 pAddStaParams->staType = STA_ENTRY_SELF;
2820 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2821 pAddStaParams->respReqd = 1;
2822
2823 /* Update PE session ID */
2824 pAddStaParams->sessionId = psessionEntry->peSessionId;
2825
2826 // This will indicate HAL to "allocate" a new STA index
2827 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2828 pAddStaParams->updateSta = FALSE;
2829
2830 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002831#ifdef WLAN_FEATURE_11AC
2832 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
2833#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002835#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002836
Jeff Johnsone7245742012-09-05 17:12:55 -07002837 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002839 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002840#ifdef DISABLE_GF_FOR_INTEROP
2841 /*
2842 * To resolve the interop problem with Broadcom AP,
2843 * where TQ STA could not pass traffic with GF enabled,
2844 * TQ STA will do Greenfield only with TQ AP, for
2845 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002846 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2848 {
2849 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2850 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2851 }
2852 else
2853#endif
2854
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2856 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2857 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2858 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2859 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2860 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2861 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2862 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2863 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2864 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2865 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2866 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002867 }
2868
2869 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002870 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2872
2873 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2874
2875 // Lets save this for when we receive the Reassoc Rsp
2876 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002877
2878 if (pCbackParams != NULL)
2879 {
2880 if (pCbackParams->cbackDataPtr != NULL)
2881 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302882 vos_mem_free(pCbackParams->cbackDataPtr);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002883 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302884 vos_mem_free(pCbackParams);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002886 return;
2887
2888end:
2889 // Free up buffer allocated for reassocReq
2890 if (pMlmReassocReq != NULL)
2891 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302892 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002894
2895 if (pCbackParams != NULL)
2896 {
2897 if (pCbackParams->cbackDataPtr != NULL)
2898 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302899 vos_mem_free(pCbackParams->cbackDataPtr);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002900 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302901 vos_mem_free(pCbackParams);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002902 }
2903
2904 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2905 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302906 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002907 if (psessionEntry != NULL)
2908 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002909 else
2910 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002911
2912 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2913}
2914/*------------------------------------------------------------------------------------------
2915 *
2916 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2917 *
2918 *
2919 *------------------------------------------------------------------------------------------
2920 */
2921static inline void
2922limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
2923{
2924 tSetLinkCbackParams * pCbackParam = NULL;
2925 tAddBssParams * pAddBssCbackInfo = NULL;
2926 tLimMlmReassocCnf mlmReassocCnf;
2927 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2928
2929 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2930 {
2931 goto end;
2932 }
2933
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302934 pCbackParam = vos_mem_malloc(sizeof( tSetLinkCbackParams ));
2935 if ( NULL == pCbackParam )
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002936 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002937 PELOGE(limLog(pMac, LOGE, FL("Could not allocate memory for LinkState callback params"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002938 goto end;
2939 }
2940
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302941 pAddBssCbackInfo = vos_mem_malloc(sizeof( tAddBssParams ));
2942 if ( NULL == pAddBssCbackInfo )
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002943 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002944 PELOGE(limLog(pMac, LOGE, FL("Could not allocate memory for Add BSS info callback param"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002945 goto end;
2946 }
2947
2948 vos_mem_copy(pAddBssCbackInfo, pAddBssParams, sizeof(tAddBssParams));
2949
2950 pCbackParam->cbackDataPtr = (void*)pAddBssCbackInfo;
2951
2952 // Set the filter state to post assoc and send out re-assoc request OTA only after response is received
2953 if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE,
2954 pAddBssParams->bssId, psessionEntry->selfMacAddr,
2955 (tpSetLinkStateCallback)limSetLinkStateForPostAssocCallback,
2956 (void *)pCbackParam) != eSIR_SUCCESS)
2957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002958 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002959 goto end;
2960 }
2961
2962 return;
2963
2964end:
2965
2966 if (pCbackParam != NULL)
2967 {
2968 if (pCbackParam->cbackDataPtr != NULL)
2969 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302970 vos_mem_free(pCbackParam->cbackDataPtr);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002971 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302972 vos_mem_free(pCbackParam);
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002973 }
2974
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2976 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2977 /* Update PE sessio Id*/
2978 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2979
2980 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2981}
2982#endif /* WLAN_FEATURE_VOWIFI_11R */
2983
2984
2985/**
2986 * limProcessStaMlmAddBssRsp()
2987 *
2988 *FUNCTION:
2989 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2990 * Upon receipt of this message from HAL, MLME -
2991 * > Validates the result of WDA_ADD_BSS_REQ
2992 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2993 *
2994 *LOGIC:
2995 * MLME had sent WDA_ADD_BSS_REQ to HAL
2996 * HAL responded with WDA_ADD_BSS_RSP to MLME
2997 * MLME now sends WDA_ADD_STA_REQ to HAL
2998 *
2999 *ASSUMPTIONS:
3000 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3001 * tSirMsgQ.body will now be freed by this routine
3002 *
3003 *NOTE:
3004 *
3005 * @param pMac Pointer to Global MAC structure
3006 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3007 *
3008 * @return None
3009 */
3010static void
3011limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3012{
3013 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3014 tLimMlmAssocCnf mlmAssocCnf;
3015 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3016 tANI_U32 subType = LIM_ASSOC;
3017 tpDphHashNode pStaDs = NULL;
3018 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3019 tANI_U8 updateSta = false;
3020 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3021
3022 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3023 {
3024 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
3025 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3026 goto end;
3027 }
3028 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3029 {
3030 mesgType = LIM_MLM_REASSOC_CNF;
3031 subType = LIM_REASSOC;
3032 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3033 //to update the existing STA entry.
3034 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3035 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3036 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3037 {
3038 staIdx = psessionEntry->staId;
3039 updateSta = true;
3040 }
3041 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003042
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003043 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003044 goto end;
3045
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3047 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003048#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3050 {
3051#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003052 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 psessionEntry->limMlmState,
3054 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3055#endif
3056 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3057 goto end;
3058 }
3059#endif /* WLAN_FEATURE_VOWIFI_11R */
3060
3061 // Set MLME state
3062 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003063 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3065 // Now, send WDA_ADD_STA_REQ
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003066 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3068 if (pStaDs == NULL)
3069 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003070 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3072 }
3073 else
3074 {
3075 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3076 //Success, handle below
3077 pStaDs->bssId = pAddBssParams->bssIdx;
3078 //STA Index(genr by HAL) for the BSS entry is stored here
3079 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3080 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3081 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3082 // Downgrade the EDCA parameters if needed
3083 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3084 // Send the active EDCA parameters to HAL
3085 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3086 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3087 } else {
3088 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3089 }
3090#if defined WLAN_FEATURE_VOWIFI
3091 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3092#endif
3093
3094 if (subType == LIM_REASSOC)
3095 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3096 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3097 {
3098 // Add STA context at HW
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003099 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003100 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3101 }
3102 }
3103 }
3104 else
3105 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003106 limLog( pMac, LOGP, FL( "ADD_BSS failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003107 // Return Assoc confirm to SME with failure
3108 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3109 }
3110
3111 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3112 {
3113 /* Update PE session Id*/
3114 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3115 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3116 }
3117 end:
3118 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303119 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003120}
3121
3122
3123
3124/**
3125 * limProcessMlmAddBssRsp()
3126 *
3127 *FUNCTION:
3128 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3129 * Upon receipt of this message from HAL, MLME -
3130 * > Determines the "state" in which this message was received
3131 * > Forwards it to the appropriate callback
3132 *
3133 *LOGIC:
3134 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3135 * in the following two states:
3136 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3137 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3138 * Based on these two states, this API will determine where to
3139 * route the message to
3140 *
3141 *ASSUMPTIONS:
3142 *
3143 *NOTE:
3144 *
3145 * @param pMac Pointer to Global MAC structure
3146 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3147 *
3148 * @return None
3149 */
3150void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3151{
3152 tLimMlmStartCnf mlmStartCnf;
3153 tpPESession psessionEntry;
3154 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3155
3156 if(NULL == pAddBssParams )
3157 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003158 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 return;
3160 }
3161
3162 //
3163 // TODO & FIXME_GEN4
3164 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3165 //
3166 //we need to process the deferred message since the initiating req. there might be nested request.
3167 //in the case of nested request the new request initiated from the response will take care of resetting
3168 //the deffered flag.
3169 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3170 // Validate SME/LIM state
3171 // Validate MLME state
3172 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3173 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003174 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003175 if( NULL != pAddBssParams )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303176 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003177 return;
3178 }
3179 /* update PE session Id*/
3180 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3181 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3182 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3183 else
3184 {
3185 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3186 {
3187 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3188 {
3189 // Mesg received from HAL in Invalid state!
3190 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003191 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 psessionEntry->limMlmState );
3193 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3194 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303195 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3197 }
3198 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3199 {
3200 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3201 }
3202 else
3203 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3204 }
3205 else
3206 /* Called while processing assoc response */
3207 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3208 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003209
3210 if(limIsInMCC(pMac))
3211 {
3212 WDA_TrafficStatsTimerActivate(TRUE);
3213 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003214
3215#ifdef WLAN_FEATURE_11W
3216 if (psessionEntry->limRmfEnabled)
3217 {
3218 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3219 {
3220 limLog( pMac, LOGE,
3221 FL( "Could not send down Exclude Unencrypted Indication!" ),
3222 psessionEntry->limMlmState );
3223 }
3224 }
3225#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003226}
3227/**
3228 * limProcessMlmSetKeyRsp()
3229 *
3230 *FUNCTION:
3231 * This function is called to process the following two
3232 * messages from HAL:
3233 * 1) WDA_SET_BSSKEY_RSP
3234 * 2) WDA_SET_STAKEY_RSP
3235 * 3) WDA_SET_STA_BCASTKEY_RSP
3236 * Upon receipt of this message from HAL,
3237 * MLME -
3238 * > Determines the "state" in which this message was received
3239 * > Forwards it to the appropriate callback
3240 *
3241 *LOGIC:
3242 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3243 * received by MLME while in the following state:
3244 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3245 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3246 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3247 * Based on this state, this API will determine where to
3248 * route the message to
3249 *
3250 *ASSUMPTIONS:
3251 * ONLY the MLME state is being taken into account for now.
3252 * This is because, it appears that the handling of the
3253 * SETKEYS REQ is handled symmetrically on both the AP & STA
3254 *
3255 *NOTE:
3256 *
3257 * @param pMac Pointer to Global MAC structure
3258 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3259 *
3260 * @return None
3261 */
3262void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3263{
Jeff Johnsone7245742012-09-05 17:12:55 -07003264 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 tLimMlmSetKeysCnf mlmSetKeysCnf;
3266 tANI_U8 sessionId = 0;
3267 tpPESession psessionEntry;
3268 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303269 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003273 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 return;
3275 }
3276 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3277 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3278 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003279 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303280 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 return;
3282 }
3283 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3284 {
3285 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003286 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 // There's not much that MLME can do at this stage...
3288 respReqd = 0;
3289 }
3290 else
3291 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3292
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303293 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003296 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 if( respReqd )
3298 {
3299 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3300 // Prepare and Send LIM_MLM_SETKEYS_CNF
3301 if( NULL != lpLimMlmSetKeysReq )
3302 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303303 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3304 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3305 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303307 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 pMac->lim.gpLimMlmSetKeysReq = NULL;
3309 }
3310 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003311 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 }
3313}
3314void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3315{
3316 tANI_U8 respReqd = 1;
3317 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003318 tANI_U16 resultCode;
3319 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 tpPESession psessionEntry;
3321 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303322 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003324 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003326 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 return;
3328 }
3329 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3330 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3331 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003332 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303333 vos_mem_free( limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 return;
3335 }
3336 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3337 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3338 else
3339 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3340
Jeff Johnsone7245742012-09-05 17:12:55 -07003341 //
3342 // TODO & FIXME_GEN4
3343 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3344 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3346 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3347 //{
3348 // Validate MLME state
3349 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3350 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3351 {
3352 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003353 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 // There's not much that MLME can do at this stage...
3355 respReqd = 0;
3356 }
3357 else
3358 mlmSetKeysCnf.resultCode = resultCode;
3359
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303360 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003361 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3363
Jeff Johnsone7245742012-09-05 17:12:55 -07003364 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 if( respReqd )
3366 {
3367 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3368 mlmSetKeysCnf.sessionId = sessionId;
3369
3370 // Prepare and Send LIM_MLM_SETKEYS_CNF
3371 if( NULL != lpLimMlmSetKeysReq )
3372 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303373 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3374 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3375 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303377 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 pMac->lim.gpLimMlmSetKeysReq = NULL;
3379 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003380 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 }
3382}
3383/**
3384 * limProcessMlmRemoveKeyRsp()
3385 *
3386 *FUNCTION:
3387 *
3388 *LOGIC:
3389 *
3390 *ASSUMPTIONS:
3391 *
3392 *NOTE:
3393 *
3394 * @param pMac Pointer to Global MAC structure
3395 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3396 *
3397 * @return None
3398 */
3399void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3400{
Jeff Johnsone7245742012-09-05 17:12:55 -07003401 tANI_U8 respReqd = 1;
3402 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3403 tANI_U16 resultCode;
3404 tANI_U8 sessionId = 0;
3405 tpPESession psessionEntry;
3406 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303407 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003408
3409 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003411 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003412 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003413 }
3414
Jeff Johnsone7245742012-09-05 17:12:55 -07003415 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3416 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3417 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3418 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003419
Jeff Johnsone7245742012-09-05 17:12:55 -07003420 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003422 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003423 return;
3424 }
3425
3426 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3427 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3428 else
3429 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3430
3431 // Validate MLME state
3432 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3433 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3434 {
3435 // Mesg received from HAL in Invalid state!
3436 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003437 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003438 limMsgQ->type,
3439 psessionEntry->limMlmState );
3440 respReqd = 0;
3441 }
3442 else
3443 mlmRemoveCnf.resultCode = resultCode;
3444
3445 //
3446 // TODO & FIXME_GEN4
3447 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3448 //
3449
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303450 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07003451
3452 // Restore MLME state
3453 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3454 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3455
3456 if( respReqd )
3457 {
3458 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3459 mlmRemoveCnf.sessionId = sessionId;
3460
3461 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3462 if( NULL != lpLimMlmRemoveKeyReq )
3463 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303464 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3465 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3466 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003467 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303468 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003469 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3470 }
3471 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3472 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003473}
3474
Jeff Johnson295189b2012-06-20 16:38:30 -07003475
3476/** ---------------------------------------------------------------------
3477\fn limProcessInitScanRsp
3478\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3479\ message from HAL. If status code is failure, then
3480\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3481\param tpAniSirGlobal pMac
3482\param tANI_U32 body
3483\return none
3484\ ----------------------------------------------------------------------- */
3485void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3486{
3487 tpInitScanParams pInitScanParam;
3488 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3490 pInitScanParam = (tpInitScanParams) body;
3491 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303492 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003493
3494 //Only abort scan if the we are scanning.
3495 if( pMac->lim.abortScan &&
3496 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3497 {
krunal sonid3d60e12013-07-17 13:24:09 -07003498 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 pMac->lim.abortScan = 0;
3500 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3501 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3502 //Set the resume channel to Any valid channel (invalid).
3503 //This will instruct HAL to set it to any previous valid channel.
3504 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003505 if (status != eHAL_STATUS_SUCCESS)
3506 {
3507 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3508 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3509 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3510 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3511 return;
3512 }
3513 else
3514 {
3515 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3516 }
3517
Jeff Johnson295189b2012-06-20 16:38:30 -07003518 }
3519 switch(pMac->lim.gLimHalScanState)
3520 {
3521 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3522 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003524 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003525 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3526 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3527 /*
3528 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3529 * another Scan request in the same context (happens when 11d is enabled
3530 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3531 * scan in the same context but with bigger channel list), so the state needs to be
3532 * changed before this response message is sent.
3533 */
3534 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003535 return;
3536 }
3537 else if (status == eHAL_STATUS_SUCCESS)
3538 {
3539 /* since we have successfully triggered a background scan,
3540 * reset the "consecutive bkgnd scan failure" count to 0
3541 */
3542 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3543 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3544 }
3545 limContinueChannelScan(pMac);
3546 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003547//WLAN_SUSPEND_LINK Related
3548 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3549 if( pMac->lim.gpLimSuspendCallback )
3550 {
3551 if( status == eHAL_STATUS_SUCCESS )
3552 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
3553 else
3554 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3555
3556 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3557 pMac->lim.gpLimSuspendCallback = NULL;
3558 pMac->lim.gpLimSuspendData = NULL;
3559 }
3560 else
3561 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003562 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 return;
3564 }
3565 break;
3566//end WLAN_SUSPEND_LINK Related
3567 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003568 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 pMac->lim.gLimHalScanState);
3570 break;
3571 }
3572 return;
3573}
3574/**
3575 * limProcessSwitchChannelReAssocReq()
3576 *
3577 *FUNCTION:
3578 * This function is called to send the reassoc req mgmt frame after the
3579 * switchChannelRsp message is received from HAL.
3580 *
3581 *LOGIC:
3582 *
3583 *ASSUMPTIONS:
3584 * NA
3585 *
3586 *NOTE:
3587 * NA
3588 *
3589 * @param pMac - Pointer to Global MAC structure.
3590 * @param psessionEntry - session related information.
3591 * @param status - channel switch success/failure.
3592 *
3593 * @return None
3594 */
3595static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3596{
3597 tLimMlmReassocCnf mlmReassocCnf;
3598 tLimMlmReassocReq *pMlmReassocReq;
3599 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3600 if(pMlmReassocReq == NULL)
3601 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003602 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3604 goto end;
3605 }
3606
3607 if(status != eHAL_STATUS_SUCCESS)
3608 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003609 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003610 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3611 goto end;
3612 }
3613 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003614 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3616 != TX_SUCCESS)
3617 {
3618 /// Could not start reassoc failure timer.
3619 // Log error
3620 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003621 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 // Return Reassoc confirm with
3623 // Resources Unavailable
3624 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3625 goto end;
3626 }
3627 /// Prepare and send Reassociation request frame
3628 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3629 return;
3630end:
3631 // Free up buffer allocated for reassocReq
3632 if(pMlmReassocReq != NULL)
3633 {
3634 /* Update PE session Id*/
3635 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303636 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 }
3638 else
3639 {
3640 mlmReassocCnf.sessionId = 0;
3641 }
3642
3643 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3644 /* Update PE sessio Id*/
3645 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3646
3647 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3648}
3649/**
3650 * limProcessSwitchChannelJoinReq()
3651 *
3652 *FUNCTION:
3653 * This function is called to send the probe req mgmt frame after the
3654 * switchChannelRsp message is received from HAL.
3655 *
3656 *LOGIC:
3657 *
3658 *ASSUMPTIONS:
3659 * NA
3660 *
3661 *NOTE:
3662 * NA
3663 *
3664 * @param pMac - Pointer to Global MAC structure.
3665 * @param psessionEntry - session related information.
3666 * @param status - channel switch success/failure.
3667 *
3668 * @return None
3669 */
3670static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3671{
3672 tANI_U32 val;
3673 tSirMacSSid ssId;
3674 tLimMlmJoinCnf mlmJoinCnf;
3675 if(status != eHAL_STATUS_SUCCESS)
3676 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003677 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 goto error;
3679 }
3680
3681 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003683 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 goto error;
3685 }
3686
Jeff Johnsone7245742012-09-05 17:12:55 -07003687
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3689 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3690 {
3691 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3692 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3693 goto error;
3694 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003695
3696 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3697 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003698 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3700 // Apply previously set configuration at HW
3701 limApplyConfiguration(pMac, psessionEntry);
3702 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303703 vos_mem_copy(ssId.ssId,
3704 psessionEntry->ssId.ssId,
3705 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003706 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003707
3708 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3709
3710 //assign appropriate sessionId to the timer object
3711 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 // include additional IE if there is
3713 limSendProbeReqMgmtFrame( pMac, &ssId,
3714 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3715 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3716 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003717
3718 // Sending mgmt frame is a blocking call activate Join failure timer now
3719 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3720 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3721 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003722 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003723 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3724 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3725 //memory is freed up below.
3726 psessionEntry->pLimMlmJoinReq = NULL;
3727 goto error;
3728 }
3729
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003730 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3731 {
Yathish9f22e662012-12-10 14:21:35 -08003732 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003733 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3734 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003735 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003736 goto error;
3737 }
3738 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003739
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 return;
3741error:
3742 if(NULL != psessionEntry)
3743 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303744 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 psessionEntry->pLimMlmJoinReq = NULL;
3746 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3747 }
3748 else
3749 {
3750 mlmJoinCnf.sessionId = 0;
3751 }
3752 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3753 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3754 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3755}
3756
3757/**
3758 * limProcessSwitchChannelRsp()
3759 *
3760 *FUNCTION:
3761 * This function is called to process switchChannelRsp message from HAL.
3762 *
3763 *LOGIC:
3764 *
3765 *ASSUMPTIONS:
3766 * NA
3767 *
3768 *NOTE:
3769 * NA
3770 *
3771 * @param pMac - Pointer to Global MAC structure
3772 * @param body - message body.
3773 *
3774 * @return None
3775 */
3776void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3777{
3778 tpSwitchChannelParams pChnlParams = NULL;
3779 eHalStatus status;
3780 tANI_U16 channelChangeReasonCode;
3781 tANI_U8 peSessionId;
3782 tpPESession psessionEntry;
3783 //we need to process the deferred message since the initiating req. there might be nested request.
3784 //in the case of nested request the new request initiated from the response will take care of resetting
3785 //the deffered flag.
3786 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3787 pChnlParams = (tpSwitchChannelParams) body;
3788 status = pChnlParams->status;
3789 peSessionId = pChnlParams->peSessionId;
3790 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3791 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303792 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003793 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003794 return;
3795 }
3796#if defined WLAN_FEATURE_VOWIFI
3797 //HAL fills in the tx power used for mgmt frames in this field.
3798 //Store this value to use in TPC report IE.
3799 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3800#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303801 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003802 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3803 // initialize it back to invalid id
3804 psessionEntry->channelChangeReasonCode = 0xBAD;
3805 switch(channelChangeReasonCode)
3806 {
3807 case LIM_SWITCH_CHANNEL_REASSOC:
3808 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3809 break;
3810 case LIM_SWITCH_CHANNEL_JOIN:
3811 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3812 break;
3813
3814 case LIM_SWITCH_CHANNEL_OPERATION:
3815 /*
3816 * The above code should also use the callback.
3817 * mechanism below, there is scope for cleanup here.
3818 * THat way all this response handler does is call the call back
3819 * We can get rid of the reason code here.
3820 */
3821 if (pMac->lim.gpchangeChannelCallback)
3822 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003823 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003824 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3825 }
3826 break;
3827 default:
3828 break;
3829 }
3830}
3831/**
3832 * limProcessStartScanRsp()
3833 *
3834 *FUNCTION:
3835 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3836 * then it will start scan/learn on the next channel.
3837 *
3838 *LOGIC:
3839 *
3840 *ASSUMPTIONS:
3841 * NA
3842 *
3843 *NOTE:
3844 * NA
3845 *
3846 * @param pMac - Pointer to Global MAC structure
3847 * @param body - message body.
3848 *
3849 * @return None
3850 */
3851
3852void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3853{
3854 tpStartScanParams pStartScanParam;
3855 eHalStatus status;
3856 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3857 pStartScanParam = (tpStartScanParams) body;
3858 status = pStartScanParam->status;
3859#if defined WLAN_FEATURE_VOWIFI
3860 //HAL fills in the tx power used for mgmt frames in this field.
3861 //Store this value to use in TPC report IE.
3862 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3863 //Store start TSF of scan start. This will be stored in BSS params.
3864 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3865#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303866 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 if( pMac->lim.abortScan )
3868 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003869 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 pMac->lim.abortScan = 0;
3871 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3872 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3873 //Set the resume channel to Any valid channel (invalid).
3874 //This will instruct HAL to set it to any previous valid channel.
3875 peSetResumeChannel(pMac, 0, 0);
3876 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3877 }
3878 switch(pMac->lim.gLimHalScanState)
3879 {
3880 case eLIM_HAL_START_SCAN_WAIT_STATE:
3881 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3882 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003883 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 //
3885 // FIXME - With this, LIM will try and recover state, but
3886 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3887 // status back to the SME
3888 //
3889 //Set the resume channel to Any valid channel (invalid).
3890 //This will instruct HAL to set it to any previous valid channel.
3891 peSetResumeChannel(pMac, 0, 0);
3892 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3893 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3894 }
3895 else
3896 {
3897 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3898 limContinuePostChannelScan(pMac);
3899 }
3900 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003901 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003902 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 pMac->lim.gLimHalScanState);
3904 break;
3905 }
3906 return;
3907}
3908void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3909{
3910 tpEndScanParams pEndScanParam;
3911 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003912 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3913 pEndScanParam = (tpEndScanParams) body;
3914 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303915 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 switch(pMac->lim.gLimHalScanState)
3917 {
3918 case eLIM_HAL_END_SCAN_WAIT_STATE:
3919 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3920 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003921 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3923 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3924 }
3925 else
3926 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08003927 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07003928 limContinueChannelScan(pMac);
3929 }
3930 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003932 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 pMac->lim.gLimHalScanState);
3934 break;
3935 }
3936 return;
3937}
Jeff Johnsone7245742012-09-05 17:12:55 -07003938/**
3939 * limStopTxAndSwitch()
3940 *
3941 *FUNCTION:
3942 * Start channel switch on all sessions that is in channel switch state.
3943 *
3944 * @param pMac - pointer to global adapter context
3945 *
3946 * @return None
3947 *
3948 */
3949static void
3950limStopTxAndSwitch (tpAniSirGlobal pMac)
3951{
3952 tANI_U8 i;
3953
3954 for(i =0; i < pMac->lim.maxBssId; i++)
3955 {
3956 if(pMac->lim.gpSession[i].valid &&
3957 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
3958 {
3959 limStopTxAndSwitchChannel(pMac, i);
3960 }
3961 }
3962 return;
3963}
3964/**
3965 * limStartQuietOnSession()
3966 *
3967 *FUNCTION:
3968 * This function is called to start quiet timer after finish scan if there is
3969 * qeuieting on any session.
3970 *
3971 *LOGIC:
3972 *
3973 *ASSUMPTIONS:
3974 * NA
3975 *
3976 *NOTE:
3977 * NA
3978 *
3979 * @param pMac - Pointer to Global MAC structure
3980 *
3981 * @return None
3982 */
3983static void
3984limStartQuietOnSession (tpAniSirGlobal pMac)
3985{
3986 tANI_U8 i;
3987
3988 for(i =0; i < pMac->lim.maxBssId; i++)
3989 {
3990 if(pMac->lim.gpSession[i].valid &&
3991 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
3992 {
3993 limStartQuietTimer(pMac, i);
3994 }
3995 }
3996 return;
3997}
Jeff Johnson295189b2012-06-20 16:38:30 -07003998void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
3999{
4000 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 eHalStatus status;
4002 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4003 pFinishScanParam = (tpFinishScanParams) body;
4004 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304005 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 switch(pMac->lim.gLimHalScanState)
4007 {
4008 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4009 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4010 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004011 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004012 {
4013 /** Right time to stop tx and start the timer for channel switch */
4014 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4015 * be any associated session id
4016 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004017 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004018 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004019 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004020 {
4021 /** Start the quieting */
4022 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4023 * be any associated session id
4024 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004025 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4028 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004029 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004030 }
4031 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004032//WLAN_SUSPEND_LINK Related
4033 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4034 if( pMac->lim.gpLimResumeCallback )
4035 {
4036 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4037 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4038 pMac->lim.gpLimResumeCallback = NULL;
4039 pMac->lim.gpLimResumeData = NULL;
4040 pMac->lim.gLimSystemInScanLearnMode = 0;
4041 }
4042 else
4043 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004044 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 return;
4046 }
4047 break;
4048//end WLAN_SUSPEND_LINK Related
4049
4050 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004051 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 pMac->lim.gLimHalScanState);
4053 break;
4054 }
4055 return;
4056}
4057/**
4058 * @function : limProcessMlmHalAddBARsp
4059 *
4060 * @brief: Process WDA_ADDBA_RSP coming from HAL
4061 *
4062 *
4063 * @param pMac The global tpAniSirGlobal object
4064 *
4065 * @param tSirMsgQ The MsgQ header containing the response buffer
4066 *
4067 * @return none
4068 */
4069void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4070 tpSirMsgQ limMsgQ )
4071{
4072 // Send LIM_MLM_ADDBA_CNF to LIM
4073 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004074 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004076
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 //now LIM can process any defer message.
4078 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4079 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004080 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 return;
4082 }
4083 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4084 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004085 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304086 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 return;
4088 }
4089#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4090 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4091#endif //FEATURE_WLAN_DIAG_SUPPORT
4092
4093 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304094 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4095 if ( NULL == pMlmAddBACnf ) {
4096 limLog( pMac, LOGP, FL(" AllocateMemory failed with error code %d"));
4097 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 return;
4099 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304100 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304102 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4103 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 // Copy other ADDBA Rsp parameters
4105 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4106 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4107 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4108 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4109 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4110 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4111 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4112 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4113 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4114 else
4115 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304116 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 // Send ADDBA CNF to LIM
4118 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4119}
4120/**
4121 * \brief Process LIM_MLM_ADDBA_CNF
4122 *
4123 * \sa limProcessMlmAddBACnf
4124 *
4125 * \param pMac The global tpAniSirGlobal object
4126 *
4127 * \param tSirMsgQ The MsgQ header containing the response buffer
4128 *
4129 * \return none
4130 */
4131void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4132 tANI_U32 *pMsgBuf )
4133{
4134tpLimMlmAddBACnf pMlmAddBACnf;
4135tpDphHashNode pSta;
4136tANI_U16 aid;
4137tLimBAState curBaState;
4138tpPESession psessionEntry = NULL;
4139if(pMsgBuf == NULL)
4140{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004141 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004142 return;
4143}
4144pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4145 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4146 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004147 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304148 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004149 return;
4150 }
4151 // First, extract the DPH entry
4152 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4153 if( NULL == pSta )
4154 {
4155 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004156 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304157 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004158 return;
4159 }
4160 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4161 // Need to validate SME state
4162 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4163 {
4164 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004165 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004166 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304167 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 return;
4169 }
4170 // Restore STA BA state
4171 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004172 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004173 {
4174 // Update LIM internal cache...
4175 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4176 {
4177 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4178 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4179 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4180 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4181 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004182 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4183 // status code. MLME will then send an ADDBA RSP
4184 // over the air to the peer MAC entity
4185 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4186 pMlmAddBACnf->peerMacAddr,
4187 pMlmAddBACnf->addBAResultCode,
4188 pMlmAddBACnf->baDialogToken,
4189 (tANI_U8) pMlmAddBACnf->baTID,
4190 (tANI_U8) pMlmAddBACnf->baPolicy,
4191 pMlmAddBACnf->baBufferSize,
4192 pMlmAddBACnf->baTimeout,psessionEntry))
4193 {
4194 PELOGW(limLog( pMac, LOGW,
4195 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4196 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4197 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 }
4199 else
4200 {
4201 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4202 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4203 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4204 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4205 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4206 }
4207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304209 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004210}
4211/**
4212 * \brief Process LIM_MLM_DELBA_CNF
4213 *
4214 * \sa limProcessMlmDelBACnf
4215 *
4216 * \param pMac The global tpAniSirGlobal object
4217 *
4218 * \param tSirMsgQ The MsgQ header containing the response buffer
4219 *
4220 * \return none
4221 */
4222void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4223 tANI_U32 *pMsgBuf )
4224{
4225 tpLimMlmDelBACnf pMlmDelBACnf;
4226 tpDphHashNode pSta;
4227 tANI_U16 aid;
4228// tANI_U8 sessionId;
4229 tLimBAState curBaState;
4230 tpPESession psessionEntry;
4231
4232 if(pMsgBuf == NULL)
4233 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004234 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 return;
4236 }
4237 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4238 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4239 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004240 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304241 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 return;
4243 }
4244 // First, extract the DPH entry
4245 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4246 if( NULL == pSta )
4247 {
4248 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004249 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304250 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 return;
4252 }
4253 if(NULL == pMlmDelBACnf)
4254 {
4255 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004256 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 return;
4258 }
4259 // Need to validate baState
4260 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4261 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4262 {
4263 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004264 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304266 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 return;
4268 }
4269 // Restore STA BA state
4270 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4271 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304272 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004273}
4274/**
4275 * \brief Process SIR_LIM_DEL_BA_IND
4276 *
4277 * \sa limProcessMlmHalBADeleteInd
4278 *
4279 * \param pMac The global tpAniSirGlobal object
4280 *
4281 * \param tSirMsgQ The MsgQ header containing the indication buffer
4282 *
4283 * \return none
4284 */
4285void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4286 tpSirMsgQ limMsgQ )
4287{
4288 tSirRetStatus status = eSIR_SUCCESS;
4289 tpBADeleteParams pBADeleteParams;
4290 tpDphHashNode pSta;
4291 tANI_U16 aid;
4292 tLimBAState curBaState;
4293 tpPESession psessionEntry;
4294 tANI_U8 sessionId;
4295
4296 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4297
4298 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4299 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004300 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304301 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 return;
4303 }
4304 // First, extract the DPH entry
4305 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4306 if( NULL == pSta )
4307 {
4308 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004309 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 goto returnAfterCleanup;
4311 }
4312
4313 // Need to validate BA state
4314 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4315 if( eLIM_BA_STATE_IDLE != curBaState )
4316 {
4317 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004318 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 curBaState );
4320 goto returnAfterCleanup;
4321 }
4322
4323 // Validate if a BA is active for the requested TID
4324 // AND in that desired direction
4325 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4326 {
4327 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4328 status = eSIR_FAILURE;
4329 }
4330 else
4331 {
4332 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4333 status = eSIR_FAILURE;
4334 }
4335 if( eSIR_FAILURE == status )
4336 {
4337 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004338 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 pBADeleteParams->baTID );
4340 }
4341 else
4342 {
4343 // Post DELBA REQ to MLME...
4344 if( eSIR_SUCCESS !=
4345 (status = limPostMlmDelBAReq( pMac,
4346 pSta,
4347 pBADeleteParams->baDirection,
4348 pBADeleteParams->baTID,
4349 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4350 {
4351 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004352 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 }
4354 else
4355 {
4356 limLog( pMac, LOGE,
4357 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4358 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4359 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4360 }
4361 }
4362returnAfterCleanup:
4363 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304364 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004365}
4366/**
4367 * @function : limProcessSetMimoRsp()
4368 *
4369 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4370 * after Processing the Req from the SME (PMC)
4371 *
4372 * LOGIC:
4373 *
4374 * ASSUMPTIONS:
4375 * NA
4376 *
4377 * NOTE:
4378 * NA
4379 *
4380 * @param pMac - Pointer to Global MAC structure
4381 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4382 * @return None
4383 */
4384
4385void
4386limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4387{
4388#if 0
4389 tSirRetStatus retStatus;
4390 tpSetMIMOPS pMIMO_PSParams;
4391
4392
4393 do {
4394
4395 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4396 if( NULL == pMIMO_PSParams ) {
4397 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4398 return;
4399 }
4400
4401 /** If Updation of the HAL Fail's*/
4402 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004403 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 break;
4405 }
4406
4407 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4408 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4409 break;
4410
4411 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4412 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4413
4414 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4415 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4416 * the Action Frame is being sent at first before setting the internal structures
4417 */
4418 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4419 tSirMacAddr macAddr;
4420
4421 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304422 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004423
4424 /** Send Action Frame with the corresponding mode */
4425 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4426 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004427 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 break;
4429 }
4430 }
4431 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4432 }while(0);
4433
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304434 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004435#endif
4436}
4437/**
4438 * @function : limHandleDelBssInReAssocContext
4439 * @brief : While Processing the ReAssociation Response Frame in STA,
4440 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4441 * being issued and the end of DelBSS the new BSS is being added.
4442 *
4443 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4444 * change, We need to update CSR with ReAssocCNF Response with the
4445 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4446 * context only
4447 *
4448 * @param : pMac - tpAniSirGlobal
4449 * pStaDs - Station Descriptor
4450 *
4451 * @return : none
4452 */
4453static void
4454limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4455{
4456 tLimMlmReassocCnf mlmReassocCnf;
4457 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4458 /** Set the MlmState to IDLE*/
4459 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 /* Update PE session Id*/
4461 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4462 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 case eLIM_SME_WT_REASSOC_STATE :
4464 {
4465 tpSirAssocRsp assocRsp;
4466 tpDphHashNode pStaDs;
4467 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004468 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 /** Delete the older STA Table entry */
4470 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4471 /**
4472 * Add an entry for AP to hash table
4473 * maintained by DPH module
4474 */
4475 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4476 {
4477 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004478 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4480 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4481 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4482 goto Error;
4483 }
4484 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4485 * is being stored to be used here for sending ADDBSS
4486 */
4487 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4488 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4489 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 limExtractApCapabilities( pMac,
4491 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4492 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4493 &beaconStruct );
4494 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4495 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4496 if(beaconStruct.erpPresent) {
4497 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4498 psessionEntry->beaconParams.fShortPreamble = 0;
4499 else
4500 psessionEntry->beaconParams.fShortPreamble = 1;
4501 }
4502 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4503 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4504 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004505 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 retStatus = eSIR_FAILURE;
4507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 if (retStatus != eSIR_SUCCESS)
4509 {
4510 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4511 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304512 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 pMac->lim.gLimAssocResponseData = NULL;
4514 goto Error;
4515 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304516 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 psessionEntry->limAssocResponseData = NULL;
4518 }
4519 break;
4520 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4521 {
4522 /** Case wherein the DisAssoc / Deauth
4523 * being sent as response to ReAssoc Req*/
4524 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4525 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4526 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4527 /** Set the SME State back to WT_Reassoc State*/
4528 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4530 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4531 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4532 {
4533 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 }
4535 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4536 }
4537 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004539 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4541 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4542 goto Error;
4543 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004544 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004545Error:
4546 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4547}
4548
4549/* Added For BT -AMP Support */
4550static void
4551limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4552{
4553 tLimMlmStartCnf mlmStartCnf;
4554 tANI_U32 val;
4555 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4556
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304557 if (NULL == pAddBssParams)
4558 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004559 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304560 goto end;
4561 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004564 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4566 {
4567 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4568 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4569 goto end;
4570 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4571 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4572 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4573 goto end;
4574 }
4575
4576 // Set MLME state
4577 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4578 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4579 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4580 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004581 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 // Create timers used by LIM
4583 if (!pMac->lim.gLimTimersCreated)
4584 limCreateTimers(pMac);
4585 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4586 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004587 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4589 // Apply previously set configuration at HW
4590 limApplyConfiguration(pMac,psessionEntry);
4591 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4592 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4593 }
4594 else
4595 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004596 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4598 }
4599 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4600 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4601 end:
4602 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304603 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004604}
4605
4606/**
4607 * @function : limHandleAddBssInReAssocContext
4608 * @brief : While Processing the ReAssociation Response Frame in STA,
4609 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4610 * being issued and the end of DelBSS the new BSS is being added.
4611 *
4612 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4613 * change, We need to update CSR with ReAssocCNF Response with the
4614 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4615 * context only
4616 *
4617 * @param : pMac - tpAniSirGlobal
4618 * pStaDs - Station Descriptor
4619 *
4620 * @return : none
4621 */
4622void
4623limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4624{
4625 tLimMlmReassocCnf mlmReassocCnf;
4626 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4627 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004628 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4629 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 case eLIM_SME_WT_REASSOC_STATE : {
4632 tpSirAssocRsp assocRsp;
4633 tpDphHashNode pStaDs;
4634 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004635 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304636 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4637 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004638 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304639 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004640 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4641 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4642 goto Error;
4643 }
4644
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 // Get the AP entry from DPH hash table
4646 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4647 if (pStaDs == NULL )
4648 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004649 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4651 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304652 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 goto Error;
4654 }
4655 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4656 * is being stored to be used here for sending ADDBSS
4657 */
4658 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4659 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4660 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004661 limExtractApCapabilities( pMac,
4662 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4663 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004664 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004666 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4667
4668 if(pBeaconStruct->erpPresent)
4669 {
4670 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004671 psessionEntry->beaconParams.fShortPreamble = 0;
4672 else
4673 psessionEntry->beaconParams.fShortPreamble = 1;
4674 }
4675
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004676 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004678 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004679 retStatus = eSIR_FAILURE;
4680 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 if (retStatus != eSIR_SUCCESS)
4682 {
4683 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4684 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304685 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304687 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004688 goto Error;
4689 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304690 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304692 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004693 }
4694 break;
4695 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4696 * being sent as response to ReAssoc Req*/
4697 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4698 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4699 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4700 /** Set the SME State back to WT_Reassoc State*/
4701 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4702 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4703 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004704 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004706 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4707 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004708
4709 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4710 }
4711 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004712 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004713 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4715 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4716 goto Error;
4717 }
4718return;
4719Error:
4720 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4721}
4722
4723#if 0
4724 static void
4725limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4726{
4727 tSirSmeAssocCnf assocCnf;
4728 tpDphHashNode pStaDs;
4729 tpPESession psessionEntry;
4730 tANI_U8 sessionId;
4731
4732 if(pMsgBuf == NULL)
4733 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004734 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004735 goto end;
4736 }
4737 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4738 !__limIsSmeAssocCnfValid(&assocCnf))
4739 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004740 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 goto end;
4742 }
4743 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4744 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004745 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 goto end;
4747 }
4748 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4749 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4750 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004751 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4753 goto end;
4754 }
4755 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4756 if (pStaDs == NULL)
4757 {
4758 limLog(pMac, LOG1,
4759 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4760 msgType, assocCnf.aid);
4761 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4762 /*
4763 ** send a DISASSOC_IND message to WSM to make sure
4764 ** the state in WSM and LIM is the same
4765 **/
4766 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4767 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4768 goto end;
4769 }
4770 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304771 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 (tANI_U8 *) assocCnf.peerMacAddr,
4773 sizeof(tSirMacAddr)) ) ||
4774 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4775 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4776 (msgType != eWNI_SME_ASSOC_CNF)) ||
4777 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4778 (msgType != eWNI_SME_REASSOC_CNF)))))
4779 {
4780 limLog(pMac, LOG1,
4781 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4782 msgType, assocCnf.aid);
4783 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4784 goto end;
4785 }
4786 /*
4787 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4788 ** has been received
4789 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004790 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4792 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4793 {
4794 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4795 * when it had received Assoc Request frame. Now, PE just needs to send
4796 * Association Response frame to the requesting BTAMP-STA.
4797 */
4798 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004799 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4801 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4802 goto end;
4803 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4804 else
4805 {
4806 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4807 limRejectAssociation(pMac, pStaDs->staAddr,
4808 pStaDs->mlmStaContext.subType,
4809 true, pStaDs->mlmStaContext.authType,
4810 pStaDs->assocId, true,
4811 assocCnf.statusCode, psessionEntry);
4812 return;
4813 }
4814end:
4815 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4816 {
4817 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4818 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304819 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4821 }
4822
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304823 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4825 }
4826} /*** end __limProcessSmeAssocCnfNew() ***/
4827#endif
4828
Jeff Johnson295189b2012-06-20 16:38:30 -07004829void
4830limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4831 tBeaconGenParams *pBeaconGenParams = NULL;
4832 tSirMsgQ limMsg;
4833 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4834 if(psessionEntry == NULL ){
4835 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004836 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 return;
4838 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304839 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4840 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 {
4842 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304843 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 return;
4845 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304846 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4847 vos_mem_copy((void *) pBeaconGenParams->bssId,
4848 (void *)psessionEntry->bssId,
4849 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 limMsg.bodyptr = pBeaconGenParams;
4851 schProcessPreBeaconInd(pMac, &limMsg);
4852 return;
4853}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304854
4855void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4856 tSirResultCodes reasonCode)
4857{
4858 tANI_U16 scanRspLen = 0;
4859
4860 pMac->lim.gLimSmeScanResultLength +=
4861 pMac->lim.gLimMlmScanResultLength;
4862 if ((pMac->lim.gLimRspReqd) ||
4863 pMac->lim.gLimReportBackgroundScanResults)
4864 {
4865 pMac->lim.gLimRspReqd = false;
4866 if ((reasonCode == eSIR_SME_SUCCESS) ||
4867 pMac->lim.gLimSmeScanResultLength) {
4868 scanRspLen = sizeof(tSirSmeScanRsp) +
4869 pMac->lim.gLimSmeScanResultLength -
4870 sizeof(tSirBssDescription);
4871 }
4872 else
4873 scanRspLen = sizeof(tSirSmeScanRsp);
4874
4875 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4876 pMac->lim.gSmeSessionId,
4877 pMac->lim.gTransactionId);
4878 }
4879}
4880
4881
4882void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4883{
4884 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4885
4886 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
4887 "scan_id = %lu", pScanEvent->scanId);
4888
4889 switch (pScanEvent->event)
4890 {
4891 case SCAN_EVENT_STARTED:
4892 break;
4893 case SCAN_EVENT_START_FAILED:
4894 case SCAN_EVENT_COMPLETED:
4895 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
4896 break;
4897 case SCAN_EVENT_BSS_CHANNEL:
4898 case SCAN_EVENT_FOREIGN_CHANNEL:
4899 case SCAN_EVENT_DEQUEUED:
4900 case SCAN_EVENT_PREEMPTED:
4901 default:
4902 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
4903 "Received unhandled scan event %lu", pScanEvent->event);
4904 }
4905}