blob: c2482747eaf86ebf6465cb728e29602888568fd4 [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);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800142 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700143 break;
144#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700145
146 case LIM_MLM_AUTH_CNF:
147 limProcessMlmAuthCnf(pMac, pMsgBuf);
148 break;
149 case LIM_MLM_AUTH_IND:
150 limProcessMlmAuthInd(pMac, pMsgBuf);
151 break;
152 case LIM_MLM_ASSOC_CNF:
153 limProcessMlmAssocCnf(pMac, pMsgBuf);
154 break;
155 case LIM_MLM_START_CNF:
156 limProcessMlmStartCnf(pMac, pMsgBuf);
157 break;
158 case LIM_MLM_JOIN_CNF:
159 limProcessMlmJoinCnf(pMac, pMsgBuf);
160 break;
161 case LIM_MLM_ASSOC_IND:
162 limProcessMlmAssocInd(pMac, pMsgBuf);
163 break;
164 case LIM_MLM_REASSOC_CNF:
165 limProcessMlmReassocCnf(pMac, pMsgBuf);
166 break;
167 case LIM_MLM_REASSOC_IND:
168 limProcessMlmReassocInd(pMac, pMsgBuf);
169 break;
170 case LIM_MLM_DISASSOC_CNF:
171 limProcessMlmDisassocCnf(pMac, pMsgBuf);
172 break;
173 case LIM_MLM_DISASSOC_IND:
174 limProcessMlmDisassocInd(pMac, pMsgBuf);
175 break;
176 case LIM_MLM_PURGE_STA_IND:
177 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
178 break;
179 case LIM_MLM_DEAUTH_CNF:
180 limProcessMlmDeauthCnf(pMac, pMsgBuf);
181 break;
182 case LIM_MLM_DEAUTH_IND:
183 limProcessMlmDeauthInd(pMac, pMsgBuf);
184 break;
185 case LIM_MLM_SETKEYS_CNF:
186 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
187 break;
188 case LIM_MLM_REMOVEKEY_CNF:
189 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
190 break;
191 case LIM_MLM_TSPEC_CNF:
192 break;
193 case LIM_MLM_ADDBA_CNF:
194 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800195 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700196 break;
197 case LIM_MLM_DELBA_CNF:
198 limProcessMlmDelBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800199 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 break;
201 default:
202 break;
203 } // switch (msgType)
204 return;
205} /*** end limProcessMlmRspMessages() ***/
206
207/**
208 * limProcessMlmScanCnf()
209 *
210 *FUNCTION:
211 * This function is called to processes MLM_SCAN_CNF
212 * message from MLM State machine.
213 *
214 *LOGIC:
215 *
216 *ASSUMPTIONS:
217 *
218 *NOTE:
219 *
220 * @param pMac Pointer to Global MAC structure
221 * @param pMsgBuf A pointer to the MLM message buffer
222 *
223 * @return None
224 */
225void
226limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
227{
228 switch(pMac->lim.gLimSmeState)
229 {
230 case eLIM_SME_WT_SCAN_STATE:
231 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
232 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
233 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700234 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 pMac->lim.gLimSystemInScanLearnMode = 0;
236 break;
237 default:
238 /**
239 * Should not have received scan confirm
240 * from MLM in other states.
241 * Log error
242 */
243 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700244 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700245 pMac->lim.gLimSmeState);)
246 return;
247 }
248
249 /// Process received scan confirm
250 /// Increment length of cached scan results
251 pMac->lim.gLimSmeScanResultLength +=
252 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
253 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
254 {
255 tANI_U16 scanRspLen = 0;
256 /// Need to send response to Host
257 pMac->lim.gLimRspReqd = false;
258 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
259 eSIR_SME_SUCCESS) ||
260 pMac->lim.gLimSmeScanResultLength)
261 {
262 scanRspLen = sizeof(tSirSmeScanRsp) +
263 pMac->lim.gLimSmeScanResultLength -
264 sizeof(tSirBssDescription);
265 }
266 else
267 {
268 scanRspLen = sizeof(tSirSmeScanRsp);
269 }
270 if(pMac->lim.gLimReportBackgroundScanResults)
271 {
272 pMac->lim.gLimBackgroundScanTerminate = TRUE;
273 }
274 if (pMac->lim.gLimSmeScanResultLength == 0)
275 {
276 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
277 }
278 else
279 {
280 limSendSmeScanRsp(pMac, scanRspLen,
281 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
282 }
283 } // if (pMac->lim.gLimRspReqd)
284 //check to see whether we need to run bgScan timer
285 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
286 {
287 if (tx_timer_activate(
288 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
289 {
290 /// Could not activate background scan timer.
291 // Log error
292 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700293 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 pMac->lim.gLimBackgroundScanStarted = FALSE;
295 }
296 else
297 {
298 pMac->lim.gLimBackgroundScanStarted = TRUE;
299 }
300 }
301} /*** end limProcessMlmScanCnf() ***/
302
Jeff Johnsone7245742012-09-05 17:12:55 -0700303#ifdef FEATURE_OEM_DATA_SUPPORT
304
305/**
306 * limProcessMlmOemDataReqCnf()
307 *
308 *FUNCTION:
309 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
310 * message from MLM State machine.
311 *
312 *LOGIC:
313 *
314 *ASSUMPTIONS:
315 *
316 *NOTE:
317 *
318 * @param pMac Pointer to Global MAC structure
319 * @param pMsgBuf A pointer to the MLM message buffer
320 *
321 * @return None
322 */
323
324void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
325{
326 tLimMlmOemDataRsp* measRsp;
327
328 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
329
330 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
331
332 //Now send the meas confirm message to the sme
333 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
334
335 //Dont free the memory here. It will be freed up by the callee
336
337 return;
338}
339#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700340
341/**
342 * limProcessMlmStartCnf()
343 *
344 *FUNCTION:
345 * This function is called to processes MLM_START_CNF
346 * message from MLM State machine.
347 *
348 *LOGIC:
349 *
350 *ASSUMPTIONS:
351 *
352 *NOTE:
353 *
354 * @param pMac Pointer to Global MAC structure
355 * @param pMsgBuf A pointer to the MLM message buffer
356 *
357 * @return None
358 */
359void
360limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
361{
362 tpPESession psessionEntry = NULL;
363 tLimMlmStartCnf *pLimMlmStartCnf;
364 tANI_U8 smesessionId;
365 tANI_U16 smetransactionId;
366
367 if(pMsgBuf == NULL)
368 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700369 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 return;
371 }
372 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
373 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
374 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700375 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 return;
377 }
378 smesessionId = psessionEntry->smeSessionId;
379 smetransactionId = psessionEntry->transactionId;
380
381 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
382 {
383 /**
384 * Should not have received Start confirm from MLM
385 * in other states.
386 * Log error
387 */
388 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700389 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 psessionEntry->limSmeState);)
391 return;
392 }
393 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
394 eSIR_SME_SUCCESS)
395 {
396
397 /**
398 * Update global SME state so that Beacon Generation
399 * module starts writing Beacon frames into TFP's
400 * Beacon file register.
401 */
402 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700403 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
405 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700406 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 }
408 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
409 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700410 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
413 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700414 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700417 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700418 }
419 else
420 {
421 /// Start BSS is a failure
422 peDeleteSession(pMac,psessionEntry);
423 psessionEntry = NULL;
424 }
425 /// Send response to Host
426 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
427 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
428 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
430 {
431 //Configure beacon and send beacons to HAL
432 limSendBeaconInd(pMac, psessionEntry);
433 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700434}
435
436 /*** end limProcessMlmStartCnf() ***/
437
438/**
439 * limProcessMlmJoinCnf()
440 *
441 *FUNCTION:
442 * This function is called to processes MLM_JOIN_CNF
443 * message from MLM State machine.
444 *
445 *LOGIC:
446 *
447 *ASSUMPTIONS:
448 *
449 *NOTE:
450 *
451 * @param pMac Pointer to Global MAC structure
452 * @param pMsgBuf A pointer to the MLM message buffer
453 *
454 * @return None
455 */
456void
457limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
458{
459 tSirResultCodes resultCode;
460 tLimMlmJoinCnf *pLimMlmJoinCnf;
461 tpPESession psessionEntry;
462 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
463 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
464 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700465 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 return;
467 }
468
469 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
470 {
471 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700472 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 psessionEntry->limSmeState);)
474 return;
475 }
476
477 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
478 /// Process Join confirm from MLM
479 if (resultCode == eSIR_SME_SUCCESS)
480 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700481 PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
484 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
485 return;
486 else
487 resultCode = eSIR_SME_REFUSED;
488 }
489 {
490 /// Join failure
491 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700492 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 /// Send Join response to Host
494 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
495 }
496} /*** end limProcessMlmJoinCnf() ***/
497
498/**
499 * limProcessMlmAuthCnf()
500 *
501 *FUNCTION:
502 * This function is called to processes MLM_AUTH_CNF
503 * message from MLM State machine.
504 *
505 *LOGIC:
506 *
507 *ASSUMPTIONS:
508 *
509 *NOTE:
510 *
511 * @param pMac Pointer to Global MAC structure
512 * @param pMsgBuf A pointer to the MLM message buffer
513 *
514 * @return None
515 */
516void
517limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
518{
519 tANI_U16 caps;
520 tANI_U32 val;
521 tAniAuthType cfgAuthType, authMode;
522 tLimMlmAuthReq *pMlmAuthReq;
523 tLimMlmAssocReq *pMlmAssocReq;
524 tLimMlmAuthCnf *pMlmAuthCnf;
525 tpPESession psessionEntry;
526 tANI_U32 teleBcnEn = 0;
527// tANI_U8 sessionId;
528
529 if(pMsgBuf == NULL)
530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700531 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 return;
533 }
534 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
535 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700537 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 return;
539 }
540
541 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
542 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
543 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
544 {
545 /**
546 * Should not have received AUTH confirm
547 * from MLM in other states or on AP.
548 * Log error
549 */
550 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700551 FL("received unexpected MLM_AUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 psessionEntry->limSmeState);)
553 return;
554 }
555 /// Process AUTH confirm from MLM
556 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
557 {
558 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
559 {
560 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
561 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
562 {
563 /**
564 * Could not get AuthType value from CFG.
565 * Log error.
566 */
567 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700568 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 }
570 }
571 else
572 cfgAuthType = pMac->lim.gLimPreAuthType;
573
574 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
575 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
576 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
577 {
578 /**
579 * When Open authentication fails with reason code "13" and
580 * authType set to 'auto switch', Try with Shared Authentication
581 */
582 authMode = eSIR_SHARED_KEY;
583 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530584 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
585 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 {
587 // Log error
588 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530589 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 return;
591 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530592 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 val = sizeof(tSirMacAddr);
594 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
595 {
596 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
597 }
598 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530599 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
600 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 sizeof(tSirMacAddr));
602 pMlmAuthReq->authType = authMode;
603 /* Update PE session Id*/
604 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
605 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
606 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
607 != eSIR_SUCCESS)
608 {
609 /**
610 * Could not get AuthFailureTimeout value from CFG.
611 * Log error.
612 */
613 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700614 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 }
616 limPostMlmMessage(pMac,
617 LIM_MLM_AUTH_REQ,
618 (tANI_U32 *) pMlmAuthReq);
619 return;
620 }
621 else
622 {
623 // MAC based authentication failure
624 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
625 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700626 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700628 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700630 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 /**
633 * Need to send Join response with
634 * auth failure to Host.
635 */
636 limHandleSmeJoinResult(pMac,
637 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
638 }
639 else
640 {
641 /**
642 * Pre-authentication failure.
643 * Send Pre-auth failure response to host
644 */
645 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700646 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 limSendSmeAuthRsp(
648 pMac,
649 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
650 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
651 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
652 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
653 }
654 } // end if (cfgAuthType == eAUTO_SWITCH)
655 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
656 else
657 {
658 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
659 {
660 /**
661 * Successful MAC based authentication
662 * Trigger Association with BSS
663 */
664 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700665 FL("*** Authenticated with BSS ***"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530666 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
667 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 {
669 // Log error
670 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530671 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 return;
673 }
674 val = sizeof(tSirMacAddr);
675 #if 0
676 if (cfgGetStr(pMac, WNI_CFG_BSSID,
677 pMlmAssocReq->peerMacAddr,
678 &val) != eSIR_SUCCESS)
679 {
680 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700681 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 }
683 #endif //SUPPORT BT-AMP
684 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
685 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
686 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
687 != eSIR_SUCCESS)
688 {
689 /**
690 * Could not get AssocFailureTimeout value
691 * from CFG. Log error.
692 */
693 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700694 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 }
696 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
697 {
698 /**
699 * Could not get Capabilities value
700 * from CFG. Log error.
701 */
702 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700703 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 }
705 /*Clear spectrum management bit if AP doesn't support it*/
706 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
707 {
708 /*AP doesn't support spectrum management clear spectrum management bit*/
709 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
710 }
711
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530712 /* Clear rrm bit if AP doesn't support it */
713 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
714 & LIM_RRM_BIT_MASK))
715 {
716 caps &= (~LIM_RRM_BIT_MASK);
717 }
718
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 pMlmAssocReq->capabilityInfo = caps;
720 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700721 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700723 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
724 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700725
726 /* If telescopic beaconing is enabled, set listen interval to
727 WNI_CFG_TELE_BCN_MAX_LI */
728 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
729 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700730 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700731
732 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
733
734 if(teleBcnEn)
735 {
736 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
737 eSIR_SUCCESS)
738 {
739 /**
740 * Could not get ListenInterval value
741 * from CFG. Log error.
742 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700743 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 }
745 }
746 else
747 {
748 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
749 {
750 /**
751 * Could not get ListenInterval value
752 * from CFG. Log error.
753 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700754 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 }
756 }
757
758 pMlmAssocReq->listenInterval = (tANI_U16)val;
759 /* Update PE session ID*/
760 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
761 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
762 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 limPostMlmMessage(pMac,
765 LIM_MLM_ASSOC_REQ,
766 (tANI_U32 *) pMlmAssocReq);
767 }
768 else
769 {
770 /**
771 * Successful Pre-authentication.
772 * Send Pre-auth response to host
773 */
774 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700775 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 limSendSmeAuthRsp(
777 pMac,
778 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
779 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
780 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
781 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
782 }
783 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
784} /*** end limProcessMlmAuthCnf() ***/
785
786/**
787 * limProcessMlmAssocCnf()
788 *
789 *FUNCTION:
790 * This function is called to processes MLM_ASSOC_CNF
791 * message from MLM State machine.
792 *
793 *LOGIC:
794 *
795 *ASSUMPTIONS:
796 *
797 *NOTE:
798 *
799 * @param pMac Pointer to Global MAC structure
800 * @param pMsgBuf A pointer to the MLM message buffer
801 *
802 * @return None
803 */
804void
805limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
806{
807 tpPESession psessionEntry;
808 tLimMlmAssocCnf *pLimMlmAssocCnf;
809
810 if(pMsgBuf == NULL)
811 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700812 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 return;
814 }
815 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
816 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
817 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700818 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 return;
820 }
821 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
822 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
823 {
824 /**
825 * Should not have received Assocication confirm
826 * from MLM in other states OR on AP.
827 * Log error
828 */
829 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700830 FL("received unexpected MLM_ASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 psessionEntry->limSmeState);)
832 return;
833 }
834 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
835 {
836 // Association failure
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700837 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700839 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 /**
841 * Need to send Join response with
842 * Association failure to Host.
843 */
844 limHandleSmeJoinResult(pMac,
845 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
846 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
847 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
848 else
849 {
850 // Successful Association
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700851 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700853 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 /**
855 * Need to send Join response with
856 * Association success to Host.
857 */
858 limHandleSmeJoinResult(pMac,
859 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
860 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
861 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
862} /*** end limProcessMlmAssocCnf() ***/
863
864/**
865 * limProcessMlmReassocCnf()
866 *
867 *FUNCTION:
868 * This function is called to processes MLM_REASSOC_CNF
869 * message from MLM State machine.
870 *
871 *LOGIC:
872 *
873 *ASSUMPTIONS:
874 *
875 *NOTE:
876 *
877 * @param pMac Pointer to Global MAC structure
878 * @param pMsgBuf A pointer to the MLM message buffer
879 *
880 * @return None
881 */
882void
883limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
884{
885 tpPESession psessionEntry;
886 tLimMlmReassocCnf *pLimMlmReassocCnf;
887
888 if(pMsgBuf == NULL)
889 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700890 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 return;
892 }
893 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
894 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
895 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700896 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 return;
898 }
899 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
900 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
901 {
902 /**
903 * Should not have received Reassocication confirm
904 * from MLM in other states OR on AP.
905 * Log error
906 */
907 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700908 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
910 return;
911 }
912 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530913 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 psessionEntry->pLimReAssocReq = NULL;
915 }
916
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700917 PELOGE(limLog(pMac, LOGE, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
919 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700920 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700921
922 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700923 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700924
925 /**
926 * Need to send Reassoc response with
927 * Reassociation success to Host.
928 */
929 limSendSmeJoinReassocRsp(
930 pMac, eWNI_SME_REASSOC_RSP,
931 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
932 psessionEntry->smeSessionId,psessionEntry->transactionId);
933 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
934 /** Reassociation failure With the New AP
935 * but we still have the link with the Older AP
936 */
937 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700938 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700939
940 /**
941 * Need to send Reassoc response with
942 * Association failure to Host.
943 */
944 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
945 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
946 psessionEntry->smeSessionId,psessionEntry->transactionId);
947 }else {
948 // Reassociation failure
949 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700950 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 /**
952 * Need to send Reassoc response with
953 * Association failure to Host.
954 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700955 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 }
957} /*** end limProcessMlmReassocCnf() ***/
958
959/**
960 * limProcessMlmReassocInd()
961 *
962 *FUNCTION:
963 * This function is called to processes MLM_REASSOC_IND
964 * message from MLM State machine.
965 *
966 *LOGIC:
967 *
968 *ASSUMPTIONS:
969 *
970 *NOTE:
971 *
972 * @param pMac Pointer to Global MAC structure
973 * @param pMsgBuf A pointer to the MLM message buffer
974 *
975 * @return None
976 */
977void
978limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
979{
980 tANI_U32 len;
981 tSirMsgQ msgQ;
982 tSirSmeReassocInd *pSirSmeReassocInd;
983 tpDphHashNode pStaDs=0;
984 tpPESession psessionEntry;
985 tANI_U8 sessionId;
986 if(pMsgBuf == NULL)
987 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700988 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 return;
990 }
991 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
992 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700993 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 return;
995 }
996 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530998 pSirSmeReassocInd = vos_mem_malloc(len);
999 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 {
1001 // Log error
1002 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301003 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 return;
1005
1006 }
1007 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1008 eWNI_SME_REASSOC_IND);
1009 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1010 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1011
1012 // Required for indicating the frames to upper layer
1013 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1014 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1015 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1016 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1017
1018 msgQ.type = eWNI_SME_REASSOC_IND;
1019 msgQ.bodyptr = pSirSmeReassocInd;
1020 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001021 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001022#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1023 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1024#endif //FEATURE_WLAN_DIAG_SUPPORT
1025 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1026 if (! pStaDs)
1027 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001028 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301030 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 return;
1032 }
1033
1034 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1035 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001036 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 /*
1038 ** turn on a timer to detect the loss of REASSOC CNF
1039 **/
1040 limActivateCnfTimer(pMac,
1041 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1042} /*** end limProcessMlmReassocInd() ***/
1043
1044/**
1045 * limProcessMlmAuthInd()
1046 *
1047 *FUNCTION:
1048 * This function is called to processes MLM_AUTH_IND
1049 * message from MLM State machine.
1050 *
1051 *LOGIC:
1052 *
1053 *ASSUMPTIONS:
1054 *
1055 *NOTE:
1056 *
1057 * @param pMac Pointer to Global MAC structure
1058 * @param pMsgBuf A pointer to the MLM message buffer
1059 *
1060 * @return None
1061 */
1062void
1063limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1064{
1065 tSirMsgQ msgQ;
1066 tSirSmeAuthInd *pSirSmeAuthInd;
1067
1068 if(pMsgBuf == NULL)
1069 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001070 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 return;
1072 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301073 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1074 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 {
1076 // Log error
1077 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301078 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 }
1080 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1081 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1082 (tANI_U8 *) &(pSirSmeAuthInd->length));
1083 msgQ.type = eWNI_SME_AUTH_IND;
1084 msgQ.bodyptr = pSirSmeAuthInd;
1085 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001086 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001087#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1088 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1089#endif //FEATURE_WLAN_DIAG_SUPPORT
1090 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1091} /*** end limProcessMlmAuthInd() ***/
1092
1093
1094
1095
1096void
1097limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1098 tSirSmeAssocInd *pSirSmeAssocInd,
1099 tpPESession psessionEntry)
1100{
1101 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1102 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1103
1104 // Required for indicating the frames to upper layer
1105 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1106 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1107
1108 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1109 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1110
1111 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301112 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1113 sizeof(tSirMacAddr));
1114
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 // Fill in aid
1116 pSirSmeAssocInd->aid = pAssocInd->aid;
1117 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301118 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 // Fill in staId
1120 //pSirSmeAssocInd->staId = psessionEntry->staId;
1121 // Fill in authType
1122 pSirSmeAssocInd->authType = pAssocInd->authType;
1123 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301124 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1125 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301127 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1128 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1129 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001130
1131 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301132 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1133 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1134 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001135
1136 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1138 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1139 {
1140 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1141 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1142 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301143 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001144 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301145 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 // Fill in WmmInfo
1148 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001149} /*** end limAssocIndSerDes() ***/
1150
1151
1152
1153/**
1154 * limProcessMlmAssocInd()
1155 *
1156 *FUNCTION:
1157 * This function is called to processes MLM_ASSOC_IND
1158 * message from MLM State machine.
1159 *
1160 *LOGIC:
1161 *
1162 *ASSUMPTIONS:
1163 *
1164 *NOTE:
1165 *
1166 * @param pMac Pointer to Global MAC structure
1167 * @param pMsgBuf A pointer to the MLM message buffer
1168 *
1169 * @return None
1170 */
1171void
1172limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1173{
1174 tANI_U32 len;
1175 tSirMsgQ msgQ;
1176 tSirSmeAssocInd *pSirSmeAssocInd;
1177 tpDphHashNode pStaDs=0;
1178 tpPESession psessionEntry;
1179 if(pMsgBuf == NULL)
1180 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001181 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 return;
1183 }
1184 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1185 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001186 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 return;
1188 }
1189 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301191 pSirSmeAssocInd = vos_mem_malloc(len);
1192 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 {
1194 // Log error
1195 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301196 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 return;
1198 }
1199
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1201 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001202 msgQ.type = eWNI_SME_ASSOC_IND;
1203 msgQ.bodyptr = pSirSmeAssocInd;
1204 msgQ.bodyval = 0;
1205 pStaDs = dphGetHashEntry(pMac,
1206 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1207 if (! pStaDs)
1208 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001209 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301211 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001212
1213 return;
1214 }
1215 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001217 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001218#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1219 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1220#endif //FEATURE_WLAN_DIAG_SUPPORT
1221 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1222
1223 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001224 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 /*
1226 ** turn on a timer to detect the loss of ASSOC CNF
1227 **/
1228 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1229
1230// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1231#ifdef TEST_BTAMP_AP
1232//tANI_U32 *pMsgBuf;
1233{
1234 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301235 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1236 if ( NULL == pSmeAssoccnf )
1237 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1239 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301240 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1241 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1243 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301244 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1245 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001246 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301247 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1249 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301250 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001251}
1252#endif
1253
1254
1255} /*** end limProcessMlmAssocInd() ***/
1256
1257
1258
1259
1260/**
1261 * limProcessMlmDisassocInd()
1262 *
1263 *FUNCTION:
1264 * This function is called to processes MLM_DISASSOC_IND
1265 * message from MLM State machine.
1266 *
1267 *LOGIC:
1268 *
1269 *ASSUMPTIONS:
1270 *
1271 *NOTE:
1272 *
1273 * @param pMac Pointer to Global MAC structure
1274 * @param pMsgBuf A pointer to the MLM message buffer
1275 *
1276 * @return None
1277 */
1278void
1279limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1280{
1281 tLimMlmDisassocInd *pMlmDisassocInd;
1282 tpPESession psessionEntry;
1283 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1284 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001286 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 return;
1288 }
1289 switch (psessionEntry->limSystemRole)
1290 {
1291 case eLIM_STA_IN_IBSS_ROLE:
1292 break;
1293 case eLIM_STA_ROLE:
1294 case eLIM_BT_AMP_STA_ROLE:
1295 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001296 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 break;
1298 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1299 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001300 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 pMlmDisassocInd->aid);)
1302 // Send SME_DISASOC_IND after Polaris cleanup
1303 // (after receiving LIM_MLM_PURGE_STA_IND)
1304 break;
1305 } // end switch (psessionEntry->limSystemRole)
1306} /*** end limProcessMlmDisassocInd() ***/
1307
1308/**
1309 * limProcessMlmDisassocCnf()
1310 *
1311 *FUNCTION:
1312 * This function is called to processes MLM_DISASSOC_CNF
1313 * message from MLM State machine.
1314 *
1315 *LOGIC:
1316 *
1317 *ASSUMPTIONS:
1318 *
1319 *NOTE:
1320 *
1321 * @param pMac Pointer to Global MAC structure
1322 * @param pMsgBuf A pointer to the MLM message buffer
1323 *
1324 * @return None
1325 */
1326void
1327limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1328{
1329 tSirResultCodes resultCode;
1330 tLimMlmDisassocCnf *pMlmDisassocCnf;
1331 tpPESession psessionEntry;
1332 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1333 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1334 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001335 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 return;
1337 }
1338 resultCode = (tSirResultCodes)
1339 (pMlmDisassocCnf->disassocTrigger ==
1340 eLIM_LINK_MONITORING_DISASSOC) ?
1341 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1342 pMlmDisassocCnf->resultCode;
1343 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1344 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 // Disassociate Confirm from MLM
1346 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1347 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1348 {
1349 /**
1350 * Should not have received
1351 * Disassocate confirm
1352 * from MLM in other states.
1353 * Log error
1354 */
1355 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001356 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 return;
1358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 if (pMac->lim.gLimRspReqd)
1360 pMac->lim.gLimRspReqd = false;
1361 if (pMlmDisassocCnf->disassocTrigger ==
1362 eLIM_PROMISCUOUS_MODE_DISASSOC)
1363 {
1364 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1365 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1366 else
1367 psessionEntry->limSmeState = eLIM_SME_OFFLINE_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 // Send Promiscuous mode response to host
1370 limSendSmePromiscuousModeRsp(pMac);
1371 }
1372 else
1373 {
1374 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1375 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1376 else
1377 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001378 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1380 resultCode,
1381 pMlmDisassocCnf->disassocTrigger,
1382 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1383 }
1384 }
1385 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1386 {
1387 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1388 resultCode,
1389 pMlmDisassocCnf->disassocTrigger,
1390 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1391 }
1392} /*** end limProcessMlmDisassocCnf() ***/
1393
1394/**
1395 * limProcessMlmDeauthInd()
1396 *
1397 *FUNCTION:
1398 * This function is called to processes MLM_DEAUTH_IND
1399 * message from MLM State machine.
1400 *
1401 *LOGIC:
1402 *
1403 *ASSUMPTIONS:
1404 *
1405 *NOTE:
1406 *
1407 * @param pMac Pointer to Global MAC structure
1408 * @param pMsgBuf A pointer to the MLM message buffer
1409 *
1410 * @return None
1411 */
1412void
1413limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1414{
1415 tLimMlmDeauthInd *pMlmDeauthInd;
1416 tpPESession psessionEntry;
1417 tANI_U8 sessionId;
1418 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1419 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1420 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001421 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 return;
1423 }
1424 switch (psessionEntry->limSystemRole)
1425 {
1426 case eLIM_STA_IN_IBSS_ROLE:
1427 break;
1428 case eLIM_STA_ROLE:
1429 case eLIM_BT_AMP_STA_ROLE:
1430 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001432
1433 default: // eLIM_AP_ROLE
1434 {
1435 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001436 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 pMlmDeauthInd->aid);)
1438 }
1439 // Send SME_DEAUTH_IND after Polaris cleanup
1440 // (after receiving LIM_MLM_PURGE_STA_IND)
1441 break;
1442 } // end switch (psessionEntry->limSystemRole)
1443} /*** end limProcessMlmDeauthInd() ***/
1444
1445/**
1446 * limProcessMlmDeauthCnf()
1447 *
1448 *FUNCTION:
1449 * This function is called to processes MLM_DEAUTH_CNF
1450 * message from MLM State machine.
1451 *
1452 *LOGIC:
1453 *
1454 *ASSUMPTIONS:
1455 *
1456 *NOTE:
1457 *
1458 * @param pMac Pointer to Global MAC structure
1459 * @param pMsgBuf A pointer to the MLM message buffer
1460 *
1461 * @return None
1462 */
1463void
1464limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1465{
1466 tANI_U16 aid;
1467 tSirResultCodes resultCode;
1468 tLimMlmDeauthCnf *pMlmDeauthCnf;
1469 tpPESession psessionEntry;
1470
1471 if(pMsgBuf == NULL)
1472 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001473 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 return;
1475 }
1476 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1477 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1478 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001479 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 return;
1481 }
1482
1483 resultCode = (tSirResultCodes)
1484 (pMlmDeauthCnf->deauthTrigger ==
1485 eLIM_LINK_MONITORING_DEAUTH) ?
1486 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1487 pMlmDeauthCnf->resultCode;
1488 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1489 pMlmDeauthCnf->aid : 1;
1490 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1491 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 // Deauth Confirm from MLM
1493 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1494 {
1495 /**
1496 * Should not have received Deauth confirm
1497 * from MLM in other states.
1498 * Log error
1499 */
1500 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001501 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 psessionEntry->limSmeState);)
1503 return;
1504 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1506 {
1507 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1508 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001509 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 }
1511 else
1512 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001513 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515 if (pMac->lim.gLimRspReqd)
1516 pMac->lim.gLimRspReqd = false;
1517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1519 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1520 resultCode,
1521 pMlmDeauthCnf->deauthTrigger,
1522 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001523} /*** end limProcessMlmDeauthCnf() ***/
1524
1525/**
1526 * limProcessMlmPurgeStaInd()
1527 *
1528 *FUNCTION:
1529 * This function is called to processes MLM_PURGE_STA_IND
1530 * message from MLM State machine.
1531 *
1532 *LOGIC:
1533 *
1534 *ASSUMPTIONS:
1535 *
1536 *NOTE:
1537 *
1538 * @param pMac Pointer to Global MAC structure
1539 * @param pMsgBuf A pointer to the MLM message buffer
1540 *
1541 * @return None
1542 */
1543void
1544limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1545{
1546 tSirResultCodes resultCode;
1547 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1548 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001549 if(pMsgBuf == NULL)
1550 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001551 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 return;
1553 }
1554 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1555 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001557 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001558 return;
1559 }
1560 // Purge STA indication from MLM
1561 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1562 switch (psessionEntry->limSystemRole)
1563 {
1564 case eLIM_STA_IN_IBSS_ROLE:
1565 break;
1566 case eLIM_STA_ROLE:
1567 case eLIM_BT_AMP_STA_ROLE:
1568 default: // eLIM_AP_ROLE
1569 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1570 (psessionEntry->limSmeState !=
1571 eLIM_SME_WT_DISASSOC_STATE) &&
1572 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1573 {
1574 /**
1575 * Should not have received
1576 * Purge STA indication
1577 * from MLM in other states.
1578 * Log error
1579 */
1580 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001581 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 psessionEntry->limSmeState);)
1583 break;
1584 }
1585 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001586 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 pMlmPurgeStaInd->aid);)
1588 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1589 {
1590 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001591 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 }
1594 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1595 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001596 limSendSmeDeauthNtf(pMac,
1597 pMlmPurgeStaInd->peerMacAddr,
1598 resultCode,
1599 pMlmPurgeStaInd->purgeTrigger,
1600 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 }
1602 else
1603 limSendSmeDisassocNtf(pMac,
1604 pMlmPurgeStaInd->peerMacAddr,
1605 resultCode,
1606 pMlmPurgeStaInd->purgeTrigger,
1607 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1608 } // end switch (psessionEntry->limSystemRole)
1609} /*** end limProcessMlmPurgeStaInd() ***/
1610
1611/**
1612 * limProcessMlmSetKeysCnf()
1613 *
1614 *FUNCTION:
1615 * This function is called to processes MLM_SETKEYS_CNF
1616 * message from MLM State machine.
1617 *
1618 *LOGIC:
1619 *
1620 *ASSUMPTIONS:
1621 *
1622 *NOTE:
1623 *
1624 * @param pMac Pointer to Global MAC structure
1625 * @param pMsgBuf A pointer to the MLM message buffer
1626 *
1627 * @return None
1628 */
1629void
1630limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1631{
1632 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001633 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 tpPESession psessionEntry;
1635
1636 if(pMsgBuf == NULL)
1637 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001638 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001639 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 }
1641 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1642 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1643 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001644 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 return;
1646 }
1647 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001648 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 pMlmSetKeysCnf->resultCode );
1650 limSendSmeSetContextRsp(pMac,
1651 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1654 psessionEntry->transactionId);
1655} /*** end limProcessMlmSetKeysCnf() ***/
1656/**
1657 * limProcessMlmRemoveKeyCnf()
1658 *
1659 *FUNCTION:
1660 * This function is called to processes MLM_REMOVEKEY_CNF
1661 * message from MLM State machine.
1662 *
1663 *LOGIC:
1664 *
1665 *ASSUMPTIONS:
1666 *
1667 *NOTE:
1668 *
1669 * @param pMac Pointer to Global MAC structure
1670 * @param pMsgBuf A pointer to the MLM message buffer
1671 *
1672 * @return None
1673 */
1674void
1675limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1676{
1677 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001678 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 tpPESession psessionEntry;
1680
1681 if(pMsgBuf == NULL)
1682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001683 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001684 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 }
1686 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1687 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1688 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001689 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 return;
1691 }
1692 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001693 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 pMlmRemoveKeyCnf->resultCode );
1695 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001696 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1698 psessionEntry->smeSessionId,psessionEntry->transactionId);
1699} /*** end limProcessMlmRemoveKeyCnf() ***/
1700
1701
1702/**
1703 * limHandleSmeJoinResult()
1704 *
1705 *FUNCTION:
1706 * This function is called to process join/auth/assoc failures
1707 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1708 * MLM_ASSOC_CNF with a success code in case of STA role and
1709 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1710 *
1711 *LOGIC:
1712 *
1713 *ASSUMPTIONS:
1714 *
1715 *NOTE:
1716 *
1717 * @param pMac Pointer to Global MAC structure
1718 * @param resultCode Failure code to be sent
1719 *
1720 *
1721 * @return None
1722 */
1723static void
1724limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1725{
1726 tpDphHashNode pStaDs = NULL;
1727 tANI_U8 smesessionId;
1728 tANI_U16 smetransactionId;
1729
1730 /* Newly Added on oct 11 th*/
1731 if(psessionEntry == NULL)
1732 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001733 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 return;
1735 }
1736 smesessionId = psessionEntry->smeSessionId;
1737 smetransactionId = psessionEntry->transactionId;
1738 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1739 if(resultCode != eSIR_SME_SUCCESS)
1740 {
1741 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1742 if (pStaDs != NULL)
1743 {
1744 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1745 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1746 pStaDs->mlmStaContext.resultCode = resultCode;
1747 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1748 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1749 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301750 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001751 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 return;
1753 }
1754 }
1755
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301756 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001757 psessionEntry->pLimJoinReq = NULL;
1758 //Delete teh session if JOIN failure occurred.
1759 if(resultCode != eSIR_SME_SUCCESS)
1760 {
1761 if(NULL != psessionEntry)
1762 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001763 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1764 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001765 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 peDeleteSession(pMac,psessionEntry);
1767 psessionEntry = NULL;
1768 }
1769 }
1770 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1771 smesessionId, smetransactionId);
1772} /*** end limHandleSmeJoinResult() ***/
1773
1774/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001775 * limHandleSmeReaasocResult()
1776 *
1777 *FUNCTION:
1778 * This function is called to process reassoc failures
1779 * upon receiving REASSOC_CNF with a failure code or
1780 * MLM_REASSOC_CNF with a success code in case of STA role
1781 *
1782 *LOGIC:
1783 *
1784 *ASSUMPTIONS:
1785 *
1786 *NOTE:
1787 *
1788 * @param pMac Pointer to Global MAC structure
1789 * @param resultCode Failure code to be sent
1790 *
1791 *
1792 * @return None
1793 */
1794static void
1795limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1796{
1797 tpDphHashNode pStaDs = NULL;
1798 tANI_U8 smesessionId;
1799 tANI_U16 smetransactionId;
1800
1801 if(psessionEntry == NULL)
1802 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001803 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001804 return;
1805 }
1806 smesessionId = psessionEntry->smeSessionId;
1807 smetransactionId = psessionEntry->transactionId;
1808 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1809 if(resultCode != eSIR_SME_SUCCESS)
1810 {
1811 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1812 if (pStaDs != NULL)
1813 {
1814 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1815 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1816 pStaDs->mlmStaContext.resultCode = resultCode;
1817 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1818 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1819 return;
1820 }
1821 }
1822
1823 //Delete teh session if REASSOC failure occurred.
1824 if(resultCode != eSIR_SME_SUCCESS)
1825 {
1826 if(NULL != psessionEntry)
1827 {
1828 peDeleteSession(pMac,psessionEntry);
1829 psessionEntry = NULL;
1830 }
1831 }
1832 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1833 smesessionId, smetransactionId);
1834} /*** end limHandleSmeReassocResult() ***/
1835
1836/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 * limProcessMlmAddStaRsp()
1838 *
1839 *FUNCTION:
1840 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1841 * Upon receipt of this message from HAL, MLME -
1842 * > Determines the "state" in which this message was received
1843 * > Forwards it to the appropriate callback
1844 *
1845 *ASSUMPTIONS:
1846 *
1847 *NOTE:
1848 *
1849 * @param pMac Pointer to Global MAC structure
1850 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1851 *
1852 * @return None
1853 */
1854void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1855{
1856 //we need to process the deferred message since the initiating req. there might be nested request.
1857 //in the case of nested request the new request initiated from the response will take care of resetting
1858 //the deffered flag.
1859 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 )
1863 {
1864 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1865 return;
1866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001868}
1869void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1870{
1871 tLimMlmAssocCnf mlmAssocCnf;
1872 tpDphHashNode pStaDs;
1873 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1874 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1875
1876 if(NULL == pAddStaParams )
1877 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001878 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 return;
1880 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301881 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301883 PELOGE(limLog(pMac, LOGE,
1884 FL("Received Deauth frame in ADD_STA_RESP state"));)
1885 pAddStaParams->status = eHAL_STATUS_FAILURE;
1886 }
1887
1888 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1889 {
1890 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 {
1892 //TODO: any response to be sent out here ?
1893 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001894 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 psessionEntry->limMlmState);
1896 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1897 goto end;
1898 }
1899 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1900 mesgType = LIM_MLM_REASSOC_CNF;
1901 //
1902 // Update the DPH Hash Entry for this STA
1903 // with proper state info
1904 //
1905 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1906 if( NULL != pStaDs)
1907 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1908 else
1909 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001910 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 DPH_STA_HASH_INDEX_PEER);
1912 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001913 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 /*
1915 * Storing the self StaIndex(Generated by HAL) in session context,
1916 * instead of storing it in DPH Hash entry for Self STA.
1917 * DPH entry for the self STA stores the sta index for the BSS entry
1918 * to which the STA is associated.
1919 */
1920 psessionEntry->staId = pAddStaParams->staIdx;
1921 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001922#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1923 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1924#endif
1925 {
1926 limReactivateHeartBeatTimer(pMac, psessionEntry);
1927 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001928 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001929
1930 //assign the sessionId to the timer Object
1931 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1932 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001933 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001934#ifdef WLAN_DEBUG
1935 pMac->lim.gLimNumLinkEsts++;
1936#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001937#ifdef FEATURE_WLAN_TDLS
1938 /* initialize TDLS peer related data */
1939 limInitTdlsData(pMac,psessionEntry);
1940#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 // Return Assoc confirm to SME with success
1942 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1943 // be passed in here....
1944 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1945 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1946 }
1947 else
1948 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301949 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1951 }
1952end:
1953 if( 0 != limMsgQ->bodyptr )
1954 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301955 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001956 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 }
1958 /* Updating PE session Id*/
1959 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1960 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301961 if (true == psessionEntry->fDeauthReceived)
1962 {
1963 psessionEntry->fDeauthReceived = false;
1964 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 return;
1966}
1967void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1968{
1969 //we need to process the deferred message since the initiating req. there might be nested request.
1970 //in the case of nested request the new request initiated from the response will take care of resetting
1971 //the deffered flag.
1972 // tpPESession psessionEntry;
1973 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1974 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
1975 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001976 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 // return;
1978 // }
1979 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001980
1981 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
1982 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 ) &&
1985 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
1986 {
1987 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
1988 return;
1989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08001991
1992 if(!limIsInMCC(pMac))
1993 {
1994 WDA_TrafficStatsTimerActivate(FALSE);
1995 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001996
1997#ifdef WLAN_FEATURE_11W
1998 if (psessionEntry->limRmfEnabled)
1999 {
2000 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2001 {
2002 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002003 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002004 }
2005 }
2006#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002007}
2008
2009void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2010{
2011 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2012 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2013 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302014
2015 if (NULL == pDelBssParams)
2016 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002017 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302018 goto end;
2019 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2021 {
2022 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002023 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2025 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2026
2027 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002028 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 statusCode = eSIR_SME_REFUSED;
2030 goto end;
2031 }
2032 if(pStaDs == NULL)
2033 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002034 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 statusCode = eSIR_SME_REFUSED;
2036 goto end;
2037 }
2038 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2039 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002040 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 pStaDs->mlmStaContext.mlmState);)
2042 statusCode = eSIR_SME_REFUSED;
2043 goto end;
2044 }
2045 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2046 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2047 }
2048 else
2049 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302050 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302051 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002052 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 return;
2054 }
2055 end:
2056 if( 0 != limMsgQ->bodyptr )
2057 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302058 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002059 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 }
2061 if(pStaDs == NULL)
2062 return;
2063 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2064 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2065 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2066 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2067 {
2068 /** The Case where the DelBss is invoked from
2069 * context of other than normal DisAssoc / Deauth OR
2070 * as part of Join Failure.
2071 */
2072 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2073 return;
2074 }
2075 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2076 return;
2077}
2078
Jeff Johnson295189b2012-06-20 16:38:30 -07002079void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2080{
2081 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002082 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2084 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2085
2086 if(psessionEntry == NULL)
2087 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002088 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002089 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002090 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302091 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002092 limMsgQ->bodyptr = NULL;
2093 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 return;
2095 }
2096
2097 if (pDelBss == NULL)
2098 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002099 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 rc = eSIR_SME_REFUSED;
2101 goto end;
2102 }
2103 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002104 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2105
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2107 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002108 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002109 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2110 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002111 rc = eSIR_SME_REFUSED;
2112 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 }
2114 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2115 {
2116 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2117 pDelBss->status, pDelBss->bssIdx);
2118 rc = eSIR_SME_STOP_BSS_FAILURE;
2119 goto end;
2120 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002121 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002123 if (status != eSIR_SUCCESS)
2124 {
2125 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 /** Softmac may send all the buffered packets right after resuming the transmission hence
2129 * to occupy the medium during non channel occupancy period. So resume the transmission after
2130 * HAL gives back the response.
2131 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002132#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 if (LIM_IS_RADAR_DETECTED(pMac))
2134 {
2135 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2136 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2137 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002138#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2140 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002142 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 end:
2144 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2145 peDeleteSession(pMac, psessionEntry);
2146
2147 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002148 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302149 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002150 limMsgQ->bodyptr = NULL;
2151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002152}
2153
2154void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2155{
2156 //we need to process the deferred message since the initiating req. there might be nested request.
2157 //in the case of nested request the new request initiated from the response will take care of resetting
2158 //the deffered flag.
2159
2160 tpPESession psessionEntry;
2161 tpDeleteStaParams pDeleteStaParams;
2162 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2163 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302164
2165 if(NULL == pDeleteStaParams ||
2166 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002168 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002169 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002170 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302171 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002172 limMsgQ->bodyptr = NULL;
2173 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 return;
2175 }
2176
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 )
2180 {
2181 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2182 return;
2183 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002185}
2186
Jeff Johnson295189b2012-06-20 16:38:30 -07002187void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2188{
2189 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2190 tpDphHashNode pStaDs;
2191 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2192 if(limMsgQ->bodyptr == NULL)
2193 {
2194 return;
2195 }
2196
2197 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2198 if(pStaDs == NULL)
2199 {
2200 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002201 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302203 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002204 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002205
2206 return;
2207 }
2208 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2209 {
2210 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002211 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002212
2213 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2214 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2215 {
2216 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002217 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2219 statusCode = eSIR_SME_REFUSED;
2220 goto end;
2221 }
2222
2223 limLog( pMac, LOG1,
2224 FL("Deleted STA AssocID %d staId %d MAC "),
2225 pStaDs->assocId, pStaDs->staIndex);
2226 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2227 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2228 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302229 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002230 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002231 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 {
2233 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002234 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 pStaDs->assocId);)
2236 // delete the TS if it has already been added.
2237 // send the response with error status.
2238 if(pStaDs->qos.addtsPresent)
2239 {
2240 tpLimTspecInfo pTspecInfo;
2241 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2242 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2243 {
2244 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2245 NULL, &pTspecInfo->idx);
2246 }
2247 }
2248 limRejectAssociation(pMac,
2249 pStaDs->staAddr,
2250 pStaDs->mlmStaContext.subType,
2251 true, pStaDs->mlmStaContext.authType,
2252 pStaDs->assocId, true,
2253 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2254 psessionEntry);
2255 }
2256 return;
2257 }
2258 }
2259 else
2260 {
2261 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002262 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 statusCode = eSIR_SME_REFUSED;
2264 }
2265 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302266 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002267 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2269 {
2270 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2271 }
2272 return;
2273}
2274
2275void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2276{
2277 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2278 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2279 tpDphHashNode pStaDs = NULL;
2280 if(NULL == pDelStaParams )
2281 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002282 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 goto end;
2284 }
2285 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2286 {
2287 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2288 if (pStaDs == NULL)
2289 {
2290 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002291 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 pDelStaParams->assocId);
2293 statusCode = eSIR_SME_REFUSED;
2294 goto end;
2295 }
2296 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2297 {
2298 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002299 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 limMlmStateStr(psessionEntry->limMlmState));
2301 statusCode = eSIR_SME_REFUSED;
2302 goto end;
2303 }
2304 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2305 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002306 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 //we must complete all cleanup related to delSta before calling limDelBSS.
2308 if( 0 != limMsgQ->bodyptr )
2309 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302310 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002311 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 }
2313 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2314 return;
2315 }
2316 else
2317 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002318 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 statusCode = eSIR_SME_REFUSED;
2320 }
2321end:
2322 if( 0 != limMsgQ->bodyptr )
2323 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302324 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002325 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 }
2327 return;
2328}
2329
Jeff Johnson295189b2012-06-20 16:38:30 -07002330void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2331{
2332 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302333 tpDphHashNode pStaDs = NULL;
2334
2335 if (NULL == pAddStaParams)
2336 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002337 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302338 goto end;
2339 }
2340
2341 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 if(pStaDs == NULL)
2343 {
2344 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002345 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 goto end;
2347 }
2348 //
2349 // TODO & FIXME_GEN4
2350 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2351 //
2352 //TODO: any check for pMac->lim.gLimMlmState ?
2353 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2354 {
2355 //TODO: any response to be sent out here ?
2356 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002357 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 pStaDs->mlmStaContext.mlmState);
2359 goto end;
2360 }
2361 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2362 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002363 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 limRejectAssociation(pMac, pStaDs->staAddr,
2365 pStaDs->mlmStaContext.subType,
2366 true, pStaDs->mlmStaContext.authType,
2367 pStaDs->assocId, true,
2368 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2369 psessionEntry);
2370 goto end;
2371 }
2372 pStaDs->bssId = pAddStaParams->bssIdx;
2373 pStaDs->staIndex = pAddStaParams->staIdx;
2374 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2375 pStaDs->valid = 1;
2376 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2377 limLog( pMac, LOG1,
2378 FL("STA AssocID %d staId %d MAC "),
2379 pStaDs->assocId,
2380 pStaDs->staIndex);
2381 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2382
2383 /* For BTAMP-AP, the flow sequence shall be:
2384 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2385 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2386 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2387 */
2388 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2389 // fall though to reclaim the original Add STA Response message
2390end:
2391 if( 0 != limMsgQ->bodyptr )
2392 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302393 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002394 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 }
2396 return;
2397}
2398
2399/**
2400 * limProcessApMlmAddBssRsp()
2401 *
2402 *FUNCTION:
2403 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2404 * Upon receipt of this message from HAL, MLME -
2405 * > Validates the result of WDA_ADD_BSS_REQ
2406 * > Init other remaining LIM variables
2407 * > Init the AID pool, for that BSSID
2408 * > Init the Pre-AUTH list, for that BSSID
2409 * > Create LIM timers, specific to that BSSID
2410 * > Init DPH related parameters that are specific to that BSSID
2411 * > TODO - When do we do the actual change channel?
2412 *
2413 *LOGIC:
2414 * SME sends eWNI_SME_START_BSS_REQ to LIM
2415 * LIM sends LIM_MLM_START_REQ to MLME
2416 * MLME sends WDA_ADD_BSS_REQ to HAL
2417 * HAL responds with WDA_ADD_BSS_RSP to MLME
2418 * MLME responds with LIM_MLM_START_CNF to LIM
2419 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2420 *
2421 *ASSUMPTIONS:
2422 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2423 * tSirMsgQ.body will now be freed by this routine
2424 *
2425 *NOTE:
2426 *
2427 * @param pMac Pointer to Global MAC structure
2428 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2429 *
2430 * @return None
2431 */
2432static void
2433limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2434{
2435 tLimMlmStartCnf mlmStartCnf;
2436 tANI_U32 val;
2437 tpPESession psessionEntry;
2438// tANI_U8 sessionId;
2439 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2440 if(NULL == pAddBssParams )
2441 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002442 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 goto end;
2444 }
2445 //TBD: free the memory before returning, do it for all places where lookup fails.
2446 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2447 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002448 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002449 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002450 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302451 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002452 limMsgQ->bodyptr = NULL;
2453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 return;
2455 }
2456 /* Update PE session Id*/
2457 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2458 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2459 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002460 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2462 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2463 goto end;
2464 // Set MLME state
2465 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002466 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2468 {
2469 /** IBSS is 'active' when we receive
2470 * Beacon frames from other STAs that are part of same IBSS.
2471 * Mark internal state as inactive until then.
2472 */
2473 psessionEntry->limIbssActive = false;
2474 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2475 limResetHBPktCount( psessionEntry );
2476 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002477 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002478 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002479 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 }
2481 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2482
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002484
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2486 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2487 else
2488 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 schEdcaProfileUpdate(pMac, psessionEntry);
2490 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002491 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 // Create timers used by LIM
2493 if (!pMac->lim.gLimTimersCreated)
2494 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002495
2496 // Start OLBC timer
2497 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2498 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002499 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002500 }
2501
Jeff Johnson295189b2012-06-20 16:38:30 -07002502 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2503 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002504 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2506 // Apply previously set configuration at HW
2507 limApplyConfiguration(pMac,psessionEntry);
2508 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2509 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2510 }
2511 else
2512 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002513 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2515 }
2516 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2517 end:
2518 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002519 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302520 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002521 limMsgQ->bodyptr = NULL;
2522 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002523}
2524
2525
2526/**
2527 * limProcessIbssMlmAddBssRsp()
2528 *
2529 *FUNCTION:
2530 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2531 * Upon receipt of this message from HAL, MLME -
2532 * > Validates the result of WDA_ADD_BSS_REQ
2533 * > Init other remaining LIM variables
2534 * > Init the AID pool, for that BSSID
2535 * > Init the Pre-AUTH list, for that BSSID
2536 * > Create LIM timers, specific to that BSSID
2537 * > Init DPH related parameters that are specific to that BSSID
2538 * > TODO - When do we do the actual change channel?
2539 *
2540 *LOGIC:
2541 * SME sends eWNI_SME_START_BSS_REQ to LIM
2542 * LIM sends LIM_MLM_START_REQ to MLME
2543 * MLME sends WDA_ADD_BSS_REQ to HAL
2544 * HAL responds with WDA_ADD_BSS_RSP to MLME
2545 * MLME responds with LIM_MLM_START_CNF to LIM
2546 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2547 *
2548 *ASSUMPTIONS:
2549 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2550 * tSirMsgQ.body will now be freed by this routine
2551 *
2552 *NOTE:
2553 *
2554 * @param pMac Pointer to Global MAC structure
2555 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2556 *
2557 * @return None
2558 */
2559static void
2560limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2561{
2562 tLimMlmStartCnf mlmStartCnf;
2563 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2564 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302565
2566 if (NULL == pAddBssParams)
2567 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002568 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302569 goto end;
2570 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002573 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2575 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2576 goto end;
2577 // Set MLME state
2578 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002579 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 /** IBSS is 'active' when we receive
2581 * Beacon frames from other STAs that are part of same IBSS.
2582 * Mark internal state as inactive until then.
2583 */
2584 psessionEntry->limIbssActive = false;
2585 limResetHBPktCount( psessionEntry );
2586 /* Timer related functions are not modified for BT-AMP : To be Done */
2587 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002588 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002589 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002590 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2592 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2593 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2594 schEdcaProfileUpdate(pMac, psessionEntry);
2595 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2596 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002597 if (0 == psessionEntry->freePeerIdxHead)
2598 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 // Create timers used by LIM
2600#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2601 if (!pMac->lim.gLimTimersCreated)
2602 limCreateTimers(pMac);
2603#endif
2604 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2605 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002606 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2608 // Apply previously set configuration at HW
2609 limApplyConfiguration(pMac,psessionEntry);
2610 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2611 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2612 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2613 if(true == pMac->lim.gLimIbssCoalescingHappened)
2614 {
2615 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2616 goto end;
2617 }
2618 }
2619 else
2620 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002621 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 pAddBssParams->status );
2623 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2624 }
2625 //Send this message to SME, when ADD_BSS is initiated by SME
2626 //If ADD_BSS is done as part of coalescing, this won't happen.
2627 /* Update PE session Id*/
2628 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2629 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2630 end:
2631 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002632 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302633 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002634 limMsgQ->bodyptr = NULL;
2635 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002636}
2637
2638static void
2639limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2640{
2641 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2642 tAniAuthType cfgAuthType, authMode;
2643 tLimMlmAuthReq *pMlmAuthReq;
2644 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302645
2646 if (NULL == pAddBssParams)
2647 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002648 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302649 goto joinFailure;
2650 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2652 {
2653 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2654 {
2655 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002656 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2658 goto joinFailure;
2659 }
2660 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2661 //Success, handle below
2662 pStaDs->bssId = pAddBssParams->bssIdx;
2663 //STA Index(genr by HAL) for the BSS entry is stored here
2664 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2665 // Trigger Authentication with AP
2666 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2667 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2668 {
2669 /**
2670 * Could not get AuthType from CFG.
2671 * Log error.
2672 */
2673 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002674 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 }
2676 if (cfgAuthType == eSIR_AUTO_SWITCH)
2677 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2678 else
2679 authMode = cfgAuthType;
2680
2681 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302682 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2683 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 {
2685 // Log error
2686 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302687 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 return;
2689 }
2690 #if 0
2691 val = sizeof(tSirMacAddr);
2692 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2693 pMlmAuthReq->peerMacAddr,
2694 &val) != eSIR_SUCCESS)
2695 {
2696 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002697 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 }
2699 #endif //TO SUPPORT BT-AMP
2700 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2701
2702 pMlmAuthReq->authType = authMode;
2703 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2704 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2705 != eSIR_SUCCESS)
2706 {
2707 /**
2708 * Could not get AuthFailureTimeout
2709 * value from CFG. Log error.
2710 */
2711 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002712 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 }
2714 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2715 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2716 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002717 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2719 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2720 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2721 // remember staId in case of assoc timeout/failure handling
2722 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2723
Jeff Johnsone7245742012-09-05 17:12:55 -07002724 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 limPostMlmMessage(pMac,
2726 LIM_MLM_AUTH_REQ,
2727 (tANI_U32 *) pMlmAuthReq);
2728 return;
2729 }
2730
2731joinFailure:
2732 {
2733 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002734 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002735
2736 /// Send Join response to Host
2737 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2738
2739 }
2740
2741}
2742
2743#ifdef WLAN_FEATURE_VOWIFI_11R
2744/*------------------------------------------------------------------------------------------
2745 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002746 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2747 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 *
2749 *
2750 *------------------------------------------------------------------------------------------
2751 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002752static inline void
2753limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002754{
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002756 tpDphHashNode pStaDs = NULL;
2757 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002758 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002759 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002760 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002761
2762 if (pAddBssParams == NULL)
2763 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002764 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002765 goto end;
2766 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002767 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2768 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002769 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002770 goto end;
2771 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002772 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2773 {
2774 goto end;
2775 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002776
2777 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2778 &psessionEntry->dph.dphHashTable)) == NULL)
2779 {
2780 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002781 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2783 goto end;
2784 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 // Prepare and send Reassociation request frame
2786 // start reassoc timer.
2787 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2788 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002789 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2791 != TX_SUCCESS)
2792 {
2793 /// Could not start reassoc failure timer.
2794 // Log error
2795 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002796 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 // Return Reassoc confirm with
2798 // Resources Unavailable
2799 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2800 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2801 goto end;
2802 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002803#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2804 pMac->lim.pSessionEntry = psessionEntry;
2805 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2806 {
2807 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302808 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2809 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2810 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2811 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2812 psessionEntry->pLimMlmReassocReq,
2813 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002814 }
2815 pMac->lim.reAssocRetryAttempt = 0;
2816#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002818
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2820 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002821 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002822 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2824
2825 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2826
2827 //Success, handle below
2828 pStaDs->bssId = pAddBssParams->bssIdx;
2829 //STA Index(genr by HAL) for the BSS entry is stored here
2830 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2831 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2832 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2833
Jeff Johnson295189b2012-06-20 16:38:30 -07002834#if defined WLAN_FEATURE_VOWIFI
2835 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2836#endif
2837
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302838 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2839 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302841 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002842 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302844 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002845
2846 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302847 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2848 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002849
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302850 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2851 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002852
2853 // Update this when we get reassoc rsp , with success.
2854 // pAddStaParams->assocId = psessionEntry->limAID;
2855
2856 pAddStaParams->staType = STA_ENTRY_SELF;
2857 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2858 pAddStaParams->respReqd = 1;
2859
2860 /* Update PE session ID */
2861 pAddStaParams->sessionId = psessionEntry->peSessionId;
2862
2863 // This will indicate HAL to "allocate" a new STA index
2864 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2865 pAddStaParams->updateSta = FALSE;
2866
2867 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002868#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002869 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07002870#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002871 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002872#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002873
Jeff Johnsone7245742012-09-05 17:12:55 -07002874 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002877#ifdef DISABLE_GF_FOR_INTEROP
2878 /*
2879 * To resolve the interop problem with Broadcom AP,
2880 * where TQ STA could not pass traffic with GF enabled,
2881 * TQ STA will do Greenfield only with TQ AP, for
2882 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002883 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2885 {
2886 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2887 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2888 }
2889 else
2890#endif
2891
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2893 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2894 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2895 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2896 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2897 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2898 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2899 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2900 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2901 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2902 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2903 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002904 }
2905
2906 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002907 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2909
2910 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2911
2912 // Lets save this for when we receive the Reassoc Rsp
2913 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002914
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002915 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002916 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002917 vos_mem_free(pAddBssParams);
2918 pAddBssParams = NULL;
2919 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002920 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 return;
2922
2923end:
2924 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002925 if (psessionEntry != NULL)
2926 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002928 vos_mem_free(psessionEntry->pLimMlmReassocReq);
2929 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002931
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002932 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002933 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002934 vos_mem_free(pAddBssParams);
2935 pAddBssParams = NULL;
2936 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002937 }
2938
2939 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2940 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302941 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002942 if (psessionEntry != NULL)
2943 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002944 else
2945 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002946
2947 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2948}
Jeff Johnson295189b2012-06-20 16:38:30 -07002949#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07002950/**
2951 * limProcessStaMlmAddBssRsp()
2952 *
2953 *FUNCTION:
2954 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2955 * Upon receipt of this message from HAL, MLME -
2956 * > Validates the result of WDA_ADD_BSS_REQ
2957 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2958 *
2959 *LOGIC:
2960 * MLME had sent WDA_ADD_BSS_REQ to HAL
2961 * HAL responded with WDA_ADD_BSS_RSP to MLME
2962 * MLME now sends WDA_ADD_STA_REQ to HAL
2963 *
2964 *ASSUMPTIONS:
2965 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2966 * tSirMsgQ.body will now be freed by this routine
2967 *
2968 *NOTE:
2969 *
2970 * @param pMac Pointer to Global MAC structure
2971 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2972 *
2973 * @return None
2974 */
2975static void
2976limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2977{
2978 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2979 tLimMlmAssocCnf mlmAssocCnf;
2980 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2981 tANI_U32 subType = LIM_ASSOC;
2982 tpDphHashNode pStaDs = NULL;
2983 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
2984 tANI_U8 updateSta = false;
2985 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
2986
2987 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
2988 {
2989 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
2990 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
2991 goto end;
2992 }
2993 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
2994 {
2995 mesgType = LIM_MLM_REASSOC_CNF;
2996 subType = LIM_REASSOC;
2997 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
2998 //to update the existing STA entry.
2999 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3000 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3001 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3002 {
3003 staIdx = psessionEntry->staId;
3004 updateSta = true;
3005 }
3006 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003007
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003008 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003009 goto end;
3010
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3012 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003013#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3015 {
3016#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003017 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 psessionEntry->limMlmState,
3019 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3020#endif
3021 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3022 goto end;
3023 }
3024#endif /* WLAN_FEATURE_VOWIFI_11R */
3025
3026 // Set MLME state
3027 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003028 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3030 // Now, send WDA_ADD_STA_REQ
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003031 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3033 if (pStaDs == NULL)
3034 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003035 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3037 }
3038 else
3039 {
3040 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3041 //Success, handle below
3042 pStaDs->bssId = pAddBssParams->bssIdx;
3043 //STA Index(genr by HAL) for the BSS entry is stored here
3044 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3045 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3046 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3047 // Downgrade the EDCA parameters if needed
3048 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3049 // Send the active EDCA parameters to HAL
3050 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3051 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3052 } else {
3053 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3054 }
3055#if defined WLAN_FEATURE_VOWIFI
3056 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3057#endif
3058
3059 if (subType == LIM_REASSOC)
3060 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3061 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3062 {
3063 // Add STA context at HW
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003064 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3066 }
3067 }
3068 }
3069 else
3070 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003071 limLog( pMac, LOGP, FL( "ADD_BSS failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 // Return Assoc confirm to SME with failure
3073 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3074 }
3075
3076 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3077 {
3078 /* Update PE session Id*/
3079 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3080 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3081 }
3082 end:
3083 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003084 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303085 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003086 limMsgQ->bodyptr = NULL;
3087 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003088}
3089
3090
3091
3092/**
3093 * limProcessMlmAddBssRsp()
3094 *
3095 *FUNCTION:
3096 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3097 * Upon receipt of this message from HAL, MLME -
3098 * > Determines the "state" in which this message was received
3099 * > Forwards it to the appropriate callback
3100 *
3101 *LOGIC:
3102 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3103 * in the following two states:
3104 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3105 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3106 * Based on these two states, this API will determine where to
3107 * route the message to
3108 *
3109 *ASSUMPTIONS:
3110 *
3111 *NOTE:
3112 *
3113 * @param pMac Pointer to Global MAC structure
3114 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3115 *
3116 * @return None
3117 */
3118void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3119{
3120 tLimMlmStartCnf mlmStartCnf;
3121 tpPESession psessionEntry;
3122 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3123
3124 if(NULL == pAddBssParams )
3125 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003126 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 return;
3128 }
3129
3130 //
3131 // TODO & FIXME_GEN4
3132 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3133 //
3134 //we need to process the deferred message since the initiating req. there might be nested request.
3135 //in the case of nested request the new request initiated from the response will take care of resetting
3136 //the deffered flag.
3137 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3138 // Validate SME/LIM state
3139 // Validate MLME state
3140 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3141 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003142 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003143 if( NULL != pAddBssParams )
3144 {
3145 vos_mem_free(pAddBssParams);
3146 limMsgQ->bodyptr = NULL;
3147 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003148 return;
3149 }
3150 /* update PE session Id*/
3151 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3152 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3153 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3154 else
3155 {
3156 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3157 {
3158 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3159 {
3160 // Mesg received from HAL in Invalid state!
3161 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003162 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 psessionEntry->limMlmState );
3164 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3165 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003166 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303167 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003168 limMsgQ->bodyptr = NULL;
3169 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003170 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3171 }
3172 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3173 {
3174 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3175 }
3176 else
3177 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3178 }
3179 else
3180 /* Called while processing assoc response */
3181 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3182 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003183
3184 if(limIsInMCC(pMac))
3185 {
3186 WDA_TrafficStatsTimerActivate(TRUE);
3187 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003188
3189#ifdef WLAN_FEATURE_11W
3190 if (psessionEntry->limRmfEnabled)
3191 {
3192 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3193 {
3194 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003195 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003196 }
3197 }
3198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003199}
3200/**
3201 * limProcessMlmSetKeyRsp()
3202 *
3203 *FUNCTION:
3204 * This function is called to process the following two
3205 * messages from HAL:
3206 * 1) WDA_SET_BSSKEY_RSP
3207 * 2) WDA_SET_STAKEY_RSP
3208 * 3) WDA_SET_STA_BCASTKEY_RSP
3209 * Upon receipt of this message from HAL,
3210 * MLME -
3211 * > Determines the "state" in which this message was received
3212 * > Forwards it to the appropriate callback
3213 *
3214 *LOGIC:
3215 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3216 * received by MLME while in the following state:
3217 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3218 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3219 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3220 * Based on this state, this API will determine where to
3221 * route the message to
3222 *
3223 *ASSUMPTIONS:
3224 * ONLY the MLME state is being taken into account for now.
3225 * This is because, it appears that the handling of the
3226 * SETKEYS REQ is handled symmetrically on both the AP & STA
3227 *
3228 *NOTE:
3229 *
3230 * @param pMac Pointer to Global MAC structure
3231 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3232 *
3233 * @return None
3234 */
3235void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3236{
Jeff Johnsone7245742012-09-05 17:12:55 -07003237 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003238 tLimMlmSetKeysCnf mlmSetKeysCnf;
3239 tANI_U8 sessionId = 0;
3240 tpPESession psessionEntry;
3241 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303242 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003244 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003246 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 return;
3248 }
3249 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3250 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3251 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003252 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303253 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003254 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 return;
3256 }
3257 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3258 {
3259 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003260 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 // There's not much that MLME can do at this stage...
3262 respReqd = 0;
3263 }
3264 else
3265 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3266
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303267 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003268 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 if( respReqd )
3273 {
3274 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3275 // Prepare and Send LIM_MLM_SETKEYS_CNF
3276 if( NULL != lpLimMlmSetKeysReq )
3277 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303278 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3279 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3280 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303282 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 pMac->lim.gpLimMlmSetKeysReq = NULL;
3284 }
3285 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003286 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 }
3288}
3289void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3290{
3291 tANI_U8 respReqd = 1;
3292 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003293 tANI_U16 resultCode;
3294 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 tpPESession psessionEntry;
3296 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303297 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003299 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003301 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 return;
3303 }
3304 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3305 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3306 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003307 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303308 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003309 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 return;
3311 }
3312 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3313 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3314 else
3315 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3316
Jeff Johnsone7245742012-09-05 17:12:55 -07003317 //
3318 // TODO & FIXME_GEN4
3319 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3320 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3322 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3323 //{
3324 // Validate MLME state
3325 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3326 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3327 {
3328 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003329 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 // There's not much that MLME can do at this stage...
3331 respReqd = 0;
3332 }
3333 else
3334 mlmSetKeysCnf.resultCode = resultCode;
3335
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303336 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003337 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3340
Jeff Johnsone7245742012-09-05 17:12:55 -07003341 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 if( respReqd )
3343 {
3344 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3345 mlmSetKeysCnf.sessionId = sessionId;
3346
3347 // Prepare and Send LIM_MLM_SETKEYS_CNF
3348 if( NULL != lpLimMlmSetKeysReq )
3349 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303350 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3351 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3352 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003353 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303354 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 pMac->lim.gpLimMlmSetKeysReq = NULL;
3356 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003357 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003358 }
3359}
3360/**
3361 * limProcessMlmRemoveKeyRsp()
3362 *
3363 *FUNCTION:
3364 *
3365 *LOGIC:
3366 *
3367 *ASSUMPTIONS:
3368 *
3369 *NOTE:
3370 *
3371 * @param pMac Pointer to Global MAC structure
3372 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3373 *
3374 * @return None
3375 */
3376void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3377{
Jeff Johnsone7245742012-09-05 17:12:55 -07003378 tANI_U8 respReqd = 1;
3379 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3380 tANI_U16 resultCode;
3381 tANI_U8 sessionId = 0;
3382 tpPESession psessionEntry;
3383 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303384 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003385
3386 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003387 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003388 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003389 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 }
3391
Jeff Johnsone7245742012-09-05 17:12:55 -07003392 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3393 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3394 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3395 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003396
Jeff Johnsone7245742012-09-05 17:12:55 -07003397 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003399 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003400 return;
3401 }
3402
3403 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3404 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3405 else
3406 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3407
3408 // Validate MLME state
3409 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3410 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3411 {
3412 // Mesg received from HAL in Invalid state!
3413 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003414 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003415 limMsgQ->type,
3416 psessionEntry->limMlmState );
3417 respReqd = 0;
3418 }
3419 else
3420 mlmRemoveCnf.resultCode = resultCode;
3421
3422 //
3423 // TODO & FIXME_GEN4
3424 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3425 //
3426
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303427 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003428 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003429
3430 // Restore MLME state
3431 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3432 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3433
3434 if( respReqd )
3435 {
3436 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3437 mlmRemoveCnf.sessionId = sessionId;
3438
3439 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3440 if( NULL != lpLimMlmRemoveKeyReq )
3441 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303442 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3443 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3444 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003445 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303446 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3448 }
3449 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3450 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003451}
3452
Jeff Johnson295189b2012-06-20 16:38:30 -07003453
3454/** ---------------------------------------------------------------------
3455\fn limProcessInitScanRsp
3456\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3457\ message from HAL. If status code is failure, then
3458\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3459\param tpAniSirGlobal pMac
3460\param tANI_U32 body
3461\return none
3462\ ----------------------------------------------------------------------- */
3463void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3464{
3465 tpInitScanParams pInitScanParam;
3466 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003467 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3468 pInitScanParam = (tpInitScanParams) body;
3469 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303470 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003471
3472 //Only abort scan if the we are scanning.
3473 if( pMac->lim.abortScan &&
3474 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3475 {
krunal sonid3d60e12013-07-17 13:24:09 -07003476 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 pMac->lim.abortScan = 0;
3478 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3479 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3480 //Set the resume channel to Any valid channel (invalid).
3481 //This will instruct HAL to set it to any previous valid channel.
3482 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003483 if (status != eHAL_STATUS_SUCCESS)
3484 {
3485 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3486 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3487 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3488 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3489 return;
3490 }
3491 else
3492 {
3493 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3494 }
3495
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 }
3497 switch(pMac->lim.gLimHalScanState)
3498 {
3499 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3500 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3501 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003502 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3504 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3505 /*
3506 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3507 * another Scan request in the same context (happens when 11d is enabled
3508 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3509 * scan in the same context but with bigger channel list), so the state needs to be
3510 * changed before this response message is sent.
3511 */
3512 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 return;
3514 }
3515 else if (status == eHAL_STATUS_SUCCESS)
3516 {
3517 /* since we have successfully triggered a background scan,
3518 * reset the "consecutive bkgnd scan failure" count to 0
3519 */
3520 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3521 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
3522 }
3523 limContinueChannelScan(pMac);
3524 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003525//WLAN_SUSPEND_LINK Related
3526 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3527 if( pMac->lim.gpLimSuspendCallback )
3528 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303529 if( eHAL_STATUS_SUCCESS == status )
3530 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003531 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303532 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003533 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303534 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003535 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303536 pMac->lim.gLimSystemInScanLearnMode = 0;
3537 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003538
3539 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3540 pMac->lim.gpLimSuspendCallback = NULL;
3541 pMac->lim.gpLimSuspendData = NULL;
3542 }
3543 else
3544 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003545 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 return;
3547 }
3548 break;
3549//end WLAN_SUSPEND_LINK Related
3550 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003551 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003552 pMac->lim.gLimHalScanState);
3553 break;
3554 }
3555 return;
3556}
3557/**
3558 * limProcessSwitchChannelReAssocReq()
3559 *
3560 *FUNCTION:
3561 * This function is called to send the reassoc req mgmt frame after the
3562 * switchChannelRsp message is received from HAL.
3563 *
3564 *LOGIC:
3565 *
3566 *ASSUMPTIONS:
3567 * NA
3568 *
3569 *NOTE:
3570 * NA
3571 *
3572 * @param pMac - Pointer to Global MAC structure.
3573 * @param psessionEntry - session related information.
3574 * @param status - channel switch success/failure.
3575 *
3576 * @return None
3577 */
3578static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3579{
3580 tLimMlmReassocCnf mlmReassocCnf;
3581 tLimMlmReassocReq *pMlmReassocReq;
3582 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3583 if(pMlmReassocReq == NULL)
3584 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003585 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3587 goto end;
3588 }
3589
3590 if(status != eHAL_STATUS_SUCCESS)
3591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003592 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3594 goto end;
3595 }
3596 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003597 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003598 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3599 != TX_SUCCESS)
3600 {
3601 /// Could not start reassoc failure timer.
3602 // Log error
3603 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003604 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 // Return Reassoc confirm with
3606 // Resources Unavailable
3607 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3608 goto end;
3609 }
3610 /// Prepare and send Reassociation request frame
3611 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3612 return;
3613end:
3614 // Free up buffer allocated for reassocReq
3615 if(pMlmReassocReq != NULL)
3616 {
3617 /* Update PE session Id*/
3618 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303619 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003620 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 }
3622 else
3623 {
3624 mlmReassocCnf.sessionId = 0;
3625 }
3626
3627 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3628 /* Update PE sessio Id*/
3629 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3630
3631 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3632}
3633/**
3634 * limProcessSwitchChannelJoinReq()
3635 *
3636 *FUNCTION:
3637 * This function is called to send the probe req mgmt frame after the
3638 * switchChannelRsp message is received from HAL.
3639 *
3640 *LOGIC:
3641 *
3642 *ASSUMPTIONS:
3643 * NA
3644 *
3645 *NOTE:
3646 * NA
3647 *
3648 * @param pMac - Pointer to Global MAC structure.
3649 * @param psessionEntry - session related information.
3650 * @param status - channel switch success/failure.
3651 *
3652 * @return None
3653 */
3654static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3655{
3656 tANI_U32 val;
3657 tSirMacSSid ssId;
3658 tLimMlmJoinCnf mlmJoinCnf;
3659 if(status != eHAL_STATUS_SUCCESS)
3660 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003661 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 goto error;
3663 }
3664
3665 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3666 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003667 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 goto error;
3669 }
3670
Jeff Johnsone7245742012-09-05 17:12:55 -07003671
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3673 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3674 {
3675 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3676 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
3677 goto error;
3678 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003679
3680 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3681 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003682 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3684 // Apply previously set configuration at HW
3685 limApplyConfiguration(pMac, psessionEntry);
3686 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303687 vos_mem_copy(ssId.ssId,
3688 psessionEntry->ssId.ssId,
3689 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003691
3692 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3693
3694 //assign appropriate sessionId to the timer object
3695 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 // include additional IE if there is
3697 limSendProbeReqMgmtFrame( pMac, &ssId,
3698 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3699 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3700 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003701
3702 // Sending mgmt frame is a blocking call activate Join failure timer now
3703 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3704 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3705 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003706 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003707 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3708 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3709 //memory is freed up below.
3710 psessionEntry->pLimMlmJoinReq = NULL;
3711 goto error;
3712 }
3713
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003714 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3715 {
Yathish9f22e662012-12-10 14:21:35 -08003716 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003717 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3718 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003719 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003720 goto error;
3721 }
3722 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003723
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 return;
3725error:
3726 if(NULL != psessionEntry)
3727 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303728 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003729 psessionEntry->pLimMlmJoinReq = NULL;
3730 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3731 }
3732 else
3733 {
3734 mlmJoinCnf.sessionId = 0;
3735 }
3736 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3737 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3738 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3739}
3740
3741/**
3742 * limProcessSwitchChannelRsp()
3743 *
3744 *FUNCTION:
3745 * This function is called to process switchChannelRsp message from HAL.
3746 *
3747 *LOGIC:
3748 *
3749 *ASSUMPTIONS:
3750 * NA
3751 *
3752 *NOTE:
3753 * NA
3754 *
3755 * @param pMac - Pointer to Global MAC structure
3756 * @param body - message body.
3757 *
3758 * @return None
3759 */
3760void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3761{
3762 tpSwitchChannelParams pChnlParams = NULL;
3763 eHalStatus status;
3764 tANI_U16 channelChangeReasonCode;
3765 tANI_U8 peSessionId;
3766 tpPESession psessionEntry;
3767 //we need to process the deferred message since the initiating req. there might be nested request.
3768 //in the case of nested request the new request initiated from the response will take care of resetting
3769 //the deffered flag.
3770 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3771 pChnlParams = (tpSwitchChannelParams) body;
3772 status = pChnlParams->status;
3773 peSessionId = pChnlParams->peSessionId;
3774 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3775 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303776 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003777 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 return;
3779 }
3780#if defined WLAN_FEATURE_VOWIFI
3781 //HAL fills in the tx power used for mgmt frames in this field.
3782 //Store this value to use in TPC report IE.
3783 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3784#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303785 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003786 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3787 // initialize it back to invalid id
3788 psessionEntry->channelChangeReasonCode = 0xBAD;
3789 switch(channelChangeReasonCode)
3790 {
3791 case LIM_SWITCH_CHANNEL_REASSOC:
3792 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3793 break;
3794 case LIM_SWITCH_CHANNEL_JOIN:
3795 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3796 break;
3797
3798 case LIM_SWITCH_CHANNEL_OPERATION:
3799 /*
3800 * The above code should also use the callback.
3801 * mechanism below, there is scope for cleanup here.
3802 * THat way all this response handler does is call the call back
3803 * We can get rid of the reason code here.
3804 */
3805 if (pMac->lim.gpchangeChannelCallback)
3806 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003807 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3809 }
3810 break;
3811 default:
3812 break;
3813 }
3814}
3815/**
3816 * limProcessStartScanRsp()
3817 *
3818 *FUNCTION:
3819 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3820 * then it will start scan/learn on the next channel.
3821 *
3822 *LOGIC:
3823 *
3824 *ASSUMPTIONS:
3825 * NA
3826 *
3827 *NOTE:
3828 * NA
3829 *
3830 * @param pMac - Pointer to Global MAC structure
3831 * @param body - message body.
3832 *
3833 * @return None
3834 */
3835
3836void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3837{
3838 tpStartScanParams pStartScanParam;
3839 eHalStatus status;
3840 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3841 pStartScanParam = (tpStartScanParams) body;
3842 status = pStartScanParam->status;
3843#if defined WLAN_FEATURE_VOWIFI
3844 //HAL fills in the tx power used for mgmt frames in this field.
3845 //Store this value to use in TPC report IE.
3846 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3847 //Store start TSF of scan start. This will be stored in BSS params.
3848 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3849#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303850 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003851 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003852 if( pMac->lim.abortScan )
3853 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003854 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 pMac->lim.abortScan = 0;
3856 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3857 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3858 //Set the resume channel to Any valid channel (invalid).
3859 //This will instruct HAL to set it to any previous valid channel.
3860 peSetResumeChannel(pMac, 0, 0);
3861 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3862 }
3863 switch(pMac->lim.gLimHalScanState)
3864 {
3865 case eLIM_HAL_START_SCAN_WAIT_STATE:
3866 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3867 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003868 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003869 //
3870 // FIXME - With this, LIM will try and recover state, but
3871 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3872 // status back to the SME
3873 //
3874 //Set the resume channel to Any valid channel (invalid).
3875 //This will instruct HAL to set it to any previous valid channel.
3876 peSetResumeChannel(pMac, 0, 0);
3877 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3878 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3879 }
3880 else
3881 {
3882 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3883 limContinuePostChannelScan(pMac);
3884 }
3885 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003887 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 pMac->lim.gLimHalScanState);
3889 break;
3890 }
3891 return;
3892}
3893void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3894{
3895 tpEndScanParams pEndScanParam;
3896 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003897 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3898 pEndScanParam = (tpEndScanParams) body;
3899 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303900 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003901 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003902 switch(pMac->lim.gLimHalScanState)
3903 {
3904 case eLIM_HAL_END_SCAN_WAIT_STATE:
3905 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3906 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003907 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3909 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3910 }
3911 else
3912 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08003913 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 limContinueChannelScan(pMac);
3915 }
3916 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003918 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 pMac->lim.gLimHalScanState);
3920 break;
3921 }
3922 return;
3923}
Jeff Johnsone7245742012-09-05 17:12:55 -07003924/**
3925 * limStopTxAndSwitch()
3926 *
3927 *FUNCTION:
3928 * Start channel switch on all sessions that is in channel switch state.
3929 *
3930 * @param pMac - pointer to global adapter context
3931 *
3932 * @return None
3933 *
3934 */
3935static void
3936limStopTxAndSwitch (tpAniSirGlobal pMac)
3937{
3938 tANI_U8 i;
3939
3940 for(i =0; i < pMac->lim.maxBssId; i++)
3941 {
3942 if(pMac->lim.gpSession[i].valid &&
3943 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
3944 {
3945 limStopTxAndSwitchChannel(pMac, i);
3946 }
3947 }
3948 return;
3949}
3950/**
3951 * limStartQuietOnSession()
3952 *
3953 *FUNCTION:
3954 * This function is called to start quiet timer after finish scan if there is
3955 * qeuieting on any session.
3956 *
3957 *LOGIC:
3958 *
3959 *ASSUMPTIONS:
3960 * NA
3961 *
3962 *NOTE:
3963 * NA
3964 *
3965 * @param pMac - Pointer to Global MAC structure
3966 *
3967 * @return None
3968 */
3969static void
3970limStartQuietOnSession (tpAniSirGlobal pMac)
3971{
3972 tANI_U8 i;
3973
3974 for(i =0; i < pMac->lim.maxBssId; i++)
3975 {
3976 if(pMac->lim.gpSession[i].valid &&
3977 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
3978 {
3979 limStartQuietTimer(pMac, i);
3980 }
3981 }
3982 return;
3983}
Jeff Johnson295189b2012-06-20 16:38:30 -07003984void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
3985{
3986 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07003987 eHalStatus status;
3988 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3989 pFinishScanParam = (tpFinishScanParams) body;
3990 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303991 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003992 body = NULL;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07003993
3994 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp in state %d"),
3995 pMac->lim.gLimHalScanState);
3996
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 switch(pMac->lim.gLimHalScanState)
3998 {
3999 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4000 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4001 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004002 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 {
4004 /** Right time to stop tx and start the timer for channel switch */
4005 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4006 * be any associated session id
4007 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004008 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004010 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 {
4012 /** Start the quieting */
4013 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4014 * be any associated session id
4015 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004016 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004018 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4019 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004020 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004021 }
4022 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004023//WLAN_SUSPEND_LINK Related
4024 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4025 if( pMac->lim.gpLimResumeCallback )
4026 {
4027 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4028 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4029 pMac->lim.gpLimResumeCallback = NULL;
4030 pMac->lim.gpLimResumeData = NULL;
4031 pMac->lim.gLimSystemInScanLearnMode = 0;
4032 }
4033 else
4034 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004035 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07004036 return;
4037 }
4038 break;
4039//end WLAN_SUSPEND_LINK Related
4040
4041 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004042 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 pMac->lim.gLimHalScanState);
4044 break;
4045 }
4046 return;
4047}
4048/**
4049 * @function : limProcessMlmHalAddBARsp
4050 *
4051 * @brief: Process WDA_ADDBA_RSP coming from HAL
4052 *
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 limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4061 tpSirMsgQ limMsgQ )
4062{
4063 // Send LIM_MLM_ADDBA_CNF to LIM
4064 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004065 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004067
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 //now LIM can process any defer message.
4069 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4070 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004071 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 return;
4073 }
4074 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4075 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004076 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304077 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004078 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004079 return;
4080 }
4081#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4082 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4083#endif //FEATURE_WLAN_DIAG_SUPPORT
4084
4085 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304086 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4087 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004088 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304089 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004090 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004091 return;
4092 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304093 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304095 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4096 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 // Copy other ADDBA Rsp parameters
4098 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4099 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4100 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4101 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4102 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4103 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4104 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4105 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4106 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4107 else
4108 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304109 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004110 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 // Send ADDBA CNF to LIM
4112 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4113}
4114/**
4115 * \brief Process LIM_MLM_ADDBA_CNF
4116 *
4117 * \sa limProcessMlmAddBACnf
4118 *
4119 * \param pMac The global tpAniSirGlobal object
4120 *
4121 * \param tSirMsgQ The MsgQ header containing the response buffer
4122 *
4123 * \return none
4124 */
4125void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4126 tANI_U32 *pMsgBuf )
4127{
4128tpLimMlmAddBACnf pMlmAddBACnf;
4129tpDphHashNode pSta;
4130tANI_U16 aid;
4131tLimBAState curBaState;
4132tpPESession psessionEntry = NULL;
4133if(pMsgBuf == NULL)
4134{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004135 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004136 return;
4137}
4138pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4139 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4140 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004141 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304142 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004143 return;
4144 }
4145 // First, extract the DPH entry
4146 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4147 if( NULL == pSta )
4148 {
4149 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004150 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304151 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004152 return;
4153 }
4154 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4155 // Need to validate SME state
4156 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4157 {
4158 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004159 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304161 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 return;
4163 }
4164 // Restore STA BA state
4165 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004166 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004167 {
4168 // Update LIM internal cache...
4169 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4170 {
4171 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4172 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4173 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4174 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4175 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004176 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4177 // status code. MLME will then send an ADDBA RSP
4178 // over the air to the peer MAC entity
4179 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4180 pMlmAddBACnf->peerMacAddr,
4181 pMlmAddBACnf->addBAResultCode,
4182 pMlmAddBACnf->baDialogToken,
4183 (tANI_U8) pMlmAddBACnf->baTID,
4184 (tANI_U8) pMlmAddBACnf->baPolicy,
4185 pMlmAddBACnf->baBufferSize,
4186 pMlmAddBACnf->baTimeout,psessionEntry))
4187 {
4188 PELOGW(limLog( pMac, LOGW,
4189 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4190 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4191 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 }
4193 else
4194 {
4195 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4196 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4197 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4198 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4199 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4200 }
4201 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304203 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004204 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004205}
4206/**
4207 * \brief Process LIM_MLM_DELBA_CNF
4208 *
4209 * \sa limProcessMlmDelBACnf
4210 *
4211 * \param pMac The global tpAniSirGlobal object
4212 *
4213 * \param tSirMsgQ The MsgQ header containing the response buffer
4214 *
4215 * \return none
4216 */
4217void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4218 tANI_U32 *pMsgBuf )
4219{
4220 tpLimMlmDelBACnf pMlmDelBACnf;
4221 tpDphHashNode pSta;
4222 tANI_U16 aid;
4223// tANI_U8 sessionId;
4224 tLimBAState curBaState;
4225 tpPESession psessionEntry;
4226
4227 if(pMsgBuf == NULL)
4228 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004229 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004230 return;
4231 }
4232 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4233 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4234 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004235 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304236 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004237 return;
4238 }
4239 // First, extract the DPH entry
4240 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4241 if( NULL == pSta )
4242 {
4243 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004244 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304245 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 return;
4247 }
4248 if(NULL == pMlmDelBACnf)
4249 {
4250 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004251 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 return;
4253 }
4254 // Need to validate baState
4255 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4256 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4257 {
4258 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004259 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304261 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 return;
4263 }
4264 // Restore STA BA state
4265 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4266 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304267 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004268}
4269/**
4270 * \brief Process SIR_LIM_DEL_BA_IND
4271 *
4272 * \sa limProcessMlmHalBADeleteInd
4273 *
4274 * \param pMac The global tpAniSirGlobal object
4275 *
4276 * \param tSirMsgQ The MsgQ header containing the indication buffer
4277 *
4278 * \return none
4279 */
4280void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4281 tpSirMsgQ limMsgQ )
4282{
4283 tSirRetStatus status = eSIR_SUCCESS;
4284 tpBADeleteParams pBADeleteParams;
4285 tpDphHashNode pSta;
4286 tANI_U16 aid;
4287 tLimBAState curBaState;
4288 tpPESession psessionEntry;
4289 tANI_U8 sessionId;
4290
4291 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4292
4293 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4294 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004295 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304296 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004297 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 return;
4299 }
4300 // First, extract the DPH entry
4301 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4302 if( NULL == pSta )
4303 {
4304 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004305 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 goto returnAfterCleanup;
4307 }
4308
4309 // Need to validate BA state
4310 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4311 if( eLIM_BA_STATE_IDLE != curBaState )
4312 {
4313 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004314 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 curBaState );
4316 goto returnAfterCleanup;
4317 }
4318
4319 // Validate if a BA is active for the requested TID
4320 // AND in that desired direction
4321 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4322 {
4323 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4324 status = eSIR_FAILURE;
4325 }
4326 else
4327 {
4328 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4329 status = eSIR_FAILURE;
4330 }
4331 if( eSIR_FAILURE == status )
4332 {
4333 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004334 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 pBADeleteParams->baTID );
4336 }
4337 else
4338 {
4339 // Post DELBA REQ to MLME...
4340 if( eSIR_SUCCESS !=
4341 (status = limPostMlmDelBAReq( pMac,
4342 pSta,
4343 pBADeleteParams->baDirection,
4344 pBADeleteParams->baTID,
4345 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4346 {
4347 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004348 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 }
4350 else
4351 {
4352 limLog( pMac, LOGE,
4353 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4354 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4355 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4356 }
4357 }
4358returnAfterCleanup:
4359 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304360 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004361 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004362}
4363/**
4364 * @function : limProcessSetMimoRsp()
4365 *
4366 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4367 * after Processing the Req from the SME (PMC)
4368 *
4369 * LOGIC:
4370 *
4371 * ASSUMPTIONS:
4372 * NA
4373 *
4374 * NOTE:
4375 * NA
4376 *
4377 * @param pMac - Pointer to Global MAC structure
4378 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4379 * @return None
4380 */
4381
4382void
4383limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4384{
4385#if 0
4386 tSirRetStatus retStatus;
4387 tpSetMIMOPS pMIMO_PSParams;
4388
4389
4390 do {
4391
4392 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4393 if( NULL == pMIMO_PSParams ) {
4394 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4395 return;
4396 }
4397
4398 /** If Updation of the HAL Fail's*/
4399 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004400 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 break;
4402 }
4403
4404 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4405 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4406 break;
4407
4408 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4409 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4410
4411 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4412 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4413 * the Action Frame is being sent at first before setting the internal structures
4414 */
4415 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4416 tSirMacAddr macAddr;
4417
4418 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304419 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004420
4421 /** Send Action Frame with the corresponding mode */
4422 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4423 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004424 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 break;
4426 }
4427 }
4428 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4429 }while(0);
4430
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304431 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004432#endif
4433}
4434/**
4435 * @function : limHandleDelBssInReAssocContext
4436 * @brief : While Processing the ReAssociation Response Frame in STA,
4437 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4438 * being issued and the end of DelBSS the new BSS is being added.
4439 *
4440 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4441 * change, We need to update CSR with ReAssocCNF Response with the
4442 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4443 * context only
4444 *
4445 * @param : pMac - tpAniSirGlobal
4446 * pStaDs - Station Descriptor
4447 *
4448 * @return : none
4449 */
4450static void
4451limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4452{
4453 tLimMlmReassocCnf mlmReassocCnf;
4454 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4455 /** Set the MlmState to IDLE*/
4456 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 /* Update PE session Id*/
4458 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4459 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 case eLIM_SME_WT_REASSOC_STATE :
4461 {
4462 tpSirAssocRsp assocRsp;
4463 tpDphHashNode pStaDs;
4464 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004465 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004466 /** Delete the older STA Table entry */
4467 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4468 /**
4469 * Add an entry for AP to hash table
4470 * maintained by DPH module
4471 */
4472 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4473 {
4474 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004475 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4477 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4478 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4479 goto Error;
4480 }
4481 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4482 * is being stored to be used here for sending ADDBSS
4483 */
4484 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4485 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4486 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 limExtractApCapabilities( pMac,
4488 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4489 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4490 &beaconStruct );
4491 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4492 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4493 if(beaconStruct.erpPresent) {
4494 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4495 psessionEntry->beaconParams.fShortPreamble = 0;
4496 else
4497 psessionEntry->beaconParams.fShortPreamble = 1;
4498 }
4499 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4500 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4501 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004502 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 retStatus = eSIR_FAILURE;
4504 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 if (retStatus != eSIR_SUCCESS)
4506 {
4507 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4508 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304509 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 pMac->lim.gLimAssocResponseData = NULL;
4511 goto Error;
4512 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304513 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 psessionEntry->limAssocResponseData = NULL;
4515 }
4516 break;
4517 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4518 {
4519 /** Case wherein the DisAssoc / Deauth
4520 * being sent as response to ReAssoc Req*/
4521 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4522 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4523 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4524 /** Set the SME State back to WT_Reassoc State*/
4525 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4527 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4528 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4529 {
4530 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004531 }
4532 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4533 }
4534 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004536 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004537 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4538 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4539 goto Error;
4540 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004541 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004542Error:
4543 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4544}
4545
4546/* Added For BT -AMP Support */
4547static void
4548limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4549{
4550 tLimMlmStartCnf mlmStartCnf;
4551 tANI_U32 val;
4552 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4553
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304554 if (NULL == pAddBssParams)
4555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004556 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304557 goto end;
4558 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4560 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004561 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4563 {
4564 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4565 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4566 goto end;
4567 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4568 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4569 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4570 goto end;
4571 }
4572
4573 // Set MLME state
4574 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4575 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4576 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4577 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004578 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 // Create timers used by LIM
4580 if (!pMac->lim.gLimTimersCreated)
4581 limCreateTimers(pMac);
4582 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4583 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004584 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4586 // Apply previously set configuration at HW
4587 limApplyConfiguration(pMac,psessionEntry);
4588 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4589 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4590 }
4591 else
4592 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004593 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4595 }
4596 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4597 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4598 end:
4599 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004600 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304601 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004602 limMsgQ->bodyptr = NULL;
4603 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004604}
4605
4606/**
4607 * @function : limHandleAddBssInReAssocContext
4608 * @brief : While Processing the ReAssociation Response Frame in STA,
4609 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4610 * being issued and the end of DelBSS the new BSS is being added.
4611 *
4612 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4613 * change, We need to update CSR with ReAssocCNF Response with the
4614 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4615 * context only
4616 *
4617 * @param : pMac - tpAniSirGlobal
4618 * pStaDs - Station Descriptor
4619 *
4620 * @return : none
4621 */
4622void
4623limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4624{
4625 tLimMlmReassocCnf mlmReassocCnf;
4626 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4627 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004628 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4629 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 case eLIM_SME_WT_REASSOC_STATE : {
4632 tpSirAssocRsp assocRsp;
4633 tpDphHashNode pStaDs;
4634 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004635 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304636 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4637 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004638 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304639 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004640 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4641 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4642 goto Error;
4643 }
4644
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 // Get the AP entry from DPH hash table
4646 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4647 if (pStaDs == NULL )
4648 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004649 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4651 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304652 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 goto Error;
4654 }
4655 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4656 * is being stored to be used here for sending ADDBSS
4657 */
4658 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4659 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4660 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004661 limExtractApCapabilities( pMac,
4662 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4663 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004664 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004665 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004666 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4667
4668 if(pBeaconStruct->erpPresent)
4669 {
4670 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004671 psessionEntry->beaconParams.fShortPreamble = 0;
4672 else
4673 psessionEntry->beaconParams.fShortPreamble = 1;
4674 }
4675
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004676 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004678 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004679 retStatus = eSIR_FAILURE;
4680 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 if (retStatus != eSIR_SUCCESS)
4682 {
4683 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4684 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304685 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304687 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004688 goto Error;
4689 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304690 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304692 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004693 }
4694 break;
4695 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4696 * being sent as response to ReAssoc Req*/
4697 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4698 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4699 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4700 /** Set the SME State back to WT_Reassoc State*/
4701 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4702 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4703 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004704 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004706 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4707 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004708
4709 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4710 }
4711 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004712 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004713 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4715 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4716 goto Error;
4717 }
4718return;
4719Error:
4720 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4721}
4722
4723#if 0
4724 static void
4725limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4726{
4727 tSirSmeAssocCnf assocCnf;
4728 tpDphHashNode pStaDs;
4729 tpPESession psessionEntry;
4730 tANI_U8 sessionId;
4731
4732 if(pMsgBuf == NULL)
4733 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004734 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004735 goto end;
4736 }
4737 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4738 !__limIsSmeAssocCnfValid(&assocCnf))
4739 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004740 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 goto end;
4742 }
4743 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4744 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004745 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004746 goto end;
4747 }
4748 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4749 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4750 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004751 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4753 goto end;
4754 }
4755 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4756 if (pStaDs == NULL)
4757 {
4758 limLog(pMac, LOG1,
4759 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4760 msgType, assocCnf.aid);
4761 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4762 /*
4763 ** send a DISASSOC_IND message to WSM to make sure
4764 ** the state in WSM and LIM is the same
4765 **/
4766 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4767 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4768 goto end;
4769 }
4770 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304771 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 (tANI_U8 *) assocCnf.peerMacAddr,
4773 sizeof(tSirMacAddr)) ) ||
4774 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4775 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4776 (msgType != eWNI_SME_ASSOC_CNF)) ||
4777 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4778 (msgType != eWNI_SME_REASSOC_CNF)))))
4779 {
4780 limLog(pMac, LOG1,
4781 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4782 msgType, assocCnf.aid);
4783 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4784 goto end;
4785 }
4786 /*
4787 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4788 ** has been received
4789 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004790 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4792 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4793 {
4794 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4795 * when it had received Assoc Request frame. Now, PE just needs to send
4796 * Association Response frame to the requesting BTAMP-STA.
4797 */
4798 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004799 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004800 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4801 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4802 goto end;
4803 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4804 else
4805 {
4806 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4807 limRejectAssociation(pMac, pStaDs->staAddr,
4808 pStaDs->mlmStaContext.subType,
4809 true, pStaDs->mlmStaContext.authType,
4810 pStaDs->assocId, true,
4811 assocCnf.statusCode, psessionEntry);
4812 return;
4813 }
4814end:
4815 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4816 {
4817 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4818 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304819 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4821 }
4822
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304823 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4825 }
4826} /*** end __limProcessSmeAssocCnfNew() ***/
4827#endif
4828
Jeff Johnson295189b2012-06-20 16:38:30 -07004829void
4830limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4831 tBeaconGenParams *pBeaconGenParams = NULL;
4832 tSirMsgQ limMsg;
4833 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4834 if(psessionEntry == NULL ){
4835 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004836 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 return;
4838 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304839 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4840 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 {
4842 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304843 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004844 return;
4845 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304846 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4847 vos_mem_copy((void *) pBeaconGenParams->bssId,
4848 (void *)psessionEntry->bssId,
4849 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 limMsg.bodyptr = pBeaconGenParams;
4851 schProcessPreBeaconInd(pMac, &limMsg);
4852 return;
4853}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304854
4855void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4856 tSirResultCodes reasonCode)
4857{
4858 tANI_U16 scanRspLen = 0;
4859
4860 pMac->lim.gLimSmeScanResultLength +=
4861 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304862 pMac->lim.gLimRspReqd = false;
4863 if ((reasonCode == eSIR_SME_SUCCESS) ||
4864 pMac->lim.gLimSmeScanResultLength) {
4865 scanRspLen = sizeof(tSirSmeScanRsp) +
4866 pMac->lim.gLimSmeScanResultLength -
4867 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304868 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304869 else
4870 scanRspLen = sizeof(tSirSmeScanRsp);
4871
4872 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4873 pMac->lim.gSmeSessionId,
4874 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304875}
4876
4877
4878void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4879{
4880 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4881
4882 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004883 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304884
4885 switch (pScanEvent->event)
4886 {
4887 case SCAN_EVENT_STARTED:
4888 break;
4889 case SCAN_EVENT_START_FAILED:
4890 case SCAN_EVENT_COMPLETED:
4891 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
4892 break;
4893 case SCAN_EVENT_BSS_CHANNEL:
4894 case SCAN_EVENT_FOREIGN_CHANNEL:
4895 case SCAN_EVENT_DEQUEUED:
4896 case SCAN_EVENT_PREEMPTED:
4897 default:
4898 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004899 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304900 }
4901}