blob: 8a89b9112d523552c794bbfd982e7f1a341bf790 [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
2869 // Downgrade the EDCA parameters if needed
2870 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
2871
2872 // Send the active EDCA parameters to HAL
2873 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
2874 {
2875 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
2876 }
2877 else
2878 {
2879 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
2880 }
2881
2882#if defined WLAN_FEATURE_VOWIFI
2883 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2884#endif
2885
2886 if( eHAL_STATUS_SUCCESS !=
2887 palAllocateMemory( pMac->hHdd, (void **) &pAddStaParams, sizeof( tAddStaParams )))
2888 {
2889 limLog( pMac, LOGP, FL( "Unable to PAL allocate memory during ADD_STA\n" ));
2890 return;
2891 }
2892 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams, sizeof(tAddStaParams));
2893
2894 /// Add STA context at MAC HW (BMU, RHP & TFP)
2895 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->staMac,
2896 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
2897
2898 palCopyMemory( pMac->hHdd, (tANI_U8 *) pAddStaParams->bssId,
2899 psessionEntry->bssId, sizeof(tSirMacAddr));
2900
2901 // Update this when we get reassoc rsp , with success.
2902 // pAddStaParams->assocId = psessionEntry->limAID;
2903
2904 pAddStaParams->staType = STA_ENTRY_SELF;
2905 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2906 pAddStaParams->respReqd = 1;
2907
2908 /* Update PE session ID */
2909 pAddStaParams->sessionId = psessionEntry->peSessionId;
2910
2911 // This will indicate HAL to "allocate" a new STA index
2912 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2913 pAddStaParams->updateSta = FALSE;
2914
2915 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002916#ifdef WLAN_FEATURE_11AC
2917 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
2918#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002920#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002921
Jeff Johnsone7245742012-09-05 17:12:55 -07002922 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002924 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002925#ifdef DISABLE_GF_FOR_INTEROP
2926 /*
2927 * To resolve the interop problem with Broadcom AP,
2928 * where TQ STA could not pass traffic with GF enabled,
2929 * TQ STA will do Greenfield only with TQ AP, for
2930 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002931 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002932 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2933 {
2934 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2935 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2936 }
2937 else
2938#endif
2939
2940#ifdef WLAN_SOFTAP_FEATURE
2941 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2942 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2943 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2944 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2945 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2946 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2947 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2948 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2949 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2950 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2951 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2952 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
2953#else
2954 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD );
2955 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET );
2956 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE );
2957 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE );
2958 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION );
2959 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA );
2960 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY );
2961 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR);
2962 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH );
2963 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ);
2964 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ);
2965 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ);
2966#endif
2967 }
2968
2969 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
2970 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL\n"));
2971 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2972
2973 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2974
2975 // Lets save this for when we receive the Reassoc Rsp
2976 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
2977 return;
2978
2979end:
2980 // Free up buffer allocated for reassocReq
2981 if (pMlmReassocReq != NULL)
2982 {
2983 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
2984 }
2985 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2986 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2987 /* Update PE sessio Id*/
2988 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
2989
2990 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2991}
2992#endif /* WLAN_FEATURE_VOWIFI_11R */
2993
2994
2995/**
2996 * limProcessStaMlmAddBssRsp()
2997 *
2998 *FUNCTION:
2999 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3000 * Upon receipt of this message from HAL, MLME -
3001 * > Validates the result of WDA_ADD_BSS_REQ
3002 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3003 *
3004 *LOGIC:
3005 * MLME had sent WDA_ADD_BSS_REQ to HAL
3006 * HAL responded with WDA_ADD_BSS_RSP to MLME
3007 * MLME now sends WDA_ADD_STA_REQ to HAL
3008 *
3009 *ASSUMPTIONS:
3010 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3011 * tSirMsgQ.body will now be freed by this routine
3012 *
3013 *NOTE:
3014 *
3015 * @param pMac Pointer to Global MAC structure
3016 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3017 *
3018 * @return None
3019 */
3020static void
3021limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3022{
3023 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3024 tLimMlmAssocCnf mlmAssocCnf;
3025 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3026 tANI_U32 subType = LIM_ASSOC;
3027 tpDphHashNode pStaDs = NULL;
3028 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3029 tANI_U8 updateSta = false;
3030 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3031
3032 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3033 {
3034 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
3035 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3036 goto end;
3037 }
3038 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3039 {
3040 mesgType = LIM_MLM_REASSOC_CNF;
3041 subType = LIM_REASSOC;
3042 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3043 //to update the existing STA entry.
3044 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3045 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3046 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3047 {
3048 staIdx = psessionEntry->staId;
3049 updateSta = true;
3050 }
3051 }
3052 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3053 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003054#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003055 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3056 {
3057#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3058 PELOGE(limLog(pMac, LOGE, FL("Mlm=%d %d\n"),
3059 psessionEntry->limMlmState,
3060 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3061#endif
3062 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3063 goto end;
3064 }
3065#endif /* WLAN_FEATURE_VOWIFI_11R */
3066
3067 // Set MLME state
3068 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003069 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3071 // Now, send WDA_ADD_STA_REQ
3072 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful\n" ));
3073 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3074 if (pStaDs == NULL)
3075 {
3076 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3077 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3078 }
3079 else
3080 {
3081 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3082 //Success, handle below
3083 pStaDs->bssId = pAddBssParams->bssIdx;
3084 //STA Index(genr by HAL) for the BSS entry is stored here
3085 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3086 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3087 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3088 // Downgrade the EDCA parameters if needed
3089 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3090 // Send the active EDCA parameters to HAL
3091 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3092 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3093 } else {
3094 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3095 }
3096#if defined WLAN_FEATURE_VOWIFI
3097 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3098#endif
3099
3100 if (subType == LIM_REASSOC)
3101 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3102 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3103 {
3104 // Add STA context at HW
3105 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station\n"));)
3106 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3107 }
3108 }
3109 }
3110 else
3111 {
3112 limLog( pMac, LOGP, FL( "ADD_BSS failed!\n" ));
3113 // Return Assoc confirm to SME with failure
3114 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3115 }
3116
3117 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3118 {
3119 /* Update PE session Id*/
3120 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3121 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3122 }
3123 end:
3124 if( 0 != limMsgQ->bodyptr )
3125 palFreeMemory( pMac->hHdd,(void *) pAddBssParams );
3126}
3127
3128
3129
3130/**
3131 * limProcessMlmAddBssRsp()
3132 *
3133 *FUNCTION:
3134 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3135 * Upon receipt of this message from HAL, MLME -
3136 * > Determines the "state" in which this message was received
3137 * > Forwards it to the appropriate callback
3138 *
3139 *LOGIC:
3140 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3141 * in the following two states:
3142 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3143 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3144 * Based on these two states, this API will determine where to
3145 * route the message to
3146 *
3147 *ASSUMPTIONS:
3148 *
3149 *NOTE:
3150 *
3151 * @param pMac Pointer to Global MAC structure
3152 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3153 *
3154 * @return None
3155 */
3156void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3157{
3158 tLimMlmStartCnf mlmStartCnf;
3159 tpPESession psessionEntry;
3160 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3161
3162 if(NULL == pAddBssParams )
3163 {
3164 limLog( pMac, LOGE, FL( "Encountered NULL Pointer\n" ));
3165 return;
3166 }
3167
3168 //
3169 // TODO & FIXME_GEN4
3170 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3171 //
3172 //we need to process the deferred message since the initiating req. there might be nested request.
3173 //in the case of nested request the new request initiated from the response will take care of resetting
3174 //the deffered flag.
3175 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3176 // Validate SME/LIM state
3177 // Validate MLME state
3178 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3179 {
3180 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId\n" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003181 if( NULL != pAddBssParams )
3182 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003183 return;
3184 }
3185 /* update PE session Id*/
3186 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3187 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3188 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3189 else
3190 {
3191 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3192 {
3193 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3194 {
3195 // Mesg received from HAL in Invalid state!
3196 limLog( pMac, LOGE,
3197 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X\n" ),
3198 psessionEntry->limMlmState );
3199 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3200 if( 0 != limMsgQ->bodyptr )
3201 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
3202 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3203 }
3204 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3205 {
3206 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3207 }
3208 else
3209 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3210 }
3211 else
3212 /* Called while processing assoc response */
3213 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3214 }
3215}
3216/**
3217 * limProcessMlmSetKeyRsp()
3218 *
3219 *FUNCTION:
3220 * This function is called to process the following two
3221 * messages from HAL:
3222 * 1) WDA_SET_BSSKEY_RSP
3223 * 2) WDA_SET_STAKEY_RSP
3224 * 3) WDA_SET_STA_BCASTKEY_RSP
3225 * Upon receipt of this message from HAL,
3226 * MLME -
3227 * > Determines the "state" in which this message was received
3228 * > Forwards it to the appropriate callback
3229 *
3230 *LOGIC:
3231 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3232 * received by MLME while in the following state:
3233 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3234 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3235 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3236 * Based on this state, this API will determine where to
3237 * route the message to
3238 *
3239 *ASSUMPTIONS:
3240 * ONLY the MLME state is being taken into account for now.
3241 * This is because, it appears that the handling of the
3242 * SETKEYS REQ is handled symmetrically on both the AP & STA
3243 *
3244 *NOTE:
3245 *
3246 * @param pMac Pointer to Global MAC structure
3247 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3248 *
3249 * @return None
3250 */
3251void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3252{
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 tLimMlmSetKeysCnf mlmSetKeysCnf;
3255 tANI_U8 sessionId = 0;
3256 tpPESession psessionEntry;
3257 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3258 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3259 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003260 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 {
3262 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3263 return;
3264 }
3265 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3266 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3267 {
3268 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003269 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 return;
3271 }
3272 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3273 {
3274 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003275 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 // There's not much that MLME can do at this stage...
3277 respReqd = 0;
3278 }
3279 else
3280 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3281
3282 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3283 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003285 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 if( respReqd )
3287 {
3288 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3289 // Prepare and Send LIM_MLM_SETKEYS_CNF
3290 if( NULL != lpLimMlmSetKeysReq )
3291 {
3292 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3293#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003294 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003295#endif
3296 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003297 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 pMac->lim.gpLimMlmSetKeysReq = NULL;
3299 }
3300 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003301 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 }
3303}
3304void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3305{
3306 tANI_U8 respReqd = 1;
3307 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003308 tANI_U16 resultCode;
3309 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 tpPESession psessionEntry;
3311 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3312 palZeroMemory( pMac->hHdd, (void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ));
3313 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003314 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 {
3316 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null\n"));)
3317 return;
3318 }
3319 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3320 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3321 {
3322 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003323 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003324 return;
3325 }
3326 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3327 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3328 else
3329 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3330
Jeff Johnsone7245742012-09-05 17:12:55 -07003331 //
3332 // TODO & FIXME_GEN4
3333 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3334 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3336 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3337 //{
3338 // Validate MLME state
3339 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3340 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3341 {
3342 // Mesg received from HAL in Invalid state!
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X\n" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 // There's not much that MLME can do at this stage...
3345 respReqd = 0;
3346 }
3347 else
3348 mlmSetKeysCnf.resultCode = resultCode;
3349
3350 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3351 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3353
Jeff Johnsone7245742012-09-05 17:12:55 -07003354 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 if( respReqd )
3356 {
3357 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3358 mlmSetKeysCnf.sessionId = sessionId;
3359
3360 // Prepare and Send LIM_MLM_SETKEYS_CNF
3361 if( NULL != lpLimMlmSetKeysReq )
3362 {
3363 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmSetKeysCnf.peerMacAddr, (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr, sizeof(tSirMacAddr) );
3364#ifdef ANI_PRODUCT_TYPE_AP
Jeff Johnsone7245742012-09-05 17:12:55 -07003365 mlmSetKeysCnf.aid = lpLimMlmSetKeysReq->aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07003366#endif
3367 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Jeff Johnsone7245742012-09-05 17:12:55 -07003368 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 pMac->lim.gpLimMlmSetKeysReq = NULL;
3370 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003371 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 }
3373}
3374/**
3375 * limProcessMlmRemoveKeyRsp()
3376 *
3377 *FUNCTION:
3378 *
3379 *LOGIC:
3380 *
3381 *ASSUMPTIONS:
3382 *
3383 *NOTE:
3384 *
3385 * @param pMac Pointer to Global MAC structure
3386 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3387 *
3388 * @return None
3389 */
3390void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3391{
Jeff Johnsone7245742012-09-05 17:12:55 -07003392 tANI_U8 respReqd = 1;
3393 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3394 tANI_U16 resultCode;
3395 tANI_U8 sessionId = 0;
3396 tpPESession psessionEntry;
3397 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3398 palZeroMemory( pMac->hHdd, (void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ));
3399
3400 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003402 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL\n"));)
3403 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 }
3405
Jeff Johnsone7245742012-09-05 17:12:55 -07003406 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3407 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3408 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3409 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003410
Jeff Johnsone7245742012-09-05 17:12:55 -07003411 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003413 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId\n"));)
3414 return;
3415 }
3416
3417 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3418 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3419 else
3420 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3421
3422 // Validate MLME state
3423 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3424 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3425 {
3426 // Mesg received from HAL in Invalid state!
3427 limLog(pMac, LOGW,
3428 FL("Received unexpected [Mesg Id - %d] in state %X\n"),
3429 limMsgQ->type,
3430 psessionEntry->limMlmState );
3431 respReqd = 0;
3432 }
3433 else
3434 mlmRemoveCnf.resultCode = resultCode;
3435
3436 //
3437 // TODO & FIXME_GEN4
3438 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3439 //
3440
3441 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
3442
3443 // Restore MLME state
3444 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3445 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3446
3447 if( respReqd )
3448 {
3449 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3450 mlmRemoveCnf.sessionId = sessionId;
3451
3452 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3453 if( NULL != lpLimMlmRemoveKeyReq )
3454 {
3455 palCopyMemory( pMac->hHdd, (tANI_U8 *) &mlmRemoveCnf.peerMacAddr, (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3456 sizeof( tSirMacAddr ));
3457 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
3458 palFreeMemory(pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimMlmRemoveKeyReq);
3459 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3460 }
3461 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3462 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003463}
3464
3465#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
3466/**----------------------------------------------------
3467\fn __limProcessFinishLearnRsp
3468\brief Handle finish learn rsp state, only for AP.
3469\param pMac
3470\return NONE
3471-----------------------------------------------------*/
3472static void __limProcessFinishLearnRsp(tpAniSirGlobal pMac)
3473{
3474 PELOG2(limLog(pMac, LOG2, FL("System Role: %d\n"), pMac->lim.gLimSystemRole);)
3475 if (pMac->lim.gpLimMeasReq == NULL)
3476 {
3477 limRestorePreLearnState(pMac);
3478 return;
3479 }
3480 /**
3481 * Initial measurement -> periodic measurement should keep enabled, so that
3482 * if system Role is UNKNOWN LIM can send indication to WSM. Overloading
3483 * periodic measurement to distinguish initial measurement and radar
3484 * detect park basically to avoid sending measurement indication after
3485 * radar detect park.
3486 * Radar detect park -> periodic measurement should be disabled, so that
3487 * LIM wont send indication even when role is UNKNOWN.
3488 * Final measurement -> periodic measurement should be enabled, so that
3489 * LIM could start measurement indication timer.
3490 */
3491 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled &&
3492 !pMac->lim.gLimMeasParams.isMeasIndTimerActive)
3493 {
3494#if 0 /* Will we be ever in UNKNOWN ROLE: Veerendra */
3495 if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
3496 {
3497 limSendSmeMeasurementInd(pMac);
3498 limCleanupMeasResources(pMac);
3499 limRestorePreLearnState(pMac);
3500 return;
3501 }
3502 else
3503#endif
3504 {
3505#ifdef GEN6_TODO
3506 /* revisit this piece of code to assign the appropriate sessionId below
3507 * priority - MEDIUM
3508 */
3509 pMac->lim.gLimMeasParams.measurementIndTimer.sessionId = sessionId;
3510#endif
3511 // Activate periodic measurement indication timer
3512 if (tx_timer_activate(
3513 &pMac->lim.gLimMeasParams.measurementIndTimer)
3514 != TX_SUCCESS)
3515 {
3516 limLog(pMac, LOGP, FL("could not start Meas IND timer\n"));
3517 return;
3518 }
3519 pMac->lim.gLimMeasParams.isMeasIndTimerActive = 1;
3520 }
3521 }
3522 if (pMac->lim.gLimMeasParams.nextLearnChannelId >=
3523 pMac->lim.gpLimMeasReq->channelList.numChannels - 1)
3524 {
3525 // All channels in the channel set are learned.
3526 pMac->lim.gLimMeasParams.nextLearnChannelId = 0;
3527 }
3528 // Go back to previous state.
3529 limRestorePreLearnState(pMac);
3530 // Restart the learn interval timer.
3531 if (pMac->lim.gpLimMeasReq->measControl.periodicMeasEnabled)
3532 limReEnableLearnMode(pMac);
3533 return;
3534}
3535#endif
3536
3537/** ---------------------------------------------------------------------
3538\fn limProcessInitScanRsp
3539\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3540\ message from HAL. If status code is failure, then
3541\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3542\param tpAniSirGlobal pMac
3543\param tANI_U32 body
3544\return none
3545\ ----------------------------------------------------------------------- */
3546void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3547{
3548 tpInitScanParams pInitScanParam;
3549 eHalStatus status;
3550#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3551 tANI_U8 channelNum;
3552#endif
3553 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3554 pInitScanParam = (tpInitScanParams) body;
3555 status = pInitScanParam->status;
3556 palFreeMemory( pMac->hHdd, (char *)body);
3557
3558 //Only abort scan if the we are scanning.
3559 if( pMac->lim.abortScan &&
3560 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3561 {
3562 limLog( pMac, LOGW, FL(" finish scan\n") );
3563 pMac->lim.abortScan = 0;
3564 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3565 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3566 //Set the resume channel to Any valid channel (invalid).
3567 //This will instruct HAL to set it to any previous valid channel.
3568 peSetResumeChannel(pMac, 0, 0);
3569 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3570 }
3571 switch(pMac->lim.gLimHalScanState)
3572 {
3573 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3574 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3575 {
3576 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d\n"), status);)
3577 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3578 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3579 /*
3580 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3581 * another Scan request in the same context (happens when 11d is enabled
3582 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3583 * scan in the same context but with bigger channel list), so the state needs to be
3584 * changed before this response message is sent.
3585 */
3586 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3587#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3588 /* For handling the measurement request from WSM as scan request in LIM*/
3589#if 0
3590 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
3591 {
3592 limRestorePreLearnState(pMac);
3593 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3594 limReEnableLearnMode(pMac);
3595 }
3596#endif
3597#endif
3598 return;
3599 }
3600 else if (status == eHAL_STATUS_SUCCESS)
3601 {
3602 /* since we have successfully triggered a background scan,
3603 * reset the "consecutive bkgnd scan failure" count to 0
3604 */
3605 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3606 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3607 }
3608 limContinueChannelScan(pMac);
3609 break;
3610#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3611 case eLIM_HAL_INIT_LEARN_WAIT_STATE:
3612// if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3613 {
3614 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3615 {
3616 limRestorePreLearnState(pMac);
3617 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3618 limReEnableLearnMode(pMac);
3619 return;
3620 }
3621 channelNum = limGetCurrentLearnChannel(pMac);
3622 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
3623 }
3624 break;
3625#endif
3626//WLAN_SUSPEND_LINK Related
3627 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3628 if( pMac->lim.gpLimSuspendCallback )
3629 {
3630 if( status == eHAL_STATUS_SUCCESS )
3631 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
3632 else
3633 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3634
3635 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3636 pMac->lim.gpLimSuspendCallback = NULL;
3637 pMac->lim.gpLimSuspendData = NULL;
3638 }
3639 else
3640 {
3641 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state\n");
3642 return;
3643 }
3644 break;
3645//end WLAN_SUSPEND_LINK Related
3646 default:
3647 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d\n"),
3648 pMac->lim.gLimHalScanState);
3649 break;
3650 }
3651 return;
3652}
3653/**
3654 * limProcessSwitchChannelReAssocReq()
3655 *
3656 *FUNCTION:
3657 * This function is called to send the reassoc req mgmt frame after the
3658 * switchChannelRsp message is received from HAL.
3659 *
3660 *LOGIC:
3661 *
3662 *ASSUMPTIONS:
3663 * NA
3664 *
3665 *NOTE:
3666 * NA
3667 *
3668 * @param pMac - Pointer to Global MAC structure.
3669 * @param psessionEntry - session related information.
3670 * @param status - channel switch success/failure.
3671 *
3672 * @return None
3673 */
3674static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3675{
3676 tLimMlmReassocCnf mlmReassocCnf;
3677 tLimMlmReassocReq *pMlmReassocReq;
3678 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3679 if(pMlmReassocReq == NULL)
3680 {
3681 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession\n"));
3682 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3683 goto end;
3684 }
3685
3686 if(status != eHAL_STATUS_SUCCESS)
3687 {
3688 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3689 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3690 goto end;
3691 }
3692 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003693 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3695 != TX_SUCCESS)
3696 {
3697 /// Could not start reassoc failure timer.
3698 // Log error
3699 limLog(pMac, LOGP,
3700 FL("could not start Reassociation failure timer\n"));
3701 // Return Reassoc confirm with
3702 // Resources Unavailable
3703 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3704 goto end;
3705 }
3706 /// Prepare and send Reassociation request frame
3707 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3708 return;
3709end:
3710 // Free up buffer allocated for reassocReq
3711 if(pMlmReassocReq != NULL)
3712 {
3713 /* Update PE session Id*/
3714 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
3715 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMlmReassocReq);
3716 }
3717 else
3718 {
3719 mlmReassocCnf.sessionId = 0;
3720 }
3721
3722 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3723 /* Update PE sessio Id*/
3724 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3725
3726 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3727}
3728/**
3729 * limProcessSwitchChannelJoinReq()
3730 *
3731 *FUNCTION:
3732 * This function is called to send the probe req mgmt frame after the
3733 * switchChannelRsp message is received from HAL.
3734 *
3735 *LOGIC:
3736 *
3737 *ASSUMPTIONS:
3738 * NA
3739 *
3740 *NOTE:
3741 * NA
3742 *
3743 * @param pMac - Pointer to Global MAC structure.
3744 * @param psessionEntry - session related information.
3745 * @param status - channel switch success/failure.
3746 *
3747 * @return None
3748 */
3749static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3750{
3751 tANI_U32 val;
3752 tSirMacSSid ssId;
3753 tLimMlmJoinCnf mlmJoinCnf;
3754 if(status != eHAL_STATUS_SUCCESS)
3755 {
3756 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!\n"));)
3757 goto error;
3758 }
3759
3760 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3761 {
3762 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!\n"));)
3763 goto error;
3764 }
3765
Jeff Johnsone7245742012-09-05 17:12:55 -07003766
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3768 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3769 {
3770 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3771 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3772 goto error;
3773 }
3774 else
3775 {
3776 if(limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
3777 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
3778 goto error;
3779 }
3780 // Update BSSID at CFG database
3781#if 0
3782 if (cfgSetStr(pMac, WNI_CFG_BSSID, pMac->lim.gpLimMlmJoinReq->bssDescription.bssId,
3783 sizeof(tSirMacAddr))
3784 != eSIR_SUCCESS)
3785 limLog(pMac, LOGP, FL("could not update BSSID at CFG\n"));
3786#endif //TO SUPPORT BT-AMP
3787 //sirCopyMacAddr(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,psessionEntry->bssId);
3788
3789 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3790 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
3791 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!\n"));
3792 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3793 // Apply previously set configuration at HW
3794 limApplyConfiguration(pMac, psessionEntry);
3795 /// Wait for Beacon to announce join success
3796#if 0
3797 if (cfgGetStr(pMac, WNI_CFG_SSID, ssId.ssId, &cfgLen) != eSIR_SUCCESS)
3798 limLog(pMac, LOGP, FL("could not retrive SSID\n"));
3799#endif //To SUPPORT BT-AMP
3800 palCopyMemory( pMac->hHdd, ssId.ssId,
3801 psessionEntry->ssId.ssId,
3802 psessionEntry->ssId.length);
3803 ssId.length = psessionEntry->ssId.length;
3804 // include additional IE if there is
3805 limSendProbeReqMgmtFrame( pMac, &ssId,
3806 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3807 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3808 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003809
3810 // Sending mgmt frame is a blocking call activate Join failure timer now
3811 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3812 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3813 {
3814 limLog(pMac, LOGP, FL("could not activate Join failure timer\n"));
3815 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3816 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3817 //memory is freed up below.
3818 psessionEntry->pLimMlmJoinReq = NULL;
3819 goto error;
3820 }
3821
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 return;
3823error:
3824 if(NULL != psessionEntry)
3825 {
3826 palFreeMemory( pMac->hHdd, (tANI_U8 *) (psessionEntry->pLimMlmJoinReq));
3827 psessionEntry->pLimMlmJoinReq = NULL;
3828 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3829 }
3830 else
3831 {
3832 mlmJoinCnf.sessionId = 0;
3833 }
3834 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3835 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3836 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3837}
3838
3839/**
3840 * limProcessSwitchChannelRsp()
3841 *
3842 *FUNCTION:
3843 * This function is called to process switchChannelRsp message from HAL.
3844 *
3845 *LOGIC:
3846 *
3847 *ASSUMPTIONS:
3848 * NA
3849 *
3850 *NOTE:
3851 * NA
3852 *
3853 * @param pMac - Pointer to Global MAC structure
3854 * @param body - message body.
3855 *
3856 * @return None
3857 */
3858void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3859{
3860 tpSwitchChannelParams pChnlParams = NULL;
3861 eHalStatus status;
3862 tANI_U16 channelChangeReasonCode;
3863 tANI_U8 peSessionId;
3864 tpPESession psessionEntry;
3865 //we need to process the deferred message since the initiating req. there might be nested request.
3866 //in the case of nested request the new request initiated from the response will take care of resetting
3867 //the deffered flag.
3868 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3869 pChnlParams = (tpSwitchChannelParams) body;
3870 status = pChnlParams->status;
3871 peSessionId = pChnlParams->peSessionId;
3872 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3873 {
3874 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3875 limLog(pMac, LOGP, FL("session does not exist for given sessionId\n"));
3876 return;
3877 }
3878#if defined WLAN_FEATURE_VOWIFI
3879 //HAL fills in the tx power used for mgmt frames in this field.
3880 //Store this value to use in TPC report IE.
3881 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3882#endif
3883 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3884 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3885 // initialize it back to invalid id
3886 psessionEntry->channelChangeReasonCode = 0xBAD;
3887 switch(channelChangeReasonCode)
3888 {
3889 case LIM_SWITCH_CHANNEL_REASSOC:
3890 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3891 break;
3892 case LIM_SWITCH_CHANNEL_JOIN:
3893 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3894 break;
3895
3896 case LIM_SWITCH_CHANNEL_OPERATION:
3897 /*
3898 * The above code should also use the callback.
3899 * mechanism below, there is scope for cleanup here.
3900 * THat way all this response handler does is call the call back
3901 * We can get rid of the reason code here.
3902 */
3903 if (pMac->lim.gpchangeChannelCallback)
3904 {
3905 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back\n");)
3906 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3907 }
3908 break;
3909 default:
3910 break;
3911 }
3912}
3913/**
3914 * limProcessStartScanRsp()
3915 *
3916 *FUNCTION:
3917 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3918 * then it will start scan/learn on the next channel.
3919 *
3920 *LOGIC:
3921 *
3922 *ASSUMPTIONS:
3923 * NA
3924 *
3925 *NOTE:
3926 * NA
3927 *
3928 * @param pMac - Pointer to Global MAC structure
3929 * @param body - message body.
3930 *
3931 * @return None
3932 */
3933
3934void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3935{
3936 tpStartScanParams pStartScanParam;
3937 eHalStatus status;
3938 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3939 pStartScanParam = (tpStartScanParams) body;
3940 status = pStartScanParam->status;
3941#if defined WLAN_FEATURE_VOWIFI
3942 //HAL fills in the tx power used for mgmt frames in this field.
3943 //Store this value to use in TPC report IE.
3944 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3945 //Store start TSF of scan start. This will be stored in BSS params.
3946 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3947#endif
3948 palFreeMemory( pMac->hHdd, (tANI_U8 *)body);
3949 if( pMac->lim.abortScan )
3950 {
3951 limLog( pMac, LOGW, FL(" finish scan\n") );
3952 pMac->lim.abortScan = 0;
3953 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3954 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3955 //Set the resume channel to Any valid channel (invalid).
3956 //This will instruct HAL to set it to any previous valid channel.
3957 peSetResumeChannel(pMac, 0, 0);
3958 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3959 }
3960 switch(pMac->lim.gLimHalScanState)
3961 {
3962 case eLIM_HAL_START_SCAN_WAIT_STATE:
3963 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3964 {
3965 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d\n"), status);)
3966 //
3967 // FIXME - With this, LIM will try and recover state, but
3968 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3969 // status back to the SME
3970 //
3971 //Set the resume channel to Any valid channel (invalid).
3972 //This will instruct HAL to set it to any previous valid channel.
3973 peSetResumeChannel(pMac, 0, 0);
3974 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3975 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3976 }
3977 else
3978 {
3979 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3980 limContinuePostChannelScan(pMac);
3981 }
3982 break;
3983#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
3984 case eLIM_HAL_START_LEARN_WAIT_STATE:
3985 // if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3986 {
3987 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3988 {
3989 //Set the resume channel to Any valid channel (invalid).
3990 //This will instruct HAL to set it to any previous valid channel.
3991 peSetResumeChannel(pMac, 0, 0);
3992 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
3993 }
3994 else
3995 {
3996 limContinueChannelLearn(pMac);
3997 }
3998 }
3999 break;
4000#endif
4001 default:
4002 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d\n"),
4003 pMac->lim.gLimHalScanState);
4004 break;
4005 }
4006 return;
4007}
4008void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4009{
4010 tpEndScanParams pEndScanParam;
4011 eHalStatus status;
4012#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4013 tANI_U8 channelNum;
4014#endif
4015 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4016 pEndScanParam = (tpEndScanParams) body;
4017 status = pEndScanParam->status;
4018 palFreeMemory( pMac->hHdd, (char *)body);
4019 switch(pMac->lim.gLimHalScanState)
4020 {
4021 case eLIM_HAL_END_SCAN_WAIT_STATE:
4022 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4023 {
4024 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4025 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4026 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4027 }
4028 else
4029 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004030 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 limContinueChannelScan(pMac);
4032 }
4033 break;
4034#if defined(ANI_PRODUCT_TYPE_AP) && (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4035 case eLIM_HAL_END_LEARN_WAIT_STATE:
4036 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4037 {
4038 //Set the resume channel to Any valid channel (invalid).
4039 //This will instruct HAL to set it to any previous valid channel.
4040 peSetResumeChannel(pMac, 0, 0);
4041 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4042 }
4043#if 0 /* Will we be in UNKNOWN ROLE ever in this context: Veerendra */
4044 else if (pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE)
4045 {
4046 /** Before starting BSS, we do complete set of measurement before putting
4047 * softmac back into normal mode.
4048 */
4049 channelNum = limGetCurrentLearnChannel(pMac);
4050 limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_LEARN_WAIT_STATE);
4051 }
4052 else
4053#endif
4054 {
4055 limLog(pMac, LOGW, FL("ERROR! This state is set only when AP in UNKNOWN_ROLE\n"),
4056 pMac->lim.gLimHalScanState);
4057 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
4058 }
4059 break;
4060#endif
4061 default:
4062 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d\n"),
4063 pMac->lim.gLimHalScanState);
4064 break;
4065 }
4066 return;
4067}
Jeff Johnsone7245742012-09-05 17:12:55 -07004068/**
4069 * limStopTxAndSwitch()
4070 *
4071 *FUNCTION:
4072 * Start channel switch on all sessions that is in channel switch state.
4073 *
4074 * @param pMac - pointer to global adapter context
4075 *
4076 * @return None
4077 *
4078 */
4079static void
4080limStopTxAndSwitch (tpAniSirGlobal pMac)
4081{
4082 tANI_U8 i;
4083
4084 for(i =0; i < pMac->lim.maxBssId; i++)
4085 {
4086 if(pMac->lim.gpSession[i].valid &&
4087 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4088 {
4089 limStopTxAndSwitchChannel(pMac, i);
4090 }
4091 }
4092 return;
4093}
4094/**
4095 * limStartQuietOnSession()
4096 *
4097 *FUNCTION:
4098 * This function is called to start quiet timer after finish scan if there is
4099 * qeuieting on any session.
4100 *
4101 *LOGIC:
4102 *
4103 *ASSUMPTIONS:
4104 * NA
4105 *
4106 *NOTE:
4107 * NA
4108 *
4109 * @param pMac - Pointer to Global MAC structure
4110 *
4111 * @return None
4112 */
4113static void
4114limStartQuietOnSession (tpAniSirGlobal pMac)
4115{
4116 tANI_U8 i;
4117
4118 for(i =0; i < pMac->lim.maxBssId; i++)
4119 {
4120 if(pMac->lim.gpSession[i].valid &&
4121 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4122 {
4123 limStartQuietTimer(pMac, i);
4124 }
4125 }
4126 return;
4127}
Jeff Johnson295189b2012-06-20 16:38:30 -07004128void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4129{
4130 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 eHalStatus status;
4132 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4133 pFinishScanParam = (tpFinishScanParams) body;
4134 status = pFinishScanParam->status;
4135 palFreeMemory( pMac->hHdd, (char *)body);
4136 switch(pMac->lim.gLimHalScanState)
4137 {
4138 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4139 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4140 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004141 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004142 {
4143 /** Right time to stop tx and start the timer for channel switch */
4144 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4145 * be any associated session id
4146 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004147 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004148 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004149 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 {
4151 /** Start the quieting */
4152 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4153 * be any associated session id
4154 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004155 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 }
4157#ifdef ANI_PRODUCT_TYPE_AP
4158 /* For handling the measurement request from WSM as scan request in LIM*/
4159#if 0
4160 if (pMac->lim.gLimSystemRole == eLIM_STA_ROLE && pMac->lim.gpLimMeasReq != NULL)
4161 {
4162 limSendSmeMeasurementInd(pMac);
4163 limCleanupMeasResources(pMac);
4164 limRestorePreLearnState(pMac);
4165 }
4166#endif
4167#endif
4168 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4169 {
4170 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d\n"), status);)
4171 }
4172 break;
4173#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4174 case eLIM_HAL_FINISH_LEARN_WAIT_STATE:
4175 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4176 __limProcessFinishLearnRsp(pMac);
4177 break;
4178#endif //#if (defined(ANI_PRODUCT_TYPE_AP) || defined(ANI_PRODUCT_TYPE_AP_SDK))
4179//WLAN_SUSPEND_LINK Related
4180 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4181 if( pMac->lim.gpLimResumeCallback )
4182 {
4183 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4184 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4185 pMac->lim.gpLimResumeCallback = NULL;
4186 pMac->lim.gpLimResumeData = NULL;
4187 pMac->lim.gLimSystemInScanLearnMode = 0;
4188 }
4189 else
4190 {
4191 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state\n");
4192 return;
4193 }
4194 break;
4195//end WLAN_SUSPEND_LINK Related
4196
4197 default:
4198 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d\n"),
4199 pMac->lim.gLimHalScanState);
4200 break;
4201 }
4202 return;
4203}
4204/**
4205 * @function : limProcessMlmHalAddBARsp
4206 *
4207 * @brief: Process WDA_ADDBA_RSP coming from HAL
4208 *
4209 *
4210 * @param pMac The global tpAniSirGlobal object
4211 *
4212 * @param tSirMsgQ The MsgQ header containing the response buffer
4213 *
4214 * @return none
4215 */
4216void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4217 tpSirMsgQ limMsgQ )
4218{
4219 // Send LIM_MLM_ADDBA_CNF to LIM
4220 tpLimMlmAddBACnf pMlmAddBACnf;
4221 tpPESession psessionEntry;
4222 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
4223#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4224 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4225#endif //FEATURE_WLAN_DIAG_SUPPORT
4226 //now LIM can process any defer message.
4227 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4228 if (pAddBAParams == NULL) {
4229 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL\n"));)
4230 return;
4231 }
4232 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4233 {
4234 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d\n"),pAddBAParams->sessionId );)
4235 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4236 return;
4237 }
4238#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4239 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4240#endif //FEATURE_WLAN_DIAG_SUPPORT
4241
4242 // Allocate for LIM_MLM_ADDBA_CNF
4243 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4244 (void **) &pMlmAddBACnf, sizeof( tLimMlmAddBACnf ))) {
4245 limLog( pMac, LOGP, FL(" palAllocateMemory failed with error code %d\n"));
4246 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4247 return;
4248 }
4249 palZeroMemory( pMac->hHdd, (void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ));
4250 // Copy the peer MAC
4251 palCopyMemory( pMac->hHdd, pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4252 sizeof( tSirMacAddr ));
4253 // Copy other ADDBA Rsp parameters
4254 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4255 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4256 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4257 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4258 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4259 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4260 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4261 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4262 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4263 else
4264 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4265 palFreeMemory(pMac->hHdd, (void*)limMsgQ->bodyptr);
4266 // Send ADDBA CNF to LIM
4267 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4268}
4269/**
4270 * \brief Process LIM_MLM_ADDBA_CNF
4271 *
4272 * \sa limProcessMlmAddBACnf
4273 *
4274 * \param pMac The global tpAniSirGlobal object
4275 *
4276 * \param tSirMsgQ The MsgQ header containing the response buffer
4277 *
4278 * \return none
4279 */
4280void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4281 tANI_U32 *pMsgBuf )
4282{
4283tpLimMlmAddBACnf pMlmAddBACnf;
4284tpDphHashNode pSta;
4285tANI_U16 aid;
4286tLimBAState curBaState;
4287tpPESession psessionEntry = NULL;
4288if(pMsgBuf == NULL)
4289{
4290 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4291 return;
4292}
4293pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4294 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4295 {
4296 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004297 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 return;
4299 }
4300 // First, extract the DPH entry
4301 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4302 if( NULL == pSta )
4303 {
4304 PELOGE(limLog( pMac, LOGE,
4305 FL( "STA context not found - ignoring ADDBA CNF from HAL\n" ));)
4306 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4307 return;
4308 }
4309 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4310 // Need to validate SME state
4311 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4312 {
4313 PELOGE(limLog( pMac, LOGE,
4314 FL( "Received unexpected ADDBA CNF when STA BA state is %d\n" ),
4315 curBaState );)
Jeff Johnsone7245742012-09-05 17:12:55 -07004316 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 return;
4318 }
4319 // Restore STA BA state
4320 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004321 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004322 {
4323 // Update LIM internal cache...
4324 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4325 {
4326 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4327 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4328 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4329 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4330 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4331 }
4332 else
4333 {
4334 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4335 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4336 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4337 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4338 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4339 }
4340 }
4341 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4342 {
4343 //
4344 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4345 // status code. MLME will then send an ADDBA RSP
4346 // over the air to the peer MAC entity
4347 //
4348 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4349 pMlmAddBACnf->peerMacAddr,
4350 pMlmAddBACnf->addBAResultCode,
4351 pMlmAddBACnf->baDialogToken,
4352 (tANI_U8) pMlmAddBACnf->baTID,
4353 (tANI_U8) pMlmAddBACnf->baPolicy,
4354 pMlmAddBACnf->baBufferSize,
4355 pMlmAddBACnf->baTimeout,psessionEntry))
4356 {
4357 PELOGW(limLog( pMac, LOGW,
4358 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4359 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4360 }
4361 }
4362 // Free the memory allocated for LIM_MLM_ADDBA_CNF
4363 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4364}
4365/**
4366 * \brief Process LIM_MLM_DELBA_CNF
4367 *
4368 * \sa limProcessMlmDelBACnf
4369 *
4370 * \param pMac The global tpAniSirGlobal object
4371 *
4372 * \param tSirMsgQ The MsgQ header containing the response buffer
4373 *
4374 * \return none
4375 */
4376void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4377 tANI_U32 *pMsgBuf )
4378{
4379 tpLimMlmDelBACnf pMlmDelBACnf;
4380 tpDphHashNode pSta;
4381 tANI_U16 aid;
4382// tANI_U8 sessionId;
4383 tLimBAState curBaState;
4384 tpPESession psessionEntry;
4385
4386 if(pMsgBuf == NULL)
4387 {
4388 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));)
4389 return;
4390 }
4391 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4392 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4393 {
4394 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004395 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 return;
4397 }
4398 // First, extract the DPH entry
4399 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4400 if( NULL == pSta )
4401 {
4402 limLog( pMac, LOGE,
4403 FL( "STA context not found - ignoring DELBA CNF from HAL\n" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07004404 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 return;
4406 }
4407 if(NULL == pMlmDelBACnf)
4408 {
4409 limLog( pMac, LOGE,
4410 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL\n" ));
4411 return;
4412 }
4413 // Need to validate baState
4414 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4415 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4416 {
4417 limLog( pMac, LOGE,
4418 FL( "Received unexpected DELBA CNF when STA BA state is %d\n" ),
4419 curBaState );
Jeff Johnsone7245742012-09-05 17:12:55 -07004420 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 return;
4422 }
4423 // Restore STA BA state
4424 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4425 // Free the memory allocated for LIM_MLM_DELBA_CNF
4426 palFreeMemory( pMac->hHdd, (void *) pMsgBuf );
4427}
4428/**
4429 * \brief Process SIR_LIM_DEL_BA_IND
4430 *
4431 * \sa limProcessMlmHalBADeleteInd
4432 *
4433 * \param pMac The global tpAniSirGlobal object
4434 *
4435 * \param tSirMsgQ The MsgQ header containing the indication buffer
4436 *
4437 * \return none
4438 */
4439void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4440 tpSirMsgQ limMsgQ )
4441{
4442 tSirRetStatus status = eSIR_SUCCESS;
4443 tpBADeleteParams pBADeleteParams;
4444 tpDphHashNode pSta;
4445 tANI_U16 aid;
4446 tLimBAState curBaState;
4447 tpPESession psessionEntry;
4448 tANI_U8 sessionId;
4449
4450 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4451
4452 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4453 {
4454 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004455 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 return;
4457 }
4458 // First, extract the DPH entry
4459 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4460 if( NULL == pSta )
4461 {
4462 limLog( pMac, LOGE,
4463 FL( "STA context not found - ignoring BA Delete IND from HAL\n" ));
4464 goto returnAfterCleanup;
4465 }
4466
4467 // Need to validate BA state
4468 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4469 if( eLIM_BA_STATE_IDLE != curBaState )
4470 {
4471 limLog( pMac, LOGE,
4472 FL( "Received unexpected BA Delete IND when STA BA state is %d\n" ),
4473 curBaState );
4474 goto returnAfterCleanup;
4475 }
4476
4477 // Validate if a BA is active for the requested TID
4478 // AND in that desired direction
4479 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4480 {
4481 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4482 status = eSIR_FAILURE;
4483 }
4484 else
4485 {
4486 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4487 status = eSIR_FAILURE;
4488 }
4489 if( eSIR_FAILURE == status )
4490 {
4491 limLog( pMac, LOGW,
4492 FL("Received an INVALID DELBA Delete Ind for TID %d...\n"),
4493 pBADeleteParams->baTID );
4494 }
4495 else
4496 {
4497 // Post DELBA REQ to MLME...
4498 if( eSIR_SUCCESS !=
4499 (status = limPostMlmDelBAReq( pMac,
4500 pSta,
4501 pBADeleteParams->baDirection,
4502 pBADeleteParams->baTID,
4503 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4504 {
4505 limLog( pMac, LOGE,
4506 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d\n" ), status);
4507 }
4508 else
4509 {
4510 limLog( pMac, LOGE,
4511 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4512 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4513 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4514 }
4515 }
4516returnAfterCleanup:
4517 // Free the memory allocated for SIR_LIM_DEL_BA_IND
4518 palFreeMemory( pMac->hHdd, (void *) limMsgQ->bodyptr );
4519}
4520/**
4521 * @function : limProcessSetMimoRsp()
4522 *
4523 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4524 * after Processing the Req from the SME (PMC)
4525 *
4526 * LOGIC:
4527 *
4528 * ASSUMPTIONS:
4529 * NA
4530 *
4531 * NOTE:
4532 * NA
4533 *
4534 * @param pMac - Pointer to Global MAC structure
4535 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4536 * @return None
4537 */
4538
4539void
4540limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4541{
4542#if 0
4543 tSirRetStatus retStatus;
4544 tpSetMIMOPS pMIMO_PSParams;
4545
4546
4547 do {
4548
4549 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4550 if( NULL == pMIMO_PSParams ) {
4551 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4552 return;
4553 }
4554
4555 /** If Updation of the HAL Fail's*/
4556 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
4557 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed\n"));
4558 break;
4559 }
4560
4561 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4562 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4563 break;
4564
4565 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4566 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4567
4568 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4569 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4570 * the Action Frame is being sent at first before setting the internal structures
4571 */
4572 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4573 tSirMacAddr macAddr;
4574
4575 /** Obtain the AP's Mac Address */
4576 palCopyMemory(pMac -> hHdd, (tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
4577
4578 /** Send Action Frame with the corresponding mode */
4579 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4580 if (retStatus != eSIR_SUCCESS) {
4581 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed\n"));)
4582 break;
4583 }
4584 }
4585 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4586 }while(0);
4587
4588 palFreeMemory( pMac->hHdd, (void *) pMIMO_PSParams );
4589#endif
4590}
4591/**
4592 * @function : limHandleDelBssInReAssocContext
4593 * @brief : While Processing the ReAssociation Response Frame in STA,
4594 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4595 * being issued and the end of DelBSS the new BSS is being added.
4596 *
4597 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4598 * change, We need to update CSR with ReAssocCNF Response with the
4599 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4600 * context only
4601 *
4602 * @param : pMac - tpAniSirGlobal
4603 * pStaDs - Station Descriptor
4604 *
4605 * @return : none
4606 */
4607static void
4608limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4609{
4610 tLimMlmReassocCnf mlmReassocCnf;
4611 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4612 /** Set the MlmState to IDLE*/
4613 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004614 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 /* Update PE session Id*/
4616 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4617 switch (psessionEntry->limMlmState) {
4618#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4619 case eLIM_SME_WT_REASSOC_STATE :
4620 {
4621 tpSirAssocRsp assocRsp;
4622 tpDphHashNode pStaDs;
4623 tSirRetStatus retStatus = eSIR_SUCCESS;
4624#ifdef ANI_PRODUCT_TYPE_CLIENT
4625 tSchBeaconStruct beaconStruct;
4626#endif
4627 /** Delete the older STA Table entry */
4628 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4629 /**
4630 * Add an entry for AP to hash table
4631 * maintained by DPH module
4632 */
4633 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4634 {
4635 // Could not add hash table entry
4636 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for \n"));)
4637 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4638 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4639 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4640 goto Error;
4641 }
4642 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4643 * is being stored to be used here for sending ADDBSS
4644 */
4645 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4646 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4647 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
4648#ifdef ANI_PRODUCT_TYPE_CLIENT
4649 limExtractApCapabilities( pMac,
4650 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4651 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4652 &beaconStruct );
4653 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4654 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4655 if(beaconStruct.erpPresent) {
4656 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4657 psessionEntry->beaconParams.fShortPreamble = 0;
4658 else
4659 psessionEntry->beaconParams.fShortPreamble = 1;
4660 }
4661 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4662 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4663 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
4664 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4665 retStatus = eSIR_FAILURE;
4666 }
4667#elif defined(ANI_AP_CLIENT_SDK)
4668 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &psessionEntry->pLimReAssocReq->neighborBssList.bssList[0],
4669 false, psessionEntry)) {
4670 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4671 retStatus = eSIR_FAILURE;
4672 }
4673#endif
4674 if (retStatus != eSIR_SUCCESS)
4675 {
4676 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4677 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4678 palFreeMemory(pMac->hHdd, assocRsp);
4679 pMac->lim.gLimAssocResponseData = NULL;
4680 goto Error;
4681 }
4682 palFreeMemory(pMac->hHdd, assocRsp);
4683 psessionEntry->limAssocResponseData = NULL;
4684 }
4685 break;
4686 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4687 {
4688 /** Case wherein the DisAssoc / Deauth
4689 * being sent as response to ReAssoc Req*/
4690 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4691 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4692 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4693 /** Set the SME State back to WT_Reassoc State*/
4694 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004695 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4697 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4698 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4699 {
4700 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07004701 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004702 }
4703 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4704 }
4705 break;
4706#endif
4707 default:
4708 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4709 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4710 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4711 goto Error;
4712 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004713 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004714Error:
4715 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4716}
4717
4718/* Added For BT -AMP Support */
4719static void
4720limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4721{
4722 tLimMlmStartCnf mlmStartCnf;
4723 tANI_U32 val;
4724 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4725
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304726 if (NULL == pAddBssParams)
4727 {
4728 limLog( pMac, LOGE, FL( "Invalid body pointer in message\n"));
4729 goto end;
4730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004731 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4732 {
4733 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS\n"));
4734 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4735 {
4736 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4737 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4738 goto end;
4739 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4740 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4741 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4742 goto end;
4743 }
4744
4745 // Set MLME state
4746 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4747 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4748 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4749 schEdcaProfileUpdate(pMac, psessionEntry);
4750 limInitAIDpool(pMac,psessionEntry);
4751 // Create timers used by LIM
4752 if (!pMac->lim.gLimTimersCreated)
4753 limCreateTimers(pMac);
4754 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4755 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
4756 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!\n"));
4757 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4758 // Apply previously set configuration at HW
4759 limApplyConfiguration(pMac,psessionEntry);
4760 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4761 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4762 }
4763 else
4764 {
4765 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d\n" ),pAddBssParams->status );
4766 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4767 }
4768 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4769 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4770 end:
4771 if( 0 != limMsgQ->bodyptr )
4772 palFreeMemory( pMac->hHdd, (void *) pAddBssParams );
4773}
4774
4775/**
4776 * @function : limHandleAddBssInReAssocContext
4777 * @brief : While Processing the ReAssociation Response Frame in STA,
4778 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4779 * being issued and the end of DelBSS the new BSS is being added.
4780 *
4781 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4782 * change, We need to update CSR with ReAssocCNF Response with the
4783 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4784 * context only
4785 *
4786 * @param : pMac - tpAniSirGlobal
4787 * pStaDs - Station Descriptor
4788 *
4789 * @return : none
4790 */
4791void
4792limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4793{
4794 tLimMlmReassocCnf mlmReassocCnf;
4795 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4796 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004797 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4798 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 switch (psessionEntry->limSmeState) {
4800#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
4801 case eLIM_SME_WT_REASSOC_STATE : {
4802 tpSirAssocRsp assocRsp;
4803 tpDphHashNode pStaDs;
4804 tSirRetStatus retStatus = eSIR_SUCCESS;
4805#ifdef ANI_PRODUCT_TYPE_CLIENT
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004806 tSchBeaconStruct *pBeaconStruct;
4807 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
4808 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
4809 {
4810 limLog(pMac, LOGE, FL("Unable to PAL allocate memory in limHandleAddBssInReAssocContext\n") );
4811 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4812 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4813 goto Error;
4814 }
4815
Jeff Johnson295189b2012-06-20 16:38:30 -07004816#endif
4817 // Get the AP entry from DPH hash table
4818 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4819 if (pStaDs == NULL )
4820 {
4821 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash\n"));)
4822 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4823 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004824 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 goto Error;
4826 }
4827 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4828 * is being stored to be used here for sending ADDBSS
4829 */
4830 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4831 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4832 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
4833#ifdef ANI_PRODUCT_TYPE_CLIENT
4834 limExtractApCapabilities( pMac,
4835 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4836 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004837 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004838 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004839 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4840
4841 if(pBeaconStruct->erpPresent)
4842 {
4843 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 psessionEntry->beaconParams.fShortPreamble = 0;
4845 else
4846 psessionEntry->beaconParams.fShortPreamble = 1;
4847 }
4848
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004849 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
4851 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4852 retStatus = eSIR_FAILURE;
4853 }
4854#elif defined(ANI_AP_CLIENT_SDK)
4855 if (eSIR_SUCCESS != limStaSendAddBss( pMac, (*assocRsp), &pMac->lim.gpLimReassocReq->neighborBssList.bssList[0], true)) {
4856 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed \n"));
4857 retStatus = eSIR_FAILURE;
4858 }
4859#endif
4860 if (retStatus != eSIR_SUCCESS)
4861 {
4862 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4863 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
4864 palFreeMemory(pMac->hHdd, assocRsp);
4865 pMac->lim.gLimAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004866 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 goto Error;
4868 }
4869 palFreeMemory(pMac->hHdd, assocRsp);
4870 psessionEntry->limAssocResponseData = NULL;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004871 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 }
4873 break;
4874 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4875 * being sent as response to ReAssoc Req*/
4876 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4877 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4878 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4879 /** Set the SME State back to WT_Reassoc State*/
4880 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4881 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4882 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
4883 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4884
4885 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4886 }
4887 break;
4888#endif
4889 default:
4890 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State\n"));)
4891 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4892 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4893 goto Error;
4894 }
4895return;
4896Error:
4897 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4898}
4899
4900#if 0
4901 static void
4902limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4903{
4904 tSirSmeAssocCnf assocCnf;
4905 tpDphHashNode pStaDs;
4906 tpPESession psessionEntry;
4907 tANI_U8 sessionId;
4908
4909 if(pMsgBuf == NULL)
4910 {
4911 limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
4912 goto end;
4913 }
4914 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4915 !__limIsSmeAssocCnfValid(&assocCnf))
4916 {
4917 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
4918 goto end;
4919 }
4920 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4921 {
4922 limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
4923 goto end;
4924 }
4925 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4926 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4927 {
4928 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
4929 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4930 goto end;
4931 }
4932 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4933 if (pStaDs == NULL)
4934 {
4935 limLog(pMac, LOG1,
4936 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4937 msgType, assocCnf.aid);
4938 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4939 /*
4940 ** send a DISASSOC_IND message to WSM to make sure
4941 ** the state in WSM and LIM is the same
4942 **/
4943 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4944 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4945 goto end;
4946 }
4947 if ((pStaDs &&
4948 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
4949 (tANI_U8 *) assocCnf.peerMacAddr,
4950 sizeof(tSirMacAddr)) ) ||
4951 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4952 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4953 (msgType != eWNI_SME_ASSOC_CNF)) ||
4954 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4955 (msgType != eWNI_SME_REASSOC_CNF)))))
4956 {
4957 limLog(pMac, LOG1,
4958 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4959 msgType, assocCnf.aid);
4960 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4961 goto end;
4962 }
4963 /*
4964 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4965 ** has been received
4966 **/
4967 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
4968 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4969 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4970 {
4971 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4972 * when it had received Assoc Request frame. Now, PE just needs to send
4973 * Association Response frame to the requesting BTAMP-STA.
4974 */
4975 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
4976 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
4977 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4978 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4979 goto end;
4980 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4981 else
4982 {
4983 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4984 limRejectAssociation(pMac, pStaDs->staAddr,
4985 pStaDs->mlmStaContext.subType,
4986 true, pStaDs->mlmStaContext.authType,
4987 pStaDs->assocId, true,
4988 assocCnf.statusCode, psessionEntry);
4989 return;
4990 }
4991end:
4992 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4993 {
4994 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4995 {
4996 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
4997 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4998 }
4999
5000 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
5001 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
5002 }
5003} /*** end __limProcessSmeAssocCnfNew() ***/
5004#endif
5005
5006#ifdef WLAN_SOFTAP_FEATURE
5007void
5008limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
5009 tBeaconGenParams *pBeaconGenParams = NULL;
5010 tSirMsgQ limMsg;
5011 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
5012 if(psessionEntry == NULL ){
5013 PELOGE( limLog( pMac, LOGE,
5014 FL( "Error:Unable to get the PESessionEntry\n" ));)
5015 return;
5016 }
5017 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5018 (void **) &pBeaconGenParams, (sizeof(*pBeaconGenParams))))
5019 {
5020 PELOGE( limLog( pMac, LOGP,
5021 FL( "Unable to PAL allocate memory during sending beaconPreMessage\n" ));)
5022 return;
5023 }
5024 palZeroMemory( pMac->hHdd, pBeaconGenParams, sizeof(*pBeaconGenParams));
5025 palCopyMemory( pMac->hHdd, (void *) pBeaconGenParams->bssId,
5026 (void *)psessionEntry->bssId,
5027 SIR_MAC_ADDR_LENGTH );
5028 limMsg.bodyptr = pBeaconGenParams;
5029 schProcessPreBeaconInd(pMac, &limMsg);
5030 return;
5031}
5032#endif