blob: e8c508b97984e3cdd16c424735b699c21c5e873e [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));
615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616#if defined(ANI_AP_CLIENT_SDK)
617 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
618 {
619 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
620 PELOGE(limLog(pMac, LOGE, FL("Setting current BSSID as NULL in cfg\n"));)
621 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
622 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
623 {
624 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
625 }
626 }
627#endif
628 /**
629 * Need to send Join response with
630 * auth failure to Host.
631 */
632 limHandleSmeJoinResult(pMac,
633 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
634 }
635 else
636 {
637 /**
638 * Pre-authentication failure.
639 * Send Pre-auth failure response to host
640 */
641 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700642 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 limSendSmeAuthRsp(
644 pMac,
645 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
646 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
647 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
648 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
649 }
650 } // end if (cfgAuthType == eAUTO_SWITCH)
651 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
652 else
653 {
654 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
655 {
656 /**
657 * Successful MAC based authentication
658 * Trigger Association with BSS
659 */
660 PELOG1(limLog(pMac, LOG1,
661 FL("*** Authenticated with BSS ***\n"));)
662 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAssocReq, sizeof(tLimMlmAssocReq)))
663 {
664 // Log error
665 limLog(pMac, LOGP,
666 FL("call to palAllocateMemory failed for mlmAssocReq\n"));
667 return;
668 }
669 val = sizeof(tSirMacAddr);
670 #if 0
671 if (cfgGetStr(pMac, WNI_CFG_BSSID,
672 pMlmAssocReq->peerMacAddr,
673 &val) != eSIR_SUCCESS)
674 {
675 /// Could not get BSSID from CFG. Log error.
676 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
677 }
678 #endif //SUPPORT BT-AMP
679 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
680 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
681 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
682 != eSIR_SUCCESS)
683 {
684 /**
685 * Could not get AssocFailureTimeout value
686 * from CFG. Log error.
687 */
688 limLog(pMac, LOGP,
689 FL("could not retrieve AssocFailureTimeout value\n"));
690 }
691 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
692 {
693 /**
694 * Could not get Capabilities value
695 * from CFG. Log error.
696 */
697 limLog(pMac, LOGP,
698 FL("could not retrieve Capabilities value\n"));
699 }
700 /*Clear spectrum management bit if AP doesn't support it*/
701 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
702 {
703 /*AP doesn't support spectrum management clear spectrum management bit*/
704 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
705 }
706
707 pMlmAssocReq->capabilityInfo = caps;
708 PELOG3(limLog(pMac, LOG3,
Jeff Johnsone7245742012-09-05 17:12:55 -0700709 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700711 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
712 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713
714 /* If telescopic beaconing is enabled, set listen interval to
715 WNI_CFG_TELE_BCN_MAX_LI */
716 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
717 eSIR_SUCCESS)
718 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
719
720 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
721
722 if(teleBcnEn)
723 {
724 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
725 eSIR_SUCCESS)
726 {
727 /**
728 * Could not get ListenInterval value
729 * from CFG. Log error.
730 */
731 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
732 }
733 }
734 else
735 {
736 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
737 {
738 /**
739 * Could not get ListenInterval value
740 * from CFG. Log error.
741 */
742 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
743 }
744 }
745
746 pMlmAssocReq->listenInterval = (tANI_U16)val;
747 /* Update PE session ID*/
748 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
749 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
750 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700751 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 limPostMlmMessage(pMac,
753 LIM_MLM_ASSOC_REQ,
754 (tANI_U32 *) pMlmAssocReq);
755 }
756 else
757 {
758 /**
759 * Successful Pre-authentication.
760 * Send Pre-auth response to host
761 */
762 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 limSendSmeAuthRsp(
765 pMac,
766 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
767 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
768 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
769 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
770 }
771 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
772} /*** end limProcessMlmAuthCnf() ***/
773
774/**
775 * limProcessMlmAssocCnf()
776 *
777 *FUNCTION:
778 * This function is called to processes MLM_ASSOC_CNF
779 * message from MLM State machine.
780 *
781 *LOGIC:
782 *
783 *ASSUMPTIONS:
784 *
785 *NOTE:
786 *
787 * @param pMac Pointer to Global MAC structure
788 * @param pMsgBuf A pointer to the MLM message buffer
789 *
790 * @return None
791 */
792void
793limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
794{
795 tpPESession psessionEntry;
796 tLimMlmAssocCnf *pLimMlmAssocCnf;
797
798 if(pMsgBuf == NULL)
799 {
800 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
801 return;
802 }
803 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
804 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
805 {
806 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId\n"));)
807 return;
808 }
809 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
810 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
811 {
812 /**
813 * Should not have received Assocication confirm
814 * from MLM in other states OR on AP.
815 * Log error
816 */
817 PELOGE(limLog(pMac, LOGE,
818 FL("received unexpected MLM_ASSOC_CNF in state %X\n"),
819 psessionEntry->limSmeState);)
820 return;
821 }
822 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
823 {
824 // Association failure
825 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***\n"));)
826 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700827 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700828#if defined(ANI_AP_CLIENT_SDK)
829 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
830 {
831 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
832 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
833 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
834 {
835 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
836 }
837 }
838#endif
839 /**
840 * Need to send Join response with
841 * Association failure to Host.
842 */
843 limHandleSmeJoinResult(pMac,
844 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
845 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
846 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
847 else
848 {
849 // Successful Association
850 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***\n"));)
851 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700852 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 /**
854 * Need to send Join response with
855 * Association success to Host.
856 */
857 limHandleSmeJoinResult(pMac,
858 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
859 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
860 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
861} /*** end limProcessMlmAssocCnf() ***/
862
863/**
864 * limProcessMlmReassocCnf()
865 *
866 *FUNCTION:
867 * This function is called to processes MLM_REASSOC_CNF
868 * message from MLM State machine.
869 *
870 *LOGIC:
871 *
872 *ASSUMPTIONS:
873 *
874 *NOTE:
875 *
876 * @param pMac Pointer to Global MAC structure
877 * @param pMsgBuf A pointer to the MLM message buffer
878 *
879 * @return None
880 */
881void
882limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
883{
884 tpPESession psessionEntry;
885 tLimMlmReassocCnf *pLimMlmReassocCnf;
886
887 if(pMsgBuf == NULL)
888 {
889 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
890 return;
891 }
892 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
893 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
894 {
895 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id\n"));)
896 return;
897 }
898 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
899 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
900 {
901 /**
902 * Should not have received Reassocication confirm
903 * from MLM in other states OR on AP.
904 * Log error
905 */
906 PELOGE(limLog(pMac, LOGE,
907 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X\n"),
908 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
909 return;
910 }
911 if (psessionEntry->pLimReAssocReq) {
912 palFreeMemory( pMac->hHdd, psessionEntry->pLimReAssocReq);
913 psessionEntry->pLimReAssocReq = NULL;
914 }
915
916 PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d\n"), pLimMlmReassocCnf->resultCode);)
917 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
918 // Successful Reassociation
919 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***\n"));)
920
921 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700922 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700923
924 /**
925 * Need to send Reassoc response with
926 * Reassociation success to Host.
927 */
928 limSendSmeJoinReassocRsp(
929 pMac, eWNI_SME_REASSOC_RSP,
930 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
931 psessionEntry->smeSessionId,psessionEntry->transactionId);
932 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
933 /** Reassociation failure With the New AP
934 * but we still have the link with the Older AP
935 */
936 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700937 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700938
939 /**
940 * Need to send Reassoc response with
941 * Association failure to Host.
942 */
943 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
944 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
945 psessionEntry->smeSessionId,psessionEntry->transactionId);
946 }else {
947 // Reassociation failure
948 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700949 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 /**
951 * Need to send Reassoc response with
952 * Association failure to Host.
953 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700954 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 }
956} /*** end limProcessMlmReassocCnf() ***/
957
958/**
959 * limProcessMlmReassocInd()
960 *
961 *FUNCTION:
962 * This function is called to processes MLM_REASSOC_IND
963 * message from MLM State machine.
964 *
965 *LOGIC:
966 *
967 *ASSUMPTIONS:
968 *
969 *NOTE:
970 *
971 * @param pMac Pointer to Global MAC structure
972 * @param pMsgBuf A pointer to the MLM message buffer
973 *
974 * @return None
975 */
976void
977limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
978{
979 tANI_U32 len;
980 tSirMsgQ msgQ;
981 tSirSmeReassocInd *pSirSmeReassocInd;
982 tpDphHashNode pStaDs=0;
983 tpPESession psessionEntry;
984 tANI_U8 sessionId;
985 if(pMsgBuf == NULL)
986 {
987 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
988 return;
989 }
990 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
991 {
992 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
993 return;
994 }
995 /// Inform Host of STA reassociation
996#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
997 len = sizeof(tSirSmeReassocInd) -
998 sizeof(tSirNeighborBssInfo) +
999 (((tpLimMlmReassocInd) pMsgBuf)->numBss *
1000 sizeof(tSirNeighborBssInfo)) -
1001 SIR_MAC_MAX_SSID_LENGTH +
1002 ((tpLimMlmReassocInd) pMsgBuf)->ssId.length;
1003#else
1004 len = sizeof(tSirSmeReassocInd);
1005#endif
1006 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeReassocInd, len))
1007 {
1008 // Log error
1009 limLog(pMac, LOGP,
1010 FL("call to palAllocateMemory failed for eWNI_SME_REASSOC_IND\n"));
1011 return;
1012
1013 }
1014 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1015 eWNI_SME_REASSOC_IND);
1016 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1017 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1018
1019 // Required for indicating the frames to upper layer
1020 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1021 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1022 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1023 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1024
1025 msgQ.type = eWNI_SME_REASSOC_IND;
1026 msgQ.bodyptr = pSirSmeReassocInd;
1027 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001028 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001029#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1030 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1031#endif //FEATURE_WLAN_DIAG_SUPPORT
1032 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1033 if (! pStaDs)
1034 {
1035 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)\n"),
1036 ((tpLimMlmReassocInd) pMsgBuf)->aid);
1037 palFreeMemory(pMac->hHdd, pSirSmeReassocInd);
1038 return;
1039 }
1040
1041 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1042 PELOG1(limLog(pMac, LOG1,
1043 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND\n"));)
1044 /*
1045 ** turn on a timer to detect the loss of REASSOC CNF
1046 **/
1047 limActivateCnfTimer(pMac,
1048 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1049} /*** end limProcessMlmReassocInd() ***/
1050
1051/**
1052 * limProcessMlmAuthInd()
1053 *
1054 *FUNCTION:
1055 * This function is called to processes MLM_AUTH_IND
1056 * message from MLM State machine.
1057 *
1058 *LOGIC:
1059 *
1060 *ASSUMPTIONS:
1061 *
1062 *NOTE:
1063 *
1064 * @param pMac Pointer to Global MAC structure
1065 * @param pMsgBuf A pointer to the MLM message buffer
1066 *
1067 * @return None
1068 */
1069void
1070limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1071{
1072 tSirMsgQ msgQ;
1073 tSirSmeAuthInd *pSirSmeAuthInd;
1074
1075 if(pMsgBuf == NULL)
1076 {
1077 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1078 return;
1079 }
1080 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthInd, sizeof(tSirSmeAuthInd)))
1081 {
1082 // Log error
1083 limLog(pMac, LOGP,
1084 FL("call to palAllocateMemory failed for eWNI_SME_AUTH_IND\n"));
1085 }
1086 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1087 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1088 (tANI_U8 *) &(pSirSmeAuthInd->length));
1089 msgQ.type = eWNI_SME_AUTH_IND;
1090 msgQ.bodyptr = pSirSmeAuthInd;
1091 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001092 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001093#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1094 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1095#endif //FEATURE_WLAN_DIAG_SUPPORT
1096 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1097} /*** end limProcessMlmAuthInd() ***/
1098
1099
1100
1101
1102void
1103limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1104 tSirSmeAssocInd *pSirSmeAssocInd,
1105 tpPESession psessionEntry)
1106{
1107 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1108 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1109
1110 // Required for indicating the frames to upper layer
1111 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1112 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1113
1114 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1115 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1116
1117 // Fill in peerMacAddr
1118 palCopyMemory( pMac->hHdd, pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr, sizeof(tSirMacAddr));
1119 // Fill in aid
1120 pSirSmeAssocInd->aid = pAssocInd->aid;
1121 // Fill in bssId
1122 palCopyMemory( pMac->hHdd, pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1123 // Fill in staId
1124 //pSirSmeAssocInd->staId = psessionEntry->staId;
1125 // Fill in authType
1126 pSirSmeAssocInd->authType = pAssocInd->authType;
1127 // Fill in ssId
1128 palCopyMemory( pMac->hHdd, (tANI_U8*)&pSirSmeAssocInd->ssId,
1129 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
1130 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
1131 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1132 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1133 pAssocInd->rsnIE.length);
1134
1135 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
1136 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1137 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1138 pAssocInd->addIE.length);
1139
1140 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1142 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1143 {
1144 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1145 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1146 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
1147 palCopyMemory( pMac->hHdd, (tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
1148 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
1149 pAssocInd->supportedChannels.numChnl);
1150 }
1151#ifdef WLAN_SOFTAP_FEATURE
1152 // Fill in WmmInfo
1153 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
1154#endif
1155} /*** end limAssocIndSerDes() ***/
1156
1157
1158
1159/**
1160 * limProcessMlmAssocInd()
1161 *
1162 *FUNCTION:
1163 * This function is called to processes MLM_ASSOC_IND
1164 * message from MLM State machine.
1165 *
1166 *LOGIC:
1167 *
1168 *ASSUMPTIONS:
1169 *
1170 *NOTE:
1171 *
1172 * @param pMac Pointer to Global MAC structure
1173 * @param pMsgBuf A pointer to the MLM message buffer
1174 *
1175 * @return None
1176 */
1177void
1178limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1179{
1180 tANI_U32 len;
1181 tSirMsgQ msgQ;
1182 tSirSmeAssocInd *pSirSmeAssocInd;
1183 tpDphHashNode pStaDs=0;
1184 tpPESession psessionEntry;
1185 if(pMsgBuf == NULL)
1186 {
1187 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1188 return;
1189 }
1190 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1191 {
1192 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
1193 return;
1194 }
1195 /// Inform Host of STA association
1196#if defined (ANI_PRODUCT_TYPE_AP)
1197 len = sizeof(tSirSmeAssocInd) -
1198 sizeof(tSirNeighborBssInfo) +
1199 (((tpLimMlmAssocInd) pMsgBuf)->numBss *
1200 sizeof(tSirNeighborBssInfo)) -
1201 SIR_MAC_MAX_SSID_LENGTH +
1202 ((tpLimMlmAssocInd) pMsgBuf)->ssId.length;
1203#else
1204 len = sizeof(tSirSmeAssocInd);
1205#endif
1206 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAssocInd, len))
1207 {
1208 // Log error
1209 limLog(pMac, LOGP,
1210 FL("call to palAllocateMemory failed for eWNI_SME_ASSOC_IND\n"));
1211 return;
1212 }
1213
1214#if defined (ANI_PRODUCT_TYPE_AP)
1215 sirStoreU16N((tANI_U8 *) &pSirSmeAssocInd->messageType,
1216 eWNI_SME_ASSOC_IND);
1217 limAssocIndSerDes(pMac, (tpLimMlmAssocInd) pMsgBuf,
1218 (tANI_U8 *) &(pSirSmeAssocInd->length), psessionEntry);
1219#else
1220 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1221 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
1222#endif
1223 msgQ.type = eWNI_SME_ASSOC_IND;
1224 msgQ.bodyptr = pSirSmeAssocInd;
1225 msgQ.bodyval = 0;
1226 pStaDs = dphGetHashEntry(pMac,
1227 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1228 if (! pStaDs)
1229 { // good time to panic...
1230 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)\n"),
1231 ((tpLimMlmAssocInd) pMsgBuf)->aid);
1232 palFreeMemory(pMac->hHdd, pSirSmeAssocInd);
1233
1234 return;
1235 }
1236 pSirSmeAssocInd->staId = pStaDs->staIndex;
1237#ifdef WLAN_SOFTAP_FEATURE
1238 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
1239#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001240 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001241#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1242 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1243#endif //FEATURE_WLAN_DIAG_SUPPORT
1244 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1245
1246 PELOG1(limLog(pMac, LOG1,
1247 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND\n"));)
1248 /*
1249 ** turn on a timer to detect the loss of ASSOC CNF
1250 **/
1251 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1252
1253// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1254#ifdef TEST_BTAMP_AP
1255//tANI_U32 *pMsgBuf;
1256{
1257 tpSirSmeAssocCnf pSmeAssoccnf;
1258 if(!palAllocateMemory(pMac->hHdd,(void **)&pSmeAssoccnf,sizeof(tSirSmeAssocCnf)))
1259 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pSmeAssoccnf \n"));)
1260 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1261 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
1262 palCopyMemory( pMac->hHdd,pSmeAssoccnf->peerMacAddr,((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr,6);
1263 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1264 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
1265 palCopyMemory( pMac->hHdd, pSmeAssoccnf->alternateBssId,pSmeAssoccnf->peerMacAddr,sizeof(tSirMacAddr));
1266 pSmeAssoccnf->alternateChannelId = 6;
1267 palCopyMemory( pMac->hHdd,pSmeAssoccnf->bssId,psessionEntry->selfMacAddr,6);
1268 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1269 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
1270 palFreeMemory(pMac->hHdd,pSmeAssoccnf);
1271}
1272#endif
1273
1274
1275} /*** end limProcessMlmAssocInd() ***/
1276
1277
1278
1279
1280/**
1281 * limProcessMlmDisassocInd()
1282 *
1283 *FUNCTION:
1284 * This function is called to processes MLM_DISASSOC_IND
1285 * message from MLM State machine.
1286 *
1287 *LOGIC:
1288 *
1289 *ASSUMPTIONS:
1290 *
1291 *NOTE:
1292 *
1293 * @param pMac Pointer to Global MAC structure
1294 * @param pMsgBuf A pointer to the MLM message buffer
1295 *
1296 * @return None
1297 */
1298void
1299limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1300{
1301 tLimMlmDisassocInd *pMlmDisassocInd;
1302 tpPESession psessionEntry;
1303 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1304 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1305 {
1306 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
1307 return;
1308 }
1309 switch (psessionEntry->limSystemRole)
1310 {
1311 case eLIM_STA_IN_IBSS_ROLE:
1312 break;
1313 case eLIM_STA_ROLE:
1314 case eLIM_BT_AMP_STA_ROLE:
1315 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001316 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 break;
1318 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1319 PELOG1(limLog(pMac, LOG1,
1320 FL("*** Peer staId=%d Disassociated ***\n"),
1321 pMlmDisassocInd->aid);)
1322 // Send SME_DISASOC_IND after Polaris cleanup
1323 // (after receiving LIM_MLM_PURGE_STA_IND)
1324 break;
1325 } // end switch (psessionEntry->limSystemRole)
1326} /*** end limProcessMlmDisassocInd() ***/
1327
1328/**
1329 * limProcessMlmDisassocCnf()
1330 *
1331 *FUNCTION:
1332 * This function is called to processes MLM_DISASSOC_CNF
1333 * message from MLM State machine.
1334 *
1335 *LOGIC:
1336 *
1337 *ASSUMPTIONS:
1338 *
1339 *NOTE:
1340 *
1341 * @param pMac Pointer to Global MAC structure
1342 * @param pMsgBuf A pointer to the MLM message buffer
1343 *
1344 * @return None
1345 */
1346void
1347limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1348{
1349 tSirResultCodes resultCode;
1350 tLimMlmDisassocCnf *pMlmDisassocCnf;
1351 tpPESession psessionEntry;
1352 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1353 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1354 {
1355 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
1356 return;
1357 }
1358 resultCode = (tSirResultCodes)
1359 (pMlmDisassocCnf->disassocTrigger ==
1360 eLIM_LINK_MONITORING_DISASSOC) ?
1361 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1362 pMlmDisassocCnf->resultCode;
1363 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1364 {
1365#if defined(ANI_AP_CLIENT_SDK)
1366 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1367#endif
1368 // Disassociate Confirm from MLM
1369 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1370 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1371 {
1372 /**
1373 * Should not have received
1374 * Disassocate confirm
1375 * from MLM in other states.
1376 * Log error
1377 */
1378 PELOGE(limLog(pMac, LOGE,
1379 FL("received unexpected MLM_DISASSOC_CNF in state %X\n"),psessionEntry->limSmeState);)
1380 return;
1381 }
1382#if defined(ANI_AP_CLIENT_SDK)
1383 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1384 // if the station finds the same AP to which it was associated, it can try to associate
1385 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1386 // up to WSM and it never see this is AP unless a cga/reboot is done.
1387 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1388 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1389 {
1390 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1391 }
1392#endif
1393 if (pMac->lim.gLimRspReqd)
1394 pMac->lim.gLimRspReqd = false;
1395 if (pMlmDisassocCnf->disassocTrigger ==
1396 eLIM_PROMISCUOUS_MODE_DISASSOC)
1397 {
1398 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1399 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1400 else
1401 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001402 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 // Send Promiscuous mode response to host
1404 limSendSmePromiscuousModeRsp(pMac);
1405 }
1406 else
1407 {
1408 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1409 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1410 else
1411 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001412 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1414 resultCode,
1415 pMlmDisassocCnf->disassocTrigger,
1416 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1417 }
1418 }
1419 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1420 {
1421 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1422 resultCode,
1423 pMlmDisassocCnf->disassocTrigger,
1424 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1425 }
1426} /*** end limProcessMlmDisassocCnf() ***/
1427
1428/**
1429 * limProcessMlmDeauthInd()
1430 *
1431 *FUNCTION:
1432 * This function is called to processes MLM_DEAUTH_IND
1433 * message from MLM State machine.
1434 *
1435 *LOGIC:
1436 *
1437 *ASSUMPTIONS:
1438 *
1439 *NOTE:
1440 *
1441 * @param pMac Pointer to Global MAC structure
1442 * @param pMsgBuf A pointer to the MLM message buffer
1443 *
1444 * @return None
1445 */
1446void
1447limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1448{
1449 tLimMlmDeauthInd *pMlmDeauthInd;
1450 tpPESession psessionEntry;
1451 tANI_U8 sessionId;
1452 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1453 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1454 {
1455 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
1456 return;
1457 }
1458 switch (psessionEntry->limSystemRole)
1459 {
1460 case eLIM_STA_IN_IBSS_ROLE:
1461 break;
1462 case eLIM_STA_ROLE:
1463 case eLIM_BT_AMP_STA_ROLE:
1464 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001465 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001466
1467 default: // eLIM_AP_ROLE
1468 {
1469 PELOG1(limLog(pMac, LOG1,
1470 FL("*** Received Deauthentication from staId=%d ***\n"),
1471 pMlmDeauthInd->aid);)
1472 }
1473 // Send SME_DEAUTH_IND after Polaris cleanup
1474 // (after receiving LIM_MLM_PURGE_STA_IND)
1475 break;
1476 } // end switch (psessionEntry->limSystemRole)
1477} /*** end limProcessMlmDeauthInd() ***/
1478
1479/**
1480 * limProcessMlmDeauthCnf()
1481 *
1482 *FUNCTION:
1483 * This function is called to processes MLM_DEAUTH_CNF
1484 * message from MLM State machine.
1485 *
1486 *LOGIC:
1487 *
1488 *ASSUMPTIONS:
1489 *
1490 *NOTE:
1491 *
1492 * @param pMac Pointer to Global MAC structure
1493 * @param pMsgBuf A pointer to the MLM message buffer
1494 *
1495 * @return None
1496 */
1497void
1498limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1499{
1500 tANI_U16 aid;
1501 tSirResultCodes resultCode;
1502 tLimMlmDeauthCnf *pMlmDeauthCnf;
1503 tpPESession psessionEntry;
1504
1505 if(pMsgBuf == NULL)
1506 {
1507 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1508 return;
1509 }
1510 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1511 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1512 {
1513 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id \n"));)
1514 return;
1515 }
1516
1517 resultCode = (tSirResultCodes)
1518 (pMlmDeauthCnf->deauthTrigger ==
1519 eLIM_LINK_MONITORING_DEAUTH) ?
1520 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1521 pMlmDeauthCnf->resultCode;
1522 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1523 pMlmDeauthCnf->aid : 1;
1524 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1525 {
1526 #if defined(ANI_AP_CLIENT_SDK)
1527 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1528 #endif
1529 // Deauth Confirm from MLM
1530 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1531 {
1532 /**
1533 * Should not have received Deauth confirm
1534 * from MLM in other states.
1535 * Log error
1536 */
1537 PELOGE(limLog(pMac, LOGE,
1538 FL("received unexpected MLM_DEAUTH_CNF in state %X\n"),
1539 psessionEntry->limSmeState);)
1540 return;
1541 }
1542#if defined(ANI_AP_CLIENT_SDK)
1543 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1544 // if the station finds the same AP to which it was associated, it can try to associate
1545 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1546 // up to WSM and it never see this is AP unless a cga/reboot is done.
1547 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1548 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1549 {
1550 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1551 }
1552#endif
1553 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1554 {
1555 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1556 PELOG1(limLog(pMac, LOG1,
1557 FL("*** Deauthenticated with BSS ***\n"));)
1558 }
1559 else
1560 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001561 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001562
1563 if (pMac->lim.gLimRspReqd)
1564 pMac->lim.gLimRspReqd = false;
1565 }
1566#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1567 // BP deauthenticated by AP or vice versa
1568 // Send SME_DISASSOC_RSP to host.
1569 limSendSmeDisassocNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1570 resultCode,
1571 pMlmDeauthCnf->deauthTrigger,
1572 aid);
1573#else
1574 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1575 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1576 resultCode,
1577 pMlmDeauthCnf->deauthTrigger,
1578 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
1579#endif
1580} /*** end limProcessMlmDeauthCnf() ***/
1581
1582/**
1583 * limProcessMlmPurgeStaInd()
1584 *
1585 *FUNCTION:
1586 * This function is called to processes MLM_PURGE_STA_IND
1587 * message from MLM State machine.
1588 *
1589 *LOGIC:
1590 *
1591 *ASSUMPTIONS:
1592 *
1593 *NOTE:
1594 *
1595 * @param pMac Pointer to Global MAC structure
1596 * @param pMsgBuf A pointer to the MLM message buffer
1597 *
1598 * @return None
1599 */
1600void
1601limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1602{
1603 tSirResultCodes resultCode;
1604 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1605 tpPESession psessionEntry;
1606#if defined(ANI_AP_CLIENT_SDK)
1607 tSirMacAddr nullMacAddr = {0, 0, 0, 0, 0, 0};
1608#endif
1609 if(pMsgBuf == NULL)
1610 {
1611 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1612 return;
1613 }
1614 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1615 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1616 {
1617 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));)
1618 return;
1619 }
1620 // Purge STA indication from MLM
1621 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1622 switch (psessionEntry->limSystemRole)
1623 {
1624 case eLIM_STA_IN_IBSS_ROLE:
1625 break;
1626 case eLIM_STA_ROLE:
1627 case eLIM_BT_AMP_STA_ROLE:
1628 default: // eLIM_AP_ROLE
1629 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1630 (psessionEntry->limSmeState !=
1631 eLIM_SME_WT_DISASSOC_STATE) &&
1632 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1633 {
1634 /**
1635 * Should not have received
1636 * Purge STA indication
1637 * from MLM in other states.
1638 * Log error
1639 */
1640 PELOGE(limLog(pMac, LOGE,
1641 FL("received unexpected MLM_PURGE_STA_IND in state %X\n"),
1642 psessionEntry->limSmeState);)
1643 break;
1644 }
1645 PELOG1(limLog(pMac, LOG1,
1646 FL("*** Polaris cleanup completed for staId=%d ***\n"),
1647 pMlmPurgeStaInd->aid);)
1648 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1649 {
1650 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001651 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653#if defined(ANI_AP_CLIENT_SDK)
1654 // Whenever there is a disassoc notification, make sure the bssId is cleared so that
1655 // if the station finds the same AP to which it was associated, it can try to associate
1656 // with it again. If this is not done, the beacons/probe rsp from this AP will not be given
1657 // up to WSM and it never see this is AP unless a cga/reboot is done.
1658 palCopyMemory(pMac->hHdd, pMac->lim.gLimBssid, nullMacAddr, sizeof(tSirMacAddr));
1659 if (cfgSetStr(pMac, WNI_CFG_BSSID, nullMacAddr, sizeof(tSirMacAddr)) != eSIR_SUCCESS)
1660 {
1661 limLog(pMac, LOGP, FL("Could not update BSSID on CFG"));
1662 }
1663#endif
1664 }
1665 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1666 {
1667#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1668 // BP deauthenticated by AP or vice versa
1669 // Send SME_DISASSOC_IND to host.
1670 limSendSmeDisassocNtf(pMac,
1671 pMlmPurgeStaInd->peerMacAddr,
1672 resultCode,
1673 pMlmPurgeStaInd->purgeTrigger,
1674 pMlmPurgeStaInd->aid,psessionEntry);
1675#else
1676 limSendSmeDeauthNtf(pMac,
1677 pMlmPurgeStaInd->peerMacAddr,
1678 resultCode,
1679 pMlmPurgeStaInd->purgeTrigger,
1680 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
1681#endif
1682 }
1683 else
1684 limSendSmeDisassocNtf(pMac,
1685 pMlmPurgeStaInd->peerMacAddr,
1686 resultCode,
1687 pMlmPurgeStaInd->purgeTrigger,
1688 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1689 } // end switch (psessionEntry->limSystemRole)
1690} /*** end limProcessMlmPurgeStaInd() ***/
1691
1692/**
1693 * limProcessMlmSetKeysCnf()
1694 *
1695 *FUNCTION:
1696 * This function is called to processes MLM_SETKEYS_CNF
1697 * message from MLM State machine.
1698 *
1699 *LOGIC:
1700 *
1701 *ASSUMPTIONS:
1702 *
1703 *NOTE:
1704 *
1705 * @param pMac Pointer to Global MAC structure
1706 * @param pMsgBuf A pointer to the MLM message buffer
1707 *
1708 * @return None
1709 */
1710void
1711limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1712{
1713 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001714 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 tpPESession psessionEntry;
1716
1717 if(pMsgBuf == NULL)
1718 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001719 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1720 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 }
1722 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1723 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1724 {
1725 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId \n"));)
1726 return;
1727 }
1728 limLog( pMac, LOG1,
1729 FL("Received MLM_SETKEYS_CNF with resultCode = %d\n"),
1730 pMlmSetKeysCnf->resultCode );
1731 limSendSmeSetContextRsp(pMac,
1732 pMlmSetKeysCnf->peerMacAddr,
1733#ifdef ANI_PRODUCT_TYPE_AP
1734 pMlmSetKeysCnf->aid,
1735#else
1736 1,
1737#endif
1738 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1739 psessionEntry->transactionId);
1740} /*** end limProcessMlmSetKeysCnf() ***/
1741/**
1742 * limProcessMlmRemoveKeyCnf()
1743 *
1744 *FUNCTION:
1745 * This function is called to processes MLM_REMOVEKEY_CNF
1746 * message from MLM State machine.
1747 *
1748 *LOGIC:
1749 *
1750 *ASSUMPTIONS:
1751 *
1752 *NOTE:
1753 *
1754 * @param pMac Pointer to Global MAC structure
1755 * @param pMsgBuf A pointer to the MLM message buffer
1756 *
1757 * @return None
1758 */
1759void
1760limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1761{
1762 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001763 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 tpPESession psessionEntry;
1765
1766 if(pMsgBuf == NULL)
1767 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001768 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
1769 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 }
1771 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1772 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1773 {
1774 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id\n"));)
1775 return;
1776 }
1777 limLog( pMac, LOG1,
1778 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d\n"),
1779 pMlmRemoveKeyCnf->resultCode );
1780 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001781 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1783 psessionEntry->smeSessionId,psessionEntry->transactionId);
1784} /*** end limProcessMlmRemoveKeyCnf() ***/
1785
1786
1787/**
1788 * limHandleSmeJoinResult()
1789 *
1790 *FUNCTION:
1791 * This function is called to process join/auth/assoc failures
1792 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1793 * MLM_ASSOC_CNF with a success code in case of STA role and
1794 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1795 *
1796 *LOGIC:
1797 *
1798 *ASSUMPTIONS:
1799 *
1800 *NOTE:
1801 *
1802 * @param pMac Pointer to Global MAC structure
1803 * @param resultCode Failure code to be sent
1804 *
1805 *
1806 * @return None
1807 */
1808static void
1809limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1810{
1811 tpDphHashNode pStaDs = NULL;
1812 tANI_U8 smesessionId;
1813 tANI_U16 smetransactionId;
1814
1815 /* Newly Added on oct 11 th*/
1816 if(psessionEntry == NULL)
1817 {
1818 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
1819 return;
1820 }
1821 smesessionId = psessionEntry->smeSessionId;
1822 smetransactionId = psessionEntry->transactionId;
1823 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1824 if(resultCode != eSIR_SME_SUCCESS)
1825 {
1826 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1827 if (pStaDs != NULL)
1828 {
1829 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1830 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1831 pStaDs->mlmStaContext.resultCode = resultCode;
1832 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1833 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1834 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001835 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
1836 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 return;
1838 }
1839 }
1840
1841 palFreeMemory( pMac->hHdd, psessionEntry->pLimJoinReq);
1842 psessionEntry->pLimJoinReq = NULL;
1843 //Delete teh session if JOIN failure occurred.
1844 if(resultCode != eSIR_SME_SUCCESS)
1845 {
1846 if(NULL != psessionEntry)
1847 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001848 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1849 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1850 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState.\n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 peDeleteSession(pMac,psessionEntry);
1852 psessionEntry = NULL;
1853 }
1854 }
1855 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1856 smesessionId, smetransactionId);
1857} /*** end limHandleSmeJoinResult() ***/
1858
1859/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001860 * limHandleSmeReaasocResult()
1861 *
1862 *FUNCTION:
1863 * This function is called to process reassoc failures
1864 * upon receiving REASSOC_CNF with a failure code or
1865 * MLM_REASSOC_CNF with a success code in case of STA role
1866 *
1867 *LOGIC:
1868 *
1869 *ASSUMPTIONS:
1870 *
1871 *NOTE:
1872 *
1873 * @param pMac Pointer to Global MAC structure
1874 * @param resultCode Failure code to be sent
1875 *
1876 *
1877 * @return None
1878 */
1879static void
1880limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1881{
1882 tpDphHashNode pStaDs = NULL;
1883 tANI_U8 smesessionId;
1884 tANI_U16 smetransactionId;
1885
1886 if(psessionEntry == NULL)
1887 {
1888 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL \n"));)
1889 return;
1890 }
1891 smesessionId = psessionEntry->smeSessionId;
1892 smetransactionId = psessionEntry->transactionId;
1893 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1894 if(resultCode != eSIR_SME_SUCCESS)
1895 {
1896 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1897 if (pStaDs != NULL)
1898 {
1899 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1900 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1901 pStaDs->mlmStaContext.resultCode = resultCode;
1902 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1903 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1904 return;
1905 }
1906 }
1907
1908 //Delete teh session if REASSOC failure occurred.
1909 if(resultCode != eSIR_SME_SUCCESS)
1910 {
1911 if(NULL != psessionEntry)
1912 {
1913 peDeleteSession(pMac,psessionEntry);
1914 psessionEntry = NULL;
1915 }
1916 }
1917 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1918 smesessionId, smetransactionId);
1919} /*** end limHandleSmeReassocResult() ***/
1920
1921/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 * limProcessMlmAddStaRsp()
1923 *
1924 *FUNCTION:
1925 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1926 * Upon receipt of this message from HAL, MLME -
1927 * > Determines the "state" in which this message was received
1928 * > Forwards it to the appropriate callback
1929 *
1930 *ASSUMPTIONS:
1931 *
1932 *NOTE:
1933 *
1934 * @param pMac Pointer to Global MAC structure
1935 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1936 *
1937 * @return None
1938 */
1939void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1940{
1941 //we need to process the deferred message since the initiating req. there might be nested request.
1942 //in the case of nested request the new request initiated from the response will take care of resetting
1943 //the deffered flag.
1944 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
1946#ifdef WLAN_SOFTAP_FEATURE
1947 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
1948#endif
1949 )
1950 {
1951 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1952 return;
1953 }
1954#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1955 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1956#endif
1957}
1958void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1959{
1960 tLimMlmAssocCnf mlmAssocCnf;
1961 tpDphHashNode pStaDs;
1962 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1963 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1964
1965 if(NULL == pAddStaParams )
1966 {
1967 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
1968 return;
1969 }
1970 if( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1971 {
1972 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
1973 {
1974 //TODO: any response to be sent out here ?
1975 limLog( pMac, LOGE,
1976 FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
1977 psessionEntry->limMlmState);
1978 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1979 goto end;
1980 }
1981 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1982 mesgType = LIM_MLM_REASSOC_CNF;
1983 //
1984 // Update the DPH Hash Entry for this STA
1985 // with proper state info
1986 //
1987 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1988 if( NULL != pStaDs)
1989 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1990 else
1991 limLog( pMac, LOGW,
1992 FL( "Unable to get the DPH Hash Entry for AID - %d\n" ),
1993 DPH_STA_HASH_INDEX_PEER);
1994 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001995 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 /*
1997 * Storing the self StaIndex(Generated by HAL) in session context,
1998 * instead of storing it in DPH Hash entry for Self STA.
1999 * DPH entry for the self STA stores the sta index for the BSS entry
2000 * to which the STA is associated.
2001 */
2002 psessionEntry->staId = pAddStaParams->staIdx;
2003 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2004 limReactivateHeartBeatTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002005 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002006
2007 //assign the sessionId to the timer Object
2008 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
2009 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
2010 limLog(pMac, LOGP, FL("Cannot activate keepalive timer.\n"));
2011#ifdef WLAN_DEBUG
2012 pMac->lim.gLimNumLinkEsts++;
2013#endif
2014 // Return Assoc confirm to SME with success
2015 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2016 // be passed in here....
2017 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2018 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2019 }
2020 else
2021 {
2022 limLog( pMac, LOGW, FL( "ADD_STA failed!\n"));
2023 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2024 }
2025end:
2026 if( 0 != limMsgQ->bodyptr )
2027 {
2028 palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
2029 }
2030 /* Updating PE session Id*/
2031 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2032 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
2033 return;
2034}
2035void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2036{
2037 //we need to process the deferred message since the initiating req. there might be nested request.
2038 //in the case of nested request the new request initiated from the response will take care of resetting
2039 //the deffered flag.
2040 // tpPESession psessionEntry;
2041 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2042 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2043 // {
2044 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId\n" ));
2045 // return;
2046 // }
2047 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002048
2049 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2050 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
2051#ifdef WLAN_SOFTAP_FEATURE
2052 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
2053#endif
2054 ) &&
2055 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2056 {
2057 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2058 return;
2059 }
2060#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2061 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2062#endif
2063}
2064
2065void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2066{
2067 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2068 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2069 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302070
2071 if (NULL == pDelBssParams)
2072 {
2073 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
2074 goto end;
2075 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2077 {
2078 PELOGW(limLog( pMac, LOGW,
2079 FL( "STA received the DEL_BSS_RSP for BSSID: %X.\n"),pDelBssParams->bssIdx);)
2080 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2081 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2082
2083 {
2084 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE\n"));)
2085 statusCode = eSIR_SME_REFUSED;
2086 goto end;
2087 }
2088 if(pStaDs == NULL)
2089 {
2090 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing.\n"));
2091 statusCode = eSIR_SME_REFUSED;
2092 goto end;
2093 }
2094 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2095 {
2096 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X\n" ),
2097 pStaDs->mlmStaContext.mlmState);)
2098 statusCode = eSIR_SME_REFUSED;
2099 goto end;
2100 }
2101 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2102 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2103 }
2104 else
2105 {
2106 limLog( pMac, LOGP, FL( "DEL BSS failed!\n" ) );
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302107 palFreeMemory( pMac->hHdd, (void *) pDelBssParams );
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);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302212
2213 if(NULL == pDeleteStaParams ||
2214 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 {
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302216 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002217 if(pDeleteStaParams != NULL)
2218 palFreeMemory( pMac->hHdd, (void *) pDeleteStaParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 return;
2220 }
2221
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
2223#ifdef WLAN_SOFTAP_FEATURE
2224 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
2225#endif
2226 )
2227 {
2228 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2229 return;
2230 }
2231#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
2232 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
2233#endif
2234}
2235
Jeff Johnson295189b2012-06-20 16:38:30 -07002236void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2237{
2238 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2239 tpDphHashNode pStaDs;
2240 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2241 if(limMsgQ->bodyptr == NULL)
2242 {
2243 return;
2244 }
2245
2246 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2247 if(pStaDs == NULL)
2248 {
2249 limLog( pMac, LOGE,
2250 FL( "DPH Entry for STA %X missing.\n"), pDelStaParams->assocId);
2251 statusCode = eSIR_SME_REFUSED;
2252 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2253
2254 return;
2255 }
2256 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2257 {
2258 limLog( pMac, LOGW,
2259 FL( "AP received the DEL_STA_RSP for assocID: %X.\n"), pDelStaParams->assocId);
2260
2261 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2262 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2263 {
2264 limLog( pMac, LOGE,
2265 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d \n" ),
2266 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2267 statusCode = eSIR_SME_REFUSED;
2268 goto end;
2269 }
2270
2271 limLog( pMac, LOG1,
2272 FL("Deleted STA AssocID %d staId %d MAC "),
2273 pStaDs->assocId, pStaDs->staIndex);
2274 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2275 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2276 {
2277 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2278 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
2279 {
2280 PELOGE(limLog(pMac, LOGE,
2281 FL("could not Add STA with assocId=%d\n"),
2282 pStaDs->assocId);)
2283 // delete the TS if it has already been added.
2284 // send the response with error status.
2285 if(pStaDs->qos.addtsPresent)
2286 {
2287 tpLimTspecInfo pTspecInfo;
2288 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2289 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2290 {
2291 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2292 NULL, &pTspecInfo->idx);
2293 }
2294 }
2295 limRejectAssociation(pMac,
2296 pStaDs->staAddr,
2297 pStaDs->mlmStaContext.subType,
2298 true, pStaDs->mlmStaContext.authType,
2299 pStaDs->assocId, true,
2300 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2301 psessionEntry);
2302 }
2303 return;
2304 }
2305 }
2306 else
2307 {
2308 limLog( pMac, LOGW,
2309 FL( "DEL STA failed!\n" ));
2310 statusCode = eSIR_SME_REFUSED;
2311 }
2312 end:
2313 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2314 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2315 {
2316 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2317 }
2318 return;
2319}
2320
2321void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2322{
2323 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2324 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2325 tpDphHashNode pStaDs = NULL;
2326 if(NULL == pDelStaParams )
2327 {
2328 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
2329 goto end;
2330 }
2331 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2332 {
2333 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2334 if (pStaDs == NULL)
2335 {
2336 //TODO: any response to be sent out here ?
2337 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"),
2338 pDelStaParams->assocId);
2339 statusCode = eSIR_SME_REFUSED;
2340 goto end;
2341 }
2342 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2343 {
2344 //TODO: any response to be sent out here ?
2345 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s\n" ),
2346 limMlmStateStr(psessionEntry->limMlmState));
2347 statusCode = eSIR_SME_REFUSED;
2348 goto end;
2349 }
2350 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2351 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2352 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X\n"), pDelStaParams->assocId);
2353 //we must complete all cleanup related to delSta before calling limDelBSS.
2354 if( 0 != limMsgQ->bodyptr )
2355 {
2356 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2357 }
2358 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2359 return;
2360 }
2361 else
2362 {
2363 limLog( pMac, LOGW, FL( "DEL_STA failed!\n" ));
2364 statusCode = eSIR_SME_REFUSED;
2365 }
2366end:
2367 if( 0 != limMsgQ->bodyptr )
2368 {
2369 palFreeMemory( pMac->hHdd, (void *) pDelStaParams );
2370 }
2371 return;
2372}
2373
Jeff Johnson295189b2012-06-20 16:38:30 -07002374void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2375{
2376 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302377 tpDphHashNode pStaDs = NULL;
2378
2379 if (NULL == pAddStaParams)
2380 {
2381 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
2382 goto end;
2383 }
2384
2385 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 if(pStaDs == NULL)
2387 {
2388 //TODO: any response to be sent out here ?
2389 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing.\n"), pAddStaParams->assocId);
2390 goto end;
2391 }
2392 //
2393 // TODO & FIXME_GEN4
2394 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2395 //
2396 //TODO: any check for pMac->lim.gLimMlmState ?
2397 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2398 {
2399 //TODO: any response to be sent out here ?
2400 limLog( pMac, LOGE,
2401 FL( "Received unexpected WDA_ADD_STA_RSP in state %X\n" ),
2402 pStaDs->mlmStaContext.mlmState);
2403 goto end;
2404 }
2405 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2406 {
2407 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d\n"),pAddStaParams->status);)
2408 limRejectAssociation(pMac, pStaDs->staAddr,
2409 pStaDs->mlmStaContext.subType,
2410 true, pStaDs->mlmStaContext.authType,
2411 pStaDs->assocId, true,
2412 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2413 psessionEntry);
2414 goto end;
2415 }
2416 pStaDs->bssId = pAddStaParams->bssIdx;
2417 pStaDs->staIndex = pAddStaParams->staIdx;
2418 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2419 pStaDs->valid = 1;
2420 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2421 limLog( pMac, LOG1,
2422 FL("STA AssocID %d staId %d MAC "),
2423 pStaDs->assocId,
2424 pStaDs->staIndex);
2425 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2426
2427 /* For BTAMP-AP, the flow sequence shall be:
2428 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2429 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2430 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2431 */
2432 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2433 // fall though to reclaim the original Add STA Response message
2434end:
2435 if( 0 != limMsgQ->bodyptr )
2436 {
2437 palFreeMemory( pMac->hHdd, (void *) pAddStaParams );
2438 }
2439 return;
2440}
2441
2442/**
2443 * limProcessApMlmAddBssRsp()
2444 *
2445 *FUNCTION:
2446 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2447 * Upon receipt of this message from HAL, MLME -
2448 * > Validates the result of WDA_ADD_BSS_REQ
2449 * > Init other remaining LIM variables
2450 * > Init the AID pool, for that BSSID
2451 * > Init the Pre-AUTH list, for that BSSID
2452 * > Create LIM timers, specific to that BSSID
2453 * > Init DPH related parameters that are specific to that BSSID
2454 * > TODO - When do we do the actual change channel?
2455 *
2456 *LOGIC:
2457 * SME sends eWNI_SME_START_BSS_REQ to LIM
2458 * LIM sends LIM_MLM_START_REQ to MLME
2459 * MLME sends WDA_ADD_BSS_REQ to HAL
2460 * HAL responds with WDA_ADD_BSS_RSP to MLME
2461 * MLME responds with LIM_MLM_START_CNF to LIM
2462 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2463 *
2464 *ASSUMPTIONS:
2465 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2466 * tSirMsgQ.body will now be freed by this routine
2467 *
2468 *NOTE:
2469 *
2470 * @param pMac Pointer to Global MAC structure
2471 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2472 *
2473 * @return None
2474 */
2475static void
2476limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2477{
2478 tLimMlmStartCnf mlmStartCnf;
2479 tANI_U32 val;
2480 tpPESession psessionEntry;
2481// tANI_U8 sessionId;
2482 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2483 if(NULL == pAddBssParams )
2484 {
2485 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
2486 goto end;
2487 }
2488 //TBD: free the memory before returning, do it for all places where lookup fails.
2489 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2490 {
2491 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002492 if( NULL != pAddBssParams )
2493 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 return;
2495 }
2496 /* Update PE session Id*/
2497 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2498 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2499 {
2500 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
2501 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2502 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2503 goto end;
2504 // Set MLME state
2505 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002506 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2508 {
2509 /** IBSS is 'active' when we receive
2510 * Beacon frames from other STAs that are part of same IBSS.
2511 * Mark internal state as inactive until then.
2512 */
2513 psessionEntry->limIbssActive = false;
2514 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2515 limResetHBPktCount( psessionEntry );
2516 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002517 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2519 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
2520 }
2521 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2522
2523#ifdef ANI_PRODUCT_TYPE_AP
2524 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2525#else
2526 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2527#endif
2528
2529#ifdef WLAN_SOFTAP_FEATURE
2530 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2531 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2532 else
2533 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2534#endif
2535 schEdcaProfileUpdate(pMac, psessionEntry);
2536 limInitPreAuthList(pMac);
2537 limInitAIDpool(pMac,psessionEntry);
2538 // Create timers used by LIM
2539 if (!pMac->lim.gLimTimersCreated)
2540 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002541
2542 // Start OLBC timer
2543 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2544 {
2545 limLog(pMac, LOGE, FL("tx_timer_activate failed\n"));
2546 }
2547
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2549 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
2550 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
2551 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2552 // Apply previously set configuration at HW
2553 limApplyConfiguration(pMac,psessionEntry);
2554 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2555 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2556 }
2557 else
2558 {
2559 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
2560 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2561 }
2562 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2563 end:
2564 if( 0 != limMsgQ->bodyptr )
2565 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
2566}
2567
2568
2569/**
2570 * limProcessIbssMlmAddBssRsp()
2571 *
2572 *FUNCTION:
2573 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2574 * Upon receipt of this message from HAL, MLME -
2575 * > Validates the result of WDA_ADD_BSS_REQ
2576 * > Init other remaining LIM variables
2577 * > Init the AID pool, for that BSSID
2578 * > Init the Pre-AUTH list, for that BSSID
2579 * > Create LIM timers, specific to that BSSID
2580 * > Init DPH related parameters that are specific to that BSSID
2581 * > TODO - When do we do the actual change channel?
2582 *
2583 *LOGIC:
2584 * SME sends eWNI_SME_START_BSS_REQ to LIM
2585 * LIM sends LIM_MLM_START_REQ to MLME
2586 * MLME sends WDA_ADD_BSS_REQ to HAL
2587 * HAL responds with WDA_ADD_BSS_RSP to MLME
2588 * MLME responds with LIM_MLM_START_CNF to LIM
2589 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2590 *
2591 *ASSUMPTIONS:
2592 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2593 * tSirMsgQ.body will now be freed by this routine
2594 *
2595 *NOTE:
2596 *
2597 * @param pMac Pointer to Global MAC structure
2598 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2599 *
2600 * @return None
2601 */
2602static void
2603limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2604{
2605 tLimMlmStartCnf mlmStartCnf;
2606 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2607 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302608
2609 if (NULL == pAddBssParams)
2610 {
2611 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
2612 goto end;
2613 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2615 {
2616 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));)
2617 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2618 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2619 goto end;
2620 // Set MLME state
2621 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002622 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 /** IBSS is 'active' when we receive
2624 * Beacon frames from other STAs that are part of same IBSS.
2625 * Mark internal state as inactive until then.
2626 */
2627 psessionEntry->limIbssActive = false;
2628 limResetHBPktCount( psessionEntry );
2629 /* Timer related functions are not modified for BT-AMP : To be Done */
2630 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002631 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 if (limActivateHearBeatTimer(pMac) != TX_SUCCESS)
2633 limLog(pMac, LOGP, FL("could not activate Heartbeat timer\n"));
2634 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2635 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2636 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2637 schEdcaProfileUpdate(pMac, psessionEntry);
2638 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2639 //limInitPreAuthList(pMac);
2640 limInitAIDpool(pMac,psessionEntry);
2641 // Create timers used by LIM
2642#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2643 if (!pMac->lim.gLimTimersCreated)
2644 limCreateTimers(pMac);
2645#endif
2646 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2647 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
2648 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
2649 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2650 // Apply previously set configuration at HW
2651 limApplyConfiguration(pMac,psessionEntry);
2652 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2653 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2654 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2655 if(true == pMac->lim.gLimIbssCoalescingHappened)
2656 {
2657 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2658 goto end;
2659 }
2660 }
2661 else
2662 {
2663 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),
2664 pAddBssParams->status );
2665 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2666 }
2667 //Send this message to SME, when ADD_BSS is initiated by SME
2668 //If ADD_BSS is done as part of coalescing, this won't happen.
2669 /* Update PE session Id*/
2670 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2671 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2672 end:
2673 if( 0 != limMsgQ->bodyptr )
2674 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
2675}
2676
2677static void
2678limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2679{
2680 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2681 tAniAuthType cfgAuthType, authMode;
2682 tLimMlmAuthReq *pMlmAuthReq;
2683 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302684
2685 if (NULL == pAddBssParams)
2686 {
2687 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
2688 goto joinFailure;
2689 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2691 {
2692 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2693 {
2694 // Could not add hash table entry
2695 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
2696 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2697 goto joinFailure;
2698 }
2699 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2700 //Success, handle below
2701 pStaDs->bssId = pAddBssParams->bssIdx;
2702 //STA Index(genr by HAL) for the BSS entry is stored here
2703 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2704 // Trigger Authentication with AP
2705 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2706 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2707 {
2708 /**
2709 * Could not get AuthType from CFG.
2710 * Log error.
2711 */
2712 limLog(pMac, LOGP,
2713 FL("could not retrieve AuthType\n"));
2714 }
2715 if (cfgAuthType == eSIR_AUTO_SWITCH)
2716 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2717 else
2718 authMode = cfgAuthType;
2719
2720 // Trigger MAC based Authentication
2721 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmAuthReq, sizeof(tLimMlmAuthReq)))
2722 {
2723 // Log error
2724 limLog(pMac, LOGP,
2725 FL("call to palAllocateMemory failed for mlmAuthReq\n"));
2726 return;
2727 }
2728 #if 0
2729 val = sizeof(tSirMacAddr);
2730 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2731 pMlmAuthReq->peerMacAddr,
2732 &val) != eSIR_SUCCESS)
2733 {
2734 /// Could not get BSSID from CFG. Log error.
2735 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
2736 }
2737 #endif //TO SUPPORT BT-AMP
2738 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2739
2740 pMlmAuthReq->authType = authMode;
2741 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2742 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2743 != eSIR_SUCCESS)
2744 {
2745 /**
2746 * Could not get AuthFailureTimeout
2747 * value from CFG. Log error.
2748 */
2749 limLog(pMac, LOGP,
2750 FL("could not retrieve AuthFailureTimeout value\n"));
2751 }
2752 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2753 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2754 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002755 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2757 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2758 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2759 // remember staId in case of assoc timeout/failure handling
2760 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2761
Jeff Johnsone7245742012-09-05 17:12:55 -07002762 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 limPostMlmMessage(pMac,
2764 LIM_MLM_AUTH_REQ,
2765 (tANI_U32 *) pMlmAuthReq);
2766 return;
2767 }
2768
2769joinFailure:
2770 {
2771 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002772 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002773
2774 /// Send Join response to Host
2775 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2776
2777 }
2778
2779}
2780
2781#ifdef WLAN_FEATURE_VOWIFI_11R
2782/*------------------------------------------------------------------------------------------
2783 *
2784 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2785 *
2786 *
2787 *------------------------------------------------------------------------------------------
2788 */
2789static inline void
2790limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
2791{
2792 tpDphHashNode pStaDs = NULL;
2793 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2794 tpAddStaParams pAddStaParams = NULL;
2795 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
2796 tLimMlmReassocReq *pMlmReassocReq;
2797 tLimMlmReassocCnf mlmReassocCnf; // keep sme
2798
2799 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
2800
2801 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2802 {
2803 goto end;
2804 }
2805
2806 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2807 &psessionEntry->dph.dphHashTable)) == NULL)
2808 {
2809 // Could not add hash table entry
2810 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
2811 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2812 goto end;
2813 }
2814
2815 // Set the filter state to post assoc
2816 if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE,
2817 pAddBssParams->bssId, psessionEntry->selfMacAddr,
2818 NULL, NULL) != eSIR_SUCCESS)
2819 {
2820 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState\n"));)
2821 goto end;
2822 }
2823
2824 // Prepare and send Reassociation request frame
2825 // start reassoc timer.
2826 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2827 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002829 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2830 != TX_SUCCESS)
2831 {
2832 /// Could not start reassoc failure timer.
2833 // Log error
2834 limLog(pMac, LOGP,
2835 FL("could not start Reassociation failure timer\n"));
2836 // Return Reassoc confirm with
2837 // Resources Unavailable
2838 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2839 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2840 goto end;
2841 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002842#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2843 pMac->lim.pSessionEntry = psessionEntry;
2844 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2845 {
2846 /* Take a copy of reassoc request for retrying */
2847 if ( !HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, (void **)&pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq))) ) goto end;
2848 palZeroMemory(pMac->hHdd, pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq));
2849 palCopyMemory( pMac->hHdd,pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, psessionEntry->pLimMlmReassocReq, sizeof(tLimMlmReassocReq));
2850 }
2851 pMac->lim.reAssocRetryAttempt = 0;
2852#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002854
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2856 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
2857 PELOGE(limLog(pMac, LOGE, FL("Set the mlm state to %d session=%d\n"),
2858 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2859
2860 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2861
2862 //Success, handle below
2863 pStaDs->bssId = pAddBssParams->bssIdx;
2864 //STA Index(genr by HAL) for the BSS entry is stored here
2865 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2866 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2867 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2868
Jeff Johnson295189b2012-06-20 16:38:30 -07002869#if defined WLAN_FEATURE_VOWIFI
2870 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2871#endif
2872
2873 if( eHAL_STATUS_SUCCESS !=
2874 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2875 {
2876 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2877 return;
2878 }
2879 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2880
2881 /// Add STA context at MAC HW (BMU, RHP & TFP)
2882 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2883 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
2884
2885 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2886 psessionEntry->bssId, sizeof(tSirMacAddr));
2887
2888 // Update this when we get reassoc rsp , with success.
2889 // pAddStaParams->assocId = psessionEntry->limAID;
2890
2891 pAddStaParams->staType = STA_ENTRY_SELF;
2892 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2893 pAddStaParams->respReqd = 1;
2894
2895 /* Update PE session ID */
2896 pAddStaParams->sessionId = psessionEntry->peSessionId;
2897
2898 // This will indicate HAL to "allocate" a new STA index
2899 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2900 pAddStaParams->updateSta = FALSE;
2901
2902 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002903#ifdef WLAN_FEATURE_11AC
2904 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
2905#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002907#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002908
Jeff Johnsone7245742012-09-05 17:12:55 -07002909 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002911 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002912#ifdef DISABLE_GF_FOR_INTEROP
2913 /*
2914 * To resolve the interop problem with Broadcom AP,
2915 * where TQ STA could not pass traffic with GF enabled,
2916 * TQ STA will do Greenfield only with TQ AP, for
2917 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002918 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2920 {
2921 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2922 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2923 }
2924 else
2925#endif
2926
2927#ifdef WLAN_SOFTAP_FEATURE
2928 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2929 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2930 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2931 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2932 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2933 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2934 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2935 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2936 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2937 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2938 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2939 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
2940#else
2941 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
2942 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
2943 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
2944 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
2945 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
2946 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
2947 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
2948 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
2949 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
2950 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
2951 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
2952 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
2953#endif
2954 }
2955
2956 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
2957 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
2958 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2959
2960 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2961
2962 // Lets save this for when we receive the Reassoc Rsp
2963 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
2964 return;
2965
2966end:
2967 // Free up buffer allocated for reassocReq
2968 if (pMlmReassocReq != NULL)
2969 {
2970 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
2971 }
2972 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2973 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2974 /* Update PE sessio Id*/
2975 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2976
2977 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2978}
2979#endif /* WLAN_FEATURE_VOWIFI_11R */
2980
2981
2982/**
2983 * limProcessStaMlmAddBssRsp()
2984 *
2985 *FUNCTION:
2986 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2987 * Upon receipt of this message from HAL, MLME -
2988 * > Validates the result of WDA_ADD_BSS_REQ
2989 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2990 *
2991 *LOGIC:
2992 * MLME had sent WDA_ADD_BSS_REQ to HAL
2993 * HAL responded with WDA_ADD_BSS_RSP to MLME
2994 * MLME now sends WDA_ADD_STA_REQ to HAL
2995 *
2996 *ASSUMPTIONS:
2997 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2998 * tSirMsgQ.body will now be freed by this routine
2999 *
3000 *NOTE:
3001 *
3002 * @param pMac Pointer to Global MAC structure
3003 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3004 *
3005 * @return None
3006 */
3007static void
3008limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3009{
3010 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3011 tLimMlmAssocCnf mlmAssocCnf;
3012 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3013 tANI_U32 subType = LIM_ASSOC;
3014 tpDphHashNode pStaDs = NULL;
3015 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3016 tANI_U8 updateSta = false;
3017 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3018
3019 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3020 {
3021 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
3022 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3023 goto end;
3024 }
3025 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3026 {
3027 mesgType = LIM_MLM_REASSOC_CNF;
3028 subType = LIM_REASSOC;
3029 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3030 //to update the existing STA entry.
3031 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3032 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3033 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3034 {
3035 staIdx = psessionEntry->staId;
3036 updateSta = true;
3037 }
3038 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003039
3040 if(pAddBssParams != 0)
3041 goto end;
3042
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3044 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003045#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3047 {
3048#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3049 PELOGE(limLog(pMac, LOGE, FL("Mlm=%d %d\n"),
3050 psessionEntry->limMlmState,
3051 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3052#endif
3053 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3054 goto end;
3055 }
3056#endif /* WLAN_FEATURE_VOWIFI_11R */
3057
3058 // Set MLME state
3059 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003060 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3062 // Now, send WDA_ADD_STA_REQ
3063 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
3064 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3065 if (pStaDs == NULL)
3066 {
3067 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3068 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3069 }
3070 else
3071 {
3072 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3073 //Success, handle below
3074 pStaDs->bssId = pAddBssParams->bssIdx;
3075 //STA Index(genr by HAL) for the BSS entry is stored here
3076 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3077 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3078 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3079 // Downgrade the EDCA parameters if needed
3080 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3081 // Send the active EDCA parameters to HAL
3082 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3083 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3084 } else {
3085 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3086 }
3087#if defined WLAN_FEATURE_VOWIFI
3088 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3089#endif
3090
3091 if (subType == LIM_REASSOC)
3092 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3093 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3094 {
3095 // Add STA context at HW
3096 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3097 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3098 }
3099 }
3100 }
3101 else
3102 {
3103 limLog( pMac, LOGP, FL( "ADD_BSS failed!\n" ));
3104 // Return Assoc confirm to SME with failure
3105 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3106 }
3107
3108 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3109 {
3110 /* Update PE session Id*/
3111 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3112 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3113 }
3114 end:
3115 if( 0 != limMsgQ->bodyptr )
3116 palFreeMemory( pMac->hHdd,(void *) pAddBssParams );
3117}
3118
3119
3120
3121/**
3122 * limProcessMlmAddBssRsp()
3123 *
3124 *FUNCTION:
3125 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3126 * Upon receipt of this message from HAL, MLME -
3127 * > Determines the "state" in which this message was received
3128 * > Forwards it to the appropriate callback
3129 *
3130 *LOGIC:
3131 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3132 * in the following two states:
3133 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3134 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3135 * Based on these two states, this API will determine where to
3136 * route the message to
3137 *
3138 *ASSUMPTIONS:
3139 *
3140 *NOTE:
3141 *
3142 * @param pMac Pointer to Global MAC structure
3143 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3144 *
3145 * @return None
3146 */
3147void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3148{
3149 tLimMlmStartCnf mlmStartCnf;
3150 tpPESession psessionEntry;
3151 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3152
3153 if(NULL == pAddBssParams )
3154 {
3155 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
3156 return;
3157 }
3158
3159 //
3160 // TODO & FIXME_GEN4
3161 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3162 //
3163 //we need to process the deferred message since the initiating req. there might be nested request.
3164 //in the case of nested request the new request initiated from the response will take care of resetting
3165 //the deffered flag.
3166 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3167 // Validate SME/LIM state
3168 // Validate MLME state
3169 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3170 {
3171 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003172 if( NULL != pAddBssParams )
3173 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 return;
3175 }
3176 /* update PE session Id*/
3177 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3178 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3179 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3180 else
3181 {
3182 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3183 {
3184 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3185 {
3186 // Mesg received from HAL in Invalid state!
3187 limLog( pMac, LOGE,
3188 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X\n" ),
3189 psessionEntry->limMlmState );
3190 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3191 if( 0 != limMsgQ->bodyptr )
3192 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
3193 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3194 }
3195 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3196 {
3197 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3198 }
3199 else
3200 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3201 }
3202 else
3203 /* Called while processing assoc response */
3204 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3205 }
3206}
3207/**
3208 * limProcessMlmSetKeyRsp()
3209 *
3210 *FUNCTION:
3211 * This function is called to process the following two
3212 * messages from HAL:
3213 * 1) WDA_SET_BSSKEY_RSP
3214 * 2) WDA_SET_STAKEY_RSP
3215 * 3) WDA_SET_STA_BCASTKEY_RSP
3216 * Upon receipt of this message from HAL,
3217 * MLME -
3218 * > Determines the "state" in which this message was received
3219 * > Forwards it to the appropriate callback
3220 *
3221 *LOGIC:
3222 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3223 * received by MLME while in the following state:
3224 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3225 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3226 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3227 * Based on this state, this API will determine where to
3228 * route the message to
3229 *
3230 *ASSUMPTIONS:
3231 * ONLY the MLME state is being taken into account for now.
3232 * This is because, it appears that the handling of the
3233 * SETKEYS REQ is handled symmetrically on both the AP & STA
3234 *
3235 *NOTE:
3236 *
3237 * @param pMac Pointer to Global MAC structure
3238 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3239 *
3240 * @return None
3241 */
3242void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3243{
Jeff Johnsone7245742012-09-05 17:12:55 -07003244 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 tLimMlmSetKeysCnf mlmSetKeysCnf;
3246 tANI_U8 sessionId = 0;
3247 tpPESession psessionEntry;
3248 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3249 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3250 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003251 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 {
3253 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3254 return;
3255 }
3256 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3257 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3258 {
3259 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003260 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 return;
3262 }
3263 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3264 {
3265 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003266 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 // There's not much that MLME can do at this stage...
3268 respReqd = 0;
3269 }
3270 else
3271 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3272
3273 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3274 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003275 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003276 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003277 if( respReqd )
3278 {
3279 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3280 // Prepare and Send LIM_MLM_SETKEYS_CNF
3281 if( NULL != lpLimMlmSetKeysReq )
3282 {
3283 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3284#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003285 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003286#endif
3287 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003288 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 pMac->lim.gpLimMlmSetKeysReq = NULL;
3290 }
3291 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003292 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 }
3294}
3295void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3296{
3297 tANI_U8 respReqd = 1;
3298 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003299 tANI_U16 resultCode;
3300 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 tpPESession psessionEntry;
3302 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3303 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3304 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003305 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 {
3307 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
3308 return;
3309 }
3310 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3311 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3312 {
3313 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003314 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 return;
3316 }
3317 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3318 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3319 else
3320 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3321
Jeff Johnsone7245742012-09-05 17:12:55 -07003322 //
3323 // TODO & FIXME_GEN4
3324 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3325 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3327 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3328 //{
3329 // Validate MLME state
3330 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3331 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3332 {
3333 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003334 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 // There's not much that MLME can do at this stage...
3336 respReqd = 0;
3337 }
3338 else
3339 mlmSetKeysCnf.resultCode = resultCode;
3340
3341 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3342 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3344
Jeff Johnsone7245742012-09-05 17:12:55 -07003345 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 if( respReqd )
3347 {
3348 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3349 mlmSetKeysCnf.sessionId = sessionId;
3350
3351 // Prepare and Send LIM_MLM_SETKEYS_CNF
3352 if( NULL != lpLimMlmSetKeysReq )
3353 {
3354 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3355#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003356 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003357#endif
3358 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003359 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 pMac->lim.gpLimMlmSetKeysReq = NULL;
3361 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003362 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 }
3364}
3365/**
3366 * limProcessMlmRemoveKeyRsp()
3367 *
3368 *FUNCTION:
3369 *
3370 *LOGIC:
3371 *
3372 *ASSUMPTIONS:
3373 *
3374 *NOTE:
3375 *
3376 * @param pMac Pointer to Global MAC structure
3377 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3378 *
3379 * @return None
3380 */
3381void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3382{
Jeff Johnsone7245742012-09-05 17:12:55 -07003383 tANI_U8 respReqd = 1;
3384 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3385 tANI_U16 resultCode;
3386 tANI_U8 sessionId = 0;
3387 tpPESession psessionEntry;
3388 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3389 palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ));
3390
3391 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003393 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3394 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 }
3396
Jeff Johnsone7245742012-09-05 17:12:55 -07003397 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3398 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3399 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3400 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003401
Jeff Johnsone7245742012-09-05 17:12:55 -07003402 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003404 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
3405 return;
3406 }
3407
3408 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3409 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3410 else
3411 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3412
3413 // Validate MLME state
3414 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3415 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3416 {
3417 // Mesg received from HAL in Invalid state!
3418 limLog(pMac, LOGW,
3419 FL("Received unexpected [Mesg Id - %d] in state %X\n"),
3420 limMsgQ->type,
3421 psessionEntry->limMlmState );
3422 respReqd = 0;
3423 }
3424 else
3425 mlmRemoveCnf.resultCode = resultCode;
3426
3427 //
3428 // TODO & FIXME_GEN4
3429 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3430 //
3431
3432 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3433
3434 // Restore MLME state
3435 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3436 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3437
3438 if( respReqd )
3439 {
3440 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3441 mlmRemoveCnf.sessionId = sessionId;
3442
3443 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3444 if( NULL != lpLimMlmRemoveKeyReq )
3445 {
3446 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3447 sizeof( tSirMacAddr ));
3448 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
3449 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
3450 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3451 }
3452 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003454}
3455
3456#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
3457/**----------------------------------------------------
3458\fn __limProcessFinishLearnRsp
3459\brief Handle finish learn rsp state, only for AP.
3460\param pMac
3461\return NONE
3462-----------------------------------------------------*/
3463static void __limProcessFinishLearnRsp(tpAniSirGlobal pMac)
3464{
3465 PELOG2(limLog(pMac, LOG2, FL("System Role: %d\n"), pMac->lim.gLimSystemRole);)
3466 if (pMac->lim.gpLimMeasReq == NULL)
3467 {
3468 limRestorePreLearnState(pMac);
3469 return;
3470 }
3471 /**
3472 * Initial measurement -> periodic measurement should keep enabled, so that
3473 * if system Role is UNKNOWN LIM can send indication to WSM. Overloading
3474 * periodic measurement to distinguish initial measurement and radar
3475 * detect park basically to avoid sending measurement indication after
3476 * radar detect park.
3477 * Radar detect park -> periodic measurement should be disabled, so that
3478 * LIM wont send indication even when role is UNKNOWN.
3479 * Final measurement -> periodic measurement should be enabled, so that
3480 * LIM could start measurement indication timer.
3481 */
3482 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled &&
3483 !pMac->lim.gLimMeasParams.isMeasIndTimerActive)
3484 {
3485#if 0 /* Will we be ever in UNKNOWN ROLE: Veerendra */
3486 if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
3487 {
3488 limSendSmeMeasurementInd(pMac);
3489 limCleanupMeasResources(pMac);
3490 limRestorePreLearnState(pMac);
3491 return;
3492 }
3493 else
3494#endif
3495 {
3496#ifdef GEN6_TODO
3497 /* revisit this piece of code to assign the appropriate sessionId below
3498 * priority - MEDIUM
3499 */
3500 pMac->lim.gLimMeasParams.measurementIndTimer.sessionId = sessionId;
3501#endif
3502 // Activate periodic measurement indication timer
3503 if (tx_timer_activate(
3504 &pMac->lim.gLimMeasParams.measurementIndTimer)
3505 != TX_SUCCESS)
3506 {
3507 limLog(pMac, LOGP, FL("could not start Meas IND timer\n"));
3508 return;
3509 }
3510 pMac->lim.gLimMeasParams.isMeasIndTimerActive = 1;
3511 }
3512 }
3513 if (pMac->lim.gLimMeasParams.nextLearnChannelId >=
3514 pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
3515 {
3516 // All channels in the channel set are learned.
3517 pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
3518 }
3519 // Go back to previous state.
3520 limRestorePreLearnState(pMac);
3521 // Restart the learn interval timer.
3522 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
3523 limReEnableLearnMode(pMac);
3524 return;
3525}
3526#endif
3527
3528/** ---------------------------------------------------------------------
3529\fn limProcessInitScanRsp
3530\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3531\ message from HAL. If status code is failure, then
3532\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3533\param tpAniSirGlobal pMac
3534\param tANI_U32 body
3535\return none
3536\ ----------------------------------------------------------------------- */
3537void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3538{
3539 tpInitScanParams pInitScanParam;
3540 eHalStatus status;
3541#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3542 tANI_U8 channelNum;
3543#endif
3544 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3545 pInitScanParam = (tpInitScanParams) body;
3546 status = pInitScanParam->status;
3547 palFreeMemory( pMac->hHdd, (char *)body);
3548
3549 //Only abort scan if the we are scanning.
3550 if( pMac->lim.abortScan &&
3551 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3552 {
3553 limLog( pMac, LOGW, FL(" finish scan\n") );
3554 pMac->lim.abortScan = 0;
3555 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3556 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3557 //Set the resume channel to Any valid channel (invalid).
3558 //This will instruct HAL to set it to any previous valid channel.
3559 peSetResumeChannel(pMac, 0, 0);
3560 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3561 }
3562 switch(pMac->lim.gLimHalScanState)
3563 {
3564 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3565 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3566 {
3567 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d\n"), status);)
3568 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3569 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3570 /*
3571 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3572 * another Scan request in the same context (happens when 11d is enabled
3573 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3574 * scan in the same context but with bigger channel list), so the state needs to be
3575 * changed before this response message is sent.
3576 */
3577 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3578#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3579 /* For handling the measurement request from WSM as scan request in LIM*/
3580#if 0
3581 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
3582 {
3583 limRestorePreLearnState(pMac);
3584 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3585 limReEnableLearnMode(pMac);
3586 }
3587#endif
3588#endif
3589 return;
3590 }
3591 else if (status == eHAL_STATUS_SUCCESS)
3592 {
3593 /* since we have successfully triggered a background scan,
3594 * reset the "consecutive bkgnd scan failure" count to 0
3595 */
3596 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3597 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3598 }
3599 limContinueChannelScan(pMac);
3600 break;
3601#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3602 case eLIM_HAL_INIT_LEARN_WAIT_STATE:
3603// if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3604 {
3605 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3606 {
3607 limRestorePreLearnState(pMac);
3608 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3609 limReEnableLearnMode(pMac);
3610 return;
3611 }
3612 channelNum = limGetCurrentLearnChannel(pMac);
3613 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
3614 }
3615 break;
3616#endif
3617//WLAN_SUSPEND_LINK Related
3618 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3619 if( pMac->lim.gpLimSuspendCallback )
3620 {
3621 if( status == eHAL_STATUS_SUCCESS )
3622 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
3623 else
3624 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3625
3626 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3627 pMac->lim.gpLimSuspendCallback = NULL;
3628 pMac->lim.gpLimSuspendData = NULL;
3629 }
3630 else
3631 {
3632 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state\n");
3633 return;
3634 }
3635 break;
3636//end WLAN_SUSPEND_LINK Related
3637 default:
3638 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d\n"),
3639 pMac->lim.gLimHalScanState);
3640 break;
3641 }
3642 return;
3643}
3644/**
3645 * limProcessSwitchChannelReAssocReq()
3646 *
3647 *FUNCTION:
3648 * This function is called to send the reassoc req mgmt frame after the
3649 * switchChannelRsp message is received from HAL.
3650 *
3651 *LOGIC:
3652 *
3653 *ASSUMPTIONS:
3654 * NA
3655 *
3656 *NOTE:
3657 * NA
3658 *
3659 * @param pMac - Pointer to Global MAC structure.
3660 * @param psessionEntry - session related information.
3661 * @param status - channel switch success/failure.
3662 *
3663 * @return None
3664 */
3665static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3666{
3667 tLimMlmReassocCnf mlmReassocCnf;
3668 tLimMlmReassocReq *pMlmReassocReq;
3669 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3670 if(pMlmReassocReq == NULL)
3671 {
3672 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession\n"));
3673 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3674 goto end;
3675 }
3676
3677 if(status != eHAL_STATUS_SUCCESS)
3678 {
3679 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3680 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3681 goto end;
3682 }
3683 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003684 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3686 != TX_SUCCESS)
3687 {
3688 /// Could not start reassoc failure timer.
3689 // Log error
3690 limLog(pMac, LOGP,
3691 FL("could not start Reassociation failure timer\n"));
3692 // Return Reassoc confirm with
3693 // Resources Unavailable
3694 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3695 goto end;
3696 }
3697 /// Prepare and send Reassociation request frame
3698 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3699 return;
3700end:
3701 // Free up buffer allocated for reassocReq
3702 if(pMlmReassocReq != NULL)
3703 {
3704 /* Update PE session Id*/
3705 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
3706 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
3707 }
3708 else
3709 {
3710 mlmReassocCnf.sessionId = 0;
3711 }
3712
3713 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3714 /* Update PE sessio Id*/
3715 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3716
3717 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3718}
3719/**
3720 * limProcessSwitchChannelJoinReq()
3721 *
3722 *FUNCTION:
3723 * This function is called to send the probe req mgmt frame after the
3724 * switchChannelRsp message is received from HAL.
3725 *
3726 *LOGIC:
3727 *
3728 *ASSUMPTIONS:
3729 * NA
3730 *
3731 *NOTE:
3732 * NA
3733 *
3734 * @param pMac - Pointer to Global MAC structure.
3735 * @param psessionEntry - session related information.
3736 * @param status - channel switch success/failure.
3737 *
3738 * @return None
3739 */
3740static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3741{
3742 tANI_U32 val;
3743 tSirMacSSid ssId;
3744 tLimMlmJoinCnf mlmJoinCnf;
3745 if(status != eHAL_STATUS_SUCCESS)
3746 {
3747 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3748 goto error;
3749 }
3750
3751 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3752 {
3753 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!\n"));)
3754 goto error;
3755 }
3756
Jeff Johnsone7245742012-09-05 17:12:55 -07003757
Jeff Johnson295189b2012-06-20 16:38:30 -07003758 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3759 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3760 {
3761 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3762 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3763 goto error;
3764 }
3765 else
3766 {
3767 if(limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
3768 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3769 goto error;
3770 }
3771 // Update BSSID at CFG database
3772#if 0
3773 if (cfgSetStr(pMac, WNI_CFG_BSSID, pMac->lim.gpLimMlmJoinReq->bssDescription.bssId,
3774 sizeof(tSirMacAddr))
3775 != eSIR_SUCCESS)
3776 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
3777#endif //TO SUPPORT BT-AMP
3778 //sirCopyMacAddr(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,psessionEntry->bssId);
3779
3780 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3781 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
3782 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!\n"));
3783 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3784 // Apply previously set configuration at HW
3785 limApplyConfiguration(pMac, psessionEntry);
3786 /// Wait for Beacon to announce join success
3787#if 0
3788 if (cfgGetStr(pMac, WNI_CFG_SSID, ssId.ssId, &cfgLen) != eSIR_SUCCESS)
3789 limLog(pMac, LOGP, FL("could not retrive SSID\n"));
3790#endif //To SUPPORT BT-AMP
3791 palCopyMemory( pMac->hHdd, ssId.ssId,
3792 psessionEntry->ssId.ssId,
3793 psessionEntry->ssId.length);
3794 ssId.length = psessionEntry->ssId.length;
3795 // include additional IE if there is
3796 limSendProbeReqMgmtFrame( pMac, &ssId,
3797 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3798 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3799 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003800
3801 // Sending mgmt frame is a blocking call activate Join failure timer now
3802 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3803 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3804 {
3805 limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
3806 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3807 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3808 //memory is freed up below.
3809 psessionEntry->pLimMlmJoinReq = NULL;
3810 goto error;
3811 }
3812
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 return;
3814error:
3815 if(NULL != psessionEntry)
3816 {
3817 palFreeMemory( pMac->hHdd, (tANI_U8 *) (psessionEntry->pLimMlmJoinReq));
3818 psessionEntry->pLimMlmJoinReq = NULL;
3819 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3820 }
3821 else
3822 {
3823 mlmJoinCnf.sessionId = 0;
3824 }
3825 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3826 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3827 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3828}
3829
3830/**
3831 * limProcessSwitchChannelRsp()
3832 *
3833 *FUNCTION:
3834 * This function is called to process switchChannelRsp message from HAL.
3835 *
3836 *LOGIC:
3837 *
3838 *ASSUMPTIONS:
3839 * NA
3840 *
3841 *NOTE:
3842 * NA
3843 *
3844 * @param pMac - Pointer to Global MAC structure
3845 * @param body - message body.
3846 *
3847 * @return None
3848 */
3849void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3850{
3851 tpSwitchChannelParams pChnlParams = NULL;
3852 eHalStatus status;
3853 tANI_U16 channelChangeReasonCode;
3854 tANI_U8 peSessionId;
3855 tpPESession psessionEntry;
3856 //we need to process the deferred message since the initiating req. there might be nested request.
3857 //in the case of nested request the new request initiated from the response will take care of resetting
3858 //the deffered flag.
3859 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3860 pChnlParams = (tpSwitchChannelParams) body;
3861 status = pChnlParams->status;
3862 peSessionId = pChnlParams->peSessionId;
3863 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3864 {
3865 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3866 limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
3867 return;
3868 }
3869#if defined WLAN_FEATURE_VOWIFI
3870 //HAL fills in the tx power used for mgmt frames in this field.
3871 //Store this value to use in TPC report IE.
3872 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3873#endif
3874 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3875 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3876 // initialize it back to invalid id
3877 psessionEntry->channelChangeReasonCode = 0xBAD;
3878 switch(channelChangeReasonCode)
3879 {
3880 case LIM_SWITCH_CHANNEL_REASSOC:
3881 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3882 break;
3883 case LIM_SWITCH_CHANNEL_JOIN:
3884 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3885 break;
3886
3887 case LIM_SWITCH_CHANNEL_OPERATION:
3888 /*
3889 * The above code should also use the callback.
3890 * mechanism below, there is scope for cleanup here.
3891 * THat way all this response handler does is call the call back
3892 * We can get rid of the reason code here.
3893 */
3894 if (pMac->lim.gpchangeChannelCallback)
3895 {
3896 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back\n");)
3897 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3898 }
3899 break;
3900 default:
3901 break;
3902 }
3903}
3904/**
3905 * limProcessStartScanRsp()
3906 *
3907 *FUNCTION:
3908 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3909 * then it will start scan/learn on the next channel.
3910 *
3911 *LOGIC:
3912 *
3913 *ASSUMPTIONS:
3914 * NA
3915 *
3916 *NOTE:
3917 * NA
3918 *
3919 * @param pMac - Pointer to Global MAC structure
3920 * @param body - message body.
3921 *
3922 * @return None
3923 */
3924
3925void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3926{
3927 tpStartScanParams pStartScanParam;
3928 eHalStatus status;
3929 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3930 pStartScanParam = (tpStartScanParams) body;
3931 status = pStartScanParam->status;
3932#if defined WLAN_FEATURE_VOWIFI
3933 //HAL fills in the tx power used for mgmt frames in this field.
3934 //Store this value to use in TPC report IE.
3935 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3936 //Store start TSF of scan start. This will be stored in BSS params.
3937 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3938#endif
3939 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3940 if( pMac->lim.abortScan )
3941 {
3942 limLog( pMac, LOGW, FL(" finish scan\n") );
3943 pMac->lim.abortScan = 0;
3944 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3945 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3946 //Set the resume channel to Any valid channel (invalid).
3947 //This will instruct HAL to set it to any previous valid channel.
3948 peSetResumeChannel(pMac, 0, 0);
3949 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3950 }
3951 switch(pMac->lim.gLimHalScanState)
3952 {
3953 case eLIM_HAL_START_SCAN_WAIT_STATE:
3954 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3955 {
3956 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d\n"), status);)
3957 //
3958 // FIXME - With this, LIM will try and recover state, but
3959 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3960 // status back to the SME
3961 //
3962 //Set the resume channel to Any valid channel (invalid).
3963 //This will instruct HAL to set it to any previous valid channel.
3964 peSetResumeChannel(pMac, 0, 0);
3965 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3966 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3967 }
3968 else
3969 {
3970 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3971 limContinuePostChannelScan(pMac);
3972 }
3973 break;
3974#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3975 case eLIM_HAL_START_LEARN_WAIT_STATE:
3976 // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3977 {
3978 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3979 {
3980 //Set the resume channel to Any valid channel (invalid).
3981 //This will instruct HAL to set it to any previous valid channel.
3982 peSetResumeChannel(pMac, 0, 0);
3983 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
3984 }
3985 else
3986 {
3987 limContinueChannelLearn(pMac);
3988 }
3989 }
3990 break;
3991#endif
3992 default:
3993 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d\n"),
3994 pMac->lim.gLimHalScanState);
3995 break;
3996 }
3997 return;
3998}
3999void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4000{
4001 tpEndScanParams pEndScanParam;
4002 eHalStatus status;
4003#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4004 tANI_U8 channelNum;
4005#endif
4006 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4007 pEndScanParam = (tpEndScanParams) body;
4008 status = pEndScanParam->status;
4009 palFreeMemory( pMac->hHdd, (char *)body);
4010 switch(pMac->lim.gLimHalScanState)
4011 {
4012 case eLIM_HAL_END_SCAN_WAIT_STATE:
4013 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4014 {
4015 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4016 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4017 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4018 }
4019 else
4020 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004021 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004022 limContinueChannelScan(pMac);
4023 }
4024 break;
4025#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4026 case eLIM_HAL_END_LEARN_WAIT_STATE:
4027 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4028 {
4029 //Set the resume channel to Any valid channel (invalid).
4030 //This will instruct HAL to set it to any previous valid channel.
4031 peSetResumeChannel(pMac, 0, 0);
4032 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4033 }
4034#if 0 /* Will we be in UNKNOWN ROLE ever in this context: Veerendra */
4035 else if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
4036 {
4037 /** Before starting BSS, we do complete set of measurement before putting
4038 * softmac back into normal mode.
4039 */
4040 channelNum = limGetCurrentLearnChannel(pMac);
4041 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
4042 }
4043 else
4044#endif
4045 {
4046 limLog(pMac, LOGW, FL("ERROR! This state is set only when AP in UNKNOWN_ROLE\n"),
4047 pMac->lim.gLimHalScanState);
4048 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4049 }
4050 break;
4051#endif
4052 default:
4053 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d\n"),
4054 pMac->lim.gLimHalScanState);
4055 break;
4056 }
4057 return;
4058}
Jeff Johnsone7245742012-09-05 17:12:55 -07004059/**
4060 * limStopTxAndSwitch()
4061 *
4062 *FUNCTION:
4063 * Start channel switch on all sessions that is in channel switch state.
4064 *
4065 * @param pMac - pointer to global adapter context
4066 *
4067 * @return None
4068 *
4069 */
4070static void
4071limStopTxAndSwitch (tpAniSirGlobal pMac)
4072{
4073 tANI_U8 i;
4074
4075 for(i =0; i < pMac->lim.maxBssId; i++)
4076 {
4077 if(pMac->lim.gpSession[i].valid &&
4078 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4079 {
4080 limStopTxAndSwitchChannel(pMac, i);
4081 }
4082 }
4083 return;
4084}
4085/**
4086 * limStartQuietOnSession()
4087 *
4088 *FUNCTION:
4089 * This function is called to start quiet timer after finish scan if there is
4090 * qeuieting on any session.
4091 *
4092 *LOGIC:
4093 *
4094 *ASSUMPTIONS:
4095 * NA
4096 *
4097 *NOTE:
4098 * NA
4099 *
4100 * @param pMac - Pointer to Global MAC structure
4101 *
4102 * @return None
4103 */
4104static void
4105limStartQuietOnSession (tpAniSirGlobal pMac)
4106{
4107 tANI_U8 i;
4108
4109 for(i =0; i < pMac->lim.maxBssId; i++)
4110 {
4111 if(pMac->lim.gpSession[i].valid &&
4112 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4113 {
4114 limStartQuietTimer(pMac, i);
4115 }
4116 }
4117 return;
4118}
Jeff Johnson295189b2012-06-20 16:38:30 -07004119void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4120{
4121 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 eHalStatus status;
4123 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4124 pFinishScanParam = (tpFinishScanParams) body;
4125 status = pFinishScanParam->status;
4126 palFreeMemory( pMac->hHdd, (char *)body);
4127 switch(pMac->lim.gLimHalScanState)
4128 {
4129 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4130 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4131 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004132 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 {
4134 /** Right time to stop tx and start the timer for channel switch */
4135 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4136 * be any associated session id
4137 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004138 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004139 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004140 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 {
4142 /** Start the quieting */
4143 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4144 * be any associated session id
4145 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004146 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004147 }
4148#ifdef ANI_PRODUCT_TYPE_AP
4149 /* For handling the measurement request from WSM as scan request in LIM*/
4150#if 0
4151 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
4152 {
4153 limSendSmeMeasurementInd(pMac);
4154 limCleanupMeasResources(pMac);
4155 limRestorePreLearnState(pMac);
4156 }
4157#endif
4158#endif
4159 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4160 {
4161 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4162 }
4163 break;
4164#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4165 case eLIM_HAL_FINISH_LEARN_WAIT_STATE:
4166 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4167 __limProcessFinishLearnRsp(pMac);
4168 break;
4169#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4170//WLAN_SUSPEND_LINK Related
4171 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4172 if( pMac->lim.gpLimResumeCallback )
4173 {
4174 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4175 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4176 pMac->lim.gpLimResumeCallback = NULL;
4177 pMac->lim.gpLimResumeData = NULL;
4178 pMac->lim.gLimSystemInScanLearnMode = 0;
4179 }
4180 else
4181 {
4182 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state\n");
4183 return;
4184 }
4185 break;
4186//end WLAN_SUSPEND_LINK Related
4187
4188 default:
4189 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d\n"),
4190 pMac->lim.gLimHalScanState);
4191 break;
4192 }
4193 return;
4194}
4195/**
4196 * @function : limProcessMlmHalAddBARsp
4197 *
4198 * @brief: Process WDA_ADDBA_RSP coming from HAL
4199 *
4200 *
4201 * @param pMac The global tpAniSirGlobal object
4202 *
4203 * @param tSirMsgQ The MsgQ header containing the response buffer
4204 *
4205 * @return none
4206 */
4207void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4208 tpSirMsgQ limMsgQ )
4209{
4210 // Send LIM_MLM_ADDBA_CNF to LIM
4211 tpLimMlmAddBACnf pMlmAddBACnf;
4212 tpPESession psessionEntry;
4213 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
4214#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4215 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4216#endif //FEATURE_WLAN_DIAG_SUPPORT
4217 //now LIM can process any defer message.
4218 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4219 if (pAddBAParams == NULL) {
4220 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL\n"));)
4221 return;
4222 }
4223 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4224 {
4225 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d\n"),pAddBAParams->sessionId );)
4226 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4227 return;
4228 }
4229#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4230 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4231#endif //FEATURE_WLAN_DIAG_SUPPORT
4232
4233 // Allocate for LIM_MLM_ADDBA_CNF
4234 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4235 (void **) &pMlmAddBACnf, sizeof( tLimMlmAddBACnf ))) {
4236 limLog( pMac, LOGP, FL(" palAllocateMemory failed with error code %d\n"));
4237 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4238 return;
4239 }
4240 palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
4241 // Copy the peer MAC
4242 palCopyMemory( pMac->hHdd, pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4243 sizeof( tSirMacAddr ));
4244 // Copy other ADDBA Rsp parameters
4245 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4246 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4247 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4248 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4249 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4250 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4251 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4252 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4253 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4254 else
4255 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4256 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4257 // Send ADDBA CNF to LIM
4258 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4259}
4260/**
4261 * \brief Process LIM_MLM_ADDBA_CNF
4262 *
4263 * \sa limProcessMlmAddBACnf
4264 *
4265 * \param pMac The global tpAniSirGlobal object
4266 *
4267 * \param tSirMsgQ The MsgQ header containing the response buffer
4268 *
4269 * \return none
4270 */
4271void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4272 tANI_U32 *pMsgBuf )
4273{
4274tpLimMlmAddBACnf pMlmAddBACnf;
4275tpDphHashNode pSta;
4276tANI_U16 aid;
4277tLimBAState curBaState;
4278tpPESession psessionEntry = NULL;
4279if(pMsgBuf == NULL)
4280{
4281 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4282 return;
4283}
4284pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4285 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4286 {
4287 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004288 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 return;
4290 }
4291 // First, extract the DPH entry
4292 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4293 if( NULL == pSta )
4294 {
4295 PELOGE(limLog( pMac, LOGE,
4296 FL( "STA context not found - ignoring ADDBA CNF from HAL\n" ));)
4297 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4298 return;
4299 }
4300 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4301 // Need to validate SME state
4302 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4303 {
4304 PELOGE(limLog( pMac, LOGE,
4305 FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
4306 curBaState );)
Jeff Johnsone7245742012-09-05 17:12:55 -07004307 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004308 return;
4309 }
4310 // Restore STA BA state
4311 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004312 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 {
4314 // Update LIM internal cache...
4315 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4316 {
4317 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4318 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4319 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4320 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4321 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4322 }
4323 else
4324 {
4325 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4326 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4327 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4328 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4329 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4330 }
4331 }
4332 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4333 {
4334 //
4335 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4336 // status code. MLME will then send an ADDBA RSP
4337 // over the air to the peer MAC entity
4338 //
4339 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4340 pMlmAddBACnf->peerMacAddr,
4341 pMlmAddBACnf->addBAResultCode,
4342 pMlmAddBACnf->baDialogToken,
4343 (tANI_U8) pMlmAddBACnf->baTID,
4344 (tANI_U8) pMlmAddBACnf->baPolicy,
4345 pMlmAddBACnf->baBufferSize,
4346 pMlmAddBACnf->baTimeout,psessionEntry))
4347 {
4348 PELOGW(limLog( pMac, LOGW,
4349 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4350 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4351 }
4352 }
4353 // Free the memory allocated for LIM_MLM_ADDBA_CNF
4354 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4355}
4356/**
4357 * \brief Process LIM_MLM_DELBA_CNF
4358 *
4359 * \sa limProcessMlmDelBACnf
4360 *
4361 * \param pMac The global tpAniSirGlobal object
4362 *
4363 * \param tSirMsgQ The MsgQ header containing the response buffer
4364 *
4365 * \return none
4366 */
4367void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4368 tANI_U32 *pMsgBuf )
4369{
4370 tpLimMlmDelBACnf pMlmDelBACnf;
4371 tpDphHashNode pSta;
4372 tANI_U16 aid;
4373// tANI_U8 sessionId;
4374 tLimBAState curBaState;
4375 tpPESession psessionEntry;
4376
4377 if(pMsgBuf == NULL)
4378 {
4379 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4380 return;
4381 }
4382 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4383 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4384 {
4385 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004386 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 return;
4388 }
4389 // First, extract the DPH entry
4390 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4391 if( NULL == pSta )
4392 {
4393 limLog( pMac, LOGE,
4394 FL( "STA context not found - ignoring DELBA CNF from HAL\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 if(NULL == pMlmDelBACnf)
4399 {
4400 limLog( pMac, LOGE,
4401 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL\n" ));
4402 return;
4403 }
4404 // Need to validate baState
4405 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4406 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4407 {
4408 limLog( pMac, LOGE,
4409 FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
4410 curBaState );
Jeff Johnsone7245742012-09-05 17:12:55 -07004411 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 return;
4413 }
4414 // Restore STA BA state
4415 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4416 // Free the memory allocated for LIM_MLM_DELBA_CNF
4417 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4418}
4419/**
4420 * \brief Process SIR_LIM_DEL_BA_IND
4421 *
4422 * \sa limProcessMlmHalBADeleteInd
4423 *
4424 * \param pMac The global tpAniSirGlobal object
4425 *
4426 * \param tSirMsgQ The MsgQ header containing the indication buffer
4427 *
4428 * \return none
4429 */
4430void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4431 tpSirMsgQ limMsgQ )
4432{
4433 tSirRetStatus status = eSIR_SUCCESS;
4434 tpBADeleteParams pBADeleteParams;
4435 tpDphHashNode pSta;
4436 tANI_U16 aid;
4437 tLimBAState curBaState;
4438 tpPESession psessionEntry;
4439 tANI_U8 sessionId;
4440
4441 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4442
4443 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4444 {
4445 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004446 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07004447 return;
4448 }
4449 // First, extract the DPH entry
4450 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4451 if( NULL == pSta )
4452 {
4453 limLog( pMac, LOGE,
4454 FL( "STA context not found - ignoring BA Delete IND from HAL\n" ));
4455 goto returnAfterCleanup;
4456 }
4457
4458 // Need to validate BA state
4459 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4460 if( eLIM_BA_STATE_IDLE != curBaState )
4461 {
4462 limLog( pMac, LOGE,
4463 FL( "Received unexpected BA Delete IND when STA BA state is %d\n" ),
4464 curBaState );
4465 goto returnAfterCleanup;
4466 }
4467
4468 // Validate if a BA is active for the requested TID
4469 // AND in that desired direction
4470 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4471 {
4472 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4473 status = eSIR_FAILURE;
4474 }
4475 else
4476 {
4477 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4478 status = eSIR_FAILURE;
4479 }
4480 if( eSIR_FAILURE == status )
4481 {
4482 limLog( pMac, LOGW,
4483 FL("Received an INVALID DELBA Delete Ind for TID %d...\n"),
4484 pBADeleteParams->baTID );
4485 }
4486 else
4487 {
4488 // Post DELBA REQ to MLME...
4489 if( eSIR_SUCCESS !=
4490 (status = limPostMlmDelBAReq( pMac,
4491 pSta,
4492 pBADeleteParams->baDirection,
4493 pBADeleteParams->baTID,
4494 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4495 {
4496 limLog( pMac, LOGE,
4497 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d\n" ), status);
4498 }
4499 else
4500 {
4501 limLog( pMac, LOGE,
4502 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4503 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4504 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4505 }
4506 }
4507returnAfterCleanup:
4508 // Free the memory allocated for SIR_LIM_DEL_BA_IND
4509 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
4510}
4511/**
4512 * @function : limProcessSetMimoRsp()
4513 *
4514 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4515 * after Processing the Req from the SME (PMC)
4516 *
4517 * LOGIC:
4518 *
4519 * ASSUMPTIONS:
4520 * NA
4521 *
4522 * NOTE:
4523 * NA
4524 *
4525 * @param pMac - Pointer to Global MAC structure
4526 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4527 * @return None
4528 */
4529
4530void
4531limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4532{
4533#if 0
4534 tSirRetStatus retStatus;
4535 tpSetMIMOPS pMIMO_PSParams;
4536
4537
4538 do {
4539
4540 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4541 if( NULL == pMIMO_PSParams ) {
4542 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4543 return;
4544 }
4545
4546 /** If Updation of the HAL Fail's*/
4547 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
4548 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed\n"));
4549 break;
4550 }
4551
4552 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4553 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4554 break;
4555
4556 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4557 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4558
4559 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4560 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4561 * the Action Frame is being sent at first before setting the internal structures
4562 */
4563 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4564 tSirMacAddr macAddr;
4565
4566 /** Obtain the AP's Mac Address */
4567 palCopyMemory(pMac -> hHdd, (tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
4568
4569 /** Send Action Frame with the corresponding mode */
4570 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4571 if (retStatus != eSIR_SUCCESS) {
4572 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed\n"));)
4573 break;
4574 }
4575 }
4576 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4577 }while(0);
4578
4579 palFreeMemory( pMac->hHdd, (void *) pMIMO_PSParams );
4580#endif
4581}
4582/**
4583 * @function : limHandleDelBssInReAssocContext
4584 * @brief : While Processing the ReAssociation Response Frame in STA,
4585 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4586 * being issued and the end of DelBSS the new BSS is being added.
4587 *
4588 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4589 * change, We need to update CSR with ReAssocCNF Response with the
4590 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4591 * context only
4592 *
4593 * @param : pMac - tpAniSirGlobal
4594 * pStaDs - Station Descriptor
4595 *
4596 * @return : none
4597 */
4598static void
4599limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4600{
4601 tLimMlmReassocCnf mlmReassocCnf;
4602 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4603 /** Set the MlmState to IDLE*/
4604 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004605 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 /* Update PE session Id*/
4607 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4608 switch (psessionEntry->limMlmState) {
4609#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4610 case eLIM_SME_WT_REASSOC_STATE :
4611 {
4612 tpSirAssocRsp assocRsp;
4613 tpDphHashNode pStaDs;
4614 tSirRetStatus retStatus = eSIR_SUCCESS;
4615#ifdef ANI_PRODUCT_TYPE_CLIENT
4616 tSchBeaconStruct beaconStruct;
4617#endif
4618 /** Delete the older STA Table entry */
4619 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4620 /**
4621 * Add an entry for AP to hash table
4622 * maintained by DPH module
4623 */
4624 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4625 {
4626 // Could not add hash table entry
4627 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
4628 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4629 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4630 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4631 goto Error;
4632 }
4633 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4634 * is being stored to be used here for sending ADDBSS
4635 */
4636 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4637 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4638 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
4639#ifdef ANI_PRODUCT_TYPE_CLIENT
4640 limExtractApCapabilities( pMac,
4641 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4642 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4643 &beaconStruct );
4644 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4645 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4646 if(beaconStruct.erpPresent) {
4647 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4648 psessionEntry->beaconParams.fShortPreamble = 0;
4649 else
4650 psessionEntry->beaconParams.fShortPreamble = 1;
4651 }
4652 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4653 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4654 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
4655 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4656 retStatus = eSIR_FAILURE;
4657 }
4658#elif defined(ANI_AP_CLIENT_SDK)
4659 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
4660 false, psessionEntry)) {
4661 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4662 retStatus = eSIR_FAILURE;
4663 }
4664#endif
4665 if (retStatus != eSIR_SUCCESS)
4666 {
4667 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4668 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4669 palFreeMemory(pMac->hHdd, assocRsp);
4670 pMac->lim.gLimAssocResponseData = NULL;
4671 goto Error;
4672 }
4673 palFreeMemory(pMac->hHdd, assocRsp);
4674 psessionEntry->limAssocResponseData = NULL;
4675 }
4676 break;
4677 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4678 {
4679 /** Case wherein the DisAssoc / Deauth
4680 * being sent as response to ReAssoc Req*/
4681 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4682 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4683 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4684 /** Set the SME State back to WT_Reassoc State*/
4685 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004686 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004687 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4688 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4689 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4690 {
4691 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004692 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004693 }
4694 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4695 }
4696 break;
4697#endif
4698 default:
4699 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4700 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4701 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4702 goto Error;
4703 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004704 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004705Error:
4706 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4707}
4708
4709/* Added For BT -AMP Support */
4710static void
4711limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4712{
4713 tLimMlmStartCnf mlmStartCnf;
4714 tANI_U32 val;
4715 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4716
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304717 if (NULL == pAddBssParams)
4718 {
4719 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
4720 goto end;
4721 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004722 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4723 {
4724 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));
4725 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4726 {
4727 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4728 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4729 goto end;
4730 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4731 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4732 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4733 goto end;
4734 }
4735
4736 // Set MLME state
4737 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4738 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4739 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4740 schEdcaProfileUpdate(pMac, psessionEntry);
4741 limInitAIDpool(pMac,psessionEntry);
4742 // Create timers used by LIM
4743 if (!pMac->lim.gLimTimersCreated)
4744 limCreateTimers(pMac);
4745 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4746 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
4747 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
4748 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4749 // Apply previously set configuration at HW
4750 limApplyConfiguration(pMac,psessionEntry);
4751 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4752 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4753 }
4754 else
4755 {
4756 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
4757 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4758 }
4759 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4760 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4761 end:
4762 if( 0 != limMsgQ->bodyptr )
4763 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
4764}
4765
4766/**
4767 * @function : limHandleAddBssInReAssocContext
4768 * @brief : While Processing the ReAssociation Response Frame in STA,
4769 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4770 * being issued and the end of DelBSS the new BSS is being added.
4771 *
4772 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4773 * change, We need to update CSR with ReAssocCNF Response with the
4774 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4775 * context only
4776 *
4777 * @param : pMac - tpAniSirGlobal
4778 * pStaDs - Station Descriptor
4779 *
4780 * @return : none
4781 */
4782void
4783limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4784{
4785 tLimMlmReassocCnf mlmReassocCnf;
4786 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4787 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004788 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4789 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 switch (psessionEntry->limSmeState) {
4791#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4792 case eLIM_SME_WT_REASSOC_STATE : {
4793 tpSirAssocRsp assocRsp;
4794 tpDphHashNode pStaDs;
4795 tSirRetStatus retStatus = eSIR_SUCCESS;
4796#ifdef ANI_PRODUCT_TYPE_CLIENT
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004797 tSchBeaconStruct *pBeaconStruct;
4798 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
4799 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
4800 {
4801 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limHandleAddBssInReAssocContext\n") );
4802 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4803 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4804 goto Error;
4805 }
4806
Jeff Johnson295189b2012-06-20 16:38:30 -07004807#endif
4808 // Get the AP entry from DPH hash table
4809 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4810 if (pStaDs == NULL )
4811 {
4812 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));)
4813 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4814 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004815 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 goto Error;
4817 }
4818 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4819 * is being stored to be used here for sending ADDBSS
4820 */
4821 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4822 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4823 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
4824#ifdef ANI_PRODUCT_TYPE_CLIENT
4825 limExtractApCapabilities( pMac,
4826 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4827 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004828 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004829 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004830 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4831
4832 if(pBeaconStruct->erpPresent)
4833 {
4834 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 psessionEntry->beaconParams.fShortPreamble = 0;
4836 else
4837 psessionEntry->beaconParams.fShortPreamble = 1;
4838 }
4839
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004840 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
4842 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4843 retStatus = eSIR_FAILURE;
4844 }
4845#elif defined(ANI_AP_CLIENT_SDK)
4846 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &pMac->lim.gpLimReassocReq->neighborBssList.bssList[0], true)) {
4847 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4848 retStatus = eSIR_FAILURE;
4849 }
4850#endif
4851 if (retStatus != eSIR_SUCCESS)
4852 {
4853 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4854 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4855 palFreeMemory(pMac->hHdd, assocRsp);
4856 pMac->lim.gLimAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004857 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 goto Error;
4859 }
4860 palFreeMemory(pMac->hHdd, assocRsp);
4861 psessionEntry->limAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004862 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 }
4864 break;
4865 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4866 * being sent as response to ReAssoc Req*/
4867 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4868 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4869 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4870 /** Set the SME State back to WT_Reassoc State*/
4871 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4872 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4873 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
4874 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4875
4876 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4877 }
4878 break;
4879#endif
4880 default:
4881 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4882 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4883 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4884 goto Error;
4885 }
4886return;
4887Error:
4888 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4889}
4890
4891#if 0
4892 static void
4893limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4894{
4895 tSirSmeAssocCnf assocCnf;
4896 tpDphHashNode pStaDs;
4897 tpPESession psessionEntry;
4898 tANI_U8 sessionId;
4899
4900 if(pMsgBuf == NULL)
4901 {
4902 limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
4903 goto end;
4904 }
4905 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4906 !__limIsSmeAssocCnfValid(&assocCnf))
4907 {
4908 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
4909 goto end;
4910 }
4911 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4912 {
4913 limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
4914 goto end;
4915 }
4916 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4917 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4918 {
4919 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
4920 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4921 goto end;
4922 }
4923 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4924 if (pStaDs == NULL)
4925 {
4926 limLog(pMac, LOG1,
4927 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4928 msgType, assocCnf.aid);
4929 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4930 /*
4931 ** send a DISASSOC_IND message to WSM to make sure
4932 ** the state in WSM and LIM is the same
4933 **/
4934 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4935 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4936 goto end;
4937 }
4938 if ((pStaDs &&
4939 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
4940 (tANI_U8 *) assocCnf.peerMacAddr,
4941 sizeof(tSirMacAddr)) ) ||
4942 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4943 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4944 (msgType != eWNI_SME_ASSOC_CNF)) ||
4945 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4946 (msgType != eWNI_SME_REASSOC_CNF)))))
4947 {
4948 limLog(pMac, LOG1,
4949 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4950 msgType, assocCnf.aid);
4951 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4952 goto end;
4953 }
4954 /*
4955 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4956 ** has been received
4957 **/
4958 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
4959 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4960 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4961 {
4962 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4963 * when it had received Assoc Request frame. Now, PE just needs to send
4964 * Association Response frame to the requesting BTAMP-STA.
4965 */
4966 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
4967 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
4968 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4969 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4970 goto end;
4971 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4972 else
4973 {
4974 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4975 limRejectAssociation(pMac, pStaDs->staAddr,
4976 pStaDs->mlmStaContext.subType,
4977 true, pStaDs->mlmStaContext.authType,
4978 pStaDs->assocId, true,
4979 assocCnf.statusCode, psessionEntry);
4980 return;
4981 }
4982end:
4983 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4984 {
4985 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4986 {
4987 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
4988 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4989 }
4990
4991 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
4992 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4993 }
4994} /*** end __limProcessSmeAssocCnfNew() ***/
4995#endif
4996
4997#ifdef WLAN_SOFTAP_FEATURE
4998void
4999limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5000 tBeaconGenParams *pBeaconGenParams = NULL;
5001 tSirMsgQ limMsg;
5002 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5003 if(psessionEntry == NULL ){
5004 PELOGE( limLog( pMac, LOGE,
5005 FL( "Error:Unable to get the PESessionEntry\n" ));)
5006 return;
5007 }
5008 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5009 (void **) &pBeaconGenParams, (sizeof(*pBeaconGenParams))))
5010 {
5011 PELOGE( limLog( pMac, LOGP,
5012 FL( "Unable to PAL allocate memory during sending beaconPreMessage\n" ));)
5013 return;
5014 }
5015 palZeroMemory( pMac->hHdd, pBeaconGenParams, sizeof(*pBeaconGenParams));
5016 palCopyMemory( pMac->hHdd, (void *) pBeaconGenParams->bssId,
5017 (void *)psessionEntry->bssId,
5018 SIR_MAC_ADDR_LENGTH );
5019 limMsg.bodyptr = pBeaconGenParams;
5020 schProcessPreBeaconInd(pMac, &limMsg);
5021 return;
5022}
5023#endif