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