blob: 37369e1a452512b5b443509f5869d7e02464b865 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file limProcessMlmRspMessages.cc contains the code
25 * for processing response messages from MLM state machine.
26 * Author: Chandra Modumudi
27 * Date: 02/11/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 *
32 */
33#include "wniApi.h"
34#ifdef ANI_PRODUCT_TYPE_AP
35#include "wniCfgAp.h"
36#else
37#include "wniCfgSta.h"
38#endif
39#include "cfgApi.h"
40#include "sirApi.h"
41#include "schApi.h"
42#include "utilsApi.h"
43#include "limUtils.h"
44#include "limAssocUtils.h"
45#include "limSecurityUtils.h"
46#include "limSerDesUtils.h"
47#include "limTimerUtils.h"
48#include "limSendMessages.h"
49#include "limAdmitControl.h"
50#include "limSendMessages.h"
51#include "limIbssPeerMgmt.h"
52#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070053#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#if defined WLAN_FEATURE_VOWIFI
55#include "rrmApi.h"
56#endif
57#if defined WLAN_FEATURE_VOWIFI_11R
58#include <limFT.h>
59#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070060#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070063static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070064void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070065#ifdef FEATURE_OEM_DATA_SUPPORT
66void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
67#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070068void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
69void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
70void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
71void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
72void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
73void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
74void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
85static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
86void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
87static void
88limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
89/**
90 * limProcessMlmRspMessages()
91 *
92 *FUNCTION:
93 * This function is called to processes various MLM response (CNF/IND
94 * messages from MLM State machine.
95 *
96 *LOGIC:
97 *
98 *ASSUMPTIONS:
99 *
100 *NOTE:
101 *
102 * @param pMac Pointer to Global MAC structure
103 * @param msgType Indicates the MLM message type
104 * @param *pMsgBuf A pointer to the MLM message buffer
105 *
106 * @return None
107 */
108void
109limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
110{
111
112 if(pMsgBuf == NULL)
113 {
114 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
115 return;
116 }
117 switch (msgType)
118 {
119 case LIM_MLM_SCAN_CNF:
120 limProcessMlmScanCnf(pMac, pMsgBuf);
121 break;
122
Jeff Johnsone7245742012-09-05 17:12:55 -0700123#ifdef FEATURE_OEM_DATA_SUPPORT
124 case LIM_MLM_OEM_DATA_CNF:
125 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
126 break;
127#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700128
129 case LIM_MLM_AUTH_CNF:
130 limProcessMlmAuthCnf(pMac, pMsgBuf);
131 break;
132 case LIM_MLM_AUTH_IND:
133 limProcessMlmAuthInd(pMac, pMsgBuf);
134 break;
135 case LIM_MLM_ASSOC_CNF:
136 limProcessMlmAssocCnf(pMac, pMsgBuf);
137 break;
138 case LIM_MLM_START_CNF:
139 limProcessMlmStartCnf(pMac, pMsgBuf);
140 break;
141 case LIM_MLM_JOIN_CNF:
142 limProcessMlmJoinCnf(pMac, pMsgBuf);
143 break;
144 case LIM_MLM_ASSOC_IND:
145 limProcessMlmAssocInd(pMac, pMsgBuf);
146 break;
147 case LIM_MLM_REASSOC_CNF:
148 limProcessMlmReassocCnf(pMac, pMsgBuf);
149 break;
150 case LIM_MLM_REASSOC_IND:
151 limProcessMlmReassocInd(pMac, pMsgBuf);
152 break;
153 case LIM_MLM_DISASSOC_CNF:
154 limProcessMlmDisassocCnf(pMac, pMsgBuf);
155 break;
156 case LIM_MLM_DISASSOC_IND:
157 limProcessMlmDisassocInd(pMac, pMsgBuf);
158 break;
159 case LIM_MLM_PURGE_STA_IND:
160 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
161 break;
162 case LIM_MLM_DEAUTH_CNF:
163 limProcessMlmDeauthCnf(pMac, pMsgBuf);
164 break;
165 case LIM_MLM_DEAUTH_IND:
166 limProcessMlmDeauthInd(pMac, pMsgBuf);
167 break;
168 case LIM_MLM_SETKEYS_CNF:
169 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
170 break;
171 case LIM_MLM_REMOVEKEY_CNF:
172 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
173 break;
174 case LIM_MLM_TSPEC_CNF:
175 break;
176 case LIM_MLM_ADDBA_CNF:
177 limProcessMlmAddBACnf( pMac, pMsgBuf );
178 break;
179 case LIM_MLM_DELBA_CNF:
180 limProcessMlmDelBACnf( pMac, pMsgBuf );
181 break;
182 default:
183 break;
184 } // switch (msgType)
185 return;
186} /*** end limProcessMlmRspMessages() ***/
187
188/**
189 * limProcessMlmScanCnf()
190 *
191 *FUNCTION:
192 * This function is called to processes MLM_SCAN_CNF
193 * message from MLM State machine.
194 *
195 *LOGIC:
196 *
197 *ASSUMPTIONS:
198 *
199 *NOTE:
200 *
201 * @param pMac Pointer to Global MAC structure
202 * @param pMsgBuf A pointer to the MLM message buffer
203 *
204 * @return None
205 */
206void
207limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
208{
209 switch(pMac->lim.gLimSmeState)
210 {
211 case eLIM_SME_WT_SCAN_STATE:
212 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
213 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
214 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700215 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 pMac->lim.gLimSystemInScanLearnMode = 0;
217 break;
218 default:
219 /**
220 * Should not have received scan confirm
221 * from MLM in other states.
222 * Log error
223 */
224 PELOGE(limLog(pMac, LOGE,
225 FL("received unexpected MLM_SCAN_CNF in state %X\n"),
226 pMac->lim.gLimSmeState);)
227 return;
228 }
229
230 /// Process received scan confirm
231 /// Increment length of cached scan results
232 pMac->lim.gLimSmeScanResultLength +=
233 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
234 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
235 {
236 tANI_U16 scanRspLen = 0;
237 /// Need to send response to Host
238 pMac->lim.gLimRspReqd = false;
239 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
240 eSIR_SME_SUCCESS) ||
241 pMac->lim.gLimSmeScanResultLength)
242 {
243 scanRspLen = sizeof(tSirSmeScanRsp) +
244 pMac->lim.gLimSmeScanResultLength -
245 sizeof(tSirBssDescription);
246 }
247 else
248 {
249 scanRspLen = sizeof(tSirSmeScanRsp);
250 }
251 if(pMac->lim.gLimReportBackgroundScanResults)
252 {
253 pMac->lim.gLimBackgroundScanTerminate = TRUE;
254 }
255 if (pMac->lim.gLimSmeScanResultLength == 0)
256 {
257 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
258 }
259 else
260 {
261 limSendSmeScanRsp(pMac, scanRspLen,
262 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
263 }
264 } // if (pMac->lim.gLimRspReqd)
265 //check to see whether we need to run bgScan timer
266 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
267 {
268 if (tx_timer_activate(
269 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
270 {
271 /// Could not activate background scan timer.
272 // Log error
273 limLog(pMac, LOGP,
274 FL("could not activate background scan timer\n"));
275 pMac->lim.gLimBackgroundScanStarted = FALSE;
276 }
277 else
278 {
279 pMac->lim.gLimBackgroundScanStarted = TRUE;
280 }
281 }
282} /*** end limProcessMlmScanCnf() ***/
283
Jeff Johnsone7245742012-09-05 17:12:55 -0700284#ifdef FEATURE_OEM_DATA_SUPPORT
285
286/**
287 * limProcessMlmOemDataReqCnf()
288 *
289 *FUNCTION:
290 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
291 * message from MLM State machine.
292 *
293 *LOGIC:
294 *
295 *ASSUMPTIONS:
296 *
297 *NOTE:
298 *
299 * @param pMac Pointer to Global MAC structure
300 * @param pMsgBuf A pointer to the MLM message buffer
301 *
302 * @return None
303 */
304
305void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
306{
307 tLimMlmOemDataRsp* measRsp;
308
309 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
310
311 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
312
313 //Now send the meas confirm message to the sme
314 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
315
316 //Dont free the memory here. It will be freed up by the callee
317
318 return;
319}
320#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700321
322/**
323 * limProcessMlmStartCnf()
324 *
325 *FUNCTION:
326 * This function is called to processes MLM_START_CNF
327 * message from MLM State machine.
328 *
329 *LOGIC:
330 *
331 *ASSUMPTIONS:
332 *
333 *NOTE:
334 *
335 * @param pMac Pointer to Global MAC structure
336 * @param pMsgBuf A pointer to the MLM message buffer
337 *
338 * @return None
339 */
340void
341limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
342{
343 tpPESession psessionEntry = NULL;
344 tLimMlmStartCnf *pLimMlmStartCnf;
345 tANI_U8 smesessionId;
346 tANI_U16 smetransactionId;
347
348 if(pMsgBuf == NULL)
349 {
350 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
351 return;
352 }
353 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
354 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
355 {
356 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId \n"));)
357 return;
358 }
359 smesessionId = psessionEntry->smeSessionId;
360 smetransactionId = psessionEntry->transactionId;
361
362 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
363 {
364 /**
365 * Should not have received Start confirm from MLM
366 * in other states.
367 * Log error
368 */
369 PELOGE(limLog(pMac, LOGE,
370 FL("received unexpected MLM_START_CNF in state %X\n"),
371 psessionEntry->limSmeState);)
372 return;
373 }
374 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
375 eSIR_SME_SUCCESS)
376 {
377
378 /**
379 * Update global SME state so that Beacon Generation
380 * module starts writing Beacon frames into TFP's
381 * Beacon file register.
382 */
383 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700384 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
386 {
387 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***\n"));
388 }
389 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
390 {
391 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***\n"));
392 }
393#ifdef WLAN_SOFTAP_FEATURE
394 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
395 {
396 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***\n"));
397 }
398#endif
399 else
400 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***\n"));)
401 }
402 else
403 {
404 /// Start BSS is a failure
405 peDeleteSession(pMac,psessionEntry);
406 psessionEntry = NULL;
407 }
408 /// Send response to Host
409 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
410 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
411 smesessionId,smetransactionId);
412#ifdef WLAN_SOFTAP_FEATURE
413 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
414 {
415 //Configure beacon and send beacons to HAL
416 limSendBeaconInd(pMac, psessionEntry);
417 }
418#endif
419}
420
421 /*** end limProcessMlmStartCnf() ***/
422
423/**
424 * limProcessMlmJoinCnf()
425 *
426 *FUNCTION:
427 * This function is called to processes MLM_JOIN_CNF
428 * message from MLM State machine.
429 *
430 *LOGIC:
431 *
432 *ASSUMPTIONS:
433 *
434 *NOTE:
435 *
436 * @param pMac Pointer to Global MAC structure
437 * @param pMsgBuf A pointer to the MLM message buffer
438 *
439 * @return None
440 */
441void
442limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
443{
444 tSirResultCodes resultCode;
445 tLimMlmJoinCnf *pLimMlmJoinCnf;
446 tpPESession psessionEntry;
447 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
448 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
449 {
450 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));)
451 return;
452 }
453
454 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
455 {
456 PELOGE(limLog(pMac, LOGE,
457 FL("received unexpected MLM_JOIN_CNF in state %X\n"),
458 psessionEntry->limSmeState);)
459 return;
460 }
461
462 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
463 /// Process Join confirm from MLM
464 if (resultCode == eSIR_SME_SUCCESS)
465 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700466 PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
469 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
470 return;
471 else
472 resultCode = eSIR_SME_REFUSED;
473 }
474 {
475 /// Join failure
476 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700477 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 /// Send Join response to Host
479 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
480 }
481} /*** end limProcessMlmJoinCnf() ***/
482
483/**
484 * limProcessMlmAuthCnf()
485 *
486 *FUNCTION:
487 * This function is called to processes MLM_AUTH_CNF
488 * message from MLM State machine.
489 *
490 *LOGIC:
491 *
492 *ASSUMPTIONS:
493 *
494 *NOTE:
495 *
496 * @param pMac Pointer to Global MAC structure
497 * @param pMsgBuf A pointer to the MLM message buffer
498 *
499 * @return None
500 */
501void
502limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
503{
504 tANI_U16 caps;
505 tANI_U32 val;
506 tAniAuthType cfgAuthType, authMode;
507 tLimMlmAuthReq *pMlmAuthReq;
508 tLimMlmAssocReq *pMlmAssocReq;
509 tLimMlmAuthCnf *pMlmAuthCnf;
510 tpPESession psessionEntry;
511 tANI_U32 teleBcnEn = 0;
512// tANI_U8 sessionId;
513
514 if(pMsgBuf == NULL)
515 {
516 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
517 return;
518 }
519 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
520 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
521 {
522 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId\n"));)
523 return;
524 }
525
526 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
527 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
528 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
529 {
530 /**
531 * Should not have received AUTH confirm
532 * from MLM in other states or on AP.
533 * Log error
534 */
535 PELOGE(limLog(pMac, LOGE,
536 FL("received unexpected MLM_AUTH_CNF in state %X\n"),
537 psessionEntry->limSmeState);)
538 return;
539 }
540 /// Process AUTH confirm from MLM
541 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
542 {
543 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
544 {
545 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
546 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
547 {
548 /**
549 * Could not get AuthType value from CFG.
550 * Log error.
551 */
552 limLog(pMac, LOGP,
553 FL("could not retrieve AuthType value\n"));
554 }
555 }
556 else
557 cfgAuthType = pMac->lim.gLimPreAuthType;
558
559 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
560 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
561 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
562 {
563 /**
564 * When Open authentication fails with reason code "13" and
565 * authType set to 'auto switch', Try with Shared Authentication
566 */
567 authMode = eSIR_SHARED_KEY;
568 // Trigger MAC based Authentication
569 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
570 {
571 // Log error
572 limLog(pMac, LOGP,
573 FL("call to palAllocateMemory failed for mlmAuthReq\n"));
574 return;
575 }
576 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq));
577 val = sizeof(tSirMacAddr);
578 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
579 {
580 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
581 }
582 else
583 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmAuthReq->peerMacAddr,
584 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
585 sizeof(tSirMacAddr));
586 pMlmAuthReq->authType = authMode;
587 /* Update PE session Id*/
588 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
589 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
590 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
591 != eSIR_SUCCESS)
592 {
593 /**
594 * Could not get AuthFailureTimeout value from CFG.
595 * Log error.
596 */
597 limLog(pMac, LOGP,
598 FL("could not retrieve AuthFailureTimeout value\n"));
599 }
600 limPostMlmMessage(pMac,
601 LIM_MLM_AUTH_REQ,
602 (tANI_U32 *) pMlmAuthReq);
603 return;
604 }
605 else
606 {
607 // MAC based authentication failure
608 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
609 {
610 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred.\n"));)
611 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700612 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700614 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Madan Mohan Koyyalamudif371f172012-10-31 16:35:43 -0700615 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
616 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
617 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState.\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619#if defined(ANI_AP_CLIENT_SDK)
620 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
621 {
622 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
623 PELOGE(limLog(pMac, LOGE, FL("Setting current BSSID as NULL in cfg\n"));)
624 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
625 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
626 {
627 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
628 }
629 }
630#endif
631 /**
632 * Need to send Join response with
633 * auth failure to Host.
634 */
635 limHandleSmeJoinResult(pMac,
636 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
637 }
638 else
639 {
640 /**
641 * Pre-authentication failure.
642 * Send Pre-auth failure response to host
643 */
644 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700645 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 limSendSmeAuthRsp(
647 pMac,
648 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
649 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
650 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
651 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
652 }
653 } // end if (cfgAuthType == eAUTO_SWITCH)
654 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
655 else
656 {
657 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
658 {
659 /**
660 * Successful MAC based authentication
661 * Trigger Association with BSS
662 */
663 PELOG1(limLog(pMac, LOG1,
664 FL("*** Authenticated with BSS ***\n"));)
665 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocReq, sizeof(tLimMlmAssocReq)))
666 {
667 // Log error
668 limLog(pMac, LOGP,
669 FL("call to palAllocateMemory failed for mlmAssocReq\n"));
670 return;
671 }
672 val = sizeof(tSirMacAddr);
673 #if 0
674 if (cfgGetStr(pMac, WNI_CFG_BSSID,
675 pMlmAssocReq->peerMacAddr,
676 &val) != eSIR_SUCCESS)
677 {
678 /// Could not get BSSID from CFG. Log error.
679 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
680 }
681 #endif //SUPPORT BT-AMP
682 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
683 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
684 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
685 != eSIR_SUCCESS)
686 {
687 /**
688 * Could not get AssocFailureTimeout value
689 * from CFG. Log error.
690 */
691 limLog(pMac, LOGP,
692 FL("could not retrieve AssocFailureTimeout value\n"));
693 }
694 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
695 {
696 /**
697 * Could not get Capabilities value
698 * from CFG. Log error.
699 */
700 limLog(pMac, LOGP,
701 FL("could not retrieve Capabilities value\n"));
702 }
703 /*Clear spectrum management bit if AP doesn't support it*/
704 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
705 {
706 /*AP doesn't support spectrum management clear spectrum management bit*/
707 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
708 }
709
710 pMlmAssocReq->capabilityInfo = caps;
711 PELOG3(limLog(pMac, LOG3,
Jeff Johnsone7245742012-09-05 17:12:55 -0700712 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700714 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
715 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
717 /* If telescopic beaconing is enabled, set listen interval to
718 WNI_CFG_TELE_BCN_MAX_LI */
719 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
720 eSIR_SUCCESS)
721 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
722
723 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
724
725 if(teleBcnEn)
726 {
727 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
728 eSIR_SUCCESS)
729 {
730 /**
731 * Could not get ListenInterval value
732 * from CFG. Log error.
733 */
734 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
735 }
736 }
737 else
738 {
739 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
740 {
741 /**
742 * Could not get ListenInterval value
743 * from CFG. Log error.
744 */
745 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
746 }
747 }
748
749 pMlmAssocReq->listenInterval = (tANI_U16)val;
750 /* Update PE session ID*/
751 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
752 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
753 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700754 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 limPostMlmMessage(pMac,
756 LIM_MLM_ASSOC_REQ,
757 (tANI_U32 *) pMlmAssocReq);
758 }
759 else
760 {
761 /**
762 * Successful Pre-authentication.
763 * Send Pre-auth response to host
764 */
765 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700766 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 limSendSmeAuthRsp(
768 pMac,
769 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
770 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
771 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
772 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
773 }
774 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
775} /*** end limProcessMlmAuthCnf() ***/
776
777/**
778 * limProcessMlmAssocCnf()
779 *
780 *FUNCTION:
781 * This function is called to processes MLM_ASSOC_CNF
782 * message from MLM State machine.
783 *
784 *LOGIC:
785 *
786 *ASSUMPTIONS:
787 *
788 *NOTE:
789 *
790 * @param pMac Pointer to Global MAC structure
791 * @param pMsgBuf A pointer to the MLM message buffer
792 *
793 * @return None
794 */
795void
796limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
797{
798 tpPESession psessionEntry;
799 tLimMlmAssocCnf *pLimMlmAssocCnf;
800
801 if(pMsgBuf == NULL)
802 {
803 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
804 return;
805 }
806 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
807 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
808 {
809 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));)
810 return;
811 }
812 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
813 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
814 {
815 /**
816 * Should not have received Assocication confirm
817 * from MLM in other states OR on AP.
818 * Log error
819 */
820 PELOGE(limLog(pMac, LOGE,
821 FL("received unexpected MLM_ASSOC_CNF in state %X\n"),
822 psessionEntry->limSmeState);)
823 return;
824 }
825 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
826 {
827 // Association failure
828 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));)
829 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700830 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831#if defined(ANI_AP_CLIENT_SDK)
832 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
833 {
834 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
835 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
836 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
837 {
838 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
839 }
840 }
841#endif
842 /**
843 * Need to send Join response with
844 * Association failure to Host.
845 */
846 limHandleSmeJoinResult(pMac,
847 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
848 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
849 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
850 else
851 {
852 // Successful Association
853 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));)
854 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700855 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 /**
857 * Need to send Join response with
858 * Association success to Host.
859 */
860 limHandleSmeJoinResult(pMac,
861 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
862 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
863 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
864} /*** end limProcessMlmAssocCnf() ***/
865
866/**
867 * limProcessMlmReassocCnf()
868 *
869 *FUNCTION:
870 * This function is called to processes MLM_REASSOC_CNF
871 * message from MLM State machine.
872 *
873 *LOGIC:
874 *
875 *ASSUMPTIONS:
876 *
877 *NOTE:
878 *
879 * @param pMac Pointer to Global MAC structure
880 * @param pMsgBuf A pointer to the MLM message buffer
881 *
882 * @return None
883 */
884void
885limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
886{
887 tpPESession psessionEntry;
888 tLimMlmReassocCnf *pLimMlmReassocCnf;
889
890 if(pMsgBuf == NULL)
891 {
892 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
893 return;
894 }
895 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
896 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
897 {
898 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id\n"));)
899 return;
900 }
901 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
902 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
903 {
904 /**
905 * Should not have received Reassocication confirm
906 * from MLM in other states OR on AP.
907 * Log error
908 */
909 PELOGE(limLog(pMac, LOGE,
910 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X\n"),
911 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
912 return;
913 }
914 if (psessionEntry->pLimReAssocReq) {
915 palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq);
916 psessionEntry->pLimReAssocReq = NULL;
917 }
918
919 PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d\n"), pLimMlmReassocCnf->resultCode);)
920 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
921 // Successful Reassociation
922 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));)
923
924 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700925 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700926
927 /**
928 * Need to send Reassoc response with
929 * Reassociation success to Host.
930 */
931 limSendSmeJoinReassocRsp(
932 pMac, eWNI_SME_REASSOC_RSP,
933 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
934 psessionEntry->smeSessionId,psessionEntry->transactionId);
935 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
936 /** Reassociation failure With the New AP
937 * but we still have the link with the Older AP
938 */
939 psessionEntry->limSmeState = eLIM_SME_LINK_EST_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 /**
943 * Need to send Reassoc response with
944 * Association failure to Host.
945 */
946 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
947 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
948 psessionEntry->smeSessionId,psessionEntry->transactionId);
949 }else {
950 // Reassociation failure
951 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700952 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 /**
954 * Need to send Reassoc response with
955 * Association failure to Host.
956 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700957 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 }
959} /*** end limProcessMlmReassocCnf() ***/
960
961/**
962 * limProcessMlmReassocInd()
963 *
964 *FUNCTION:
965 * This function is called to processes MLM_REASSOC_IND
966 * message from MLM State machine.
967 *
968 *LOGIC:
969 *
970 *ASSUMPTIONS:
971 *
972 *NOTE:
973 *
974 * @param pMac Pointer to Global MAC structure
975 * @param pMsgBuf A pointer to the MLM message buffer
976 *
977 * @return None
978 */
979void
980limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
981{
982 tANI_U32 len;
983 tSirMsgQ msgQ;
984 tSirSmeReassocInd *pSirSmeReassocInd;
985 tpDphHashNode pStaDs=0;
986 tpPESession psessionEntry;
987 tANI_U8 sessionId;
988 if(pMsgBuf == NULL)
989 {
990 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
991 return;
992 }
993 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
994 {
995 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
996 return;
997 }
998 /// Inform Host of STA reassociation
999#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
1000 len = sizeof(tSirSmeReassocInd) -
1001 sizeof(tSirNeighborBssInfo) +
1002 (((tpLimMlmReassocInd) pMsgBuf)->numBss *
1003 sizeof(tSirNeighborBssInfo)) -
1004 SIR_MAC_MAX_SSID_LENGTH +
1005 ((tpLimMlmReassocInd) pMsgBuf)->ssId.length;
1006#else
1007 len = sizeof(tSirSmeReassocInd);
1008#endif
1009 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeReassocInd, len))
1010 {
1011 // Log error
1012 limLog(pMac, LOGP,
1013 FL("call to palAllocateMemory failed for eWNI_SME_REASSOC_IND\n"));
1014 return;
1015
1016 }
1017 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1018 eWNI_SME_REASSOC_IND);
1019 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1020 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1021
1022 // Required for indicating the frames to upper layer
1023 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1024 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1025 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1026 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1027
1028 msgQ.type = eWNI_SME_REASSOC_IND;
1029 msgQ.bodyptr = pSirSmeReassocInd;
1030 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001031 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001032#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1033 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1034#endif //FEATURE_WLAN_DIAG_SUPPORT
1035 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1036 if (! pStaDs)
1037 {
1038 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)\n"),
1039 ((tpLimMlmReassocInd) pMsgBuf)->aid);
1040 palFreeMemory(pMac->hHdd, pSirSmeReassocInd);
1041 return;
1042 }
1043
1044 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1045 PELOG1(limLog(pMac, LOG1,
1046 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND\n"));)
1047 /*
1048 ** turn on a timer to detect the loss of REASSOC CNF
1049 **/
1050 limActivateCnfTimer(pMac,
1051 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1052} /*** end limProcessMlmReassocInd() ***/
1053
1054/**
1055 * limProcessMlmAuthInd()
1056 *
1057 *FUNCTION:
1058 * This function is called to processes MLM_AUTH_IND
1059 * message from MLM State machine.
1060 *
1061 *LOGIC:
1062 *
1063 *ASSUMPTIONS:
1064 *
1065 *NOTE:
1066 *
1067 * @param pMac Pointer to Global MAC structure
1068 * @param pMsgBuf A pointer to the MLM message buffer
1069 *
1070 * @return None
1071 */
1072void
1073limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1074{
1075 tSirMsgQ msgQ;
1076 tSirSmeAuthInd *pSirSmeAuthInd;
1077
1078 if(pMsgBuf == NULL)
1079 {
1080 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1081 return;
1082 }
1083 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthInd, sizeof(tSirSmeAuthInd)))
1084 {
1085 // Log error
1086 limLog(pMac, LOGP,
1087 FL("call to palAllocateMemory failed for eWNI_SME_AUTH_IND\n"));
1088 }
1089 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1090 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1091 (tANI_U8 *) &(pSirSmeAuthInd->length));
1092 msgQ.type = eWNI_SME_AUTH_IND;
1093 msgQ.bodyptr = pSirSmeAuthInd;
1094 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001095 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001096#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1097 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1098#endif //FEATURE_WLAN_DIAG_SUPPORT
1099 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1100} /*** end limProcessMlmAuthInd() ***/
1101
1102
1103
1104
1105void
1106limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1107 tSirSmeAssocInd *pSirSmeAssocInd,
1108 tpPESession psessionEntry)
1109{
1110 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1111 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1112
1113 // Required for indicating the frames to upper layer
1114 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1115 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1116
1117 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1118 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1119
1120 // Fill in peerMacAddr
1121 palCopyMemory( pMac->hHdd, pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
1122 // Fill in aid
1123 pSirSmeAssocInd->aid = pAssocInd->aid;
1124 // Fill in bssId
1125 palCopyMemory( pMac->hHdd, pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1126 // Fill in staId
1127 //pSirSmeAssocInd->staId = psessionEntry->staId;
1128 // Fill in authType
1129 pSirSmeAssocInd->authType = pAssocInd->authType;
1130 // Fill in ssId
1131 palCopyMemory( pMac->hHdd, (tANI_U8*)&pSirSmeAssocInd->ssId,
1132 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
1133 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
1134 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1135 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1136 pAssocInd->rsnIE.length);
1137
1138 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
1139 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1140 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1141 pAssocInd->addIE.length);
1142
1143 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1145 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1146 {
1147 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1148 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1149 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
1150 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
1151 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1152 pAssocInd->supportedChannels.numChnl);
1153 }
1154#ifdef WLAN_SOFTAP_FEATURE
1155 // Fill in WmmInfo
1156 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
1157#endif
1158} /*** end limAssocIndSerDes() ***/
1159
1160
1161
1162/**
1163 * limProcessMlmAssocInd()
1164 *
1165 *FUNCTION:
1166 * This function is called to processes MLM_ASSOC_IND
1167 * message from MLM State machine.
1168 *
1169 *LOGIC:
1170 *
1171 *ASSUMPTIONS:
1172 *
1173 *NOTE:
1174 *
1175 * @param pMac Pointer to Global MAC structure
1176 * @param pMsgBuf A pointer to the MLM message buffer
1177 *
1178 * @return None
1179 */
1180void
1181limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1182{
1183 tANI_U32 len;
1184 tSirMsgQ msgQ;
1185 tSirSmeAssocInd *pSirSmeAssocInd;
1186 tpDphHashNode pStaDs=0;
1187 tpPESession psessionEntry;
1188 if(pMsgBuf == NULL)
1189 {
1190 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1191 return;
1192 }
1193 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1194 {
1195 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
1196 return;
1197 }
1198 /// Inform Host of STA association
1199#if defined (ANI_PRODUCT_TYPE_AP)
1200 len = sizeof(tSirSmeAssocInd) -
1201 sizeof(tSirNeighborBssInfo) +
1202 (((tpLimMlmAssocInd) pMsgBuf)->numBss *
1203 sizeof(tSirNeighborBssInfo)) -
1204 SIR_MAC_MAX_SSID_LENGTH +
1205 ((tpLimMlmAssocInd) pMsgBuf)->ssId.length;
1206#else
1207 len = sizeof(tSirSmeAssocInd);
1208#endif
1209 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAssocInd, len))
1210 {
1211 // Log error
1212 limLog(pMac, LOGP,
1213 FL("call to palAllocateMemory failed for eWNI_SME_ASSOC_IND\n"));
1214 return;
1215 }
1216
1217#if defined (ANI_PRODUCT_TYPE_AP)
1218 sirStoreU16N((tANI_U8 *) &pSirSmeAssocInd->messageType,
1219 eWNI_SME_ASSOC_IND);
1220 limAssocIndSerDes(pMac, (tpLimMlmAssocInd) pMsgBuf,
1221 (tANI_U8 *) &(pSirSmeAssocInd->length), psessionEntry);
1222#else
1223 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1224 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
1225#endif
1226 msgQ.type = eWNI_SME_ASSOC_IND;
1227 msgQ.bodyptr = pSirSmeAssocInd;
1228 msgQ.bodyval = 0;
1229 pStaDs = dphGetHashEntry(pMac,
1230 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1231 if (! pStaDs)
1232 { // good time to panic...
1233 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)\n"),
1234 ((tpLimMlmAssocInd) pMsgBuf)->aid);
1235 palFreeMemory(pMac->hHdd, pSirSmeAssocInd);
1236
1237 return;
1238 }
1239 pSirSmeAssocInd->staId = pStaDs->staIndex;
1240#ifdef WLAN_SOFTAP_FEATURE
1241 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
1242#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001243 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001244#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1245 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1246#endif //FEATURE_WLAN_DIAG_SUPPORT
1247 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1248
1249 PELOG1(limLog(pMac, LOG1,
1250 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND\n"));)
1251 /*
1252 ** turn on a timer to detect the loss of ASSOC CNF
1253 **/
1254 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1255
1256// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1257#ifdef TEST_BTAMP_AP
1258//tANI_U32 *pMsgBuf;
1259{
1260 tpSirSmeAssocCnf pSmeAssoccnf;
1261 if(!palAllocateMemory(pMac->hHdd,(void **)&pSmeAssoccnf,sizeof(tSirSmeAssocCnf)))
1262 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pSmeAssoccnf \n"));)
1263 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1264 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
1265 palCopyMemory( pMac->hHdd,pSmeAssoccnf->peerMacAddr,((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr,6);
1266 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1267 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
1268 palCopyMemory( pMac->hHdd, pSmeAssoccnf->alternateBssId,pSmeAssoccnf->peerMacAddr,sizeof(tSirMacAddr));
1269 pSmeAssoccnf->alternateChannelId = 6;
1270 palCopyMemory( pMac->hHdd,pSmeAssoccnf->bssId,psessionEntry->selfMacAddr,6);
1271 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1272 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
1273 palFreeMemory(pMac->hHdd,pSmeAssoccnf);
1274}
1275#endif
1276
1277
1278} /*** end limProcessMlmAssocInd() ***/
1279
1280
1281
1282
1283/**
1284 * limProcessMlmDisassocInd()
1285 *
1286 *FUNCTION:
1287 * This function is called to processes MLM_DISASSOC_IND
1288 * message from MLM State machine.
1289 *
1290 *LOGIC:
1291 *
1292 *ASSUMPTIONS:
1293 *
1294 *NOTE:
1295 *
1296 * @param pMac Pointer to Global MAC structure
1297 * @param pMsgBuf A pointer to the MLM message buffer
1298 *
1299 * @return None
1300 */
1301void
1302limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1303{
1304 tLimMlmDisassocInd *pMlmDisassocInd;
1305 tpPESession psessionEntry;
1306 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1307 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1308 {
1309 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
1310 return;
1311 }
1312 switch (psessionEntry->limSystemRole)
1313 {
1314 case eLIM_STA_IN_IBSS_ROLE:
1315 break;
1316 case eLIM_STA_ROLE:
1317 case eLIM_BT_AMP_STA_ROLE:
1318 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001319 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 break;
1321 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1322 PELOG1(limLog(pMac, LOG1,
1323 FL("*** Peer staId=%d Disassociated ***\n"),
1324 pMlmDisassocInd->aid);)
1325 // Send SME_DISASOC_IND after Polaris cleanup
1326 // (after receiving LIM_MLM_PURGE_STA_IND)
1327 break;
1328 } // end switch (psessionEntry->limSystemRole)
1329} /*** end limProcessMlmDisassocInd() ***/
1330
1331/**
1332 * limProcessMlmDisassocCnf()
1333 *
1334 *FUNCTION:
1335 * This function is called to processes MLM_DISASSOC_CNF
1336 * message from MLM State machine.
1337 *
1338 *LOGIC:
1339 *
1340 *ASSUMPTIONS:
1341 *
1342 *NOTE:
1343 *
1344 * @param pMac Pointer to Global MAC structure
1345 * @param pMsgBuf A pointer to the MLM message buffer
1346 *
1347 * @return None
1348 */
1349void
1350limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1351{
1352 tSirResultCodes resultCode;
1353 tLimMlmDisassocCnf *pMlmDisassocCnf;
1354 tpPESession psessionEntry;
1355 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1356 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1357 {
1358 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
1359 return;
1360 }
1361 resultCode = (tSirResultCodes)
1362 (pMlmDisassocCnf->disassocTrigger ==
1363 eLIM_LINK_MONITORING_DISASSOC) ?
1364 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1365 pMlmDisassocCnf->resultCode;
1366 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1367 {
1368#if defined(ANI_AP_CLIENT_SDK)
1369 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1370#endif
1371 // Disassociate Confirm from MLM
1372 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1373 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1374 {
1375 /**
1376 * Should not have received
1377 * Disassocate confirm
1378 * from MLM in other states.
1379 * Log error
1380 */
1381 PELOGE(limLog(pMac, LOGE,
1382 FL("received unexpected MLM_DISASSOC_CNF in state %X\n"),psessionEntry->limSmeState);)
1383 return;
1384 }
1385#if defined(ANI_AP_CLIENT_SDK)
1386 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1387 // if the station finds the same AP to which it was associated, it can try to associate
1388 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1389 // up to WSM and it never see this is AP unless a cga/reboot is done.
1390 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1391 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1392 {
1393 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1394 }
1395#endif
1396 if (pMac->lim.gLimRspReqd)
1397 pMac->lim.gLimRspReqd = false;
1398 if (pMlmDisassocCnf->disassocTrigger ==
1399 eLIM_PROMISCUOUS_MODE_DISASSOC)
1400 {
1401 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1402 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1403 else
1404 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001405 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 // Send Promiscuous mode response to host
1407 limSendSmePromiscuousModeRsp(pMac);
1408 }
1409 else
1410 {
1411 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1412 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1413 else
1414 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001415 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1417 resultCode,
1418 pMlmDisassocCnf->disassocTrigger,
1419 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1420 }
1421 }
1422 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1423 {
1424 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1425 resultCode,
1426 pMlmDisassocCnf->disassocTrigger,
1427 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1428 }
1429} /*** end limProcessMlmDisassocCnf() ***/
1430
1431/**
1432 * limProcessMlmDeauthInd()
1433 *
1434 *FUNCTION:
1435 * This function is called to processes MLM_DEAUTH_IND
1436 * message from MLM State machine.
1437 *
1438 *LOGIC:
1439 *
1440 *ASSUMPTIONS:
1441 *
1442 *NOTE:
1443 *
1444 * @param pMac Pointer to Global MAC structure
1445 * @param pMsgBuf A pointer to the MLM message buffer
1446 *
1447 * @return None
1448 */
1449void
1450limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1451{
1452 tLimMlmDeauthInd *pMlmDeauthInd;
1453 tpPESession psessionEntry;
1454 tANI_U8 sessionId;
1455 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1456 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1457 {
1458 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
1459 return;
1460 }
1461 switch (psessionEntry->limSystemRole)
1462 {
1463 case eLIM_STA_IN_IBSS_ROLE:
1464 break;
1465 case eLIM_STA_ROLE:
1466 case eLIM_BT_AMP_STA_ROLE:
1467 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001468 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001469
1470 default: // eLIM_AP_ROLE
1471 {
1472 PELOG1(limLog(pMac, LOG1,
1473 FL("*** Received Deauthentication from staId=%d ***\n"),
1474 pMlmDeauthInd->aid);)
1475 }
1476 // Send SME_DEAUTH_IND after Polaris cleanup
1477 // (after receiving LIM_MLM_PURGE_STA_IND)
1478 break;
1479 } // end switch (psessionEntry->limSystemRole)
1480} /*** end limProcessMlmDeauthInd() ***/
1481
1482/**
1483 * limProcessMlmDeauthCnf()
1484 *
1485 *FUNCTION:
1486 * This function is called to processes MLM_DEAUTH_CNF
1487 * message from MLM State machine.
1488 *
1489 *LOGIC:
1490 *
1491 *ASSUMPTIONS:
1492 *
1493 *NOTE:
1494 *
1495 * @param pMac Pointer to Global MAC structure
1496 * @param pMsgBuf A pointer to the MLM message buffer
1497 *
1498 * @return None
1499 */
1500void
1501limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1502{
1503 tANI_U16 aid;
1504 tSirResultCodes resultCode;
1505 tLimMlmDeauthCnf *pMlmDeauthCnf;
1506 tpPESession psessionEntry;
1507
1508 if(pMsgBuf == NULL)
1509 {
1510 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1511 return;
1512 }
1513 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1514 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1515 {
1516 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id \n"));)
1517 return;
1518 }
1519
1520 resultCode = (tSirResultCodes)
1521 (pMlmDeauthCnf->deauthTrigger ==
1522 eLIM_LINK_MONITORING_DEAUTH) ?
1523 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1524 pMlmDeauthCnf->resultCode;
1525 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1526 pMlmDeauthCnf->aid : 1;
1527 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1528 {
1529 #if defined(ANI_AP_CLIENT_SDK)
1530 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1531 #endif
1532 // Deauth Confirm from MLM
1533 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1534 {
1535 /**
1536 * Should not have received Deauth confirm
1537 * from MLM in other states.
1538 * Log error
1539 */
1540 PELOGE(limLog(pMac, LOGE,
1541 FL("received unexpected MLM_DEAUTH_CNF in state %X\n"),
1542 psessionEntry->limSmeState);)
1543 return;
1544 }
1545#if defined(ANI_AP_CLIENT_SDK)
1546 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1547 // if the station finds the same AP to which it was associated, it can try to associate
1548 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1549 // up to WSM and it never see this is AP unless a cga/reboot is done.
1550 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1551 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1552 {
1553 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1554 }
1555#endif
1556 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1557 {
1558 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1559 PELOG1(limLog(pMac, LOG1,
1560 FL("*** Deauthenticated with BSS ***\n"));)
1561 }
1562 else
1563 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001564 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001565
1566 if (pMac->lim.gLimRspReqd)
1567 pMac->lim.gLimRspReqd = false;
1568 }
1569#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1570 // BP deauthenticated by AP or vice versa
1571 // Send SME_DISASSOC_RSP to host.
1572 limSendSmeDisassocNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1573 resultCode,
1574 pMlmDeauthCnf->deauthTrigger,
1575 aid);
1576#else
1577 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1578 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1579 resultCode,
1580 pMlmDeauthCnf->deauthTrigger,
1581 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
1582#endif
1583} /*** end limProcessMlmDeauthCnf() ***/
1584
1585/**
1586 * limProcessMlmPurgeStaInd()
1587 *
1588 *FUNCTION:
1589 * This function is called to processes MLM_PURGE_STA_IND
1590 * message from MLM State machine.
1591 *
1592 *LOGIC:
1593 *
1594 *ASSUMPTIONS:
1595 *
1596 *NOTE:
1597 *
1598 * @param pMac Pointer to Global MAC structure
1599 * @param pMsgBuf A pointer to the MLM message buffer
1600 *
1601 * @return None
1602 */
1603void
1604limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1605{
1606 tSirResultCodes resultCode;
1607 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1608 tpPESession psessionEntry;
1609#if defined(ANI_AP_CLIENT_SDK)
1610 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1611#endif
1612 if(pMsgBuf == NULL)
1613 {
1614 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1615 return;
1616 }
1617 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1618 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1619 {
1620 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
1621 return;
1622 }
1623 // Purge STA indication from MLM
1624 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1625 switch (psessionEntry->limSystemRole)
1626 {
1627 case eLIM_STA_IN_IBSS_ROLE:
1628 break;
1629 case eLIM_STA_ROLE:
1630 case eLIM_BT_AMP_STA_ROLE:
1631 default: // eLIM_AP_ROLE
1632 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1633 (psessionEntry->limSmeState !=
1634 eLIM_SME_WT_DISASSOC_STATE) &&
1635 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1636 {
1637 /**
1638 * Should not have received
1639 * Purge STA indication
1640 * from MLM in other states.
1641 * Log error
1642 */
1643 PELOGE(limLog(pMac, LOGE,
1644 FL("received unexpected MLM_PURGE_STA_IND in state %X\n"),
1645 psessionEntry->limSmeState);)
1646 break;
1647 }
1648 PELOG1(limLog(pMac, LOG1,
1649 FL("*** Polaris cleanup completed for staId=%d ***\n"),
1650 pMlmPurgeStaInd->aid);)
1651 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1652 {
1653 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001654 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001655
1656#if defined(ANI_AP_CLIENT_SDK)
1657 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1658 // if the station finds the same AP to which it was associated, it can try to associate
1659 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1660 // up to WSM and it never see this is AP unless a cga/reboot is done.
1661 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1662 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1663 {
1664 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1665 }
1666#endif
1667 }
1668 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1669 {
1670#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1671 // BP deauthenticated by AP or vice versa
1672 // Send SME_DISASSOC_IND to host.
1673 limSendSmeDisassocNtf(pMac,
1674 pMlmPurgeStaInd->peerMacAddr,
1675 resultCode,
1676 pMlmPurgeStaInd->purgeTrigger,
1677 pMlmPurgeStaInd->aid,psessionEntry);
1678#else
1679 limSendSmeDeauthNtf(pMac,
1680 pMlmPurgeStaInd->peerMacAddr,
1681 resultCode,
1682 pMlmPurgeStaInd->purgeTrigger,
1683 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
1684#endif
1685 }
1686 else
1687 limSendSmeDisassocNtf(pMac,
1688 pMlmPurgeStaInd->peerMacAddr,
1689 resultCode,
1690 pMlmPurgeStaInd->purgeTrigger,
1691 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1692 } // end switch (psessionEntry->limSystemRole)
1693} /*** end limProcessMlmPurgeStaInd() ***/
1694
1695/**
1696 * limProcessMlmSetKeysCnf()
1697 *
1698 *FUNCTION:
1699 * This function is called to processes MLM_SETKEYS_CNF
1700 * message from MLM State machine.
1701 *
1702 *LOGIC:
1703 *
1704 *ASSUMPTIONS:
1705 *
1706 *NOTE:
1707 *
1708 * @param pMac Pointer to Global MAC structure
1709 * @param pMsgBuf A pointer to the MLM message buffer
1710 *
1711 * @return None
1712 */
1713void
1714limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1715{
1716 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001717 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 tpPESession psessionEntry;
1719
1720 if(pMsgBuf == NULL)
1721 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001722 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1723 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 }
1725 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1726 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1727 {
1728 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId \n"));)
1729 return;
1730 }
1731 limLog( pMac, LOG1,
1732 FL("Received MLM_SETKEYS_CNF with resultCode = %d\n"),
1733 pMlmSetKeysCnf->resultCode );
1734 limSendSmeSetContextRsp(pMac,
1735 pMlmSetKeysCnf->peerMacAddr,
1736#ifdef ANI_PRODUCT_TYPE_AP
1737 pMlmSetKeysCnf->aid,
1738#else
1739 1,
1740#endif
1741 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1742 psessionEntry->transactionId);
1743} /*** end limProcessMlmSetKeysCnf() ***/
1744/**
1745 * limProcessMlmRemoveKeyCnf()
1746 *
1747 *FUNCTION:
1748 * This function is called to processes MLM_REMOVEKEY_CNF
1749 * message from MLM State machine.
1750 *
1751 *LOGIC:
1752 *
1753 *ASSUMPTIONS:
1754 *
1755 *NOTE:
1756 *
1757 * @param pMac Pointer to Global MAC structure
1758 * @param pMsgBuf A pointer to the MLM message buffer
1759 *
1760 * @return None
1761 */
1762void
1763limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1764{
1765 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001766 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 tpPESession psessionEntry;
1768
1769 if(pMsgBuf == NULL)
1770 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001771 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1772 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 }
1774 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1775 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1776 {
1777 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
1778 return;
1779 }
1780 limLog( pMac, LOG1,
1781 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"),
1782 pMlmRemoveKeyCnf->resultCode );
1783 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001784 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1786 psessionEntry->smeSessionId,psessionEntry->transactionId);
1787} /*** end limProcessMlmRemoveKeyCnf() ***/
1788
1789
1790/**
1791 * limHandleSmeJoinResult()
1792 *
1793 *FUNCTION:
1794 * This function is called to process join/auth/assoc failures
1795 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1796 * MLM_ASSOC_CNF with a success code in case of STA role and
1797 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1798 *
1799 *LOGIC:
1800 *
1801 *ASSUMPTIONS:
1802 *
1803 *NOTE:
1804 *
1805 * @param pMac Pointer to Global MAC structure
1806 * @param resultCode Failure code to be sent
1807 *
1808 *
1809 * @return None
1810 */
1811static void
1812limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1813{
1814 tpDphHashNode pStaDs = NULL;
1815 tANI_U8 smesessionId;
1816 tANI_U16 smetransactionId;
1817
1818 /* Newly Added on oct 11 th*/
1819 if(psessionEntry == NULL)
1820 {
1821 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
1822 return;
1823 }
1824 smesessionId = psessionEntry->smeSessionId;
1825 smetransactionId = psessionEntry->transactionId;
1826 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1827 if(resultCode != eSIR_SME_SUCCESS)
1828 {
1829 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1830 if (pStaDs != NULL)
1831 {
1832 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1833 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1834 pStaDs->mlmStaContext.resultCode = resultCode;
1835 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1836 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1837 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001838 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
1839 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 return;
1841 }
1842 }
1843
1844 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
1845 psessionEntry->pLimJoinReq = NULL;
1846 //Delete teh session if JOIN failure occurred.
1847 if(resultCode != eSIR_SME_SUCCESS)
1848 {
1849 if(NULL != psessionEntry)
1850 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001851 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1852 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1853 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState.\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001854 peDeleteSession(pMac,psessionEntry);
1855 psessionEntry = NULL;
1856 }
1857 }
1858 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1859 smesessionId, smetransactionId);
1860} /*** end limHandleSmeJoinResult() ***/
1861
1862/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001863 * limHandleSmeReaasocResult()
1864 *
1865 *FUNCTION:
1866 * This function is called to process reassoc failures
1867 * upon receiving REASSOC_CNF with a failure code or
1868 * MLM_REASSOC_CNF with a success code in case of STA role
1869 *
1870 *LOGIC:
1871 *
1872 *ASSUMPTIONS:
1873 *
1874 *NOTE:
1875 *
1876 * @param pMac Pointer to Global MAC structure
1877 * @param resultCode Failure code to be sent
1878 *
1879 *
1880 * @return None
1881 */
1882static void
1883limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1884{
1885 tpDphHashNode pStaDs = NULL;
1886 tANI_U8 smesessionId;
1887 tANI_U16 smetransactionId;
1888
1889 if(psessionEntry == NULL)
1890 {
1891 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
1892 return;
1893 }
1894 smesessionId = psessionEntry->smeSessionId;
1895 smetransactionId = psessionEntry->transactionId;
1896 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1897 if(resultCode != eSIR_SME_SUCCESS)
1898 {
1899 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1900 if (pStaDs != NULL)
1901 {
1902 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1903 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1904 pStaDs->mlmStaContext.resultCode = resultCode;
1905 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1906 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1907 return;
1908 }
1909 }
1910
1911 //Delete teh session if REASSOC failure occurred.
1912 if(resultCode != eSIR_SME_SUCCESS)
1913 {
1914 if(NULL != psessionEntry)
1915 {
1916 peDeleteSession(pMac,psessionEntry);
1917 psessionEntry = NULL;
1918 }
1919 }
1920 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1921 smesessionId, smetransactionId);
1922} /*** end limHandleSmeReassocResult() ***/
1923
1924/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 * limProcessMlmAddStaRsp()
1926 *
1927 *FUNCTION:
1928 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1929 * Upon receipt of this message from HAL, MLME -
1930 * > Determines the "state" in which this message was received
1931 * > Forwards it to the appropriate callback
1932 *
1933 *ASSUMPTIONS:
1934 *
1935 *NOTE:
1936 *
1937 * @param pMac Pointer to Global MAC structure
1938 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1939 *
1940 * @return None
1941 */
1942void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1943{
1944 //we need to process the deferred message since the initiating req. there might be nested request.
1945 //in the case of nested request the new request initiated from the response will take care of resetting
1946 //the deffered flag.
1947 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
1949#ifdef WLAN_SOFTAP_FEATURE
1950 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1951#endif
1952 )
1953 {
1954 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1955 return;
1956 }
1957#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1958 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1959#endif
1960}
1961void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1962{
1963 tLimMlmAssocCnf mlmAssocCnf;
1964 tpDphHashNode pStaDs;
1965 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1966 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1967
1968 if(NULL == pAddStaParams )
1969 {
1970 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
1971 return;
1972 }
1973 if( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1974 {
1975 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
1976 {
1977 //TODO: any response to be sent out here ?
1978 limLog( pMac, LOGE,
1979 FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
1980 psessionEntry->limMlmState);
1981 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1982 goto end;
1983 }
1984 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1985 mesgType = LIM_MLM_REASSOC_CNF;
1986 //
1987 // Update the DPH Hash Entry for this STA
1988 // with proper state info
1989 //
1990 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1991 if( NULL != pStaDs)
1992 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1993 else
1994 limLog( pMac, LOGW,
1995 FL( "Unable to get the DPH Hash Entry for AID - %d\n" ),
1996 DPH_STA_HASH_INDEX_PEER);
1997 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001998 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 /*
2000 * Storing the self StaIndex(Generated by HAL) in session context,
2001 * instead of storing it in DPH Hash entry for Self STA.
2002 * DPH entry for the self STA stores the sta index for the BSS entry
2003 * to which the STA is associated.
2004 */
2005 psessionEntry->staId = pAddStaParams->staIdx;
2006 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2007 limReactivateHeartBeatTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002008 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002009
2010 //assign the sessionId to the timer Object
2011 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2012 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
2013 limLog(pMac, LOGP, FL("Cannot activate keepalive timer.\n"));
2014#ifdef WLAN_DEBUG
2015 pMac->lim.gLimNumLinkEsts++;
2016#endif
2017 // Return Assoc confirm to SME with success
2018 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2019 // be passed in here....
2020 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2021 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2022 }
2023 else
2024 {
2025 limLog( pMac, LOGW, FL( "ADD_STA failed!\n"));
2026 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2027 }
2028end:
2029 if( 0 != limMsgQ->bodyptr )
2030 {
2031 palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
2032 }
2033 /* Updating PE session Id*/
2034 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2035 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
2036 return;
2037}
2038void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2039{
2040 //we need to process the deferred message since the initiating req. there might be nested request.
2041 //in the case of nested request the new request initiated from the response will take care of resetting
2042 //the deffered flag.
2043 // tpPESession psessionEntry;
2044 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2045 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2046 // {
2047 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId\n" ));
2048 // return;
2049 // }
2050 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002051
2052 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2053 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
2054#ifdef WLAN_SOFTAP_FEATURE
2055 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
2056#endif
2057 ) &&
2058 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2059 {
2060 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2061 return;
2062 }
2063#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2064 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2065#endif
2066}
2067
2068void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2069{
2070 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2071 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2072 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2073 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2074 {
2075 PELOGW(limLog( pMac, LOGW,
2076 FL( "STA received the DEL_BSS_RSP for BSSID: %X.\n"),pDelBssParams->bssIdx);)
2077 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2078 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2079
2080 {
2081 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE\n"));)
2082 statusCode = eSIR_SME_REFUSED;
2083 goto end;
2084 }
2085 if(pStaDs == NULL)
2086 {
2087 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing.\n"));
2088 statusCode = eSIR_SME_REFUSED;
2089 goto end;
2090 }
2091 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2092 {
2093 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ),
2094 pStaDs->mlmStaContext.mlmState);)
2095 statusCode = eSIR_SME_REFUSED;
2096 goto end;
2097 }
2098 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2099 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2100 }
2101 else
2102 {
2103 limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002104 if( NULL != pDelBssParams )
2105 {
2106 palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07002107 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 return;
2109 }
2110 end:
2111 if( 0 != limMsgQ->bodyptr )
2112 {
2113 palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
2114 }
2115 if(pStaDs == NULL)
2116 return;
2117 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2118 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2119 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2120 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2121 {
2122 /** The Case where the DelBss is invoked from
2123 * context of other than normal DisAssoc / Deauth OR
2124 * as part of Join Failure.
2125 */
2126 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2127 return;
2128 }
2129 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2130 return;
2131}
2132
Jeff Johnson295189b2012-06-20 16:38:30 -07002133void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2134{
2135 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002136 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2138 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2139
2140 if(psessionEntry == NULL)
2141 {
2142 limLog(pMac, LOGE,FL("Session entry passed is NULL\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002143 if(pDelBss != NULL)
2144 palFreeMemory( pMac->hHdd, (void *) pDelBss );
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 return;
2146 }
2147
2148 if (pDelBss == NULL)
2149 {
2150 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!\n"));)
2151 rc = eSIR_SME_REFUSED;
2152 goto end;
2153 }
2154 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
2155 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2156 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002157 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002158 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2159 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002160 rc = eSIR_SME_REFUSED;
2161 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 }
2163 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2164 {
2165 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2166 pDelBss->status, pDelBss->bssIdx);
2167 rc = eSIR_SME_STOP_BSS_FAILURE;
2168 goto end;
2169 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002170 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002172 if (status != eSIR_SUCCESS)
2173 {
2174 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 /** Softmac may send all the buffered packets right after resuming the transmission hence
2178 * to occupy the medium during non channel occupancy period. So resume the transmission after
2179 * HAL gives back the response.
2180 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002181#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 if (LIM_IS_RADAR_DETECTED(pMac))
2183 {
2184 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2185 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2186 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002187#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2189 limDeletePreAuthList(pMac);
2190#ifdef WLAN_SOFTAP_FEATURE
2191 //Initialize number of associated stations during cleanup
2192 pMac->lim.gLimNumOfCurrentSTAs = 0;
2193#endif
2194 end:
2195 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2196 peDeleteSession(pMac, psessionEntry);
2197
2198 if(pDelBss != NULL)
2199 palFreeMemory( pMac->hHdd, (void *) pDelBss );
2200}
2201
2202void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2203{
2204 //we need to process the deferred message since the initiating req. there might be nested request.
2205 //in the case of nested request the new request initiated from the response will take care of resetting
2206 //the deffered flag.
2207
2208 tpPESession psessionEntry;
2209 tpDeleteStaParams pDeleteStaParams;
2210 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2211 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
2212 if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteStaParams->sessionId))==NULL)
2213 {
2214 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002215 if(pDeleteStaParams != NULL)
2216 palFreeMemory( pMac->hHdd, (void *) pDeleteStaParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 return;
2218 }
2219
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
2221#ifdef WLAN_SOFTAP_FEATURE
2222 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
2223#endif
2224 )
2225 {
2226 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2227 return;
2228 }
2229#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2230 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
2231#endif
2232}
2233
Jeff Johnson295189b2012-06-20 16:38:30 -07002234void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2235{
2236 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2237 tpDphHashNode pStaDs;
2238 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2239 if(limMsgQ->bodyptr == NULL)
2240 {
2241 return;
2242 }
2243
2244 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2245 if(pStaDs == NULL)
2246 {
2247 limLog( pMac, LOGE,
2248 FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
2249 statusCode = eSIR_SME_REFUSED;
2250 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2251
2252 return;
2253 }
2254 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2255 {
2256 limLog( pMac, LOGW,
2257 FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
2258
2259 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2260 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2261 {
2262 limLog( pMac, LOGE,
2263 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
2264 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2265 statusCode = eSIR_SME_REFUSED;
2266 goto end;
2267 }
2268
2269 limLog( pMac, LOG1,
2270 FL("Deleted STA AssocID %d staId %d MAC "),
2271 pStaDs->assocId, pStaDs->staIndex);
2272 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2273 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2274 {
2275 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2276 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
2277 {
2278 PELOGE(limLog(pMac, LOGE,
2279 FL("could not Add STA with assocId=%d\n"),
2280 pStaDs->assocId);)
2281 // delete the TS if it has already been added.
2282 // send the response with error status.
2283 if(pStaDs->qos.addtsPresent)
2284 {
2285 tpLimTspecInfo pTspecInfo;
2286 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2287 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2288 {
2289 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2290 NULL, &pTspecInfo->idx);
2291 }
2292 }
2293 limRejectAssociation(pMac,
2294 pStaDs->staAddr,
2295 pStaDs->mlmStaContext.subType,
2296 true, pStaDs->mlmStaContext.authType,
2297 pStaDs->assocId, true,
2298 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2299 psessionEntry);
2300 }
2301 return;
2302 }
2303 }
2304 else
2305 {
2306 limLog( pMac, LOGW,
2307 FL( "DEL STA failed!\n" ));
2308 statusCode = eSIR_SME_REFUSED;
2309 }
2310 end:
2311 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2312 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2313 {
2314 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2315 }
2316 return;
2317}
2318
2319void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2320{
2321 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2322 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2323 tpDphHashNode pStaDs = NULL;
2324 if(NULL == pDelStaParams )
2325 {
2326 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
2327 goto end;
2328 }
2329 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2330 {
2331 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2332 if (pStaDs == NULL)
2333 {
2334 //TODO: any response to be sent out here ?
2335 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"),
2336 pDelStaParams->assocId);
2337 statusCode = eSIR_SME_REFUSED;
2338 goto end;
2339 }
2340 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2341 {
2342 //TODO: any response to be sent out here ?
2343 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s\n" ),
2344 limMlmStateStr(psessionEntry->limMlmState));
2345 statusCode = eSIR_SME_REFUSED;
2346 goto end;
2347 }
2348 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2349 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2350 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X\n"), pDelStaParams->assocId);
2351 //we must complete all cleanup related to delSta before calling limDelBSS.
2352 if( 0 != limMsgQ->bodyptr )
2353 {
2354 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2355 }
2356 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2357 return;
2358 }
2359 else
2360 {
2361 limLog( pMac, LOGW, FL( "DEL_STA failed!\n" ));
2362 statusCode = eSIR_SME_REFUSED;
2363 }
2364end:
2365 if( 0 != limMsgQ->bodyptr )
2366 {
2367 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2368 }
2369 return;
2370}
2371
Jeff Johnson295189b2012-06-20 16:38:30 -07002372void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2373{
2374 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
2375 tpDphHashNode pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
2376 if(pStaDs == NULL)
2377 {
2378 //TODO: any response to be sent out here ?
2379 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
2380 goto end;
2381 }
2382 //
2383 // TODO & FIXME_GEN4
2384 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2385 //
2386 //TODO: any check for pMac->lim.gLimMlmState ?
2387 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2388 {
2389 //TODO: any response to be sent out here ?
2390 limLog( pMac, LOGE,
2391 FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
2392 pStaDs->mlmStaContext.mlmState);
2393 goto end;
2394 }
2395 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2396 {
2397 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
2398 limRejectAssociation(pMac, pStaDs->staAddr,
2399 pStaDs->mlmStaContext.subType,
2400 true, pStaDs->mlmStaContext.authType,
2401 pStaDs->assocId, true,
2402 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2403 psessionEntry);
2404 goto end;
2405 }
2406 pStaDs->bssId = pAddStaParams->bssIdx;
2407 pStaDs->staIndex = pAddStaParams->staIdx;
2408 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2409 pStaDs->valid = 1;
2410 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2411 limLog( pMac, LOG1,
2412 FL("STA AssocID %d staId %d MAC "),
2413 pStaDs->assocId,
2414 pStaDs->staIndex);
2415 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2416
2417 /* For BTAMP-AP, the flow sequence shall be:
2418 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2419 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2420 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2421 */
2422 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2423 // fall though to reclaim the original Add STA Response message
2424end:
2425 if( 0 != limMsgQ->bodyptr )
2426 {
2427 palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
2428 }
2429 return;
2430}
2431
2432/**
2433 * limProcessApMlmAddBssRsp()
2434 *
2435 *FUNCTION:
2436 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2437 * Upon receipt of this message from HAL, MLME -
2438 * > Validates the result of WDA_ADD_BSS_REQ
2439 * > Init other remaining LIM variables
2440 * > Init the AID pool, for that BSSID
2441 * > Init the Pre-AUTH list, for that BSSID
2442 * > Create LIM timers, specific to that BSSID
2443 * > Init DPH related parameters that are specific to that BSSID
2444 * > TODO - When do we do the actual change channel?
2445 *
2446 *LOGIC:
2447 * SME sends eWNI_SME_START_BSS_REQ to LIM
2448 * LIM sends LIM_MLM_START_REQ to MLME
2449 * MLME sends WDA_ADD_BSS_REQ to HAL
2450 * HAL responds with WDA_ADD_BSS_RSP to MLME
2451 * MLME responds with LIM_MLM_START_CNF to LIM
2452 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2453 *
2454 *ASSUMPTIONS:
2455 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2456 * tSirMsgQ.body will now be freed by this routine
2457 *
2458 *NOTE:
2459 *
2460 * @param pMac Pointer to Global MAC structure
2461 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2462 *
2463 * @return None
2464 */
2465static void
2466limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2467{
2468 tLimMlmStartCnf mlmStartCnf;
2469 tANI_U32 val;
2470 tpPESession psessionEntry;
2471// tANI_U8 sessionId;
2472 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2473 if(NULL == pAddBssParams )
2474 {
2475 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
2476 goto end;
2477 }
2478 //TBD: free the memory before returning, do it for all places where lookup fails.
2479 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2480 {
2481 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002482 if( NULL != pAddBssParams )
2483 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 return;
2485 }
2486 /* Update PE session Id*/
2487 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2488 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2489 {
2490 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
2491 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2492 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2493 goto end;
2494 // Set MLME state
2495 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002496 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2498 {
2499 /** IBSS is 'active' when we receive
2500 * Beacon frames from other STAs that are part of same IBSS.
2501 * Mark internal state as inactive until then.
2502 */
2503 psessionEntry->limIbssActive = false;
2504 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2505 limResetHBPktCount( psessionEntry );
2506 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002507 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2509 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
2510 }
2511 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2512
2513#ifdef ANI_PRODUCT_TYPE_AP
2514 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2515#else
2516 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2517#endif
2518
2519#ifdef WLAN_SOFTAP_FEATURE
2520 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2521 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2522 else
2523 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2524#endif
2525 schEdcaProfileUpdate(pMac, psessionEntry);
2526 limInitPreAuthList(pMac);
2527 limInitAIDpool(pMac,psessionEntry);
2528 // Create timers used by LIM
2529 if (!pMac->lim.gLimTimersCreated)
2530 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002531
2532 // Start OLBC timer
2533 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2534 {
2535 limLog(pMac, LOGE, FL("tx_timer_activate failed\n"));
2536 }
2537
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2539 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
2540 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
2541 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2542 // Apply previously set configuration at HW
2543 limApplyConfiguration(pMac,psessionEntry);
2544 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2545 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2546 }
2547 else
2548 {
2549 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
2550 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2551 }
2552 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2553 end:
2554 if( 0 != limMsgQ->bodyptr )
2555 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
2556}
2557
2558
2559/**
2560 * limProcessIbssMlmAddBssRsp()
2561 *
2562 *FUNCTION:
2563 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2564 * Upon receipt of this message from HAL, MLME -
2565 * > Validates the result of WDA_ADD_BSS_REQ
2566 * > Init other remaining LIM variables
2567 * > Init the AID pool, for that BSSID
2568 * > Init the Pre-AUTH list, for that BSSID
2569 * > Create LIM timers, specific to that BSSID
2570 * > Init DPH related parameters that are specific to that BSSID
2571 * > TODO - When do we do the actual change channel?
2572 *
2573 *LOGIC:
2574 * SME sends eWNI_SME_START_BSS_REQ to LIM
2575 * LIM sends LIM_MLM_START_REQ to MLME
2576 * MLME sends WDA_ADD_BSS_REQ to HAL
2577 * HAL responds with WDA_ADD_BSS_RSP to MLME
2578 * MLME responds with LIM_MLM_START_CNF to LIM
2579 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2580 *
2581 *ASSUMPTIONS:
2582 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2583 * tSirMsgQ.body will now be freed by this routine
2584 *
2585 *NOTE:
2586 *
2587 * @param pMac Pointer to Global MAC structure
2588 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2589 *
2590 * @return None
2591 */
2592static void
2593limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2594{
2595 tLimMlmStartCnf mlmStartCnf;
2596 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2597 tANI_U32 val;
2598 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2599 {
2600 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
2601 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2602 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2603 goto end;
2604 // Set MLME state
2605 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002606 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 /** IBSS is 'active' when we receive
2608 * Beacon frames from other STAs that are part of same IBSS.
2609 * Mark internal state as inactive until then.
2610 */
2611 psessionEntry->limIbssActive = false;
2612 limResetHBPktCount( psessionEntry );
2613 /* Timer related functions are not modified for BT-AMP : To be Done */
2614 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002615 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2617 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
2618 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2619 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2620 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2621 schEdcaProfileUpdate(pMac, psessionEntry);
2622 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2623 //limInitPreAuthList(pMac);
2624 limInitAIDpool(pMac,psessionEntry);
2625 // Create timers used by LIM
2626#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2627 if (!pMac->lim.gLimTimersCreated)
2628 limCreateTimers(pMac);
2629#endif
2630 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2631 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
2632 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
2633 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2634 // Apply previously set configuration at HW
2635 limApplyConfiguration(pMac,psessionEntry);
2636 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2637 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2638 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2639 if(true == pMac->lim.gLimIbssCoalescingHappened)
2640 {
2641 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2642 goto end;
2643 }
2644 }
2645 else
2646 {
2647 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),
2648 pAddBssParams->status );
2649 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2650 }
2651 //Send this message to SME, when ADD_BSS is initiated by SME
2652 //If ADD_BSS is done as part of coalescing, this won't happen.
2653 /* Update PE session Id*/
2654 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2655 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2656 end:
2657 if( 0 != limMsgQ->bodyptr )
2658 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
2659}
2660
2661static void
2662limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2663{
2664 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2665 tAniAuthType cfgAuthType, authMode;
2666 tLimMlmAuthReq *pMlmAuthReq;
2667 tpDphHashNode pStaDs = NULL;
2668 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2669 {
2670 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2671 {
2672 // Could not add hash table entry
2673 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
2674 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2675 goto joinFailure;
2676 }
2677 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2678 //Success, handle below
2679 pStaDs->bssId = pAddBssParams->bssIdx;
2680 //STA Index(genr by HAL) for the BSS entry is stored here
2681 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2682 // Trigger Authentication with AP
2683 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2684 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2685 {
2686 /**
2687 * Could not get AuthType from CFG.
2688 * Log error.
2689 */
2690 limLog(pMac, LOGP,
2691 FL("could not retrieve AuthType\n"));
2692 }
2693 if (cfgAuthType == eSIR_AUTO_SWITCH)
2694 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2695 else
2696 authMode = cfgAuthType;
2697
2698 // Trigger MAC based Authentication
2699 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
2700 {
2701 // Log error
2702 limLog(pMac, LOGP,
2703 FL("call to palAllocateMemory failed for mlmAuthReq\n"));
2704 return;
2705 }
2706 #if 0
2707 val = sizeof(tSirMacAddr);
2708 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2709 pMlmAuthReq->peerMacAddr,
2710 &val) != eSIR_SUCCESS)
2711 {
2712 /// Could not get BSSID from CFG. Log error.
2713 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2714 }
2715 #endif //TO SUPPORT BT-AMP
2716 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2717
2718 pMlmAuthReq->authType = authMode;
2719 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2720 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2721 != eSIR_SUCCESS)
2722 {
2723 /**
2724 * Could not get AuthFailureTimeout
2725 * value from CFG. Log error.
2726 */
2727 limLog(pMac, LOGP,
2728 FL("could not retrieve AuthFailureTimeout value\n"));
2729 }
2730 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2731 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2732 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002733 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2735 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2736 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2737 // remember staId in case of assoc timeout/failure handling
2738 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2739
Jeff Johnsone7245742012-09-05 17:12:55 -07002740 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002741 limPostMlmMessage(pMac,
2742 LIM_MLM_AUTH_REQ,
2743 (tANI_U32 *) pMlmAuthReq);
2744 return;
2745 }
2746
2747joinFailure:
2748 {
2749 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002750 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002751
2752 /// Send Join response to Host
2753 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2754
2755 }
2756
2757}
2758
2759#ifdef WLAN_FEATURE_VOWIFI_11R
2760/*------------------------------------------------------------------------------------------
2761 *
2762 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2763 *
2764 *
2765 *------------------------------------------------------------------------------------------
2766 */
2767static inline void
2768limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
2769{
2770 tpDphHashNode pStaDs = NULL;
2771 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2772 tpAddStaParams pAddStaParams = NULL;
2773 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
2774 tLimMlmReassocReq *pMlmReassocReq;
2775 tLimMlmReassocCnf mlmReassocCnf; // keep sme
2776
2777 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2778
2779 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2780 {
2781 goto end;
2782 }
2783
2784 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2785 &psessionEntry->dph.dphHashTable)) == NULL)
2786 {
2787 // Could not add hash table entry
2788 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
2789 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2790 goto end;
2791 }
2792
2793 // Set the filter state to post assoc
2794 if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE,
2795 pAddBssParams->bssId, psessionEntry->selfMacAddr,
2796 NULL, NULL) != eSIR_SUCCESS)
2797 {
2798 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
2799 goto end;
2800 }
2801
2802 // Prepare and send Reassociation request frame
2803 // start reassoc timer.
2804 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2805 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002806 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2808 != TX_SUCCESS)
2809 {
2810 /// Could not start reassoc failure timer.
2811 // Log error
2812 limLog(pMac, LOGP,
2813 FL("could not start Reassociation failure timer\n"));
2814 // Return Reassoc confirm with
2815 // Resources Unavailable
2816 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2817 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2818 goto end;
2819 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002820#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2821 pMac->lim.pSessionEntry = psessionEntry;
2822 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2823 {
2824 /* Take a copy of reassoc request for retrying */
2825 if ( !HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq))) ) goto end;
2826 palZeroMemory(pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq));
2827 palCopyMemory( pMac->hHdd,pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, psessionEntry->pLimMlmReassocReq, sizeof(tLimMlmReassocReq));
2828 }
2829 pMac->lim.reAssocRetryAttempt = 0;
2830#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002831 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002832
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2834 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
2835 PELOGE(limLog(pMac, LOGE, FL("Set the mlm state to %d session=%d\n"),
2836 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2837
2838 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2839
2840 //Success, handle below
2841 pStaDs->bssId = pAddBssParams->bssIdx;
2842 //STA Index(genr by HAL) for the BSS entry is stored here
2843 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2844 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2845 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2846
2847 // Downgrade the EDCA parameters if needed
2848 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
2849
2850 // Send the active EDCA parameters to HAL
2851 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
2852 {
2853 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
2854 }
2855 else
2856 {
2857 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
2858 }
2859
2860#if defined WLAN_FEATURE_VOWIFI
2861 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2862#endif
2863
2864 if( eHAL_STATUS_SUCCESS !=
2865 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2866 {
2867 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2868 return;
2869 }
2870 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2871
2872 /// Add STA context at MAC HW (BMU, RHP & TFP)
2873 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2874 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
2875
2876 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2877 psessionEntry->bssId, sizeof(tSirMacAddr));
2878
2879 // Update this when we get reassoc rsp , with success.
2880 // pAddStaParams->assocId = psessionEntry->limAID;
2881
2882 pAddStaParams->staType = STA_ENTRY_SELF;
2883 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2884 pAddStaParams->respReqd = 1;
2885
2886 /* Update PE session ID */
2887 pAddStaParams->sessionId = psessionEntry->peSessionId;
2888
2889 // This will indicate HAL to "allocate" a new STA index
2890 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2891 pAddStaParams->updateSta = FALSE;
2892
2893 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002894#ifdef WLAN_FEATURE_11AC
2895 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
2896#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002897 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002898#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002899
Jeff Johnsone7245742012-09-05 17:12:55 -07002900 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002901 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002902 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002903#ifdef DISABLE_GF_FOR_INTEROP
2904 /*
2905 * To resolve the interop problem with Broadcom AP,
2906 * where TQ STA could not pass traffic with GF enabled,
2907 * TQ STA will do Greenfield only with TQ AP, for
2908 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002909 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2911 {
2912 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2913 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2914 }
2915 else
2916#endif
2917
2918#ifdef WLAN_SOFTAP_FEATURE
2919 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2920 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2921 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2922 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2923 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2924 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2925 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2926 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2927 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2928 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2929 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2930 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
2931#else
2932 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
2933 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
2934 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
2935 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
2936 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
2937 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
2938 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
2939 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
2940 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
2941 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
2942 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
2943 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
2944#endif
2945 }
2946
2947 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
2948 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
2949 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2950
2951 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2952
2953 // Lets save this for when we receive the Reassoc Rsp
2954 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
2955 return;
2956
2957end:
2958 // Free up buffer allocated for reassocReq
2959 if (pMlmReassocReq != NULL)
2960 {
2961 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
2962 }
2963 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2964 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2965 /* Update PE sessio Id*/
2966 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2967
2968 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2969}
2970#endif /* WLAN_FEATURE_VOWIFI_11R */
2971
2972
2973/**
2974 * limProcessStaMlmAddBssRsp()
2975 *
2976 *FUNCTION:
2977 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2978 * Upon receipt of this message from HAL, MLME -
2979 * > Validates the result of WDA_ADD_BSS_REQ
2980 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2981 *
2982 *LOGIC:
2983 * MLME had sent WDA_ADD_BSS_REQ to HAL
2984 * HAL responded with WDA_ADD_BSS_RSP to MLME
2985 * MLME now sends WDA_ADD_STA_REQ to HAL
2986 *
2987 *ASSUMPTIONS:
2988 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2989 * tSirMsgQ.body will now be freed by this routine
2990 *
2991 *NOTE:
2992 *
2993 * @param pMac Pointer to Global MAC structure
2994 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2995 *
2996 * @return None
2997 */
2998static void
2999limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3000{
3001 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3002 tLimMlmAssocCnf mlmAssocCnf;
3003 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3004 tANI_U32 subType = LIM_ASSOC;
3005 tpDphHashNode pStaDs = NULL;
3006 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3007 tANI_U8 updateSta = false;
3008 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3009
3010 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3011 {
3012 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
3013 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3014 goto end;
3015 }
3016 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3017 {
3018 mesgType = LIM_MLM_REASSOC_CNF;
3019 subType = LIM_REASSOC;
3020 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3021 //to update the existing STA entry.
3022 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3023 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3024 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3025 {
3026 staIdx = psessionEntry->staId;
3027 updateSta = true;
3028 }
3029 }
3030 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3031 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003032#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3034 {
3035#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3036 PELOGE(limLog(pMac, LOGE, FL("Mlm=%d %d\n"),
3037 psessionEntry->limMlmState,
3038 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3039#endif
3040 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3041 goto end;
3042 }
3043#endif /* WLAN_FEATURE_VOWIFI_11R */
3044
3045 // Set MLME state
3046 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003047 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003048 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3049 // Now, send WDA_ADD_STA_REQ
3050 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
3051 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3052 if (pStaDs == NULL)
3053 {
3054 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3055 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3056 }
3057 else
3058 {
3059 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3060 //Success, handle below
3061 pStaDs->bssId = pAddBssParams->bssIdx;
3062 //STA Index(genr by HAL) for the BSS entry is stored here
3063 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3064 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3065 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3066 // Downgrade the EDCA parameters if needed
3067 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3068 // Send the active EDCA parameters to HAL
3069 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3070 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3071 } else {
3072 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3073 }
3074#if defined WLAN_FEATURE_VOWIFI
3075 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3076#endif
3077
3078 if (subType == LIM_REASSOC)
3079 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3080 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3081 {
3082 // Add STA context at HW
3083 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3084 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3085 }
3086 }
3087 }
3088 else
3089 {
3090 limLog( pMac, LOGP, FL( "ADD_BSS failed!\n" ));
3091 // Return Assoc confirm to SME with failure
3092 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3093 }
3094
3095 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3096 {
3097 /* Update PE session Id*/
3098 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3099 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3100 }
3101 end:
3102 if( 0 != limMsgQ->bodyptr )
3103 palFreeMemory( pMac->hHdd,(void *) pAddBssParams );
3104}
3105
3106
3107
3108/**
3109 * limProcessMlmAddBssRsp()
3110 *
3111 *FUNCTION:
3112 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3113 * Upon receipt of this message from HAL, MLME -
3114 * > Determines the "state" in which this message was received
3115 * > Forwards it to the appropriate callback
3116 *
3117 *LOGIC:
3118 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3119 * in the following two states:
3120 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3121 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3122 * Based on these two states, this API will determine where to
3123 * route the message to
3124 *
3125 *ASSUMPTIONS:
3126 *
3127 *NOTE:
3128 *
3129 * @param pMac Pointer to Global MAC structure
3130 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3131 *
3132 * @return None
3133 */
3134void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3135{
3136 tLimMlmStartCnf mlmStartCnf;
3137 tpPESession psessionEntry;
3138 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3139
3140 if(NULL == pAddBssParams )
3141 {
3142 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
3143 return;
3144 }
3145
3146 //
3147 // TODO & FIXME_GEN4
3148 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3149 //
3150 //we need to process the deferred message since the initiating req. there might be nested request.
3151 //in the case of nested request the new request initiated from the response will take care of resetting
3152 //the deffered flag.
3153 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3154 // Validate SME/LIM state
3155 // Validate MLME state
3156 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3157 {
3158 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003159 if( NULL != pAddBssParams )
3160 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003161 return;
3162 }
3163 /* update PE session Id*/
3164 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3165 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3166 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3167 else
3168 {
3169 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3170 {
3171 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3172 {
3173 // Mesg received from HAL in Invalid state!
3174 limLog( pMac, LOGE,
3175 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X\n" ),
3176 psessionEntry->limMlmState );
3177 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3178 if( 0 != limMsgQ->bodyptr )
3179 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
3180 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3181 }
3182 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3183 {
3184 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3185 }
3186 else
3187 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3188 }
3189 else
3190 /* Called while processing assoc response */
3191 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3192 }
3193}
3194/**
3195 * limProcessMlmSetKeyRsp()
3196 *
3197 *FUNCTION:
3198 * This function is called to process the following two
3199 * messages from HAL:
3200 * 1) WDA_SET_BSSKEY_RSP
3201 * 2) WDA_SET_STAKEY_RSP
3202 * 3) WDA_SET_STA_BCASTKEY_RSP
3203 * Upon receipt of this message from HAL,
3204 * MLME -
3205 * > Determines the "state" in which this message was received
3206 * > Forwards it to the appropriate callback
3207 *
3208 *LOGIC:
3209 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3210 * received by MLME while in the following state:
3211 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3212 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3213 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3214 * Based on this state, this API will determine where to
3215 * route the message to
3216 *
3217 *ASSUMPTIONS:
3218 * ONLY the MLME state is being taken into account for now.
3219 * This is because, it appears that the handling of the
3220 * SETKEYS REQ is handled symmetrically on both the AP & STA
3221 *
3222 *NOTE:
3223 *
3224 * @param pMac Pointer to Global MAC structure
3225 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3226 *
3227 * @return None
3228 */
3229void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3230{
Jeff Johnsone7245742012-09-05 17:12:55 -07003231 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 tLimMlmSetKeysCnf mlmSetKeysCnf;
3233 tANI_U8 sessionId = 0;
3234 tpPESession psessionEntry;
3235 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3236 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3237 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003238 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 {
3240 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3241 return;
3242 }
3243 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3244 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3245 {
3246 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003247 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return;
3249 }
3250 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3251 {
3252 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 // There's not much that MLME can do at this stage...
3255 respReqd = 0;
3256 }
3257 else
3258 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3259
3260 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3261 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003263 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 if( respReqd )
3265 {
3266 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3267 // Prepare and Send LIM_MLM_SETKEYS_CNF
3268 if( NULL != lpLimMlmSetKeysReq )
3269 {
3270 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3271#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003272 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003273#endif
3274 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003275 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 pMac->lim.gpLimMlmSetKeysReq = NULL;
3277 }
3278 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003279 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 }
3281}
3282void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3283{
3284 tANI_U8 respReqd = 1;
3285 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003286 tANI_U16 resultCode;
3287 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 tpPESession psessionEntry;
3289 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3290 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3291 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003292 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 {
3294 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
3295 return;
3296 }
3297 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3298 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3299 {
3300 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003301 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 return;
3303 }
3304 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3305 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3306 else
3307 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3308
Jeff Johnsone7245742012-09-05 17:12:55 -07003309 //
3310 // TODO & FIXME_GEN4
3311 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3312 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3314 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3315 //{
3316 // Validate MLME state
3317 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3318 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3319 {
3320 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003321 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 // There's not much that MLME can do at this stage...
3323 respReqd = 0;
3324 }
3325 else
3326 mlmSetKeysCnf.resultCode = resultCode;
3327
3328 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3329 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3331
Jeff Johnsone7245742012-09-05 17:12:55 -07003332 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 if( respReqd )
3334 {
3335 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3336 mlmSetKeysCnf.sessionId = sessionId;
3337
3338 // Prepare and Send LIM_MLM_SETKEYS_CNF
3339 if( NULL != lpLimMlmSetKeysReq )
3340 {
3341 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3342#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003344#endif
3345 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 pMac->lim.gpLimMlmSetKeysReq = NULL;
3348 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003349 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 }
3351}
3352/**
3353 * limProcessMlmRemoveKeyRsp()
3354 *
3355 *FUNCTION:
3356 *
3357 *LOGIC:
3358 *
3359 *ASSUMPTIONS:
3360 *
3361 *NOTE:
3362 *
3363 * @param pMac Pointer to Global MAC structure
3364 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3365 *
3366 * @return None
3367 */
3368void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3369{
Jeff Johnsone7245742012-09-05 17:12:55 -07003370 tANI_U8 respReqd = 1;
3371 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3372 tANI_U16 resultCode;
3373 tANI_U8 sessionId = 0;
3374 tpPESession psessionEntry;
3375 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3376 palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ));
3377
3378 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003380 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3381 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 }
3383
Jeff Johnsone7245742012-09-05 17:12:55 -07003384 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3385 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3386 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3387 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003388
Jeff Johnsone7245742012-09-05 17:12:55 -07003389 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003391 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
3392 return;
3393 }
3394
3395 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3396 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3397 else
3398 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3399
3400 // Validate MLME state
3401 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3402 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3403 {
3404 // Mesg received from HAL in Invalid state!
3405 limLog(pMac, LOGW,
3406 FL("Received unexpected [Mesg Id - %d] in state %X\n"),
3407 limMsgQ->type,
3408 psessionEntry->limMlmState );
3409 respReqd = 0;
3410 }
3411 else
3412 mlmRemoveCnf.resultCode = resultCode;
3413
3414 //
3415 // TODO & FIXME_GEN4
3416 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3417 //
3418
3419 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3420
3421 // Restore MLME state
3422 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3423 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3424
3425 if( respReqd )
3426 {
3427 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3428 mlmRemoveCnf.sessionId = sessionId;
3429
3430 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3431 if( NULL != lpLimMlmRemoveKeyReq )
3432 {
3433 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3434 sizeof( tSirMacAddr ));
3435 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
3436 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
3437 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3438 }
3439 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3440 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003441}
3442
3443#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
3444/**----------------------------------------------------
3445\fn __limProcessFinishLearnRsp
3446\brief Handle finish learn rsp state, only for AP.
3447\param pMac
3448\return NONE
3449-----------------------------------------------------*/
3450static void __limProcessFinishLearnRsp(tpAniSirGlobal pMac)
3451{
3452 PELOG2(limLog(pMac, LOG2, FL("System Role: %d\n"), pMac->lim.gLimSystemRole);)
3453 if (pMac->lim.gpLimMeasReq == NULL)
3454 {
3455 limRestorePreLearnState(pMac);
3456 return;
3457 }
3458 /**
3459 * Initial measurement -> periodic measurement should keep enabled, so that
3460 * if system Role is UNKNOWN LIM can send indication to WSM. Overloading
3461 * periodic measurement to distinguish initial measurement and radar
3462 * detect park basically to avoid sending measurement indication after
3463 * radar detect park.
3464 * Radar detect park -> periodic measurement should be disabled, so that
3465 * LIM wont send indication even when role is UNKNOWN.
3466 * Final measurement -> periodic measurement should be enabled, so that
3467 * LIM could start measurement indication timer.
3468 */
3469 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled &&
3470 !pMac->lim.gLimMeasParams.isMeasIndTimerActive)
3471 {
3472#if 0 /* Will we be ever in UNKNOWN ROLE: Veerendra */
3473 if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
3474 {
3475 limSendSmeMeasurementInd(pMac);
3476 limCleanupMeasResources(pMac);
3477 limRestorePreLearnState(pMac);
3478 return;
3479 }
3480 else
3481#endif
3482 {
3483#ifdef GEN6_TODO
3484 /* revisit this piece of code to assign the appropriate sessionId below
3485 * priority - MEDIUM
3486 */
3487 pMac->lim.gLimMeasParams.measurementIndTimer.sessionId = sessionId;
3488#endif
3489 // Activate periodic measurement indication timer
3490 if (tx_timer_activate(
3491 &pMac->lim.gLimMeasParams.measurementIndTimer)
3492 != TX_SUCCESS)
3493 {
3494 limLog(pMac, LOGP, FL("could not start Meas IND timer\n"));
3495 return;
3496 }
3497 pMac->lim.gLimMeasParams.isMeasIndTimerActive = 1;
3498 }
3499 }
3500 if (pMac->lim.gLimMeasParams.nextLearnChannelId >=
3501 pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
3502 {
3503 // All channels in the channel set are learned.
3504 pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
3505 }
3506 // Go back to previous state.
3507 limRestorePreLearnState(pMac);
3508 // Restart the learn interval timer.
3509 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
3510 limReEnableLearnMode(pMac);
3511 return;
3512}
3513#endif
3514
3515/** ---------------------------------------------------------------------
3516\fn limProcessInitScanRsp
3517\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3518\ message from HAL. If status code is failure, then
3519\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3520\param tpAniSirGlobal pMac
3521\param tANI_U32 body
3522\return none
3523\ ----------------------------------------------------------------------- */
3524void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3525{
3526 tpInitScanParams pInitScanParam;
3527 eHalStatus status;
3528#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3529 tANI_U8 channelNum;
3530#endif
3531 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3532 pInitScanParam = (tpInitScanParams) body;
3533 status = pInitScanParam->status;
3534 palFreeMemory( pMac->hHdd, (char *)body);
3535
3536 //Only abort scan if the we are scanning.
3537 if( pMac->lim.abortScan &&
3538 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3539 {
3540 limLog( pMac, LOGW, FL(" finish scan\n") );
3541 pMac->lim.abortScan = 0;
3542 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3543 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3544 //Set the resume channel to Any valid channel (invalid).
3545 //This will instruct HAL to set it to any previous valid channel.
3546 peSetResumeChannel(pMac, 0, 0);
3547 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3548 }
3549 switch(pMac->lim.gLimHalScanState)
3550 {
3551 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3552 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3553 {
3554 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d\n"), status);)
3555 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3556 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3557 /*
3558 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3559 * another Scan request in the same context (happens when 11d is enabled
3560 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3561 * scan in the same context but with bigger channel list), so the state needs to be
3562 * changed before this response message is sent.
3563 */
3564 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3565#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3566 /* For handling the measurement request from WSM as scan request in LIM*/
3567#if 0
3568 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
3569 {
3570 limRestorePreLearnState(pMac);
3571 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3572 limReEnableLearnMode(pMac);
3573 }
3574#endif
3575#endif
3576 return;
3577 }
3578 else if (status == eHAL_STATUS_SUCCESS)
3579 {
3580 /* since we have successfully triggered a background scan,
3581 * reset the "consecutive bkgnd scan failure" count to 0
3582 */
3583 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3584 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3585 }
3586 limContinueChannelScan(pMac);
3587 break;
3588#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3589 case eLIM_HAL_INIT_LEARN_WAIT_STATE:
3590// if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3591 {
3592 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3593 {
3594 limRestorePreLearnState(pMac);
3595 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3596 limReEnableLearnMode(pMac);
3597 return;
3598 }
3599 channelNum = limGetCurrentLearnChannel(pMac);
3600 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
3601 }
3602 break;
3603#endif
3604//WLAN_SUSPEND_LINK Related
3605 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3606 if( pMac->lim.gpLimSuspendCallback )
3607 {
3608 if( status == eHAL_STATUS_SUCCESS )
3609 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
3610 else
3611 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3612
3613 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3614 pMac->lim.gpLimSuspendCallback = NULL;
3615 pMac->lim.gpLimSuspendData = NULL;
3616 }
3617 else
3618 {
3619 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state\n");
3620 return;
3621 }
3622 break;
3623//end WLAN_SUSPEND_LINK Related
3624 default:
3625 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d\n"),
3626 pMac->lim.gLimHalScanState);
3627 break;
3628 }
3629 return;
3630}
3631/**
3632 * limProcessSwitchChannelReAssocReq()
3633 *
3634 *FUNCTION:
3635 * This function is called to send the reassoc req mgmt frame after the
3636 * switchChannelRsp message is received from HAL.
3637 *
3638 *LOGIC:
3639 *
3640 *ASSUMPTIONS:
3641 * NA
3642 *
3643 *NOTE:
3644 * NA
3645 *
3646 * @param pMac - Pointer to Global MAC structure.
3647 * @param psessionEntry - session related information.
3648 * @param status - channel switch success/failure.
3649 *
3650 * @return None
3651 */
3652static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3653{
3654 tLimMlmReassocCnf mlmReassocCnf;
3655 tLimMlmReassocReq *pMlmReassocReq;
3656 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3657 if(pMlmReassocReq == NULL)
3658 {
3659 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession\n"));
3660 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3661 goto end;
3662 }
3663
3664 if(status != eHAL_STATUS_SUCCESS)
3665 {
3666 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3667 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3668 goto end;
3669 }
3670 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003671 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3673 != TX_SUCCESS)
3674 {
3675 /// Could not start reassoc failure timer.
3676 // Log error
3677 limLog(pMac, LOGP,
3678 FL("could not start Reassociation failure timer\n"));
3679 // Return Reassoc confirm with
3680 // Resources Unavailable
3681 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3682 goto end;
3683 }
3684 /// Prepare and send Reassociation request frame
3685 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3686 return;
3687end:
3688 // Free up buffer allocated for reassocReq
3689 if(pMlmReassocReq != NULL)
3690 {
3691 /* Update PE session Id*/
3692 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
3693 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
3694 }
3695 else
3696 {
3697 mlmReassocCnf.sessionId = 0;
3698 }
3699
3700 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3701 /* Update PE sessio Id*/
3702 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3703
3704 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3705}
3706/**
3707 * limProcessSwitchChannelJoinReq()
3708 *
3709 *FUNCTION:
3710 * This function is called to send the probe req mgmt frame after the
3711 * switchChannelRsp message is received from HAL.
3712 *
3713 *LOGIC:
3714 *
3715 *ASSUMPTIONS:
3716 * NA
3717 *
3718 *NOTE:
3719 * NA
3720 *
3721 * @param pMac - Pointer to Global MAC structure.
3722 * @param psessionEntry - session related information.
3723 * @param status - channel switch success/failure.
3724 *
3725 * @return None
3726 */
3727static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3728{
3729 tANI_U32 val;
3730 tSirMacSSid ssId;
3731 tLimMlmJoinCnf mlmJoinCnf;
3732 if(status != eHAL_STATUS_SUCCESS)
3733 {
3734 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3735 goto error;
3736 }
3737
3738 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3739 {
3740 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!\n"));)
3741 goto error;
3742 }
3743
Jeff Johnsone7245742012-09-05 17:12:55 -07003744
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3746 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3747 {
3748 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3749 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3750 goto error;
3751 }
3752 else
3753 {
3754 if(limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
3755 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3756 goto error;
3757 }
3758 // Update BSSID at CFG database
3759#if 0
3760 if (cfgSetStr(pMac, WNI_CFG_BSSID, pMac->lim.gpLimMlmJoinReq->bssDescription.bssId,
3761 sizeof(tSirMacAddr))
3762 != eSIR_SUCCESS)
3763 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
3764#endif //TO SUPPORT BT-AMP
3765 //sirCopyMacAddr(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,psessionEntry->bssId);
3766
3767 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3768 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
3769 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!\n"));
3770 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3771 // Apply previously set configuration at HW
3772 limApplyConfiguration(pMac, psessionEntry);
3773 /// Wait for Beacon to announce join success
3774#if 0
3775 if (cfgGetStr(pMac, WNI_CFG_SSID, ssId.ssId, &cfgLen) != eSIR_SUCCESS)
3776 limLog(pMac, LOGP, FL("could not retrive SSID\n"));
3777#endif //To SUPPORT BT-AMP
3778 palCopyMemory( pMac->hHdd, ssId.ssId,
3779 psessionEntry->ssId.ssId,
3780 psessionEntry->ssId.length);
3781 ssId.length = psessionEntry->ssId.length;
3782 // include additional IE if there is
3783 limSendProbeReqMgmtFrame( pMac, &ssId,
3784 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3785 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3786 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003787
3788 // Sending mgmt frame is a blocking call activate Join failure timer now
3789 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3790 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3791 {
3792 limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
3793 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3794 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3795 //memory is freed up below.
3796 psessionEntry->pLimMlmJoinReq = NULL;
3797 goto error;
3798 }
3799
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 return;
3801error:
3802 if(NULL != psessionEntry)
3803 {
3804 palFreeMemory( pMac->hHdd, (tANI_U8 *) (psessionEntry->pLimMlmJoinReq));
3805 psessionEntry->pLimMlmJoinReq = NULL;
3806 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3807 }
3808 else
3809 {
3810 mlmJoinCnf.sessionId = 0;
3811 }
3812 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3813 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3814 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3815}
3816
3817/**
3818 * limProcessSwitchChannelRsp()
3819 *
3820 *FUNCTION:
3821 * This function is called to process switchChannelRsp message from HAL.
3822 *
3823 *LOGIC:
3824 *
3825 *ASSUMPTIONS:
3826 * NA
3827 *
3828 *NOTE:
3829 * NA
3830 *
3831 * @param pMac - Pointer to Global MAC structure
3832 * @param body - message body.
3833 *
3834 * @return None
3835 */
3836void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3837{
3838 tpSwitchChannelParams pChnlParams = NULL;
3839 eHalStatus status;
3840 tANI_U16 channelChangeReasonCode;
3841 tANI_U8 peSessionId;
3842 tpPESession psessionEntry;
3843 //we need to process the deferred message since the initiating req. there might be nested request.
3844 //in the case of nested request the new request initiated from the response will take care of resetting
3845 //the deffered flag.
3846 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3847 pChnlParams = (tpSwitchChannelParams) body;
3848 status = pChnlParams->status;
3849 peSessionId = pChnlParams->peSessionId;
3850 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3851 {
3852 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3853 limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
3854 return;
3855 }
3856#if defined WLAN_FEATURE_VOWIFI
3857 //HAL fills in the tx power used for mgmt frames in this field.
3858 //Store this value to use in TPC report IE.
3859 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3860#endif
3861 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3862 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3863 // initialize it back to invalid id
3864 psessionEntry->channelChangeReasonCode = 0xBAD;
3865 switch(channelChangeReasonCode)
3866 {
3867 case LIM_SWITCH_CHANNEL_REASSOC:
3868 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3869 break;
3870 case LIM_SWITCH_CHANNEL_JOIN:
3871 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3872 break;
3873
3874 case LIM_SWITCH_CHANNEL_OPERATION:
3875 /*
3876 * The above code should also use the callback.
3877 * mechanism below, there is scope for cleanup here.
3878 * THat way all this response handler does is call the call back
3879 * We can get rid of the reason code here.
3880 */
3881 if (pMac->lim.gpchangeChannelCallback)
3882 {
3883 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back\n");)
3884 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3885 }
3886 break;
3887 default:
3888 break;
3889 }
3890}
3891/**
3892 * limProcessStartScanRsp()
3893 *
3894 *FUNCTION:
3895 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3896 * then it will start scan/learn on the next channel.
3897 *
3898 *LOGIC:
3899 *
3900 *ASSUMPTIONS:
3901 * NA
3902 *
3903 *NOTE:
3904 * NA
3905 *
3906 * @param pMac - Pointer to Global MAC structure
3907 * @param body - message body.
3908 *
3909 * @return None
3910 */
3911
3912void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3913{
3914 tpStartScanParams pStartScanParam;
3915 eHalStatus status;
3916 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3917 pStartScanParam = (tpStartScanParams) body;
3918 status = pStartScanParam->status;
3919#if defined WLAN_FEATURE_VOWIFI
3920 //HAL fills in the tx power used for mgmt frames in this field.
3921 //Store this value to use in TPC report IE.
3922 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3923 //Store start TSF of scan start. This will be stored in BSS params.
3924 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3925#endif
3926 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3927 if( pMac->lim.abortScan )
3928 {
3929 limLog( pMac, LOGW, FL(" finish scan\n") );
3930 pMac->lim.abortScan = 0;
3931 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3932 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3933 //Set the resume channel to Any valid channel (invalid).
3934 //This will instruct HAL to set it to any previous valid channel.
3935 peSetResumeChannel(pMac, 0, 0);
3936 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3937 }
3938 switch(pMac->lim.gLimHalScanState)
3939 {
3940 case eLIM_HAL_START_SCAN_WAIT_STATE:
3941 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3942 {
3943 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d\n"), status);)
3944 //
3945 // FIXME - With this, LIM will try and recover state, but
3946 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3947 // status back to the SME
3948 //
3949 //Set the resume channel to Any valid channel (invalid).
3950 //This will instruct HAL to set it to any previous valid channel.
3951 peSetResumeChannel(pMac, 0, 0);
3952 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3953 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3954 }
3955 else
3956 {
3957 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3958 limContinuePostChannelScan(pMac);
3959 }
3960 break;
3961#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3962 case eLIM_HAL_START_LEARN_WAIT_STATE:
3963 // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3964 {
3965 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3966 {
3967 //Set the resume channel to Any valid channel (invalid).
3968 //This will instruct HAL to set it to any previous valid channel.
3969 peSetResumeChannel(pMac, 0, 0);
3970 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
3971 }
3972 else
3973 {
3974 limContinueChannelLearn(pMac);
3975 }
3976 }
3977 break;
3978#endif
3979 default:
3980 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d\n"),
3981 pMac->lim.gLimHalScanState);
3982 break;
3983 }
3984 return;
3985}
3986void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3987{
3988 tpEndScanParams pEndScanParam;
3989 eHalStatus status;
3990#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3991 tANI_U8 channelNum;
3992#endif
3993 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3994 pEndScanParam = (tpEndScanParams) body;
3995 status = pEndScanParam->status;
3996 palFreeMemory( pMac->hHdd, (char *)body);
3997 switch(pMac->lim.gLimHalScanState)
3998 {
3999 case eLIM_HAL_END_SCAN_WAIT_STATE:
4000 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4001 {
4002 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4003 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4004 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4005 }
4006 else
4007 {
Jeff Johnsone7245742012-09-05 17:12:55 -07004008 //Skip Dfs Channel in case of P2P Search
4009 //If skipDfsChnlInP2pSearch is set in ini
4010 if( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
4011 pMac->lim.gpLimMlmScanReq->p2pSearch &&
4012 pMac->lim.gpLimMlmScanReq->skipDfsChnlInP2pSearch )
4013 {
4014 int flag = 0;
4015 while(!flag)
4016 {
4017 pMac->lim.gLimCurrentScanChannelId++;
4018 if( (pMac->lim.gLimCurrentScanChannelId >
4019 (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))||
4020 (limActiveScanAllowed(pMac, limGetCurrentScanChannel(pMac))))
4021 {
4022 flag=1; //Bail out from here
4023 }
4024 }
4025 }
4026 else
4027 {
4028 pMac->lim.gLimCurrentScanChannelId++;
4029 }
4030
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 limContinueChannelScan(pMac);
4032 }
4033 break;
4034#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4035 case eLIM_HAL_END_LEARN_WAIT_STATE:
4036 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4037 {
4038 //Set the resume channel to Any valid channel (invalid).
4039 //This will instruct HAL to set it to any previous valid channel.
4040 peSetResumeChannel(pMac, 0, 0);
4041 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4042 }
4043#if 0 /* Will we be in UNKNOWN ROLE ever in this context: Veerendra */
4044 else if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
4045 {
4046 /** Before starting BSS, we do complete set of measurement before putting
4047 * softmac back into normal mode.
4048 */
4049 channelNum = limGetCurrentLearnChannel(pMac);
4050 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
4051 }
4052 else
4053#endif
4054 {
4055 limLog(pMac, LOGW, FL("ERROR! This state is set only when AP in UNKNOWN_ROLE\n"),
4056 pMac->lim.gLimHalScanState);
4057 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4058 }
4059 break;
4060#endif
4061 default:
4062 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d\n"),
4063 pMac->lim.gLimHalScanState);
4064 break;
4065 }
4066 return;
4067}
Jeff Johnsone7245742012-09-05 17:12:55 -07004068/**
4069 * limStopTxAndSwitch()
4070 *
4071 *FUNCTION:
4072 * Start channel switch on all sessions that is in channel switch state.
4073 *
4074 * @param pMac - pointer to global adapter context
4075 *
4076 * @return None
4077 *
4078 */
4079static void
4080limStopTxAndSwitch (tpAniSirGlobal pMac)
4081{
4082 tANI_U8 i;
4083
4084 for(i =0; i < pMac->lim.maxBssId; i++)
4085 {
4086 if(pMac->lim.gpSession[i].valid &&
4087 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4088 {
4089 limStopTxAndSwitchChannel(pMac, i);
4090 }
4091 }
4092 return;
4093}
4094/**
4095 * limStartQuietOnSession()
4096 *
4097 *FUNCTION:
4098 * This function is called to start quiet timer after finish scan if there is
4099 * qeuieting on any session.
4100 *
4101 *LOGIC:
4102 *
4103 *ASSUMPTIONS:
4104 * NA
4105 *
4106 *NOTE:
4107 * NA
4108 *
4109 * @param pMac - Pointer to Global MAC structure
4110 *
4111 * @return None
4112 */
4113static void
4114limStartQuietOnSession (tpAniSirGlobal pMac)
4115{
4116 tANI_U8 i;
4117
4118 for(i =0; i < pMac->lim.maxBssId; i++)
4119 {
4120 if(pMac->lim.gpSession[i].valid &&
4121 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4122 {
4123 limStartQuietTimer(pMac, i);
4124 }
4125 }
4126 return;
4127}
Jeff Johnson295189b2012-06-20 16:38:30 -07004128void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4129{
4130 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 eHalStatus status;
4132 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4133 pFinishScanParam = (tpFinishScanParams) body;
4134 status = pFinishScanParam->status;
4135 palFreeMemory( pMac->hHdd, (char *)body);
4136 switch(pMac->lim.gLimHalScanState)
4137 {
4138 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4139 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4140 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004141 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004142 {
4143 /** Right time to stop tx and start the timer for channel switch */
4144 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4145 * be any associated session id
4146 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004147 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004148 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004149 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 {
4151 /** Start the quieting */
4152 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4153 * be any associated session id
4154 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004155 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 }
4157#ifdef ANI_PRODUCT_TYPE_AP
4158 /* For handling the measurement request from WSM as scan request in LIM*/
4159#if 0
4160 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
4161 {
4162 limSendSmeMeasurementInd(pMac);
4163 limCleanupMeasResources(pMac);
4164 limRestorePreLearnState(pMac);
4165 }
4166#endif
4167#endif
4168 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4169 {
4170 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4171 }
4172 break;
4173#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4174 case eLIM_HAL_FINISH_LEARN_WAIT_STATE:
4175 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4176 __limProcessFinishLearnRsp(pMac);
4177 break;
4178#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4179//WLAN_SUSPEND_LINK Related
4180 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4181 if( pMac->lim.gpLimResumeCallback )
4182 {
4183 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4184 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4185 pMac->lim.gpLimResumeCallback = NULL;
4186 pMac->lim.gpLimResumeData = NULL;
4187 pMac->lim.gLimSystemInScanLearnMode = 0;
4188 }
4189 else
4190 {
4191 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state\n");
4192 return;
4193 }
4194 break;
4195//end WLAN_SUSPEND_LINK Related
4196
4197 default:
4198 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d\n"),
4199 pMac->lim.gLimHalScanState);
4200 break;
4201 }
4202 return;
4203}
4204/**
4205 * @function : limProcessMlmHalAddBARsp
4206 *
4207 * @brief: Process WDA_ADDBA_RSP coming from HAL
4208 *
4209 *
4210 * @param pMac The global tpAniSirGlobal object
4211 *
4212 * @param tSirMsgQ The MsgQ header containing the response buffer
4213 *
4214 * @return none
4215 */
4216void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4217 tpSirMsgQ limMsgQ )
4218{
4219 // Send LIM_MLM_ADDBA_CNF to LIM
4220 tpLimMlmAddBACnf pMlmAddBACnf;
4221 tpPESession psessionEntry;
4222 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
4223#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4224 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4225#endif //FEATURE_WLAN_DIAG_SUPPORT
4226 //now LIM can process any defer message.
4227 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4228 if (pAddBAParams == NULL) {
4229 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL\n"));)
4230 return;
4231 }
4232 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4233 {
4234 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d\n"),pAddBAParams->sessionId );)
4235 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4236 return;
4237 }
4238#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4239 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4240#endif //FEATURE_WLAN_DIAG_SUPPORT
4241
4242 // Allocate for LIM_MLM_ADDBA_CNF
4243 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4244 (void **) &pMlmAddBACnf, sizeof( tLimMlmAddBACnf ))) {
4245 limLog( pMac, LOGP, FL(" palAllocateMemory failed with error code %d\n"));
4246 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4247 return;
4248 }
4249 palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
4250 // Copy the peer MAC
4251 palCopyMemory( pMac->hHdd, pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4252 sizeof( tSirMacAddr ));
4253 // Copy other ADDBA Rsp parameters
4254 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4255 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4256 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4257 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4258 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4259 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4260 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4261 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4262 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4263 else
4264 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4265 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4266 // Send ADDBA CNF to LIM
4267 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4268}
4269/**
4270 * \brief Process LIM_MLM_ADDBA_CNF
4271 *
4272 * \sa limProcessMlmAddBACnf
4273 *
4274 * \param pMac The global tpAniSirGlobal object
4275 *
4276 * \param tSirMsgQ The MsgQ header containing the response buffer
4277 *
4278 * \return none
4279 */
4280void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4281 tANI_U32 *pMsgBuf )
4282{
4283tpLimMlmAddBACnf pMlmAddBACnf;
4284tpDphHashNode pSta;
4285tANI_U16 aid;
4286tLimBAState curBaState;
4287tpPESession psessionEntry = NULL;
4288if(pMsgBuf == NULL)
4289{
4290 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4291 return;
4292}
4293pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4294 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4295 {
4296 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004297 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 return;
4299 }
4300 // First, extract the DPH entry
4301 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4302 if( NULL == pSta )
4303 {
4304 PELOGE(limLog( pMac, LOGE,
4305 FL( "STA context not found - ignoring ADDBA CNF from HAL\n" ));)
4306 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4307 return;
4308 }
4309 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4310 // Need to validate SME state
4311 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4312 {
4313 PELOGE(limLog( pMac, LOGE,
4314 FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
4315 curBaState );)
Jeff Johnsone7245742012-09-05 17:12:55 -07004316 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 return;
4318 }
4319 // Restore STA BA state
4320 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004321 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004322 {
4323 // Update LIM internal cache...
4324 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4325 {
4326 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4327 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4328 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4329 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4330 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4331 }
4332 else
4333 {
4334 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4335 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4336 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4337 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4338 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4339 }
4340 }
4341 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4342 {
4343 //
4344 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4345 // status code. MLME will then send an ADDBA RSP
4346 // over the air to the peer MAC entity
4347 //
4348 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4349 pMlmAddBACnf->peerMacAddr,
4350 pMlmAddBACnf->addBAResultCode,
4351 pMlmAddBACnf->baDialogToken,
4352 (tANI_U8) pMlmAddBACnf->baTID,
4353 (tANI_U8) pMlmAddBACnf->baPolicy,
4354 pMlmAddBACnf->baBufferSize,
4355 pMlmAddBACnf->baTimeout,psessionEntry))
4356 {
4357 PELOGW(limLog( pMac, LOGW,
4358 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4359 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4360 }
4361 }
4362 // Free the memory allocated for LIM_MLM_ADDBA_CNF
4363 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4364}
4365/**
4366 * \brief Process LIM_MLM_DELBA_CNF
4367 *
4368 * \sa limProcessMlmDelBACnf
4369 *
4370 * \param pMac The global tpAniSirGlobal object
4371 *
4372 * \param tSirMsgQ The MsgQ header containing the response buffer
4373 *
4374 * \return none
4375 */
4376void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4377 tANI_U32 *pMsgBuf )
4378{
4379 tpLimMlmDelBACnf pMlmDelBACnf;
4380 tpDphHashNode pSta;
4381 tANI_U16 aid;
4382// tANI_U8 sessionId;
4383 tLimBAState curBaState;
4384 tpPESession psessionEntry;
4385
4386 if(pMsgBuf == NULL)
4387 {
4388 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4389 return;
4390 }
4391 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4392 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4393 {
4394 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004395 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 return;
4397 }
4398 // First, extract the DPH entry
4399 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4400 if( NULL == pSta )
4401 {
4402 limLog( pMac, LOGE,
4403 FL( "STA context not found - ignoring DELBA CNF from HAL\n" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07004404 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 return;
4406 }
4407 if(NULL == pMlmDelBACnf)
4408 {
4409 limLog( pMac, LOGE,
4410 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL\n" ));
4411 return;
4412 }
4413 // Need to validate baState
4414 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4415 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4416 {
4417 limLog( pMac, LOGE,
4418 FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
4419 curBaState );
Jeff Johnsone7245742012-09-05 17:12:55 -07004420 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 return;
4422 }
4423 // Restore STA BA state
4424 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4425 // Free the memory allocated for LIM_MLM_DELBA_CNF
4426 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4427}
4428/**
4429 * \brief Process SIR_LIM_DEL_BA_IND
4430 *
4431 * \sa limProcessMlmHalBADeleteInd
4432 *
4433 * \param pMac The global tpAniSirGlobal object
4434 *
4435 * \param tSirMsgQ The MsgQ header containing the indication buffer
4436 *
4437 * \return none
4438 */
4439void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4440 tpSirMsgQ limMsgQ )
4441{
4442 tSirRetStatus status = eSIR_SUCCESS;
4443 tpBADeleteParams pBADeleteParams;
4444 tpDphHashNode pSta;
4445 tANI_U16 aid;
4446 tLimBAState curBaState;
4447 tpPESession psessionEntry;
4448 tANI_U8 sessionId;
4449
4450 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4451
4452 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4453 {
4454 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004455 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 return;
4457 }
4458 // First, extract the DPH entry
4459 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4460 if( NULL == pSta )
4461 {
4462 limLog( pMac, LOGE,
4463 FL( "STA context not found - ignoring BA Delete IND from HAL\n" ));
4464 goto returnAfterCleanup;
4465 }
4466
4467 // Need to validate BA state
4468 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4469 if( eLIM_BA_STATE_IDLE != curBaState )
4470 {
4471 limLog( pMac, LOGE,
4472 FL( "Received unexpected BA Delete IND when STA BA state is %d\n" ),
4473 curBaState );
4474 goto returnAfterCleanup;
4475 }
4476
4477 // Validate if a BA is active for the requested TID
4478 // AND in that desired direction
4479 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4480 {
4481 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4482 status = eSIR_FAILURE;
4483 }
4484 else
4485 {
4486 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4487 status = eSIR_FAILURE;
4488 }
4489 if( eSIR_FAILURE == status )
4490 {
4491 limLog( pMac, LOGW,
4492 FL("Received an INVALID DELBA Delete Ind for TID %d...\n"),
4493 pBADeleteParams->baTID );
4494 }
4495 else
4496 {
4497 // Post DELBA REQ to MLME...
4498 if( eSIR_SUCCESS !=
4499 (status = limPostMlmDelBAReq( pMac,
4500 pSta,
4501 pBADeleteParams->baDirection,
4502 pBADeleteParams->baTID,
4503 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4504 {
4505 limLog( pMac, LOGE,
4506 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d\n" ), status);
4507 }
4508 else
4509 {
4510 limLog( pMac, LOGE,
4511 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4512 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4513 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4514 }
4515 }
4516returnAfterCleanup:
4517 // Free the memory allocated for SIR_LIM_DEL_BA_IND
4518 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
4519}
4520/**
4521 * @function : limProcessSetMimoRsp()
4522 *
4523 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4524 * after Processing the Req from the SME (PMC)
4525 *
4526 * LOGIC:
4527 *
4528 * ASSUMPTIONS:
4529 * NA
4530 *
4531 * NOTE:
4532 * NA
4533 *
4534 * @param pMac - Pointer to Global MAC structure
4535 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4536 * @return None
4537 */
4538
4539void
4540limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4541{
4542#if 0
4543 tSirRetStatus retStatus;
4544 tpSetMIMOPS pMIMO_PSParams;
4545
4546
4547 do {
4548
4549 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4550 if( NULL == pMIMO_PSParams ) {
4551 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4552 return;
4553 }
4554
4555 /** If Updation of the HAL Fail's*/
4556 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
4557 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed\n"));
4558 break;
4559 }
4560
4561 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4562 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4563 break;
4564
4565 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4566 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4567
4568 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4569 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4570 * the Action Frame is being sent at first before setting the internal structures
4571 */
4572 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4573 tSirMacAddr macAddr;
4574
4575 /** Obtain the AP's Mac Address */
4576 palCopyMemory(pMac -> hHdd, (tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
4577
4578 /** Send Action Frame with the corresponding mode */
4579 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4580 if (retStatus != eSIR_SUCCESS) {
4581 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed\n"));)
4582 break;
4583 }
4584 }
4585 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4586 }while(0);
4587
4588 palFreeMemory( pMac->hHdd, (void *) pMIMO_PSParams );
4589#endif
4590}
4591/**
4592 * @function : limHandleDelBssInReAssocContext
4593 * @brief : While Processing the ReAssociation Response Frame in STA,
4594 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4595 * being issued and the end of DelBSS the new BSS is being added.
4596 *
4597 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4598 * change, We need to update CSR with ReAssocCNF Response with the
4599 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4600 * context only
4601 *
4602 * @param : pMac - tpAniSirGlobal
4603 * pStaDs - Station Descriptor
4604 *
4605 * @return : none
4606 */
4607static void
4608limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4609{
4610 tLimMlmReassocCnf mlmReassocCnf;
4611 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4612 /** Set the MlmState to IDLE*/
4613 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004614 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 /* Update PE session Id*/
4616 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4617 switch (psessionEntry->limMlmState) {
4618#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4619 case eLIM_SME_WT_REASSOC_STATE :
4620 {
4621 tpSirAssocRsp assocRsp;
4622 tpDphHashNode pStaDs;
4623 tSirRetStatus retStatus = eSIR_SUCCESS;
4624#ifdef ANI_PRODUCT_TYPE_CLIENT
4625 tSchBeaconStruct beaconStruct;
4626#endif
4627 /** Delete the older STA Table entry */
4628 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4629 /**
4630 * Add an entry for AP to hash table
4631 * maintained by DPH module
4632 */
4633 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4634 {
4635 // Could not add hash table entry
4636 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
4637 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4638 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4639 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4640 goto Error;
4641 }
4642 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4643 * is being stored to be used here for sending ADDBSS
4644 */
4645 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4646 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4647 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
4648#ifdef ANI_PRODUCT_TYPE_CLIENT
4649 limExtractApCapabilities( pMac,
4650 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4651 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4652 &beaconStruct );
4653 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4654 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4655 if(beaconStruct.erpPresent) {
4656 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4657 psessionEntry->beaconParams.fShortPreamble = 0;
4658 else
4659 psessionEntry->beaconParams.fShortPreamble = 1;
4660 }
4661 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4662 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4663 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
4664 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4665 retStatus = eSIR_FAILURE;
4666 }
4667#elif defined(ANI_AP_CLIENT_SDK)
4668 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
4669 false, psessionEntry)) {
4670 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4671 retStatus = eSIR_FAILURE;
4672 }
4673#endif
4674 if (retStatus != eSIR_SUCCESS)
4675 {
4676 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4677 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4678 palFreeMemory(pMac->hHdd, assocRsp);
4679 pMac->lim.gLimAssocResponseData = NULL;
4680 goto Error;
4681 }
4682 palFreeMemory(pMac->hHdd, assocRsp);
4683 psessionEntry->limAssocResponseData = NULL;
4684 }
4685 break;
4686 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4687 {
4688 /** Case wherein the DisAssoc / Deauth
4689 * being sent as response to ReAssoc Req*/
4690 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4691 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4692 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4693 /** Set the SME State back to WT_Reassoc State*/
4694 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004695 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4697 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4698 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4699 {
4700 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004701 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004702 }
4703 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4704 }
4705 break;
4706#endif
4707 default:
4708 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4709 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4710 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4711 goto Error;
4712 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004713 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004714Error:
4715 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4716}
4717
4718/* Added For BT -AMP Support */
4719static void
4720limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4721{
4722 tLimMlmStartCnf mlmStartCnf;
4723 tANI_U32 val;
4724 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4725
4726 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4727 {
4728 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));
4729 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4730 {
4731 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4732 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4733 goto end;
4734 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4735 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4736 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4737 goto end;
4738 }
4739
4740 // Set MLME state
4741 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4742 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4743 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4744 schEdcaProfileUpdate(pMac, psessionEntry);
4745 limInitAIDpool(pMac,psessionEntry);
4746 // Create timers used by LIM
4747 if (!pMac->lim.gLimTimersCreated)
4748 limCreateTimers(pMac);
4749 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4750 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
4751 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
4752 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4753 // Apply previously set configuration at HW
4754 limApplyConfiguration(pMac,psessionEntry);
4755 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4756 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4757 }
4758 else
4759 {
4760 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
4761 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4762 }
4763 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4764 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4765 end:
4766 if( 0 != limMsgQ->bodyptr )
4767 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
4768}
4769
4770/**
4771 * @function : limHandleAddBssInReAssocContext
4772 * @brief : While Processing the ReAssociation Response Frame in STA,
4773 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4774 * being issued and the end of DelBSS the new BSS is being added.
4775 *
4776 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4777 * change, We need to update CSR with ReAssocCNF Response with the
4778 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4779 * context only
4780 *
4781 * @param : pMac - tpAniSirGlobal
4782 * pStaDs - Station Descriptor
4783 *
4784 * @return : none
4785 */
4786void
4787limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4788{
4789 tLimMlmReassocCnf mlmReassocCnf;
4790 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4791 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004792 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4793 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004794 switch (psessionEntry->limSmeState) {
4795#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4796 case eLIM_SME_WT_REASSOC_STATE : {
4797 tpSirAssocRsp assocRsp;
4798 tpDphHashNode pStaDs;
4799 tSirRetStatus retStatus = eSIR_SUCCESS;
4800#ifdef ANI_PRODUCT_TYPE_CLIENT
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004801 tSchBeaconStruct *pBeaconStruct;
4802 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
4803 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
4804 {
4805 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limHandleAddBssInReAssocContext\n") );
4806 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4807 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4808 goto Error;
4809 }
4810
Jeff Johnson295189b2012-06-20 16:38:30 -07004811#endif
4812 // Get the AP entry from DPH hash table
4813 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4814 if (pStaDs == NULL )
4815 {
4816 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));)
4817 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4818 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004819 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 goto Error;
4821 }
4822 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4823 * is being stored to be used here for sending ADDBSS
4824 */
4825 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4826 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4827 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
4828#ifdef ANI_PRODUCT_TYPE_CLIENT
4829 limExtractApCapabilities( pMac,
4830 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4831 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004832 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004834 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4835
4836 if(pBeaconStruct->erpPresent)
4837 {
4838 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 psessionEntry->beaconParams.fShortPreamble = 0;
4840 else
4841 psessionEntry->beaconParams.fShortPreamble = 1;
4842 }
4843
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004844 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
4846 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4847 retStatus = eSIR_FAILURE;
4848 }
4849#elif defined(ANI_AP_CLIENT_SDK)
4850 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &pMac->lim.gpLimReassocReq->neighborBssList.bssList[0], true)) {
4851 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4852 retStatus = eSIR_FAILURE;
4853 }
4854#endif
4855 if (retStatus != eSIR_SUCCESS)
4856 {
4857 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4858 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4859 palFreeMemory(pMac->hHdd, assocRsp);
4860 pMac->lim.gLimAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004861 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 goto Error;
4863 }
4864 palFreeMemory(pMac->hHdd, assocRsp);
4865 psessionEntry->limAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004866 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 }
4868 break;
4869 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4870 * being sent as response to ReAssoc Req*/
4871 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4872 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4873 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4874 /** Set the SME State back to WT_Reassoc State*/
4875 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4876 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4877 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
4878 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4879
4880 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4881 }
4882 break;
4883#endif
4884 default:
4885 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4886 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4887 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4888 goto Error;
4889 }
4890return;
4891Error:
4892 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4893}
4894
4895#if 0
4896 static void
4897limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4898{
4899 tSirSmeAssocCnf assocCnf;
4900 tpDphHashNode pStaDs;
4901 tpPESession psessionEntry;
4902 tANI_U8 sessionId;
4903
4904 if(pMsgBuf == NULL)
4905 {
4906 limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
4907 goto end;
4908 }
4909 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4910 !__limIsSmeAssocCnfValid(&assocCnf))
4911 {
4912 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
4913 goto end;
4914 }
4915 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4916 {
4917 limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
4918 goto end;
4919 }
4920 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4921 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4922 {
4923 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
4924 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4925 goto end;
4926 }
4927 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4928 if (pStaDs == NULL)
4929 {
4930 limLog(pMac, LOG1,
4931 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4932 msgType, assocCnf.aid);
4933 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4934 /*
4935 ** send a DISASSOC_IND message to WSM to make sure
4936 ** the state in WSM and LIM is the same
4937 **/
4938 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4939 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4940 goto end;
4941 }
4942 if ((pStaDs &&
4943 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
4944 (tANI_U8 *) assocCnf.peerMacAddr,
4945 sizeof(tSirMacAddr)) ) ||
4946 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4947 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4948 (msgType != eWNI_SME_ASSOC_CNF)) ||
4949 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4950 (msgType != eWNI_SME_REASSOC_CNF)))))
4951 {
4952 limLog(pMac, LOG1,
4953 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4954 msgType, assocCnf.aid);
4955 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4956 goto end;
4957 }
4958 /*
4959 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4960 ** has been received
4961 **/
4962 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
4963 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4964 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4965 {
4966 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4967 * when it had received Assoc Request frame. Now, PE just needs to send
4968 * Association Response frame to the requesting BTAMP-STA.
4969 */
4970 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
4971 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
4972 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4973 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4974 goto end;
4975 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4976 else
4977 {
4978 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4979 limRejectAssociation(pMac, pStaDs->staAddr,
4980 pStaDs->mlmStaContext.subType,
4981 true, pStaDs->mlmStaContext.authType,
4982 pStaDs->assocId, true,
4983 assocCnf.statusCode, psessionEntry);
4984 return;
4985 }
4986end:
4987 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4988 {
4989 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4990 {
4991 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
4992 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4993 }
4994
4995 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
4996 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4997 }
4998} /*** end __limProcessSmeAssocCnfNew() ***/
4999#endif
5000
5001#ifdef WLAN_SOFTAP_FEATURE
5002void
5003limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5004 tBeaconGenParams *pBeaconGenParams = NULL;
5005 tSirMsgQ limMsg;
5006 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5007 if(psessionEntry == NULL ){
5008 PELOGE( limLog( pMac, LOGE,
5009 FL( "Error:Unable to get the PESessionEntry\n" ));)
5010 return;
5011 }
5012 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5013 (void **) &pBeaconGenParams, (sizeof(*pBeaconGenParams))))
5014 {
5015 PELOGE( limLog( pMac, LOGP,
5016 FL( "Unable to PAL allocate memory during sending beaconPreMessage\n" ));)
5017 return;
5018 }
5019 palZeroMemory( pMac->hHdd, pBeaconGenParams, sizeof(*pBeaconGenParams));
5020 palCopyMemory( pMac->hHdd, (void *) pBeaconGenParams->bssId,
5021 (void *)psessionEntry->bssId,
5022 SIR_MAC_ADDR_LENGTH );
5023 limMsg.bodyptr = pBeaconGenParams;
5024 schProcessPreBeaconInd(pMac, &limMsg);
5025 return;
5026}
5027#endif