blob: 531ed57fa66cf3b9fda890e05cf3f149a4fb73ed [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
Gopichand Nakkala2c231c82013-06-11 17:49:16 +053042
Jeff Johnson295189b2012-06-20 16:38:30 -070043/*
Jeff Johnson295189b2012-06-20 16:38:30 -070044 * This file limProcessMlmRspMessages.cc contains the code
45 * for processing response messages from MLM state machine.
46 * Author: Chandra Modumudi
47 * Date: 02/11/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#include "cfgApi.h"
56#include "sirApi.h"
57#include "schApi.h"
58#include "utilsApi.h"
59#include "limUtils.h"
60#include "limAssocUtils.h"
61#include "limSecurityUtils.h"
62#include "limSerDesUtils.h"
63#include "limTimerUtils.h"
64#include "limSendMessages.h"
65#include "limAdmitControl.h"
66#include "limSendMessages.h"
67#include "limIbssPeerMgmt.h"
68#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070069#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070070#if defined WLAN_FEATURE_VOWIFI
71#include "rrmApi.h"
72#endif
73#if defined WLAN_FEATURE_VOWIFI_11R
74#include <limFT.h>
75#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070076#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070079static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070080void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070081#ifdef FEATURE_OEM_DATA_SUPPORT
82void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
83#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070084void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
86void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
87void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
88void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
89void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
90void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
91void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
92void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
93void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
94void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
95void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
96void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
97void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
98void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
99void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
100void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
101static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
102void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
103static void
104limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
105/**
106 * limProcessMlmRspMessages()
107 *
108 *FUNCTION:
109 * This function is called to processes various MLM response (CNF/IND
110 * messages from MLM State machine.
111 *
112 *LOGIC:
113 *
114 *ASSUMPTIONS:
115 *
116 *NOTE:
117 *
118 * @param pMac Pointer to Global MAC structure
119 * @param msgType Indicates the MLM message type
120 * @param *pMsgBuf A pointer to the MLM message buffer
121 *
122 * @return None
123 */
124void
125limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
126{
127
128 if(pMsgBuf == NULL)
129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700130 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 return;
132 }
133 switch (msgType)
134 {
135 case LIM_MLM_SCAN_CNF:
136 limProcessMlmScanCnf(pMac, pMsgBuf);
137 break;
138
Jeff Johnsone7245742012-09-05 17:12:55 -0700139#ifdef FEATURE_OEM_DATA_SUPPORT
140 case LIM_MLM_OEM_DATA_CNF:
141 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
142 break;
143#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700144
145 case LIM_MLM_AUTH_CNF:
146 limProcessMlmAuthCnf(pMac, pMsgBuf);
147 break;
148 case LIM_MLM_AUTH_IND:
149 limProcessMlmAuthInd(pMac, pMsgBuf);
150 break;
151 case LIM_MLM_ASSOC_CNF:
152 limProcessMlmAssocCnf(pMac, pMsgBuf);
153 break;
154 case LIM_MLM_START_CNF:
155 limProcessMlmStartCnf(pMac, pMsgBuf);
156 break;
157 case LIM_MLM_JOIN_CNF:
158 limProcessMlmJoinCnf(pMac, pMsgBuf);
159 break;
160 case LIM_MLM_ASSOC_IND:
161 limProcessMlmAssocInd(pMac, pMsgBuf);
162 break;
163 case LIM_MLM_REASSOC_CNF:
164 limProcessMlmReassocCnf(pMac, pMsgBuf);
165 break;
166 case LIM_MLM_REASSOC_IND:
167 limProcessMlmReassocInd(pMac, pMsgBuf);
168 break;
169 case LIM_MLM_DISASSOC_CNF:
170 limProcessMlmDisassocCnf(pMac, pMsgBuf);
171 break;
172 case LIM_MLM_DISASSOC_IND:
173 limProcessMlmDisassocInd(pMac, pMsgBuf);
174 break;
175 case LIM_MLM_PURGE_STA_IND:
176 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
177 break;
178 case LIM_MLM_DEAUTH_CNF:
179 limProcessMlmDeauthCnf(pMac, pMsgBuf);
180 break;
181 case LIM_MLM_DEAUTH_IND:
182 limProcessMlmDeauthInd(pMac, pMsgBuf);
183 break;
184 case LIM_MLM_SETKEYS_CNF:
185 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
186 break;
187 case LIM_MLM_REMOVEKEY_CNF:
188 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
189 break;
190 case LIM_MLM_TSPEC_CNF:
191 break;
192 case LIM_MLM_ADDBA_CNF:
193 limProcessMlmAddBACnf( pMac, pMsgBuf );
194 break;
195 case LIM_MLM_DELBA_CNF:
196 limProcessMlmDelBACnf( pMac, pMsgBuf );
197 break;
198 default:
199 break;
200 } // switch (msgType)
201 return;
202} /*** end limProcessMlmRspMessages() ***/
203
204/**
205 * limProcessMlmScanCnf()
206 *
207 *FUNCTION:
208 * This function is called to processes MLM_SCAN_CNF
209 * message from MLM State machine.
210 *
211 *LOGIC:
212 *
213 *ASSUMPTIONS:
214 *
215 *NOTE:
216 *
217 * @param pMac Pointer to Global MAC structure
218 * @param pMsgBuf A pointer to the MLM message buffer
219 *
220 * @return None
221 */
222void
223limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
224{
225 switch(pMac->lim.gLimSmeState)
226 {
227 case eLIM_SME_WT_SCAN_STATE:
228 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
229 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
230 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700231 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 pMac->lim.gLimSystemInScanLearnMode = 0;
233 break;
234 default:
235 /**
236 * Should not have received scan confirm
237 * from MLM in other states.
238 * Log error
239 */
240 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700241 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700242 pMac->lim.gLimSmeState);)
243 return;
244 }
245
246 /// Process received scan confirm
247 /// Increment length of cached scan results
248 pMac->lim.gLimSmeScanResultLength +=
249 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
250 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
251 {
252 tANI_U16 scanRspLen = 0;
253 /// Need to send response to Host
254 pMac->lim.gLimRspReqd = false;
255 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
256 eSIR_SME_SUCCESS) ||
257 pMac->lim.gLimSmeScanResultLength)
258 {
259 scanRspLen = sizeof(tSirSmeScanRsp) +
260 pMac->lim.gLimSmeScanResultLength -
261 sizeof(tSirBssDescription);
262 }
263 else
264 {
265 scanRspLen = sizeof(tSirSmeScanRsp);
266 }
267 if(pMac->lim.gLimReportBackgroundScanResults)
268 {
269 pMac->lim.gLimBackgroundScanTerminate = TRUE;
270 }
271 if (pMac->lim.gLimSmeScanResultLength == 0)
272 {
273 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
274 }
275 else
276 {
277 limSendSmeScanRsp(pMac, scanRspLen,
278 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
279 }
280 } // if (pMac->lim.gLimRspReqd)
281 //check to see whether we need to run bgScan timer
282 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
283 {
284 if (tx_timer_activate(
285 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
286 {
287 /// Could not activate background scan timer.
288 // Log error
289 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700290 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 pMac->lim.gLimBackgroundScanStarted = FALSE;
292 }
293 else
294 {
295 pMac->lim.gLimBackgroundScanStarted = TRUE;
296 }
297 }
298} /*** end limProcessMlmScanCnf() ***/
299
Jeff Johnsone7245742012-09-05 17:12:55 -0700300#ifdef FEATURE_OEM_DATA_SUPPORT
301
302/**
303 * limProcessMlmOemDataReqCnf()
304 *
305 *FUNCTION:
306 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
307 * message from MLM State machine.
308 *
309 *LOGIC:
310 *
311 *ASSUMPTIONS:
312 *
313 *NOTE:
314 *
315 * @param pMac Pointer to Global MAC structure
316 * @param pMsgBuf A pointer to the MLM message buffer
317 *
318 * @return None
319 */
320
321void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
322{
323 tLimMlmOemDataRsp* measRsp;
324
325 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
326
327 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
328
329 //Now send the meas confirm message to the sme
330 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
331
332 //Dont free the memory here. It will be freed up by the callee
333
334 return;
335}
336#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700337
338/**
339 * limProcessMlmStartCnf()
340 *
341 *FUNCTION:
342 * This function is called to processes MLM_START_CNF
343 * message from MLM State machine.
344 *
345 *LOGIC:
346 *
347 *ASSUMPTIONS:
348 *
349 *NOTE:
350 *
351 * @param pMac Pointer to Global MAC structure
352 * @param pMsgBuf A pointer to the MLM message buffer
353 *
354 * @return None
355 */
356void
357limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
358{
359 tpPESession psessionEntry = NULL;
360 tLimMlmStartCnf *pLimMlmStartCnf;
361 tANI_U8 smesessionId;
362 tANI_U16 smetransactionId;
363
364 if(pMsgBuf == NULL)
365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700366 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 return;
368 }
369 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
370 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
371 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700372 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 return;
374 }
375 smesessionId = psessionEntry->smeSessionId;
376 smetransactionId = psessionEntry->transactionId;
377
378 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
379 {
380 /**
381 * Should not have received Start confirm from MLM
382 * in other states.
383 * Log error
384 */
385 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700386 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 psessionEntry->limSmeState);)
388 return;
389 }
390 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
391 eSIR_SME_SUCCESS)
392 {
393
394 /**
395 * Update global SME state so that Beacon Generation
396 * module starts writing Beacon frames into TFP's
397 * Beacon file register.
398 */
399 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700400 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700403 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
405 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
406 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700407 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700411 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700414 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 }
416 else
417 {
418 /// Start BSS is a failure
419 peDeleteSession(pMac,psessionEntry);
420 psessionEntry = NULL;
421 }
422 /// Send response to Host
423 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
424 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
425 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
427 {
428 //Configure beacon and send beacons to HAL
429 limSendBeaconInd(pMac, psessionEntry);
430 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700431}
432
433 /*** end limProcessMlmStartCnf() ***/
434
435/**
436 * limProcessMlmJoinCnf()
437 *
438 *FUNCTION:
439 * This function is called to processes MLM_JOIN_CNF
440 * message from MLM State machine.
441 *
442 *LOGIC:
443 *
444 *ASSUMPTIONS:
445 *
446 *NOTE:
447 *
448 * @param pMac Pointer to Global MAC structure
449 * @param pMsgBuf A pointer to the MLM message buffer
450 *
451 * @return None
452 */
453void
454limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
455{
456 tSirResultCodes resultCode;
457 tLimMlmJoinCnf *pLimMlmJoinCnf;
458 tpPESession psessionEntry;
459 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
460 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700462 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 return;
464 }
465
466 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
467 {
468 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700469 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 psessionEntry->limSmeState);)
471 return;
472 }
473
474 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
475 /// Process Join confirm from MLM
476 if (resultCode == eSIR_SME_SUCCESS)
477 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700478 PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
481 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
482 return;
483 else
484 resultCode = eSIR_SME_REFUSED;
485 }
486 {
487 /// Join failure
488 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700489 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 /// Send Join response to Host
491 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
492 }
493} /*** end limProcessMlmJoinCnf() ***/
494
495/**
496 * limProcessMlmAuthCnf()
497 *
498 *FUNCTION:
499 * This function is called to processes MLM_AUTH_CNF
500 * message from MLM State machine.
501 *
502 *LOGIC:
503 *
504 *ASSUMPTIONS:
505 *
506 *NOTE:
507 *
508 * @param pMac Pointer to Global MAC structure
509 * @param pMsgBuf A pointer to the MLM message buffer
510 *
511 * @return None
512 */
513void
514limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
515{
516 tANI_U16 caps;
517 tANI_U32 val;
518 tAniAuthType cfgAuthType, authMode;
519 tLimMlmAuthReq *pMlmAuthReq;
520 tLimMlmAssocReq *pMlmAssocReq;
521 tLimMlmAuthCnf *pMlmAuthCnf;
522 tpPESession psessionEntry;
523 tANI_U32 teleBcnEn = 0;
524// tANI_U8 sessionId;
525
526 if(pMsgBuf == NULL)
527 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700528 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 return;
530 }
531 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
532 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
533 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700534 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 return;
536 }
537
538 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
539 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
540 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
541 {
542 /**
543 * Should not have received AUTH confirm
544 * from MLM in other states or on AP.
545 * Log error
546 */
547 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700548 FL("received unexpected MLM_AUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 psessionEntry->limSmeState);)
550 return;
551 }
552 /// Process AUTH confirm from MLM
553 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
554 {
555 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
556 {
557 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
558 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
559 {
560 /**
561 * Could not get AuthType value from CFG.
562 * Log error.
563 */
564 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700565 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 }
567 }
568 else
569 cfgAuthType = pMac->lim.gLimPreAuthType;
570
571 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
572 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
573 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
574 {
575 /**
576 * When Open authentication fails with reason code "13" and
577 * authType set to 'auto switch', Try with Shared Authentication
578 */
579 authMode = eSIR_SHARED_KEY;
580 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530581 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
582 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 {
584 // Log error
585 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530586 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 return;
588 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530589 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 val = sizeof(tSirMacAddr);
591 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
592 {
593 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
594 }
595 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530596 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
597 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 sizeof(tSirMacAddr));
599 pMlmAuthReq->authType = authMode;
600 /* Update PE session Id*/
601 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
602 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
603 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
604 != eSIR_SUCCESS)
605 {
606 /**
607 * Could not get AuthFailureTimeout value from CFG.
608 * Log error.
609 */
610 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700611 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 }
613 limPostMlmMessage(pMac,
614 LIM_MLM_AUTH_REQ,
615 (tANI_U32 *) pMlmAuthReq);
616 return;
617 }
618 else
619 {
620 // MAC based authentication failure
621 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
622 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700623 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700625 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700627 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
628
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 /**
630 * Need to send Join response with
631 * auth failure to Host.
632 */
633 limHandleSmeJoinResult(pMac,
634 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
635 }
636 else
637 {
638 /**
639 * Pre-authentication failure.
640 * Send Pre-auth failure response to host
641 */
642 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 limSendSmeAuthRsp(
645 pMac,
646 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
647 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
648 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
649 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
650 }
651 } // end if (cfgAuthType == eAUTO_SWITCH)
652 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
653 else
654 {
655 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
656 {
657 /**
658 * Successful MAC based authentication
659 * Trigger Association with BSS
660 */
661 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700662 FL("*** Authenticated with BSS ***"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530663 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
664 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 {
666 // Log error
667 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530668 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 return;
670 }
671 val = sizeof(tSirMacAddr);
672 #if 0
673 if (cfgGetStr(pMac, WNI_CFG_BSSID,
674 pMlmAssocReq->peerMacAddr,
675 &val) != eSIR_SUCCESS)
676 {
677 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700678 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 }
680 #endif //SUPPORT BT-AMP
681 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
682 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
683 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
684 != eSIR_SUCCESS)
685 {
686 /**
687 * Could not get AssocFailureTimeout value
688 * from CFG. Log error.
689 */
690 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700691 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 }
693 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
694 {
695 /**
696 * Could not get Capabilities value
697 * from CFG. Log error.
698 */
699 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700700 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 }
702 /*Clear spectrum management bit if AP doesn't support it*/
703 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
704 {
705 /*AP doesn't support spectrum management clear spectrum management bit*/
706 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
707 }
708
709 pMlmAssocReq->capabilityInfo = caps;
710 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700711 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700712 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700713 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
714 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700715
716 /* If telescopic beaconing is enabled, set listen interval to
717 WNI_CFG_TELE_BCN_MAX_LI */
718 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
719 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700720 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700721
722 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
723
724 if(teleBcnEn)
725 {
726 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
727 eSIR_SUCCESS)
728 {
729 /**
730 * Could not get ListenInterval value
731 * from CFG. Log error.
732 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700733 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 }
735 }
736 else
737 {
738 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
739 {
740 /**
741 * Could not get ListenInterval value
742 * from CFG. Log error.
743 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700744 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 }
746 }
747
748 pMlmAssocReq->listenInterval = (tANI_U16)val;
749 /* Update PE session ID*/
750 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
751 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
752 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700753 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 limPostMlmMessage(pMac,
755 LIM_MLM_ASSOC_REQ,
756 (tANI_U32 *) pMlmAssocReq);
757 }
758 else
759 {
760 /**
761 * Successful Pre-authentication.
762 * Send Pre-auth response to host
763 */
764 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700765 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 limSendSmeAuthRsp(
767 pMac,
768 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
769 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
770 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
771 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
772 }
773 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
774} /*** end limProcessMlmAuthCnf() ***/
775
776/**
777 * limProcessMlmAssocCnf()
778 *
779 *FUNCTION:
780 * This function is called to processes MLM_ASSOC_CNF
781 * message from MLM State machine.
782 *
783 *LOGIC:
784 *
785 *ASSUMPTIONS:
786 *
787 *NOTE:
788 *
789 * @param pMac Pointer to Global MAC structure
790 * @param pMsgBuf A pointer to the MLM message buffer
791 *
792 * @return None
793 */
794void
795limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
796{
797 tpPESession psessionEntry;
798 tLimMlmAssocCnf *pLimMlmAssocCnf;
799
800 if(pMsgBuf == NULL)
801 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700802 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 return;
804 }
805 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
806 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
807 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700808 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 return;
810 }
811 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
812 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
813 {
814 /**
815 * Should not have received Assocication confirm
816 * from MLM in other states OR on AP.
817 * Log error
818 */
819 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700820 FL("received unexpected MLM_ASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 psessionEntry->limSmeState);)
822 return;
823 }
824 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
825 {
826 // Association failure
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700827 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700829 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 /**
831 * Need to send Join response with
832 * Association failure to Host.
833 */
834 limHandleSmeJoinResult(pMac,
835 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
836 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
837 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
838 else
839 {
840 // Successful Association
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700841 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700843 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 /**
845 * Need to send Join response with
846 * Association success to Host.
847 */
848 limHandleSmeJoinResult(pMac,
849 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
850 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
851 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
852} /*** end limProcessMlmAssocCnf() ***/
853
854/**
855 * limProcessMlmReassocCnf()
856 *
857 *FUNCTION:
858 * This function is called to processes MLM_REASSOC_CNF
859 * message from MLM State machine.
860 *
861 *LOGIC:
862 *
863 *ASSUMPTIONS:
864 *
865 *NOTE:
866 *
867 * @param pMac Pointer to Global MAC structure
868 * @param pMsgBuf A pointer to the MLM message buffer
869 *
870 * @return None
871 */
872void
873limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
874{
875 tpPESession psessionEntry;
876 tLimMlmReassocCnf *pLimMlmReassocCnf;
877
878 if(pMsgBuf == NULL)
879 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700880 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 return;
882 }
883 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
884 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700886 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 return;
888 }
889 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
890 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
891 {
892 /**
893 * Should not have received Reassocication confirm
894 * from MLM in other states OR on AP.
895 * Log error
896 */
897 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700898 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
900 return;
901 }
902 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530903 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 psessionEntry->pLimReAssocReq = NULL;
905 }
906
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700907 PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
909 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700910 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700911
912 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700913 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700914
915 /**
916 * Need to send Reassoc response with
917 * Reassociation success to Host.
918 */
919 limSendSmeJoinReassocRsp(
920 pMac, eWNI_SME_REASSOC_RSP,
921 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
922 psessionEntry->smeSessionId,psessionEntry->transactionId);
923 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
924 /** Reassociation failure With the New AP
925 * but we still have the link with the Older AP
926 */
927 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700928 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700929
930 /**
931 * Need to send Reassoc response with
932 * Association failure to Host.
933 */
934 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
935 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
936 psessionEntry->smeSessionId,psessionEntry->transactionId);
937 }else {
938 // Reassociation failure
939 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700940 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 /**
942 * Need to send Reassoc response with
943 * Association failure to Host.
944 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700945 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 }
947} /*** end limProcessMlmReassocCnf() ***/
948
949/**
950 * limProcessMlmReassocInd()
951 *
952 *FUNCTION:
953 * This function is called to processes MLM_REASSOC_IND
954 * message from MLM State machine.
955 *
956 *LOGIC:
957 *
958 *ASSUMPTIONS:
959 *
960 *NOTE:
961 *
962 * @param pMac Pointer to Global MAC structure
963 * @param pMsgBuf A pointer to the MLM message buffer
964 *
965 * @return None
966 */
967void
968limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
969{
970 tANI_U32 len;
971 tSirMsgQ msgQ;
972 tSirSmeReassocInd *pSirSmeReassocInd;
973 tpDphHashNode pStaDs=0;
974 tpPESession psessionEntry;
975 tANI_U8 sessionId;
976 if(pMsgBuf == NULL)
977 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700978 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 return;
980 }
981 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
982 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700983 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 return;
985 }
986 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530988 pSirSmeReassocInd = vos_mem_malloc(len);
989 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 {
991 // Log error
992 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530993 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 return;
995
996 }
997 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
998 eWNI_SME_REASSOC_IND);
999 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1000 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1001
1002 // Required for indicating the frames to upper layer
1003 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1004 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1005 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1006 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1007
1008 msgQ.type = eWNI_SME_REASSOC_IND;
1009 msgQ.bodyptr = pSirSmeReassocInd;
1010 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001011 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001012#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1013 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1014#endif //FEATURE_WLAN_DIAG_SUPPORT
1015 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1016 if (! pStaDs)
1017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001018 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301020 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 return;
1022 }
1023
1024 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1025 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001026 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 /*
1028 ** turn on a timer to detect the loss of REASSOC CNF
1029 **/
1030 limActivateCnfTimer(pMac,
1031 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1032} /*** end limProcessMlmReassocInd() ***/
1033
1034/**
1035 * limProcessMlmAuthInd()
1036 *
1037 *FUNCTION:
1038 * This function is called to processes MLM_AUTH_IND
1039 * message from MLM State machine.
1040 *
1041 *LOGIC:
1042 *
1043 *ASSUMPTIONS:
1044 *
1045 *NOTE:
1046 *
1047 * @param pMac Pointer to Global MAC structure
1048 * @param pMsgBuf A pointer to the MLM message buffer
1049 *
1050 * @return None
1051 */
1052void
1053limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1054{
1055 tSirMsgQ msgQ;
1056 tSirSmeAuthInd *pSirSmeAuthInd;
1057
1058 if(pMsgBuf == NULL)
1059 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001060 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 return;
1062 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301063 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1064 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 {
1066 // Log error
1067 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301068 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 }
1070 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1071 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1072 (tANI_U8 *) &(pSirSmeAuthInd->length));
1073 msgQ.type = eWNI_SME_AUTH_IND;
1074 msgQ.bodyptr = pSirSmeAuthInd;
1075 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001076 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001077#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1078 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1079#endif //FEATURE_WLAN_DIAG_SUPPORT
1080 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1081} /*** end limProcessMlmAuthInd() ***/
1082
1083
1084
1085
1086void
1087limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1088 tSirSmeAssocInd *pSirSmeAssocInd,
1089 tpPESession psessionEntry)
1090{
1091 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1092 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1093
1094 // Required for indicating the frames to upper layer
1095 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1096 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1097
1098 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1099 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1100
1101 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301102 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1103 sizeof(tSirMacAddr));
1104
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 // Fill in aid
1106 pSirSmeAssocInd->aid = pAssocInd->aid;
1107 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301108 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 // Fill in staId
1110 //pSirSmeAssocInd->staId = psessionEntry->staId;
1111 // Fill in authType
1112 pSirSmeAssocInd->authType = pAssocInd->authType;
1113 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301114 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1115 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301117 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1118 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1119 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001120
1121 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301122 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1123 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1124 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
1126 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1128 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1129 {
1130 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1131 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1132 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301133 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301135 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 // Fill in WmmInfo
1138 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001139} /*** end limAssocIndSerDes() ***/
1140
1141
1142
1143/**
1144 * limProcessMlmAssocInd()
1145 *
1146 *FUNCTION:
1147 * This function is called to processes MLM_ASSOC_IND
1148 * message from MLM State machine.
1149 *
1150 *LOGIC:
1151 *
1152 *ASSUMPTIONS:
1153 *
1154 *NOTE:
1155 *
1156 * @param pMac Pointer to Global MAC structure
1157 * @param pMsgBuf A pointer to the MLM message buffer
1158 *
1159 * @return None
1160 */
1161void
1162limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1163{
1164 tANI_U32 len;
1165 tSirMsgQ msgQ;
1166 tSirSmeAssocInd *pSirSmeAssocInd;
1167 tpDphHashNode pStaDs=0;
1168 tpPESession psessionEntry;
1169 if(pMsgBuf == NULL)
1170 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001171 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 return;
1173 }
1174 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1175 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001176 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 return;
1178 }
1179 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301181 pSirSmeAssocInd = vos_mem_malloc(len);
1182 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 {
1184 // Log error
1185 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301186 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 return;
1188 }
1189
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1191 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 msgQ.type = eWNI_SME_ASSOC_IND;
1193 msgQ.bodyptr = pSirSmeAssocInd;
1194 msgQ.bodyval = 0;
1195 pStaDs = dphGetHashEntry(pMac,
1196 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1197 if (! pStaDs)
1198 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001199 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301201 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001202
1203 return;
1204 }
1205 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001207 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001208#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1209 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1210#endif //FEATURE_WLAN_DIAG_SUPPORT
1211 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1212
1213 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001214 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 /*
1216 ** turn on a timer to detect the loss of ASSOC CNF
1217 **/
1218 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1219
1220// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1221#ifdef TEST_BTAMP_AP
1222//tANI_U32 *pMsgBuf;
1223{
1224 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301225 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1226 if ( NULL == pSmeAssoccnf )
1227 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1229 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301230 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1231 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1233 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301234 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1235 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301237 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1239 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301240 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001241}
1242#endif
1243
1244
1245} /*** end limProcessMlmAssocInd() ***/
1246
1247
1248
1249
1250/**
1251 * limProcessMlmDisassocInd()
1252 *
1253 *FUNCTION:
1254 * This function is called to processes MLM_DISASSOC_IND
1255 * message from MLM State machine.
1256 *
1257 *LOGIC:
1258 *
1259 *ASSUMPTIONS:
1260 *
1261 *NOTE:
1262 *
1263 * @param pMac Pointer to Global MAC structure
1264 * @param pMsgBuf A pointer to the MLM message buffer
1265 *
1266 * @return None
1267 */
1268void
1269limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1270{
1271 tLimMlmDisassocInd *pMlmDisassocInd;
1272 tpPESession psessionEntry;
1273 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1274 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1275 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001276 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 return;
1278 }
1279 switch (psessionEntry->limSystemRole)
1280 {
1281 case eLIM_STA_IN_IBSS_ROLE:
1282 break;
1283 case eLIM_STA_ROLE:
1284 case eLIM_BT_AMP_STA_ROLE:
1285 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001286 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 break;
1288 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1289 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001290 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 pMlmDisassocInd->aid);)
1292 // Send SME_DISASOC_IND after Polaris cleanup
1293 // (after receiving LIM_MLM_PURGE_STA_IND)
1294 break;
1295 } // end switch (psessionEntry->limSystemRole)
1296} /*** end limProcessMlmDisassocInd() ***/
1297
1298/**
1299 * limProcessMlmDisassocCnf()
1300 *
1301 *FUNCTION:
1302 * This function is called to processes MLM_DISASSOC_CNF
1303 * message from MLM State machine.
1304 *
1305 *LOGIC:
1306 *
1307 *ASSUMPTIONS:
1308 *
1309 *NOTE:
1310 *
1311 * @param pMac Pointer to Global MAC structure
1312 * @param pMsgBuf A pointer to the MLM message buffer
1313 *
1314 * @return None
1315 */
1316void
1317limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1318{
1319 tSirResultCodes resultCode;
1320 tLimMlmDisassocCnf *pMlmDisassocCnf;
1321 tpPESession psessionEntry;
1322 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1323 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1324 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001325 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 return;
1327 }
1328 resultCode = (tSirResultCodes)
1329 (pMlmDisassocCnf->disassocTrigger ==
1330 eLIM_LINK_MONITORING_DISASSOC) ?
1331 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1332 pMlmDisassocCnf->resultCode;
1333 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1334 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 // Disassociate Confirm from MLM
1336 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1337 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1338 {
1339 /**
1340 * Should not have received
1341 * Disassocate confirm
1342 * from MLM in other states.
1343 * Log error
1344 */
1345 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001346 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 return;
1348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 if (pMac->lim.gLimRspReqd)
1350 pMac->lim.gLimRspReqd = false;
1351 if (pMlmDisassocCnf->disassocTrigger ==
1352 eLIM_PROMISCUOUS_MODE_DISASSOC)
1353 {
1354 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1355 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1356 else
1357 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001358 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 // Send Promiscuous mode response to host
1360 limSendSmePromiscuousModeRsp(pMac);
1361 }
1362 else
1363 {
1364 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1365 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1366 else
1367 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001368 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1370 resultCode,
1371 pMlmDisassocCnf->disassocTrigger,
1372 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1373 }
1374 }
1375 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1376 {
1377 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1378 resultCode,
1379 pMlmDisassocCnf->disassocTrigger,
1380 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1381 }
1382} /*** end limProcessMlmDisassocCnf() ***/
1383
1384/**
1385 * limProcessMlmDeauthInd()
1386 *
1387 *FUNCTION:
1388 * This function is called to processes MLM_DEAUTH_IND
1389 * message from MLM State machine.
1390 *
1391 *LOGIC:
1392 *
1393 *ASSUMPTIONS:
1394 *
1395 *NOTE:
1396 *
1397 * @param pMac Pointer to Global MAC structure
1398 * @param pMsgBuf A pointer to the MLM message buffer
1399 *
1400 * @return None
1401 */
1402void
1403limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1404{
1405 tLimMlmDeauthInd *pMlmDeauthInd;
1406 tpPESession psessionEntry;
1407 tANI_U8 sessionId;
1408 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1409 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001411 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 return;
1413 }
1414 switch (psessionEntry->limSystemRole)
1415 {
1416 case eLIM_STA_IN_IBSS_ROLE:
1417 break;
1418 case eLIM_STA_ROLE:
1419 case eLIM_BT_AMP_STA_ROLE:
1420 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001421 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422
1423 default: // eLIM_AP_ROLE
1424 {
1425 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001426 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 pMlmDeauthInd->aid);)
1428 }
1429 // Send SME_DEAUTH_IND after Polaris cleanup
1430 // (after receiving LIM_MLM_PURGE_STA_IND)
1431 break;
1432 } // end switch (psessionEntry->limSystemRole)
1433} /*** end limProcessMlmDeauthInd() ***/
1434
1435/**
1436 * limProcessMlmDeauthCnf()
1437 *
1438 *FUNCTION:
1439 * This function is called to processes MLM_DEAUTH_CNF
1440 * message from MLM State machine.
1441 *
1442 *LOGIC:
1443 *
1444 *ASSUMPTIONS:
1445 *
1446 *NOTE:
1447 *
1448 * @param pMac Pointer to Global MAC structure
1449 * @param pMsgBuf A pointer to the MLM message buffer
1450 *
1451 * @return None
1452 */
1453void
1454limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1455{
1456 tANI_U16 aid;
1457 tSirResultCodes resultCode;
1458 tLimMlmDeauthCnf *pMlmDeauthCnf;
1459 tpPESession psessionEntry;
1460
1461 if(pMsgBuf == NULL)
1462 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001463 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 return;
1465 }
1466 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1467 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1468 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001469 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 return;
1471 }
1472
1473 resultCode = (tSirResultCodes)
1474 (pMlmDeauthCnf->deauthTrigger ==
1475 eLIM_LINK_MONITORING_DEAUTH) ?
1476 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1477 pMlmDeauthCnf->resultCode;
1478 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1479 pMlmDeauthCnf->aid : 1;
1480 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1481 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 // Deauth Confirm from MLM
1483 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1484 {
1485 /**
1486 * Should not have received Deauth confirm
1487 * from MLM in other states.
1488 * Log error
1489 */
1490 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001491 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 psessionEntry->limSmeState);)
1493 return;
1494 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1496 {
1497 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1498 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001499 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 }
1501 else
1502 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001503 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
1505 if (pMac->lim.gLimRspReqd)
1506 pMac->lim.gLimRspReqd = false;
1507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1509 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1510 resultCode,
1511 pMlmDeauthCnf->deauthTrigger,
1512 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001513} /*** end limProcessMlmDeauthCnf() ***/
1514
1515/**
1516 * limProcessMlmPurgeStaInd()
1517 *
1518 *FUNCTION:
1519 * This function is called to processes MLM_PURGE_STA_IND
1520 * message from MLM State machine.
1521 *
1522 *LOGIC:
1523 *
1524 *ASSUMPTIONS:
1525 *
1526 *NOTE:
1527 *
1528 * @param pMac Pointer to Global MAC structure
1529 * @param pMsgBuf A pointer to the MLM message buffer
1530 *
1531 * @return None
1532 */
1533void
1534limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1535{
1536 tSirResultCodes resultCode;
1537 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1538 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 if(pMsgBuf == NULL)
1540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001541 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 return;
1543 }
1544 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1545 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001547 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 return;
1549 }
1550 // Purge STA indication from MLM
1551 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1552 switch (psessionEntry->limSystemRole)
1553 {
1554 case eLIM_STA_IN_IBSS_ROLE:
1555 break;
1556 case eLIM_STA_ROLE:
1557 case eLIM_BT_AMP_STA_ROLE:
1558 default: // eLIM_AP_ROLE
1559 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1560 (psessionEntry->limSmeState !=
1561 eLIM_SME_WT_DISASSOC_STATE) &&
1562 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1563 {
1564 /**
1565 * Should not have received
1566 * Purge STA indication
1567 * from MLM in other states.
1568 * Log error
1569 */
1570 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001571 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 psessionEntry->limSmeState);)
1573 break;
1574 }
1575 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001576 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 pMlmPurgeStaInd->aid);)
1578 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1579 {
1580 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001581 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001582
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 }
1584 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1585 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 limSendSmeDeauthNtf(pMac,
1587 pMlmPurgeStaInd->peerMacAddr,
1588 resultCode,
1589 pMlmPurgeStaInd->purgeTrigger,
1590 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 }
1592 else
1593 limSendSmeDisassocNtf(pMac,
1594 pMlmPurgeStaInd->peerMacAddr,
1595 resultCode,
1596 pMlmPurgeStaInd->purgeTrigger,
1597 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1598 } // end switch (psessionEntry->limSystemRole)
1599} /*** end limProcessMlmPurgeStaInd() ***/
1600
1601/**
1602 * limProcessMlmSetKeysCnf()
1603 *
1604 *FUNCTION:
1605 * This function is called to processes MLM_SETKEYS_CNF
1606 * message from MLM State machine.
1607 *
1608 *LOGIC:
1609 *
1610 *ASSUMPTIONS:
1611 *
1612 *NOTE:
1613 *
1614 * @param pMac Pointer to Global MAC structure
1615 * @param pMsgBuf A pointer to the MLM message buffer
1616 *
1617 * @return None
1618 */
1619void
1620limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1621{
1622 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001623 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001624 tpPESession psessionEntry;
1625
1626 if(pMsgBuf == NULL)
1627 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001628 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001629 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 }
1631 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1632 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001634 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 return;
1636 }
1637 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001638 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 pMlmSetKeysCnf->resultCode );
1640 limSendSmeSetContextRsp(pMac,
1641 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1644 psessionEntry->transactionId);
1645} /*** end limProcessMlmSetKeysCnf() ***/
1646/**
1647 * limProcessMlmRemoveKeyCnf()
1648 *
1649 *FUNCTION:
1650 * This function is called to processes MLM_REMOVEKEY_CNF
1651 * message from MLM State machine.
1652 *
1653 *LOGIC:
1654 *
1655 *ASSUMPTIONS:
1656 *
1657 *NOTE:
1658 *
1659 * @param pMac Pointer to Global MAC structure
1660 * @param pMsgBuf A pointer to the MLM message buffer
1661 *
1662 * @return None
1663 */
1664void
1665limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1666{
1667 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001668 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 tpPESession psessionEntry;
1670
1671 if(pMsgBuf == NULL)
1672 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001673 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001674 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 }
1676 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1677 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1678 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001679 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 return;
1681 }
1682 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001683 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 pMlmRemoveKeyCnf->resultCode );
1685 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001686 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001687 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1688 psessionEntry->smeSessionId,psessionEntry->transactionId);
1689} /*** end limProcessMlmRemoveKeyCnf() ***/
1690
1691
1692/**
1693 * limHandleSmeJoinResult()
1694 *
1695 *FUNCTION:
1696 * This function is called to process join/auth/assoc failures
1697 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1698 * MLM_ASSOC_CNF with a success code in case of STA role and
1699 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1700 *
1701 *LOGIC:
1702 *
1703 *ASSUMPTIONS:
1704 *
1705 *NOTE:
1706 *
1707 * @param pMac Pointer to Global MAC structure
1708 * @param resultCode Failure code to be sent
1709 *
1710 *
1711 * @return None
1712 */
1713static void
1714limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1715{
1716 tpDphHashNode pStaDs = NULL;
1717 tANI_U8 smesessionId;
1718 tANI_U16 smetransactionId;
1719
1720 /* Newly Added on oct 11 th*/
1721 if(psessionEntry == NULL)
1722 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001723 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 return;
1725 }
1726 smesessionId = psessionEntry->smeSessionId;
1727 smetransactionId = psessionEntry->transactionId;
1728 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1729 if(resultCode != eSIR_SME_SUCCESS)
1730 {
1731 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1732 if (pStaDs != NULL)
1733 {
1734 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1735 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1736 pStaDs->mlmStaContext.resultCode = resultCode;
1737 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1738 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1739 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301740 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001741 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 return;
1743 }
1744 }
1745
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301746 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 psessionEntry->pLimJoinReq = NULL;
1748 //Delete teh session if JOIN failure occurred.
1749 if(resultCode != eSIR_SME_SUCCESS)
1750 {
1751 if(NULL != psessionEntry)
1752 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001753 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1754 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001755 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 peDeleteSession(pMac,psessionEntry);
1757 psessionEntry = NULL;
1758 }
1759 }
1760 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1761 smesessionId, smetransactionId);
1762} /*** end limHandleSmeJoinResult() ***/
1763
1764/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001765 * limHandleSmeReaasocResult()
1766 *
1767 *FUNCTION:
1768 * This function is called to process reassoc failures
1769 * upon receiving REASSOC_CNF with a failure code or
1770 * MLM_REASSOC_CNF with a success code in case of STA role
1771 *
1772 *LOGIC:
1773 *
1774 *ASSUMPTIONS:
1775 *
1776 *NOTE:
1777 *
1778 * @param pMac Pointer to Global MAC structure
1779 * @param resultCode Failure code to be sent
1780 *
1781 *
1782 * @return None
1783 */
1784static void
1785limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1786{
1787 tpDphHashNode pStaDs = NULL;
1788 tANI_U8 smesessionId;
1789 tANI_U16 smetransactionId;
1790
1791 if(psessionEntry == NULL)
1792 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001793 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001794 return;
1795 }
1796 smesessionId = psessionEntry->smeSessionId;
1797 smetransactionId = psessionEntry->transactionId;
1798 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1799 if(resultCode != eSIR_SME_SUCCESS)
1800 {
1801 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1802 if (pStaDs != NULL)
1803 {
1804 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1805 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1806 pStaDs->mlmStaContext.resultCode = resultCode;
1807 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1808 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1809 return;
1810 }
1811 }
1812
1813 //Delete teh session if REASSOC failure occurred.
1814 if(resultCode != eSIR_SME_SUCCESS)
1815 {
1816 if(NULL != psessionEntry)
1817 {
1818 peDeleteSession(pMac,psessionEntry);
1819 psessionEntry = NULL;
1820 }
1821 }
1822 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1823 smesessionId, smetransactionId);
1824} /*** end limHandleSmeReassocResult() ***/
1825
1826/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 * limProcessMlmAddStaRsp()
1828 *
1829 *FUNCTION:
1830 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1831 * Upon receipt of this message from HAL, MLME -
1832 * > Determines the "state" in which this message was received
1833 * > Forwards it to the appropriate callback
1834 *
1835 *ASSUMPTIONS:
1836 *
1837 *NOTE:
1838 *
1839 * @param pMac Pointer to Global MAC structure
1840 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1841 *
1842 * @return None
1843 */
1844void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1845{
1846 //we need to process the deferred message since the initiating req. there might be nested request.
1847 //in the case of nested request the new request initiated from the response will take care of resetting
1848 //the deffered flag.
1849 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 )
1853 {
1854 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1855 return;
1856 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001858}
1859void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1860{
1861 tLimMlmAssocCnf mlmAssocCnf;
1862 tpDphHashNode pStaDs;
1863 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1864 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1865
1866 if(NULL == pAddStaParams )
1867 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001868 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 return;
1870 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301871 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301873 PELOGE(limLog(pMac, LOGE,
1874 FL("Received Deauth frame in ADD_STA_RESP state"));)
1875 pAddStaParams->status = eHAL_STATUS_FAILURE;
1876 }
1877
1878 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1879 {
1880 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 {
1882 //TODO: any response to be sent out here ?
1883 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001884 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 psessionEntry->limMlmState);
1886 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1887 goto end;
1888 }
1889 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1890 mesgType = LIM_MLM_REASSOC_CNF;
1891 //
1892 // Update the DPH Hash Entry for this STA
1893 // with proper state info
1894 //
1895 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1896 if( NULL != pStaDs)
1897 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1898 else
1899 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001900 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001901 DPH_STA_HASH_INDEX_PEER);
1902 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001903 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 /*
1905 * Storing the self StaIndex(Generated by HAL) in session context,
1906 * instead of storing it in DPH Hash entry for Self STA.
1907 * DPH entry for the self STA stores the sta index for the BSS entry
1908 * to which the STA is associated.
1909 */
1910 psessionEntry->staId = pAddStaParams->staIdx;
1911 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001912#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1913 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1914#endif
1915 {
1916 limReactivateHeartBeatTimer(pMac, psessionEntry);
1917 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001918 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001919
1920 //assign the sessionId to the timer Object
1921 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1922 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001923 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001924#ifdef WLAN_DEBUG
1925 pMac->lim.gLimNumLinkEsts++;
1926#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001927#ifdef FEATURE_WLAN_TDLS
1928 /* initialize TDLS peer related data */
1929 limInitTdlsData(pMac,psessionEntry);
1930#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 // Return Assoc confirm to SME with success
1932 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1933 // be passed in here....
1934 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1935 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1936 }
1937 else
1938 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301939 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1941 }
1942end:
1943 if( 0 != limMsgQ->bodyptr )
1944 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301945 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 }
1947 /* Updating PE session Id*/
1948 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1949 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301950 if (true == psessionEntry->fDeauthReceived)
1951 {
1952 psessionEntry->fDeauthReceived = false;
1953 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 return;
1955}
1956void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1957{
1958 //we need to process the deferred message since the initiating req. there might be nested request.
1959 //in the case of nested request the new request initiated from the response will take care of resetting
1960 //the deffered flag.
1961 // tpPESession psessionEntry;
1962 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1963 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
1964 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001965 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 // return;
1967 // }
1968 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001969
1970 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
1971 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 ) &&
1974 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
1975 {
1976 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
1977 return;
1978 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08001980
1981 if(!limIsInMCC(pMac))
1982 {
1983 WDA_TrafficStatsTimerActivate(FALSE);
1984 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001985
1986#ifdef WLAN_FEATURE_11W
1987 if (psessionEntry->limRmfEnabled)
1988 {
1989 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
1990 {
1991 limLog( pMac, LOGE,
1992 FL( "Could not send down Exclude Unencrypted Indication!" ),
1993 psessionEntry->limMlmState );
1994 }
1995 }
1996#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001997}
1998
1999void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2000{
2001 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2002 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2003 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302004
2005 if (NULL == pDelBssParams)
2006 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002007 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302008 goto end;
2009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2011 {
2012 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002013 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2015 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2016
2017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002018 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 statusCode = eSIR_SME_REFUSED;
2020 goto end;
2021 }
2022 if(pStaDs == NULL)
2023 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002024 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 statusCode = eSIR_SME_REFUSED;
2026 goto end;
2027 }
2028 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2029 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002030 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 pStaDs->mlmStaContext.mlmState);)
2032 statusCode = eSIR_SME_REFUSED;
2033 goto end;
2034 }
2035 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2036 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2037 }
2038 else
2039 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302040 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302041 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 return;
2043 }
2044 end:
2045 if( 0 != limMsgQ->bodyptr )
2046 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302047 vos_mem_free(pDelBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 }
2049 if(pStaDs == NULL)
2050 return;
2051 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2052 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2053 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2054 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2055 {
2056 /** The Case where the DelBss is invoked from
2057 * context of other than normal DisAssoc / Deauth OR
2058 * as part of Join Failure.
2059 */
2060 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2061 return;
2062 }
2063 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2064 return;
2065}
2066
Jeff Johnson295189b2012-06-20 16:38:30 -07002067void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2068{
2069 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002070 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2072 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2073
2074 if(psessionEntry == NULL)
2075 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002076 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002077 if(pDelBss != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302078 vos_mem_free(pDelBss);
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 return;
2080 }
2081
2082 if (pDelBss == NULL)
2083 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002084 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 rc = eSIR_SME_REFUSED;
2086 goto end;
2087 }
2088 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002089 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2090
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2092 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002093 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002094 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2095 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002096 rc = eSIR_SME_REFUSED;
2097 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 }
2099 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2100 {
2101 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2102 pDelBss->status, pDelBss->bssIdx);
2103 rc = eSIR_SME_STOP_BSS_FAILURE;
2104 goto end;
2105 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002106 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002108 if (status != eSIR_SUCCESS)
2109 {
2110 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002112 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 /** Softmac may send all the buffered packets right after resuming the transmission hence
2114 * to occupy the medium during non channel occupancy period. So resume the transmission after
2115 * HAL gives back the response.
2116 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002117#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 if (LIM_IS_RADAR_DETECTED(pMac))
2119 {
2120 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2121 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2122 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002123#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2125 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002127 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 end:
2129 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2130 peDeleteSession(pMac, psessionEntry);
2131
2132 if(pDelBss != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302133 vos_mem_free(pDelBss);
Jeff Johnson295189b2012-06-20 16:38:30 -07002134}
2135
2136void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2137{
2138 //we need to process the deferred message since the initiating req. there might be nested request.
2139 //in the case of nested request the new request initiated from the response will take care of resetting
2140 //the deffered flag.
2141
2142 tpPESession psessionEntry;
2143 tpDeleteStaParams pDeleteStaParams;
2144 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2145 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302146
2147 if(NULL == pDeleteStaParams ||
2148 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002150 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002151 if(pDeleteStaParams != NULL)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302152 vos_mem_free(pDeleteStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 return;
2154 }
2155
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 )
2159 {
2160 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2161 return;
2162 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002164}
2165
Jeff Johnson295189b2012-06-20 16:38:30 -07002166void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2167{
2168 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2169 tpDphHashNode pStaDs;
2170 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2171 if(limMsgQ->bodyptr == NULL)
2172 {
2173 return;
2174 }
2175
2176 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2177 if(pStaDs == NULL)
2178 {
2179 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002180 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302182 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002183
2184 return;
2185 }
2186 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2187 {
2188 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002189 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002190
2191 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2192 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2193 {
2194 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002195 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2197 statusCode = eSIR_SME_REFUSED;
2198 goto end;
2199 }
2200
2201 limLog( pMac, LOG1,
2202 FL("Deleted STA AssocID %d staId %d MAC "),
2203 pStaDs->assocId, pStaDs->staIndex);
2204 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2205 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2206 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302207 vos_mem_free(pDelStaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002208 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 {
2210 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002211 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 pStaDs->assocId);)
2213 // delete the TS if it has already been added.
2214 // send the response with error status.
2215 if(pStaDs->qos.addtsPresent)
2216 {
2217 tpLimTspecInfo pTspecInfo;
2218 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2219 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2220 {
2221 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2222 NULL, &pTspecInfo->idx);
2223 }
2224 }
2225 limRejectAssociation(pMac,
2226 pStaDs->staAddr,
2227 pStaDs->mlmStaContext.subType,
2228 true, pStaDs->mlmStaContext.authType,
2229 pStaDs->assocId, true,
2230 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2231 psessionEntry);
2232 }
2233 return;
2234 }
2235 }
2236 else
2237 {
2238 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002239 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 statusCode = eSIR_SME_REFUSED;
2241 }
2242 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302243 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2245 {
2246 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2247 }
2248 return;
2249}
2250
2251void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2252{
2253 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2254 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2255 tpDphHashNode pStaDs = NULL;
2256 if(NULL == pDelStaParams )
2257 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002258 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 goto end;
2260 }
2261 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2262 {
2263 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2264 if (pStaDs == NULL)
2265 {
2266 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002267 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 pDelStaParams->assocId);
2269 statusCode = eSIR_SME_REFUSED;
2270 goto end;
2271 }
2272 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2273 {
2274 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002275 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 limMlmStateStr(psessionEntry->limMlmState));
2277 statusCode = eSIR_SME_REFUSED;
2278 goto end;
2279 }
2280 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2281 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002282 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 //we must complete all cleanup related to delSta before calling limDelBSS.
2284 if( 0 != limMsgQ->bodyptr )
2285 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302286 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2289 return;
2290 }
2291 else
2292 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002293 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 statusCode = eSIR_SME_REFUSED;
2295 }
2296end:
2297 if( 0 != limMsgQ->bodyptr )
2298 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302299 vos_mem_free(pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301 return;
2302}
2303
Jeff Johnson295189b2012-06-20 16:38:30 -07002304void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2305{
2306 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302307 tpDphHashNode pStaDs = NULL;
2308
2309 if (NULL == pAddStaParams)
2310 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002311 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302312 goto end;
2313 }
2314
2315 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 if(pStaDs == NULL)
2317 {
2318 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002319 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 goto end;
2321 }
2322 //
2323 // TODO & FIXME_GEN4
2324 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2325 //
2326 //TODO: any check for pMac->lim.gLimMlmState ?
2327 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2328 {
2329 //TODO: any response to be sent out here ?
2330 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002331 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 pStaDs->mlmStaContext.mlmState);
2333 goto end;
2334 }
2335 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2336 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002337 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 limRejectAssociation(pMac, pStaDs->staAddr,
2339 pStaDs->mlmStaContext.subType,
2340 true, pStaDs->mlmStaContext.authType,
2341 pStaDs->assocId, true,
2342 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2343 psessionEntry);
2344 goto end;
2345 }
2346 pStaDs->bssId = pAddStaParams->bssIdx;
2347 pStaDs->staIndex = pAddStaParams->staIdx;
2348 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2349 pStaDs->valid = 1;
2350 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2351 limLog( pMac, LOG1,
2352 FL("STA AssocID %d staId %d MAC "),
2353 pStaDs->assocId,
2354 pStaDs->staIndex);
2355 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2356
2357 /* For BTAMP-AP, the flow sequence shall be:
2358 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2359 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2360 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2361 */
2362 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2363 // fall though to reclaim the original Add STA Response message
2364end:
2365 if( 0 != limMsgQ->bodyptr )
2366 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302367 vos_mem_free(pAddStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 }
2369 return;
2370}
2371
2372/**
2373 * limProcessApMlmAddBssRsp()
2374 *
2375 *FUNCTION:
2376 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2377 * Upon receipt of this message from HAL, MLME -
2378 * > Validates the result of WDA_ADD_BSS_REQ
2379 * > Init other remaining LIM variables
2380 * > Init the AID pool, for that BSSID
2381 * > Init the Pre-AUTH list, for that BSSID
2382 * > Create LIM timers, specific to that BSSID
2383 * > Init DPH related parameters that are specific to that BSSID
2384 * > TODO - When do we do the actual change channel?
2385 *
2386 *LOGIC:
2387 * SME sends eWNI_SME_START_BSS_REQ to LIM
2388 * LIM sends LIM_MLM_START_REQ to MLME
2389 * MLME sends WDA_ADD_BSS_REQ to HAL
2390 * HAL responds with WDA_ADD_BSS_RSP to MLME
2391 * MLME responds with LIM_MLM_START_CNF to LIM
2392 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2393 *
2394 *ASSUMPTIONS:
2395 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2396 * tSirMsgQ.body will now be freed by this routine
2397 *
2398 *NOTE:
2399 *
2400 * @param pMac Pointer to Global MAC structure
2401 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2402 *
2403 * @return None
2404 */
2405static void
2406limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2407{
2408 tLimMlmStartCnf mlmStartCnf;
2409 tANI_U32 val;
2410 tpPESession psessionEntry;
2411// tANI_U8 sessionId;
2412 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2413 if(NULL == pAddBssParams )
2414 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002415 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 goto end;
2417 }
2418 //TBD: free the memory before returning, do it for all places where lookup fails.
2419 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2420 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002421 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002422 if( NULL != pAddBssParams )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302423 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 return;
2425 }
2426 /* Update PE session Id*/
2427 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2428 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002430 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2432 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2433 goto end;
2434 // Set MLME state
2435 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002436 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002437 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2438 {
2439 /** IBSS is 'active' when we receive
2440 * Beacon frames from other STAs that are part of same IBSS.
2441 * Mark internal state as inactive until then.
2442 */
2443 psessionEntry->limIbssActive = false;
2444 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2445 limResetHBPktCount( psessionEntry );
2446 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002447 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002448 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002449 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 }
2451 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2452
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002454
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2456 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2457 else
2458 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 schEdcaProfileUpdate(pMac, psessionEntry);
2460 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002461 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 // Create timers used by LIM
2463 if (!pMac->lim.gLimTimersCreated)
2464 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002465
2466 // Start OLBC timer
2467 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2468 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002469 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002470 }
2471
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2473 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002474 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002475 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2476 // Apply previously set configuration at HW
2477 limApplyConfiguration(pMac,psessionEntry);
2478 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2479 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2480 }
2481 else
2482 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002483 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2485 }
2486 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2487 end:
2488 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302489 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002490}
2491
2492
2493/**
2494 * limProcessIbssMlmAddBssRsp()
2495 *
2496 *FUNCTION:
2497 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2498 * Upon receipt of this message from HAL, MLME -
2499 * > Validates the result of WDA_ADD_BSS_REQ
2500 * > Init other remaining LIM variables
2501 * > Init the AID pool, for that BSSID
2502 * > Init the Pre-AUTH list, for that BSSID
2503 * > Create LIM timers, specific to that BSSID
2504 * > Init DPH related parameters that are specific to that BSSID
2505 * > TODO - When do we do the actual change channel?
2506 *
2507 *LOGIC:
2508 * SME sends eWNI_SME_START_BSS_REQ to LIM
2509 * LIM sends LIM_MLM_START_REQ to MLME
2510 * MLME sends WDA_ADD_BSS_REQ to HAL
2511 * HAL responds with WDA_ADD_BSS_RSP to MLME
2512 * MLME responds with LIM_MLM_START_CNF to LIM
2513 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2514 *
2515 *ASSUMPTIONS:
2516 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2517 * tSirMsgQ.body will now be freed by this routine
2518 *
2519 *NOTE:
2520 *
2521 * @param pMac Pointer to Global MAC structure
2522 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2523 *
2524 * @return None
2525 */
2526static void
2527limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2528{
2529 tLimMlmStartCnf mlmStartCnf;
2530 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2531 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302532
2533 if (NULL == pAddBssParams)
2534 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002535 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302536 goto end;
2537 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2539 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002540 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2542 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2543 goto end;
2544 // Set MLME state
2545 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002546 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 /** IBSS is 'active' when we receive
2548 * Beacon frames from other STAs that are part of same IBSS.
2549 * Mark internal state as inactive until then.
2550 */
2551 psessionEntry->limIbssActive = false;
2552 limResetHBPktCount( psessionEntry );
2553 /* Timer related functions are not modified for BT-AMP : To be Done */
2554 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002555 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002556 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002557 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2559 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2560 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2561 schEdcaProfileUpdate(pMac, psessionEntry);
2562 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2563 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002564 if (0 == psessionEntry->freePeerIdxHead)
2565 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002566 // Create timers used by LIM
2567#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2568 if (!pMac->lim.gLimTimersCreated)
2569 limCreateTimers(pMac);
2570#endif
2571 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2572 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002573 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2575 // Apply previously set configuration at HW
2576 limApplyConfiguration(pMac,psessionEntry);
2577 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2578 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2579 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2580 if(true == pMac->lim.gLimIbssCoalescingHappened)
2581 {
2582 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2583 goto end;
2584 }
2585 }
2586 else
2587 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002588 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 pAddBssParams->status );
2590 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2591 }
2592 //Send this message to SME, when ADD_BSS is initiated by SME
2593 //If ADD_BSS is done as part of coalescing, this won't happen.
2594 /* Update PE session Id*/
2595 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2596 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2597 end:
2598 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302599 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002600}
2601
2602static void
2603limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2604{
2605 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2606 tAniAuthType cfgAuthType, authMode;
2607 tLimMlmAuthReq *pMlmAuthReq;
2608 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302609
2610 if (NULL == pAddBssParams)
2611 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002612 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302613 goto joinFailure;
2614 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2616 {
2617 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2618 {
2619 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002620 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002621 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2622 goto joinFailure;
2623 }
2624 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2625 //Success, handle below
2626 pStaDs->bssId = pAddBssParams->bssIdx;
2627 //STA Index(genr by HAL) for the BSS entry is stored here
2628 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2629 // Trigger Authentication with AP
2630 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2631 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2632 {
2633 /**
2634 * Could not get AuthType from CFG.
2635 * Log error.
2636 */
2637 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002638 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 }
2640 if (cfgAuthType == eSIR_AUTO_SWITCH)
2641 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2642 else
2643 authMode = cfgAuthType;
2644
2645 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302646 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2647 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 {
2649 // Log error
2650 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302651 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002652 return;
2653 }
2654 #if 0
2655 val = sizeof(tSirMacAddr);
2656 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2657 pMlmAuthReq->peerMacAddr,
2658 &val) != eSIR_SUCCESS)
2659 {
2660 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002661 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 }
2663 #endif //TO SUPPORT BT-AMP
2664 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2665
2666 pMlmAuthReq->authType = authMode;
2667 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2668 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2669 != eSIR_SUCCESS)
2670 {
2671 /**
2672 * Could not get AuthFailureTimeout
2673 * value from CFG. Log error.
2674 */
2675 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002676 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 }
2678 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2679 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2680 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002681 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2683 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2684 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2685 // remember staId in case of assoc timeout/failure handling
2686 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2687
Jeff Johnsone7245742012-09-05 17:12:55 -07002688 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 limPostMlmMessage(pMac,
2690 LIM_MLM_AUTH_REQ,
2691 (tANI_U32 *) pMlmAuthReq);
2692 return;
2693 }
2694
2695joinFailure:
2696 {
2697 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002698 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002699
2700 /// Send Join response to Host
2701 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2702
2703 }
2704
2705}
2706
2707#ifdef WLAN_FEATURE_VOWIFI_11R
2708/*------------------------------------------------------------------------------------------
2709 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002710 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2711 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 *
2713 *
2714 *------------------------------------------------------------------------------------------
2715 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002716static inline void
2717limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002718{
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002720 tpDphHashNode pStaDs = NULL;
2721 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002722 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002723 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002724 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002725
2726 if (pAddBssParams == NULL)
2727 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002728 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002729 goto end;
2730 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002731 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2732 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002733 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002734 goto end;
2735 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002736 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2737 {
2738 goto end;
2739 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002740
2741 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2742 &psessionEntry->dph.dphHashTable)) == NULL)
2743 {
2744 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002745 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2747 goto end;
2748 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 // Prepare and send Reassociation request frame
2750 // start reassoc timer.
2751 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2752 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002753 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2755 != TX_SUCCESS)
2756 {
2757 /// Could not start reassoc failure timer.
2758 // Log error
2759 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002760 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002761 // Return Reassoc confirm with
2762 // Resources Unavailable
2763 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2764 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2765 goto end;
2766 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002767#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2768 pMac->lim.pSessionEntry = psessionEntry;
2769 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2770 {
2771 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302772 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2773 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2774 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2775 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2776 psessionEntry->pLimMlmReassocReq,
2777 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002778 }
2779 pMac->lim.reAssocRetryAttempt = 0;
2780#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002781 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002782
Jeff Johnson295189b2012-06-20 16:38:30 -07002783 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2784 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002785 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002786 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2788
2789 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2790
2791 //Success, handle below
2792 pStaDs->bssId = pAddBssParams->bssIdx;
2793 //STA Index(genr by HAL) for the BSS entry is stored here
2794 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2795 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2796 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2797
Jeff Johnson295189b2012-06-20 16:38:30 -07002798#if defined WLAN_FEATURE_VOWIFI
2799 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2800#endif
2801
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302802 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2803 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302805 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002806 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302808 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002809
2810 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302811 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2812 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002813
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302814 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2815 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002816
2817 // Update this when we get reassoc rsp , with success.
2818 // pAddStaParams->assocId = psessionEntry->limAID;
2819
2820 pAddStaParams->staType = STA_ENTRY_SELF;
2821 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2822 pAddStaParams->respReqd = 1;
2823
2824 /* Update PE session ID */
2825 pAddStaParams->sessionId = psessionEntry->peSessionId;
2826
2827 // This will indicate HAL to "allocate" a new STA index
2828 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2829 pAddStaParams->updateSta = FALSE;
2830
2831 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002832#ifdef WLAN_FEATURE_11AC
2833 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
2834#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 limPopulateOwnRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002836#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002837
Jeff Johnsone7245742012-09-05 17:12:55 -07002838 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002840 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002841#ifdef DISABLE_GF_FOR_INTEROP
2842 /*
2843 * To resolve the interop problem with Broadcom AP,
2844 * where TQ STA could not pass traffic with GF enabled,
2845 * TQ STA will do Greenfield only with TQ AP, for
2846 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002847 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2849 {
2850 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2851 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2852 }
2853 else
2854#endif
2855
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2857 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2858 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2859 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2860 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2861 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2862 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2863 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2864 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2865 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2866 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2867 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002868 }
2869
2870 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002871 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2873
2874 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2875
2876 // Lets save this for when we receive the Reassoc Rsp
2877 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002878
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002879 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002880 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002881 vos_mem_free(pAddBssParams);
2882 pAddBssParams = NULL;
2883 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002884 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 return;
2886
2887end:
2888 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002889 if (psessionEntry != NULL)
2890 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002892 vos_mem_free(psessionEntry->pLimMlmReassocReq);
2893 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002895
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002896 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002897 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002898 vos_mem_free(pAddBssParams);
2899 pAddBssParams = NULL;
2900 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002901 }
2902
2903 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2904 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302905 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002906 if (psessionEntry != NULL)
2907 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002908 else
2909 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002910
2911 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2912}
Jeff Johnson295189b2012-06-20 16:38:30 -07002913#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07002914/**
2915 * limProcessStaMlmAddBssRsp()
2916 *
2917 *FUNCTION:
2918 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2919 * Upon receipt of this message from HAL, MLME -
2920 * > Validates the result of WDA_ADD_BSS_REQ
2921 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2922 *
2923 *LOGIC:
2924 * MLME had sent WDA_ADD_BSS_REQ to HAL
2925 * HAL responded with WDA_ADD_BSS_RSP to MLME
2926 * MLME now sends WDA_ADD_STA_REQ to HAL
2927 *
2928 *ASSUMPTIONS:
2929 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2930 * tSirMsgQ.body will now be freed by this routine
2931 *
2932 *NOTE:
2933 *
2934 * @param pMac Pointer to Global MAC structure
2935 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2936 *
2937 * @return None
2938 */
2939static void
2940limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2941{
2942 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2943 tLimMlmAssocCnf mlmAssocCnf;
2944 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2945 tANI_U32 subType = LIM_ASSOC;
2946 tpDphHashNode pStaDs = NULL;
2947 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
2948 tANI_U8 updateSta = false;
2949 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
2950
2951 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
2952 {
2953 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
2954 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
2955 goto end;
2956 }
2957 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
2958 {
2959 mesgType = LIM_MLM_REASSOC_CNF;
2960 subType = LIM_REASSOC;
2961 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
2962 //to update the existing STA entry.
2963 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
2964 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
2965 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
2966 {
2967 staIdx = psessionEntry->staId;
2968 updateSta = true;
2969 }
2970 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08002971
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08002972 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08002973 goto end;
2974
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2976 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002977#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
2979 {
2980#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002981 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 psessionEntry->limMlmState,
2983 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
2984#endif
2985 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
2986 goto end;
2987 }
2988#endif /* WLAN_FEATURE_VOWIFI_11R */
2989
2990 // Set MLME state
2991 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002992 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002993 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
2994 // Now, send WDA_ADD_STA_REQ
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002995 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002996 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2997 if (pStaDs == NULL)
2998 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002999 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3001 }
3002 else
3003 {
3004 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3005 //Success, handle below
3006 pStaDs->bssId = pAddBssParams->bssIdx;
3007 //STA Index(genr by HAL) for the BSS entry is stored here
3008 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3009 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3010 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3011 // Downgrade the EDCA parameters if needed
3012 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3013 // Send the active EDCA parameters to HAL
3014 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3015 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3016 } else {
3017 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3018 }
3019#if defined WLAN_FEATURE_VOWIFI
3020 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3021#endif
3022
3023 if (subType == LIM_REASSOC)
3024 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3025 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3026 {
3027 // Add STA context at HW
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003028 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3030 }
3031 }
3032 }
3033 else
3034 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003035 limLog( pMac, LOGP, FL( "ADD_BSS failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 // Return Assoc confirm to SME with failure
3037 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3038 }
3039
3040 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3041 {
3042 /* Update PE session Id*/
3043 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3044 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3045 }
3046 end:
3047 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303048 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003049}
3050
3051
3052
3053/**
3054 * limProcessMlmAddBssRsp()
3055 *
3056 *FUNCTION:
3057 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3058 * Upon receipt of this message from HAL, MLME -
3059 * > Determines the "state" in which this message was received
3060 * > Forwards it to the appropriate callback
3061 *
3062 *LOGIC:
3063 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3064 * in the following two states:
3065 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3066 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3067 * Based on these two states, this API will determine where to
3068 * route the message to
3069 *
3070 *ASSUMPTIONS:
3071 *
3072 *NOTE:
3073 *
3074 * @param pMac Pointer to Global MAC structure
3075 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3076 *
3077 * @return None
3078 */
3079void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3080{
3081 tLimMlmStartCnf mlmStartCnf;
3082 tpPESession psessionEntry;
3083 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3084
3085 if(NULL == pAddBssParams )
3086 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003087 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 return;
3089 }
3090
3091 //
3092 // TODO & FIXME_GEN4
3093 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3094 //
3095 //we need to process the deferred message since the initiating req. there might be nested request.
3096 //in the case of nested request the new request initiated from the response will take care of resetting
3097 //the deffered flag.
3098 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3099 // Validate SME/LIM state
3100 // Validate MLME state
3101 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3102 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003103 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003104 if( NULL != pAddBssParams )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303105 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 return;
3107 }
3108 /* update PE session Id*/
3109 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3110 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3111 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3112 else
3113 {
3114 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3115 {
3116 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3117 {
3118 // Mesg received from HAL in Invalid state!
3119 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003120 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 psessionEntry->limMlmState );
3122 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3123 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303124 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3126 }
3127 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3128 {
3129 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3130 }
3131 else
3132 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3133 }
3134 else
3135 /* Called while processing assoc response */
3136 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3137 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003138
3139 if(limIsInMCC(pMac))
3140 {
3141 WDA_TrafficStatsTimerActivate(TRUE);
3142 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003143
3144#ifdef WLAN_FEATURE_11W
3145 if (psessionEntry->limRmfEnabled)
3146 {
3147 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3148 {
3149 limLog( pMac, LOGE,
3150 FL( "Could not send down Exclude Unencrypted Indication!" ),
3151 psessionEntry->limMlmState );
3152 }
3153 }
3154#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003155}
3156/**
3157 * limProcessMlmSetKeyRsp()
3158 *
3159 *FUNCTION:
3160 * This function is called to process the following two
3161 * messages from HAL:
3162 * 1) WDA_SET_BSSKEY_RSP
3163 * 2) WDA_SET_STAKEY_RSP
3164 * 3) WDA_SET_STA_BCASTKEY_RSP
3165 * Upon receipt of this message from HAL,
3166 * MLME -
3167 * > Determines the "state" in which this message was received
3168 * > Forwards it to the appropriate callback
3169 *
3170 *LOGIC:
3171 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3172 * received by MLME while in the following state:
3173 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3174 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3175 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3176 * Based on this state, this API will determine where to
3177 * route the message to
3178 *
3179 *ASSUMPTIONS:
3180 * ONLY the MLME state is being taken into account for now.
3181 * This is because, it appears that the handling of the
3182 * SETKEYS REQ is handled symmetrically on both the AP & STA
3183 *
3184 *NOTE:
3185 *
3186 * @param pMac Pointer to Global MAC structure
3187 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3188 *
3189 * @return None
3190 */
3191void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3192{
Jeff Johnsone7245742012-09-05 17:12:55 -07003193 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003194 tLimMlmSetKeysCnf mlmSetKeysCnf;
3195 tANI_U8 sessionId = 0;
3196 tpPESession psessionEntry;
3197 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303198 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003200 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003202 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003203 return;
3204 }
3205 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3206 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3207 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003208 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303209 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 return;
3211 }
3212 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3213 {
3214 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003215 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 // There's not much that MLME can do at this stage...
3217 respReqd = 0;
3218 }
3219 else
3220 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3221
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303222 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003223 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003225 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 if( respReqd )
3227 {
3228 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3229 // Prepare and Send LIM_MLM_SETKEYS_CNF
3230 if( NULL != lpLimMlmSetKeysReq )
3231 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303232 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3233 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3234 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303236 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 pMac->lim.gpLimMlmSetKeysReq = NULL;
3238 }
3239 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003240 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 }
3242}
3243void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3244{
3245 tANI_U8 respReqd = 1;
3246 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003247 tANI_U16 resultCode;
3248 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 tpPESession psessionEntry;
3250 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303251 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003253 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003255 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 return;
3257 }
3258 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3259 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3260 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003261 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303262 vos_mem_free( limMsgQ->bodyptr );
Jeff Johnson295189b2012-06-20 16:38:30 -07003263 return;
3264 }
3265 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3266 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3267 else
3268 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3269
Jeff Johnsone7245742012-09-05 17:12:55 -07003270 //
3271 // TODO & FIXME_GEN4
3272 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3273 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3275 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3276 //{
3277 // Validate MLME state
3278 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3279 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3280 {
3281 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003282 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 // There's not much that MLME can do at this stage...
3284 respReqd = 0;
3285 }
3286 else
3287 mlmSetKeysCnf.resultCode = resultCode;
3288
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303289 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3292
Jeff Johnsone7245742012-09-05 17:12:55 -07003293 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 if( respReqd )
3295 {
3296 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3297 mlmSetKeysCnf.sessionId = sessionId;
3298
3299 // Prepare and Send LIM_MLM_SETKEYS_CNF
3300 if( NULL != lpLimMlmSetKeysReq )
3301 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303302 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3303 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3304 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303306 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 pMac->lim.gpLimMlmSetKeysReq = NULL;
3308 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003309 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 }
3311}
3312/**
3313 * limProcessMlmRemoveKeyRsp()
3314 *
3315 *FUNCTION:
3316 *
3317 *LOGIC:
3318 *
3319 *ASSUMPTIONS:
3320 *
3321 *NOTE:
3322 *
3323 * @param pMac Pointer to Global MAC structure
3324 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3325 *
3326 * @return None
3327 */
3328void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3329{
Jeff Johnsone7245742012-09-05 17:12:55 -07003330 tANI_U8 respReqd = 1;
3331 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3332 tANI_U16 resultCode;
3333 tANI_U8 sessionId = 0;
3334 tpPESession psessionEntry;
3335 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303336 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003337
3338 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003340 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003341 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 }
3343
Jeff Johnsone7245742012-09-05 17:12:55 -07003344 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3345 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3346 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3347 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003348
Jeff Johnsone7245742012-09-05 17:12:55 -07003349 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003351 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003352 return;
3353 }
3354
3355 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3356 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3357 else
3358 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3359
3360 // Validate MLME state
3361 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3362 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3363 {
3364 // Mesg received from HAL in Invalid state!
3365 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003366 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003367 limMsgQ->type,
3368 psessionEntry->limMlmState );
3369 respReqd = 0;
3370 }
3371 else
3372 mlmRemoveCnf.resultCode = resultCode;
3373
3374 //
3375 // TODO & FIXME_GEN4
3376 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3377 //
3378
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303379 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07003380
3381 // Restore MLME state
3382 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3383 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3384
3385 if( respReqd )
3386 {
3387 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3388 mlmRemoveCnf.sessionId = sessionId;
3389
3390 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3391 if( NULL != lpLimMlmRemoveKeyReq )
3392 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303393 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3394 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3395 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003396 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303397 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003398 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3399 }
3400 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3401 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003402}
3403
Jeff Johnson295189b2012-06-20 16:38:30 -07003404
3405/** ---------------------------------------------------------------------
3406\fn limProcessInitScanRsp
3407\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3408\ message from HAL. If status code is failure, then
3409\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3410\param tpAniSirGlobal pMac
3411\param tANI_U32 body
3412\return none
3413\ ----------------------------------------------------------------------- */
3414void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3415{
3416 tpInitScanParams pInitScanParam;
3417 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003418 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3419 pInitScanParam = (tpInitScanParams) body;
3420 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303421 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003422
3423 //Only abort scan if the we are scanning.
3424 if( pMac->lim.abortScan &&
3425 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3426 {
krunal sonid3d60e12013-07-17 13:24:09 -07003427 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003428 pMac->lim.abortScan = 0;
3429 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3430 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3431 //Set the resume channel to Any valid channel (invalid).
3432 //This will instruct HAL to set it to any previous valid channel.
3433 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003434 if (status != eHAL_STATUS_SUCCESS)
3435 {
3436 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3437 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3438 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3439 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3440 return;
3441 }
3442 else
3443 {
3444 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3445 }
3446
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 }
3448 switch(pMac->lim.gLimHalScanState)
3449 {
3450 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3451 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3452 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003453 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003454 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3455 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3456 /*
3457 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3458 * another Scan request in the same context (happens when 11d is enabled
3459 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3460 * scan in the same context but with bigger channel list), so the state needs to be
3461 * changed before this response message is sent.
3462 */
3463 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 return;
3465 }
3466 else if (status == eHAL_STATUS_SUCCESS)
3467 {
3468 /* since we have successfully triggered a background scan,
3469 * reset the "consecutive bkgnd scan failure" count to 0
3470 */
3471 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3472 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3473 }
3474 limContinueChannelScan(pMac);
3475 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003476//WLAN_SUSPEND_LINK Related
3477 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3478 if( pMac->lim.gpLimSuspendCallback )
3479 {
3480 if( status == eHAL_STATUS_SUCCESS )
3481 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
3482 else
3483 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3484
3485 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3486 pMac->lim.gpLimSuspendCallback = NULL;
3487 pMac->lim.gpLimSuspendData = NULL;
3488 }
3489 else
3490 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003491 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 return;
3493 }
3494 break;
3495//end WLAN_SUSPEND_LINK Related
3496 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003497 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 pMac->lim.gLimHalScanState);
3499 break;
3500 }
3501 return;
3502}
3503/**
3504 * limProcessSwitchChannelReAssocReq()
3505 *
3506 *FUNCTION:
3507 * This function is called to send the reassoc req mgmt frame after the
3508 * switchChannelRsp message is received from HAL.
3509 *
3510 *LOGIC:
3511 *
3512 *ASSUMPTIONS:
3513 * NA
3514 *
3515 *NOTE:
3516 * NA
3517 *
3518 * @param pMac - Pointer to Global MAC structure.
3519 * @param psessionEntry - session related information.
3520 * @param status - channel switch success/failure.
3521 *
3522 * @return None
3523 */
3524static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3525{
3526 tLimMlmReassocCnf mlmReassocCnf;
3527 tLimMlmReassocReq *pMlmReassocReq;
3528 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3529 if(pMlmReassocReq == NULL)
3530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003531 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3533 goto end;
3534 }
3535
3536 if(status != eHAL_STATUS_SUCCESS)
3537 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003538 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3540 goto end;
3541 }
3542 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003543 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3545 != TX_SUCCESS)
3546 {
3547 /// Could not start reassoc failure timer.
3548 // Log error
3549 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003550 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 // Return Reassoc confirm with
3552 // Resources Unavailable
3553 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3554 goto end;
3555 }
3556 /// Prepare and send Reassociation request frame
3557 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3558 return;
3559end:
3560 // Free up buffer allocated for reassocReq
3561 if(pMlmReassocReq != NULL)
3562 {
3563 /* Update PE session Id*/
3564 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303565 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003566 }
3567 else
3568 {
3569 mlmReassocCnf.sessionId = 0;
3570 }
3571
3572 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3573 /* Update PE sessio Id*/
3574 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3575
3576 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3577}
3578/**
3579 * limProcessSwitchChannelJoinReq()
3580 *
3581 *FUNCTION:
3582 * This function is called to send the probe req mgmt frame after the
3583 * switchChannelRsp message is received from HAL.
3584 *
3585 *LOGIC:
3586 *
3587 *ASSUMPTIONS:
3588 * NA
3589 *
3590 *NOTE:
3591 * NA
3592 *
3593 * @param pMac - Pointer to Global MAC structure.
3594 * @param psessionEntry - session related information.
3595 * @param status - channel switch success/failure.
3596 *
3597 * @return None
3598 */
3599static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3600{
3601 tANI_U32 val;
3602 tSirMacSSid ssId;
3603 tLimMlmJoinCnf mlmJoinCnf;
3604 if(status != eHAL_STATUS_SUCCESS)
3605 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003606 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003607 goto error;
3608 }
3609
3610 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3611 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003612 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 goto error;
3614 }
3615
Jeff Johnsone7245742012-09-05 17:12:55 -07003616
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3618 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3619 {
3620 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3621 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3622 goto error;
3623 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003624
3625 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3626 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003627 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3629 // Apply previously set configuration at HW
3630 limApplyConfiguration(pMac, psessionEntry);
3631 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303632 vos_mem_copy(ssId.ssId,
3633 psessionEntry->ssId.ssId,
3634 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003635 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003636
3637 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3638
3639 //assign appropriate sessionId to the timer object
3640 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 // include additional IE if there is
3642 limSendProbeReqMgmtFrame( pMac, &ssId,
3643 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3644 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3645 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003646
3647 // Sending mgmt frame is a blocking call activate Join failure timer now
3648 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3649 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3650 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003651 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003652 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3653 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3654 //memory is freed up below.
3655 psessionEntry->pLimMlmJoinReq = NULL;
3656 goto error;
3657 }
3658
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003659 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3660 {
Yathish9f22e662012-12-10 14:21:35 -08003661 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003662 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3663 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003664 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003665 goto error;
3666 }
3667 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003668
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 return;
3670error:
3671 if(NULL != psessionEntry)
3672 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303673 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 psessionEntry->pLimMlmJoinReq = NULL;
3675 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3676 }
3677 else
3678 {
3679 mlmJoinCnf.sessionId = 0;
3680 }
3681 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3682 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3683 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3684}
3685
3686/**
3687 * limProcessSwitchChannelRsp()
3688 *
3689 *FUNCTION:
3690 * This function is called to process switchChannelRsp message from HAL.
3691 *
3692 *LOGIC:
3693 *
3694 *ASSUMPTIONS:
3695 * NA
3696 *
3697 *NOTE:
3698 * NA
3699 *
3700 * @param pMac - Pointer to Global MAC structure
3701 * @param body - message body.
3702 *
3703 * @return None
3704 */
3705void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3706{
3707 tpSwitchChannelParams pChnlParams = NULL;
3708 eHalStatus status;
3709 tANI_U16 channelChangeReasonCode;
3710 tANI_U8 peSessionId;
3711 tpPESession psessionEntry;
3712 //we need to process the deferred message since the initiating req. there might be nested request.
3713 //in the case of nested request the new request initiated from the response will take care of resetting
3714 //the deffered flag.
3715 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3716 pChnlParams = (tpSwitchChannelParams) body;
3717 status = pChnlParams->status;
3718 peSessionId = pChnlParams->peSessionId;
3719 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3720 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303721 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003722 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 return;
3724 }
3725#if defined WLAN_FEATURE_VOWIFI
3726 //HAL fills in the tx power used for mgmt frames in this field.
3727 //Store this value to use in TPC report IE.
3728 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3729#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303730 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003731 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3732 // initialize it back to invalid id
3733 psessionEntry->channelChangeReasonCode = 0xBAD;
3734 switch(channelChangeReasonCode)
3735 {
3736 case LIM_SWITCH_CHANNEL_REASSOC:
3737 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3738 break;
3739 case LIM_SWITCH_CHANNEL_JOIN:
3740 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3741 break;
3742
3743 case LIM_SWITCH_CHANNEL_OPERATION:
3744 /*
3745 * The above code should also use the callback.
3746 * mechanism below, there is scope for cleanup here.
3747 * THat way all this response handler does is call the call back
3748 * We can get rid of the reason code here.
3749 */
3750 if (pMac->lim.gpchangeChannelCallback)
3751 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003752 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3754 }
3755 break;
3756 default:
3757 break;
3758 }
3759}
3760/**
3761 * limProcessStartScanRsp()
3762 *
3763 *FUNCTION:
3764 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3765 * then it will start scan/learn on the next channel.
3766 *
3767 *LOGIC:
3768 *
3769 *ASSUMPTIONS:
3770 * NA
3771 *
3772 *NOTE:
3773 * NA
3774 *
3775 * @param pMac - Pointer to Global MAC structure
3776 * @param body - message body.
3777 *
3778 * @return None
3779 */
3780
3781void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3782{
3783 tpStartScanParams pStartScanParam;
3784 eHalStatus status;
3785 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3786 pStartScanParam = (tpStartScanParams) body;
3787 status = pStartScanParam->status;
3788#if defined WLAN_FEATURE_VOWIFI
3789 //HAL fills in the tx power used for mgmt frames in this field.
3790 //Store this value to use in TPC report IE.
3791 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3792 //Store start TSF of scan start. This will be stored in BSS params.
3793 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3794#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303795 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 if( pMac->lim.abortScan )
3797 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003798 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 pMac->lim.abortScan = 0;
3800 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3801 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3802 //Set the resume channel to Any valid channel (invalid).
3803 //This will instruct HAL to set it to any previous valid channel.
3804 peSetResumeChannel(pMac, 0, 0);
3805 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3806 }
3807 switch(pMac->lim.gLimHalScanState)
3808 {
3809 case eLIM_HAL_START_SCAN_WAIT_STATE:
3810 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3811 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003812 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 //
3814 // FIXME - With this, LIM will try and recover state, but
3815 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3816 // status back to the SME
3817 //
3818 //Set the resume channel to Any valid channel (invalid).
3819 //This will instruct HAL to set it to any previous valid channel.
3820 peSetResumeChannel(pMac, 0, 0);
3821 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3822 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3823 }
3824 else
3825 {
3826 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3827 limContinuePostChannelScan(pMac);
3828 }
3829 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003831 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 pMac->lim.gLimHalScanState);
3833 break;
3834 }
3835 return;
3836}
3837void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3838{
3839 tpEndScanParams pEndScanParam;
3840 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3842 pEndScanParam = (tpEndScanParams) body;
3843 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303844 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003845 switch(pMac->lim.gLimHalScanState)
3846 {
3847 case eLIM_HAL_END_SCAN_WAIT_STATE:
3848 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3849 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003850 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3852 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3853 }
3854 else
3855 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08003856 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 limContinueChannelScan(pMac);
3858 }
3859 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003861 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003862 pMac->lim.gLimHalScanState);
3863 break;
3864 }
3865 return;
3866}
Jeff Johnsone7245742012-09-05 17:12:55 -07003867/**
3868 * limStopTxAndSwitch()
3869 *
3870 *FUNCTION:
3871 * Start channel switch on all sessions that is in channel switch state.
3872 *
3873 * @param pMac - pointer to global adapter context
3874 *
3875 * @return None
3876 *
3877 */
3878static void
3879limStopTxAndSwitch (tpAniSirGlobal pMac)
3880{
3881 tANI_U8 i;
3882
3883 for(i =0; i < pMac->lim.maxBssId; i++)
3884 {
3885 if(pMac->lim.gpSession[i].valid &&
3886 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
3887 {
3888 limStopTxAndSwitchChannel(pMac, i);
3889 }
3890 }
3891 return;
3892}
3893/**
3894 * limStartQuietOnSession()
3895 *
3896 *FUNCTION:
3897 * This function is called to start quiet timer after finish scan if there is
3898 * qeuieting on any session.
3899 *
3900 *LOGIC:
3901 *
3902 *ASSUMPTIONS:
3903 * NA
3904 *
3905 *NOTE:
3906 * NA
3907 *
3908 * @param pMac - Pointer to Global MAC structure
3909 *
3910 * @return None
3911 */
3912static void
3913limStartQuietOnSession (tpAniSirGlobal pMac)
3914{
3915 tANI_U8 i;
3916
3917 for(i =0; i < pMac->lim.maxBssId; i++)
3918 {
3919 if(pMac->lim.gpSession[i].valid &&
3920 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
3921 {
3922 limStartQuietTimer(pMac, i);
3923 }
3924 }
3925 return;
3926}
Jeff Johnson295189b2012-06-20 16:38:30 -07003927void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
3928{
3929 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 eHalStatus status;
3931 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3932 pFinishScanParam = (tpFinishScanParams) body;
3933 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303934 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 switch(pMac->lim.gLimHalScanState)
3936 {
3937 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
3938 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3939 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07003940 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 {
3942 /** Right time to stop tx and start the timer for channel switch */
3943 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
3944 * be any associated session id
3945 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003946 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003948 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 {
3950 /** Start the quieting */
3951 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
3952 * be any associated session id
3953 */
Jeff Johnsone7245742012-09-05 17:12:55 -07003954 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003956 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003958 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 }
3960 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003961//WLAN_SUSPEND_LINK Related
3962 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
3963 if( pMac->lim.gpLimResumeCallback )
3964 {
3965 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3966 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
3967 pMac->lim.gpLimResumeCallback = NULL;
3968 pMac->lim.gpLimResumeData = NULL;
3969 pMac->lim.gLimSystemInScanLearnMode = 0;
3970 }
3971 else
3972 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003973 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003974 return;
3975 }
3976 break;
3977//end WLAN_SUSPEND_LINK Related
3978
3979 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003980 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003981 pMac->lim.gLimHalScanState);
3982 break;
3983 }
3984 return;
3985}
3986/**
3987 * @function : limProcessMlmHalAddBARsp
3988 *
3989 * @brief: Process WDA_ADDBA_RSP coming from HAL
3990 *
3991 *
3992 * @param pMac The global tpAniSirGlobal object
3993 *
3994 * @param tSirMsgQ The MsgQ header containing the response buffer
3995 *
3996 * @return none
3997 */
3998void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
3999 tpSirMsgQ limMsgQ )
4000{
4001 // Send LIM_MLM_ADDBA_CNF to LIM
4002 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004003 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004005
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 //now LIM can process any defer message.
4007 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4008 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004009 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 return;
4011 }
4012 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4013 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004014 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304015 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004016 return;
4017 }
4018#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4019 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4020#endif //FEATURE_WLAN_DIAG_SUPPORT
4021
4022 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304023 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4024 if ( NULL == pMlmAddBACnf ) {
4025 limLog( pMac, LOGP, FL(" AllocateMemory failed with error code %d"));
4026 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 return;
4028 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304029 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004030 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304031 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4032 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 // Copy other ADDBA Rsp parameters
4034 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4035 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4036 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4037 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4038 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4039 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4040 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4041 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4042 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4043 else
4044 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304045 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 // Send ADDBA CNF to LIM
4047 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4048}
4049/**
4050 * \brief Process LIM_MLM_ADDBA_CNF
4051 *
4052 * \sa limProcessMlmAddBACnf
4053 *
4054 * \param pMac The global tpAniSirGlobal object
4055 *
4056 * \param tSirMsgQ The MsgQ header containing the response buffer
4057 *
4058 * \return none
4059 */
4060void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4061 tANI_U32 *pMsgBuf )
4062{
4063tpLimMlmAddBACnf pMlmAddBACnf;
4064tpDphHashNode pSta;
4065tANI_U16 aid;
4066tLimBAState curBaState;
4067tpPESession psessionEntry = NULL;
4068if(pMsgBuf == NULL)
4069{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004070 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 return;
4072}
4073pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4074 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4075 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004076 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304077 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004078 return;
4079 }
4080 // First, extract the DPH entry
4081 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4082 if( NULL == pSta )
4083 {
4084 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004085 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304086 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 return;
4088 }
4089 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4090 // Need to validate SME state
4091 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4092 {
4093 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004094 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304096 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 return;
4098 }
4099 // Restore STA BA state
4100 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004101 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004102 {
4103 // Update LIM internal cache...
4104 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4105 {
4106 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4107 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4108 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4109 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4110 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004111 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4112 // status code. MLME will then send an ADDBA RSP
4113 // over the air to the peer MAC entity
4114 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4115 pMlmAddBACnf->peerMacAddr,
4116 pMlmAddBACnf->addBAResultCode,
4117 pMlmAddBACnf->baDialogToken,
4118 (tANI_U8) pMlmAddBACnf->baTID,
4119 (tANI_U8) pMlmAddBACnf->baPolicy,
4120 pMlmAddBACnf->baBufferSize,
4121 pMlmAddBACnf->baTimeout,psessionEntry))
4122 {
4123 PELOGW(limLog( pMac, LOGW,
4124 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4125 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4126 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 }
4128 else
4129 {
4130 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4131 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4132 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4133 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4134 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4135 }
4136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304138 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004139}
4140/**
4141 * \brief Process LIM_MLM_DELBA_CNF
4142 *
4143 * \sa limProcessMlmDelBACnf
4144 *
4145 * \param pMac The global tpAniSirGlobal object
4146 *
4147 * \param tSirMsgQ The MsgQ header containing the response buffer
4148 *
4149 * \return none
4150 */
4151void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4152 tANI_U32 *pMsgBuf )
4153{
4154 tpLimMlmDelBACnf pMlmDelBACnf;
4155 tpDphHashNode pSta;
4156 tANI_U16 aid;
4157// tANI_U8 sessionId;
4158 tLimBAState curBaState;
4159 tpPESession psessionEntry;
4160
4161 if(pMsgBuf == NULL)
4162 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004163 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 return;
4165 }
4166 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4167 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4168 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004169 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304170 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004171 return;
4172 }
4173 // First, extract the DPH entry
4174 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4175 if( NULL == pSta )
4176 {
4177 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004178 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304179 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 return;
4181 }
4182 if(NULL == pMlmDelBACnf)
4183 {
4184 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004185 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004186 return;
4187 }
4188 // Need to validate baState
4189 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4190 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4191 {
4192 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004193 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304195 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 return;
4197 }
4198 // Restore STA BA state
4199 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4200 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304201 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004202}
4203/**
4204 * \brief Process SIR_LIM_DEL_BA_IND
4205 *
4206 * \sa limProcessMlmHalBADeleteInd
4207 *
4208 * \param pMac The global tpAniSirGlobal object
4209 *
4210 * \param tSirMsgQ The MsgQ header containing the indication buffer
4211 *
4212 * \return none
4213 */
4214void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4215 tpSirMsgQ limMsgQ )
4216{
4217 tSirRetStatus status = eSIR_SUCCESS;
4218 tpBADeleteParams pBADeleteParams;
4219 tpDphHashNode pSta;
4220 tANI_U16 aid;
4221 tLimBAState curBaState;
4222 tpPESession psessionEntry;
4223 tANI_U8 sessionId;
4224
4225 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4226
4227 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4228 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004229 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304230 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 return;
4232 }
4233 // First, extract the DPH entry
4234 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4235 if( NULL == pSta )
4236 {
4237 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004238 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 goto returnAfterCleanup;
4240 }
4241
4242 // Need to validate BA state
4243 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4244 if( eLIM_BA_STATE_IDLE != curBaState )
4245 {
4246 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004247 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004248 curBaState );
4249 goto returnAfterCleanup;
4250 }
4251
4252 // Validate if a BA is active for the requested TID
4253 // AND in that desired direction
4254 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4255 {
4256 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4257 status = eSIR_FAILURE;
4258 }
4259 else
4260 {
4261 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4262 status = eSIR_FAILURE;
4263 }
4264 if( eSIR_FAILURE == status )
4265 {
4266 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004267 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 pBADeleteParams->baTID );
4269 }
4270 else
4271 {
4272 // Post DELBA REQ to MLME...
4273 if( eSIR_SUCCESS !=
4274 (status = limPostMlmDelBAReq( pMac,
4275 pSta,
4276 pBADeleteParams->baDirection,
4277 pBADeleteParams->baTID,
4278 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4279 {
4280 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004281 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 }
4283 else
4284 {
4285 limLog( pMac, LOGE,
4286 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4287 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4288 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4289 }
4290 }
4291returnAfterCleanup:
4292 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304293 vos_mem_free(limMsgQ->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004294}
4295/**
4296 * @function : limProcessSetMimoRsp()
4297 *
4298 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4299 * after Processing the Req from the SME (PMC)
4300 *
4301 * LOGIC:
4302 *
4303 * ASSUMPTIONS:
4304 * NA
4305 *
4306 * NOTE:
4307 * NA
4308 *
4309 * @param pMac - Pointer to Global MAC structure
4310 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4311 * @return None
4312 */
4313
4314void
4315limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4316{
4317#if 0
4318 tSirRetStatus retStatus;
4319 tpSetMIMOPS pMIMO_PSParams;
4320
4321
4322 do {
4323
4324 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4325 if( NULL == pMIMO_PSParams ) {
4326 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4327 return;
4328 }
4329
4330 /** If Updation of the HAL Fail's*/
4331 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004332 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 break;
4334 }
4335
4336 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4337 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4338 break;
4339
4340 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4341 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4342
4343 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4344 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4345 * the Action Frame is being sent at first before setting the internal structures
4346 */
4347 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4348 tSirMacAddr macAddr;
4349
4350 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304351 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004352
4353 /** Send Action Frame with the corresponding mode */
4354 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4355 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004356 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 break;
4358 }
4359 }
4360 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4361 }while(0);
4362
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304363 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004364#endif
4365}
4366/**
4367 * @function : limHandleDelBssInReAssocContext
4368 * @brief : While Processing the ReAssociation Response Frame in STA,
4369 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4370 * being issued and the end of DelBSS the new BSS is being added.
4371 *
4372 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4373 * change, We need to update CSR with ReAssocCNF Response with the
4374 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4375 * context only
4376 *
4377 * @param : pMac - tpAniSirGlobal
4378 * pStaDs - Station Descriptor
4379 *
4380 * @return : none
4381 */
4382static void
4383limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4384{
4385 tLimMlmReassocCnf mlmReassocCnf;
4386 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4387 /** Set the MlmState to IDLE*/
4388 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 /* Update PE session Id*/
4390 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4391 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 case eLIM_SME_WT_REASSOC_STATE :
4393 {
4394 tpSirAssocRsp assocRsp;
4395 tpDphHashNode pStaDs;
4396 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004397 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 /** Delete the older STA Table entry */
4399 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4400 /**
4401 * Add an entry for AP to hash table
4402 * maintained by DPH module
4403 */
4404 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4405 {
4406 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004407 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004408 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4409 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4410 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4411 goto Error;
4412 }
4413 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4414 * is being stored to be used here for sending ADDBSS
4415 */
4416 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4417 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4418 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 limExtractApCapabilities( pMac,
4420 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4421 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4422 &beaconStruct );
4423 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4424 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4425 if(beaconStruct.erpPresent) {
4426 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4427 psessionEntry->beaconParams.fShortPreamble = 0;
4428 else
4429 psessionEntry->beaconParams.fShortPreamble = 1;
4430 }
4431 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4432 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4433 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004434 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 retStatus = eSIR_FAILURE;
4436 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004437 if (retStatus != eSIR_SUCCESS)
4438 {
4439 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4440 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304441 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004442 pMac->lim.gLimAssocResponseData = NULL;
4443 goto Error;
4444 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304445 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 psessionEntry->limAssocResponseData = NULL;
4447 }
4448 break;
4449 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4450 {
4451 /** Case wherein the DisAssoc / Deauth
4452 * being sent as response to ReAssoc Req*/
4453 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4454 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4455 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4456 /** Set the SME State back to WT_Reassoc State*/
4457 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4459 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4460 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4461 {
4462 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 }
4464 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4465 }
4466 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004467 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004468 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4470 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4471 goto Error;
4472 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004473 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004474Error:
4475 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4476}
4477
4478/* Added For BT -AMP Support */
4479static void
4480limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4481{
4482 tLimMlmStartCnf mlmStartCnf;
4483 tANI_U32 val;
4484 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4485
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304486 if (NULL == pAddBssParams)
4487 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004488 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304489 goto end;
4490 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004491 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4492 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004493 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4495 {
4496 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4497 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4498 goto end;
4499 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4500 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4501 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4502 goto end;
4503 }
4504
4505 // Set MLME state
4506 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4507 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4508 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4509 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004510 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 // Create timers used by LIM
4512 if (!pMac->lim.gLimTimersCreated)
4513 limCreateTimers(pMac);
4514 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4515 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004516 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004517 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4518 // Apply previously set configuration at HW
4519 limApplyConfiguration(pMac,psessionEntry);
4520 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4521 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4522 }
4523 else
4524 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004525 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4527 }
4528 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4529 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4530 end:
4531 if( 0 != limMsgQ->bodyptr )
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304532 vos_mem_free(pAddBssParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004533}
4534
4535/**
4536 * @function : limHandleAddBssInReAssocContext
4537 * @brief : While Processing the ReAssociation Response Frame in STA,
4538 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4539 * being issued and the end of DelBSS the new BSS is being added.
4540 *
4541 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4542 * change, We need to update CSR with ReAssocCNF Response with the
4543 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4544 * context only
4545 *
4546 * @param : pMac - tpAniSirGlobal
4547 * pStaDs - Station Descriptor
4548 *
4549 * @return : none
4550 */
4551void
4552limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4553{
4554 tLimMlmReassocCnf mlmReassocCnf;
4555 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4556 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004557 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4558 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 case eLIM_SME_WT_REASSOC_STATE : {
4561 tpSirAssocRsp assocRsp;
4562 tpDphHashNode pStaDs;
4563 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004564 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304565 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4566 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004567 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304568 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004569 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4570 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4571 goto Error;
4572 }
4573
Jeff Johnson295189b2012-06-20 16:38:30 -07004574 // Get the AP entry from DPH hash table
4575 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4576 if (pStaDs == NULL )
4577 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004578 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4580 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304581 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004582 goto Error;
4583 }
4584 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4585 * is being stored to be used here for sending ADDBSS
4586 */
4587 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4588 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4589 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004590 limExtractApCapabilities( pMac,
4591 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4592 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004593 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004595 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4596
4597 if(pBeaconStruct->erpPresent)
4598 {
4599 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004600 psessionEntry->beaconParams.fShortPreamble = 0;
4601 else
4602 psessionEntry->beaconParams.fShortPreamble = 1;
4603 }
4604
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004605 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004607 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 retStatus = eSIR_FAILURE;
4609 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004610 if (retStatus != eSIR_SUCCESS)
4611 {
4612 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4613 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304614 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004615 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304616 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004617 goto Error;
4618 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304619 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004620 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304621 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004622 }
4623 break;
4624 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4625 * being sent as response to ReAssoc Req*/
4626 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4627 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4628 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4629 /** Set the SME State back to WT_Reassoc State*/
4630 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4631 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4632 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004633 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004634 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004635 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004637
4638 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4639 }
4640 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004641 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004642 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4644 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4645 goto Error;
4646 }
4647return;
4648Error:
4649 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4650}
4651
4652#if 0
4653 static void
4654limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4655{
4656 tSirSmeAssocCnf assocCnf;
4657 tpDphHashNode pStaDs;
4658 tpPESession psessionEntry;
4659 tANI_U8 sessionId;
4660
4661 if(pMsgBuf == NULL)
4662 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004663 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 goto end;
4665 }
4666 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4667 !__limIsSmeAssocCnfValid(&assocCnf))
4668 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004669 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 goto end;
4671 }
4672 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4673 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004674 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004675 goto end;
4676 }
4677 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4678 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4679 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004680 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4682 goto end;
4683 }
4684 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4685 if (pStaDs == NULL)
4686 {
4687 limLog(pMac, LOG1,
4688 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4689 msgType, assocCnf.aid);
4690 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4691 /*
4692 ** send a DISASSOC_IND message to WSM to make sure
4693 ** the state in WSM and LIM is the same
4694 **/
4695 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4696 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4697 goto end;
4698 }
4699 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304700 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 (tANI_U8 *) assocCnf.peerMacAddr,
4702 sizeof(tSirMacAddr)) ) ||
4703 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4704 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4705 (msgType != eWNI_SME_ASSOC_CNF)) ||
4706 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4707 (msgType != eWNI_SME_REASSOC_CNF)))))
4708 {
4709 limLog(pMac, LOG1,
4710 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4711 msgType, assocCnf.aid);
4712 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4713 goto end;
4714 }
4715 /*
4716 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4717 ** has been received
4718 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004719 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004720 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4721 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4722 {
4723 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4724 * when it had received Assoc Request frame. Now, PE just needs to send
4725 * Association Response frame to the requesting BTAMP-STA.
4726 */
4727 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004728 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004729 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4730 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4731 goto end;
4732 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4733 else
4734 {
4735 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4736 limRejectAssociation(pMac, pStaDs->staAddr,
4737 pStaDs->mlmStaContext.subType,
4738 true, pStaDs->mlmStaContext.authType,
4739 pStaDs->assocId, true,
4740 assocCnf.statusCode, psessionEntry);
4741 return;
4742 }
4743end:
4744 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4745 {
4746 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4747 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304748 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4750 }
4751
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304752 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004753 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4754 }
4755} /*** end __limProcessSmeAssocCnfNew() ***/
4756#endif
4757
Jeff Johnson295189b2012-06-20 16:38:30 -07004758void
4759limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4760 tBeaconGenParams *pBeaconGenParams = NULL;
4761 tSirMsgQ limMsg;
4762 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4763 if(psessionEntry == NULL ){
4764 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004765 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 return;
4767 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304768 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4769 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 {
4771 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304772 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 return;
4774 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304775 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4776 vos_mem_copy((void *) pBeaconGenParams->bssId,
4777 (void *)psessionEntry->bssId,
4778 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 limMsg.bodyptr = pBeaconGenParams;
4780 schProcessPreBeaconInd(pMac, &limMsg);
4781 return;
4782}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304783
4784void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4785 tSirResultCodes reasonCode)
4786{
4787 tANI_U16 scanRspLen = 0;
4788
4789 pMac->lim.gLimSmeScanResultLength +=
4790 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304791 pMac->lim.gLimRspReqd = false;
4792 if ((reasonCode == eSIR_SME_SUCCESS) ||
4793 pMac->lim.gLimSmeScanResultLength) {
4794 scanRspLen = sizeof(tSirSmeScanRsp) +
4795 pMac->lim.gLimSmeScanResultLength -
4796 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304797 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304798 else
4799 scanRspLen = sizeof(tSirSmeScanRsp);
4800
4801 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4802 pMac->lim.gSmeSessionId,
4803 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304804}
4805
4806
4807void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4808{
4809 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4810
4811 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
4812 "scan_id = %lu", pScanEvent->scanId);
4813
4814 switch (pScanEvent->event)
4815 {
4816 case SCAN_EVENT_STARTED:
4817 break;
4818 case SCAN_EVENT_START_FAILED:
4819 case SCAN_EVENT_COMPLETED:
4820 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
4821 break;
4822 case SCAN_EVENT_BSS_CHANNEL:
4823 case SCAN_EVENT_FOREIGN_CHANNEL:
4824 case SCAN_EVENT_DEQUEUED:
4825 case SCAN_EVENT_PREEMPTED:
4826 default:
4827 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
4828 "Received unhandled scan event %lu", pScanEvent->event);
4829 }
4830}