blob: bcdd62841bc716fdbd6fdeb3739ca6cd7eab2262 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2014 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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limProcessMlmRspMessages.cc contains the code
30 * for processing response messages from MLM state machine.
31 * Author: Chandra Modumudi
32 * Date: 02/11/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070039#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070040#include "cfgApi.h"
41#include "sirApi.h"
42#include "schApi.h"
43#include "utilsApi.h"
44#include "limUtils.h"
45#include "limAssocUtils.h"
46#include "limSecurityUtils.h"
47#include "limSerDesUtils.h"
48#include "limTimerUtils.h"
49#include "limSendMessages.h"
50#include "limAdmitControl.h"
51#include "limSendMessages.h"
52#include "limIbssPeerMgmt.h"
53#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070054#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#if defined WLAN_FEATURE_VOWIFI
56#include "rrmApi.h"
57#endif
58#if defined WLAN_FEATURE_VOWIFI_11R
59#include <limFT.h>
60#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070064static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070065void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070066#ifdef FEATURE_OEM_DATA_SUPPORT
67void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
68#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070069void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
70void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
71void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
72void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
73void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
74void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
86static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
87void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
88static void
89limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
90/**
91 * limProcessMlmRspMessages()
92 *
93 *FUNCTION:
94 * This function is called to processes various MLM response (CNF/IND
95 * messages from MLM State machine.
96 *
97 *LOGIC:
98 *
99 *ASSUMPTIONS:
100 *
101 *NOTE:
102 *
103 * @param pMac Pointer to Global MAC structure
104 * @param msgType Indicates the MLM message type
105 * @param *pMsgBuf A pointer to the MLM message buffer
106 *
107 * @return None
108 */
109void
110limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
111{
112
113 if(pMsgBuf == NULL)
114 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700115 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700116 return;
117 }
118 switch (msgType)
119 {
120 case LIM_MLM_SCAN_CNF:
121 limProcessMlmScanCnf(pMac, pMsgBuf);
122 break;
123
Jeff Johnsone7245742012-09-05 17:12:55 -0700124#ifdef FEATURE_OEM_DATA_SUPPORT
125 case LIM_MLM_OEM_DATA_CNF:
126 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800127 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700128 break;
129#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700130
131 case LIM_MLM_AUTH_CNF:
132 limProcessMlmAuthCnf(pMac, pMsgBuf);
133 break;
134 case LIM_MLM_AUTH_IND:
135 limProcessMlmAuthInd(pMac, pMsgBuf);
136 break;
137 case LIM_MLM_ASSOC_CNF:
138 limProcessMlmAssocCnf(pMac, pMsgBuf);
139 break;
140 case LIM_MLM_START_CNF:
141 limProcessMlmStartCnf(pMac, pMsgBuf);
142 break;
143 case LIM_MLM_JOIN_CNF:
144 limProcessMlmJoinCnf(pMac, pMsgBuf);
145 break;
146 case LIM_MLM_ASSOC_IND:
147 limProcessMlmAssocInd(pMac, pMsgBuf);
148 break;
149 case LIM_MLM_REASSOC_CNF:
150 limProcessMlmReassocCnf(pMac, pMsgBuf);
151 break;
152 case LIM_MLM_REASSOC_IND:
153 limProcessMlmReassocInd(pMac, pMsgBuf);
154 break;
155 case LIM_MLM_DISASSOC_CNF:
156 limProcessMlmDisassocCnf(pMac, pMsgBuf);
157 break;
158 case LIM_MLM_DISASSOC_IND:
159 limProcessMlmDisassocInd(pMac, pMsgBuf);
160 break;
161 case LIM_MLM_PURGE_STA_IND:
162 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
163 break;
164 case LIM_MLM_DEAUTH_CNF:
165 limProcessMlmDeauthCnf(pMac, pMsgBuf);
166 break;
167 case LIM_MLM_DEAUTH_IND:
168 limProcessMlmDeauthInd(pMac, pMsgBuf);
169 break;
170 case LIM_MLM_SETKEYS_CNF:
171 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
172 break;
173 case LIM_MLM_REMOVEKEY_CNF:
174 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
175 break;
176 case LIM_MLM_TSPEC_CNF:
177 break;
178 case LIM_MLM_ADDBA_CNF:
179 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800180 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700181 break;
182 case LIM_MLM_DELBA_CNF:
183 limProcessMlmDelBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800184 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700185 break;
186 default:
187 break;
188 } // switch (msgType)
189 return;
190} /*** end limProcessMlmRspMessages() ***/
191
192/**
193 * limProcessMlmScanCnf()
194 *
195 *FUNCTION:
196 * This function is called to processes MLM_SCAN_CNF
197 * message from MLM State machine.
198 *
199 *LOGIC:
200 *
201 *ASSUMPTIONS:
202 *
203 *NOTE:
204 *
205 * @param pMac Pointer to Global MAC structure
206 * @param pMsgBuf A pointer to the MLM message buffer
207 *
208 * @return None
209 */
210void
211limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
212{
213 switch(pMac->lim.gLimSmeState)
214 {
215 case eLIM_SME_WT_SCAN_STATE:
216 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
217 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
218 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700219 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700220 pMac->lim.gLimSystemInScanLearnMode = 0;
221 break;
222 default:
223 /**
224 * Should not have received scan confirm
225 * from MLM in other states.
226 * Log error
227 */
228 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700229 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 pMac->lim.gLimSmeState);)
231 return;
232 }
233
234 /// Process received scan confirm
235 /// Increment length of cached scan results
236 pMac->lim.gLimSmeScanResultLength +=
237 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
238 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
239 {
240 tANI_U16 scanRspLen = 0;
241 /// Need to send response to Host
242 pMac->lim.gLimRspReqd = false;
243 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
244 eSIR_SME_SUCCESS) ||
245 pMac->lim.gLimSmeScanResultLength)
246 {
247 scanRspLen = sizeof(tSirSmeScanRsp) +
248 pMac->lim.gLimSmeScanResultLength -
249 sizeof(tSirBssDescription);
250 }
251 else
252 {
253 scanRspLen = sizeof(tSirSmeScanRsp);
254 }
255 if(pMac->lim.gLimReportBackgroundScanResults)
256 {
257 pMac->lim.gLimBackgroundScanTerminate = TRUE;
258 }
259 if (pMac->lim.gLimSmeScanResultLength == 0)
260 {
261 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
262 }
263 else
264 {
265 limSendSmeScanRsp(pMac, scanRspLen,
266 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
267 }
268 } // if (pMac->lim.gLimRspReqd)
269 //check to see whether we need to run bgScan timer
270 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
271 {
272 if (tx_timer_activate(
273 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
274 {
275 /// Could not activate background scan timer.
276 // Log error
277 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700278 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 pMac->lim.gLimBackgroundScanStarted = FALSE;
280 }
281 else
282 {
283 pMac->lim.gLimBackgroundScanStarted = TRUE;
284 }
285 }
286} /*** end limProcessMlmScanCnf() ***/
287
Jeff Johnsone7245742012-09-05 17:12:55 -0700288#ifdef FEATURE_OEM_DATA_SUPPORT
289
290/**
291 * limProcessMlmOemDataReqCnf()
292 *
293 *FUNCTION:
294 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
295 * message from MLM State machine.
296 *
297 *LOGIC:
298 *
299 *ASSUMPTIONS:
300 *
301 *NOTE:
302 *
303 * @param pMac Pointer to Global MAC structure
304 * @param pMsgBuf A pointer to the MLM message buffer
305 *
306 * @return None
307 */
308
309void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
310{
311 tLimMlmOemDataRsp* measRsp;
312
313 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
314
315 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
316
317 //Now send the meas confirm message to the sme
318 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
319
320 //Dont free the memory here. It will be freed up by the callee
321
322 return;
323}
324#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700325
326/**
327 * limProcessMlmStartCnf()
328 *
329 *FUNCTION:
330 * This function is called to processes MLM_START_CNF
331 * message from MLM State machine.
332 *
333 *LOGIC:
334 *
335 *ASSUMPTIONS:
336 *
337 *NOTE:
338 *
339 * @param pMac Pointer to Global MAC structure
340 * @param pMsgBuf A pointer to the MLM message buffer
341 *
342 * @return None
343 */
344void
345limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
346{
347 tpPESession psessionEntry = NULL;
348 tLimMlmStartCnf *pLimMlmStartCnf;
349 tANI_U8 smesessionId;
350 tANI_U16 smetransactionId;
351
352 if(pMsgBuf == NULL)
353 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700354 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 return;
356 }
357 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
358 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
359 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700360 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 return;
362 }
363 smesessionId = psessionEntry->smeSessionId;
364 smetransactionId = psessionEntry->transactionId;
365
366 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
367 {
368 /**
369 * Should not have received Start confirm from MLM
370 * in other states.
371 * Log error
372 */
373 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700374 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 psessionEntry->limSmeState);)
376 return;
377 }
378 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
379 eSIR_SME_SUCCESS)
380 {
381
382 /**
383 * Update global SME state so that Beacon Generation
384 * module starts writing Beacon frames into TFP's
385 * Beacon file register.
386 */
387 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700388 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
390 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700391 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 }
393 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
394 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700395 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700402 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else
405 {
406 /// Start BSS is a failure
407 peDeleteSession(pMac,psessionEntry);
408 psessionEntry = NULL;
Leela Venkata Kiran Kumar Reddy Chiralac7a12152014-02-03 11:20:14 -0800409 PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
410 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 }
412 /// Send response to Host
413 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
414 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
415 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
417 {
418 //Configure beacon and send beacons to HAL
419 limSendBeaconInd(pMac, psessionEntry);
420 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700421}
422
423 /*** end limProcessMlmStartCnf() ***/
424
425/**
426 * limProcessMlmJoinCnf()
427 *
428 *FUNCTION:
429 * This function is called to processes MLM_JOIN_CNF
430 * message from MLM State machine.
431 *
432 *LOGIC:
433 *
434 *ASSUMPTIONS:
435 *
436 *NOTE:
437 *
438 * @param pMac Pointer to Global MAC structure
439 * @param pMsgBuf A pointer to the MLM message buffer
440 *
441 * @return None
442 */
443void
444limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
445{
446 tSirResultCodes resultCode;
447 tLimMlmJoinCnf *pLimMlmJoinCnf;
448 tpPESession psessionEntry;
449 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
450 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
451 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700452 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 return;
454 }
455
456 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
457 {
458 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700459 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 psessionEntry->limSmeState);)
461 return;
462 }
463
464 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
465 /// Process Join confirm from MLM
466 if (resultCode == eSIR_SME_SUCCESS)
467 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700468 PELOG1(limLog(pMac, LOG1, FL("*** Joined ESS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
471 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
472 return;
473 else
474 resultCode = eSIR_SME_REFUSED;
475 }
476 {
477 /// Join failure
478 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700479 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 /// Send Join response to Host
481 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
482 }
483} /*** end limProcessMlmJoinCnf() ***/
484
485/**
486 * limProcessMlmAuthCnf()
487 *
488 *FUNCTION:
489 * This function is called to processes MLM_AUTH_CNF
490 * message from MLM State machine.
491 *
492 *LOGIC:
493 *
494 *ASSUMPTIONS:
495 *
496 *NOTE:
497 *
498 * @param pMac Pointer to Global MAC structure
499 * @param pMsgBuf A pointer to the MLM message buffer
500 *
501 * @return None
502 */
503void
504limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
505{
506 tANI_U16 caps;
507 tANI_U32 val;
508 tAniAuthType cfgAuthType, authMode;
509 tLimMlmAuthReq *pMlmAuthReq;
510 tLimMlmAssocReq *pMlmAssocReq;
511 tLimMlmAuthCnf *pMlmAuthCnf;
512 tpPESession psessionEntry;
513 tANI_U32 teleBcnEn = 0;
514// tANI_U8 sessionId;
515
516 if(pMsgBuf == NULL)
517 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700518 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 return;
520 }
521 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
522 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700524 PELOGE(limLog(pMac, LOGE, FL("session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 return;
526 }
527
528 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
529 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
530 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
531 {
532 /**
533 * Should not have received AUTH confirm
534 * from MLM in other states or on AP.
535 * Log error
536 */
537 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700538 FL("received unexpected MLM_AUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 psessionEntry->limSmeState);)
540 return;
541 }
542 /// Process AUTH confirm from MLM
543 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
544 {
545 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
546 {
547 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
548 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
549 {
550 /**
551 * Could not get AuthType value from CFG.
552 * Log error.
553 */
554 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700555 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 }
557 }
558 else
559 cfgAuthType = pMac->lim.gLimPreAuthType;
560
561 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
562 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
563 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
564 {
565 /**
566 * When Open authentication fails with reason code "13" and
567 * authType set to 'auto switch', Try with Shared Authentication
568 */
569 authMode = eSIR_SHARED_KEY;
570 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530571 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
572 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 {
574 // Log error
575 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530576 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 return;
578 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530579 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 val = sizeof(tSirMacAddr);
581 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
582 {
583 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
584 }
585 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530586 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
587 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 sizeof(tSirMacAddr));
589 pMlmAuthReq->authType = authMode;
590 /* Update PE session Id*/
591 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
592 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
593 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
594 != eSIR_SUCCESS)
595 {
596 /**
597 * Could not get AuthFailureTimeout value from CFG.
598 * Log error.
599 */
600 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700601 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 }
603 limPostMlmMessage(pMac,
604 LIM_MLM_AUTH_REQ,
605 (tANI_U32 *) pMlmAuthReq);
606 return;
607 }
608 else
609 {
610 // MAC based authentication failure
611 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
612 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700613 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700617 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 /**
620 * Need to send Join response with
621 * auth failure to Host.
622 */
623 limHandleSmeJoinResult(pMac,
624 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
625 }
626 else
627 {
628 /**
629 * Pre-authentication failure.
630 * Send Pre-auth failure response to host
631 */
632 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700633 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 limSendSmeAuthRsp(
635 pMac,
636 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
637 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
638 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
639 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
640 }
641 } // end if (cfgAuthType == eAUTO_SWITCH)
642 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
643 else
644 {
645 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
646 {
647 /**
648 * Successful MAC based authentication
649 * Trigger Association with BSS
650 */
651 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700652 FL("*** Authenticated with BSS ***"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530653 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
654 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 {
656 // Log error
657 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530658 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 return;
660 }
661 val = sizeof(tSirMacAddr);
662 #if 0
663 if (cfgGetStr(pMac, WNI_CFG_BSSID,
664 pMlmAssocReq->peerMacAddr,
665 &val) != eSIR_SUCCESS)
666 {
667 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700668 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 }
670 #endif //SUPPORT BT-AMP
671 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
672 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
673 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
674 != eSIR_SUCCESS)
675 {
676 /**
677 * Could not get AssocFailureTimeout value
678 * from CFG. Log error.
679 */
680 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700681 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 }
683 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
684 {
685 /**
686 * Could not get Capabilities value
687 * from CFG. Log error.
688 */
689 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700690 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 }
692 /*Clear spectrum management bit if AP doesn't support it*/
693 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
694 {
695 /*AP doesn't support spectrum management clear spectrum management bit*/
696 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
697 }
698
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530699 /* Clear rrm bit if AP doesn't support it */
700 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
701 & LIM_RRM_BIT_MASK))
702 {
703 caps &= (~LIM_RRM_BIT_MASK);
704 }
705
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 pMlmAssocReq->capabilityInfo = caps;
707 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700708 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700710 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
711 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700712
713 /* If telescopic beaconing is enabled, set listen interval to
714 WNI_CFG_TELE_BCN_MAX_LI */
715 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
716 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700717 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700718
719 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
720
721 if(teleBcnEn)
722 {
723 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
724 eSIR_SUCCESS)
725 {
726 /**
727 * Could not get ListenInterval value
728 * from CFG. Log error.
729 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700730 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 }
732 }
733 else
734 {
735 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
736 {
737 /**
738 * Could not get ListenInterval value
739 * from CFG. Log error.
740 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700741 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 }
743 }
744
745 pMlmAssocReq->listenInterval = (tANI_U16)val;
746 /* Update PE session ID*/
747 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
748 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
749 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700750 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 limPostMlmMessage(pMac,
752 LIM_MLM_ASSOC_REQ,
753 (tANI_U32 *) pMlmAssocReq);
754 }
755 else
756 {
757 /**
758 * Successful Pre-authentication.
759 * Send Pre-auth response to host
760 */
761 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700762 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 limSendSmeAuthRsp(
764 pMac,
765 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
766 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
767 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
768 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
769 }
770 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
771} /*** end limProcessMlmAuthCnf() ***/
772
773/**
774 * limProcessMlmAssocCnf()
775 *
776 *FUNCTION:
777 * This function is called to processes MLM_ASSOC_CNF
778 * message from MLM State machine.
779 *
780 *LOGIC:
781 *
782 *ASSUMPTIONS:
783 *
784 *NOTE:
785 *
786 * @param pMac Pointer to Global MAC structure
787 * @param pMsgBuf A pointer to the MLM message buffer
788 *
789 * @return None
790 */
791void
792limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
793{
794 tpPESession psessionEntry;
795 tLimMlmAssocCnf *pLimMlmAssocCnf;
796
797 if(pMsgBuf == NULL)
798 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700799 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 return;
801 }
802 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
803 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700805 PELOGE(limLog(pMac, LOGE,FL("Session does not exist for given sessionId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 return;
807 }
808 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
809 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
810 {
811 /**
812 * Should not have received Assocication confirm
813 * from MLM in other states OR on AP.
814 * Log error
815 */
816 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700817 FL("received unexpected MLM_ASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 psessionEntry->limSmeState);)
819 return;
820 }
821 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
822 {
823 // Association failure
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700824 PELOG1(limLog(pMac, LOG1, FL("*** Association failure ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700826 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 /**
828 * Need to send Join response with
829 * Association failure to Host.
830 */
831 limHandleSmeJoinResult(pMac,
832 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
833 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
834 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
835 else
836 {
837 // Successful Association
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700838 PELOG1(limLog(pMac, LOG1, FL("*** Associated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700840 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 /**
842 * Need to send Join response with
843 * Association success to Host.
844 */
845 limHandleSmeJoinResult(pMac,
846 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
847 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
848 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
849} /*** end limProcessMlmAssocCnf() ***/
850
851/**
852 * limProcessMlmReassocCnf()
853 *
854 *FUNCTION:
855 * This function is called to processes MLM_REASSOC_CNF
856 * message from MLM State machine.
857 *
858 *LOGIC:
859 *
860 *ASSUMPTIONS:
861 *
862 *NOTE:
863 *
864 * @param pMac Pointer to Global MAC structure
865 * @param pMsgBuf A pointer to the MLM message buffer
866 *
867 * @return None
868 */
869void
870limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
871{
872 tpPESession psessionEntry;
873 tLimMlmReassocCnf *pLimMlmReassocCnf;
874
875 if(pMsgBuf == NULL)
876 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700877 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 return;
879 }
880 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
881 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
882 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700883 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 return;
885 }
886 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
887 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
888 {
889 /**
890 * Should not have received Reassocication confirm
891 * from MLM in other states OR on AP.
892 * Log error
893 */
894 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700895 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
897 return;
898 }
899 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530900 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 psessionEntry->pLimReAssocReq = NULL;
902 }
903
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530904 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
906 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700907 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700908
909 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700910 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700911
912 /**
913 * Need to send Reassoc response with
914 * Reassociation success to Host.
915 */
916 limSendSmeJoinReassocRsp(
917 pMac, eWNI_SME_REASSOC_RSP,
918 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
919 psessionEntry->smeSessionId,psessionEntry->transactionId);
920 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
921 /** Reassociation failure With the New AP
922 * but we still have the link with the Older AP
923 */
924 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700925 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700926
927 /**
928 * Need to send Reassoc response with
929 * Association failure to Host.
930 */
931 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
932 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
933 psessionEntry->smeSessionId,psessionEntry->transactionId);
934 }else {
935 // Reassociation failure
936 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700937 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 /**
939 * Need to send Reassoc response with
940 * Association failure to Host.
941 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700942 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 }
944} /*** end limProcessMlmReassocCnf() ***/
945
946/**
947 * limProcessMlmReassocInd()
948 *
949 *FUNCTION:
950 * This function is called to processes MLM_REASSOC_IND
951 * message from MLM State machine.
952 *
953 *LOGIC:
954 *
955 *ASSUMPTIONS:
956 *
957 *NOTE:
958 *
959 * @param pMac Pointer to Global MAC structure
960 * @param pMsgBuf A pointer to the MLM message buffer
961 *
962 * @return None
963 */
964void
965limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
966{
967 tANI_U32 len;
968 tSirMsgQ msgQ;
969 tSirSmeReassocInd *pSirSmeReassocInd;
970 tpDphHashNode pStaDs=0;
971 tpPESession psessionEntry;
972 tANI_U8 sessionId;
973 if(pMsgBuf == NULL)
974 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700975 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 return;
977 }
978 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
979 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700980 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 return;
982 }
983 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530985 pSirSmeReassocInd = vos_mem_malloc(len);
986 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 {
988 // Log error
989 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530990 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 return;
992
993 }
994 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
995 eWNI_SME_REASSOC_IND);
996 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
997 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
998
999 // Required for indicating the frames to upper layer
1000 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1001 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1002 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1003 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1004
1005 msgQ.type = eWNI_SME_REASSOC_IND;
1006 msgQ.bodyptr = pSirSmeReassocInd;
1007 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001008 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001009#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1010 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1011#endif //FEATURE_WLAN_DIAG_SUPPORT
1012 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1013 if (! pStaDs)
1014 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001015 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301017 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 return;
1019 }
1020
1021 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1022 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001023 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 /*
1025 ** turn on a timer to detect the loss of REASSOC CNF
1026 **/
1027 limActivateCnfTimer(pMac,
1028 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1029} /*** end limProcessMlmReassocInd() ***/
1030
1031/**
1032 * limProcessMlmAuthInd()
1033 *
1034 *FUNCTION:
1035 * This function is called to processes MLM_AUTH_IND
1036 * message from MLM State machine.
1037 *
1038 *LOGIC:
1039 *
1040 *ASSUMPTIONS:
1041 *
1042 *NOTE:
1043 *
1044 * @param pMac Pointer to Global MAC structure
1045 * @param pMsgBuf A pointer to the MLM message buffer
1046 *
1047 * @return None
1048 */
1049void
1050limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1051{
1052 tSirMsgQ msgQ;
1053 tSirSmeAuthInd *pSirSmeAuthInd;
1054
1055 if(pMsgBuf == NULL)
1056 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001057 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 return;
1059 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301060 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1061 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 {
1063 // Log error
1064 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301065 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 }
1067 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1068 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1069 (tANI_U8 *) &(pSirSmeAuthInd->length));
1070 msgQ.type = eWNI_SME_AUTH_IND;
1071 msgQ.bodyptr = pSirSmeAuthInd;
1072 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001073 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001074#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1075 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1076#endif //FEATURE_WLAN_DIAG_SUPPORT
1077 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1078} /*** end limProcessMlmAuthInd() ***/
1079
1080
1081
1082
1083void
1084limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1085 tSirSmeAssocInd *pSirSmeAssocInd,
1086 tpPESession psessionEntry)
1087{
1088 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1089 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1090
1091 // Required for indicating the frames to upper layer
1092 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1093 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1094
1095 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1096 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1097
1098 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301099 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1100 sizeof(tSirMacAddr));
1101
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 // Fill in aid
1103 pSirSmeAssocInd->aid = pAssocInd->aid;
1104 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301105 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 // Fill in staId
1107 //pSirSmeAssocInd->staId = psessionEntry->staId;
1108 // Fill in authType
1109 pSirSmeAssocInd->authType = pAssocInd->authType;
1110 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301111 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1112 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301114 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1115 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1116 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001117
1118 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301119 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1120 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1121 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001122
1123 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1125 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1126 {
1127 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1128 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1129 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301130 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301132 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 // Fill in WmmInfo
1135 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001136} /*** end limAssocIndSerDes() ***/
1137
1138
1139
1140/**
1141 * limProcessMlmAssocInd()
1142 *
1143 *FUNCTION:
1144 * This function is called to processes MLM_ASSOC_IND
1145 * message from MLM State machine.
1146 *
1147 *LOGIC:
1148 *
1149 *ASSUMPTIONS:
1150 *
1151 *NOTE:
1152 *
1153 * @param pMac Pointer to Global MAC structure
1154 * @param pMsgBuf A pointer to the MLM message buffer
1155 *
1156 * @return None
1157 */
1158void
1159limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1160{
1161 tANI_U32 len;
1162 tSirMsgQ msgQ;
1163 tSirSmeAssocInd *pSirSmeAssocInd;
1164 tpDphHashNode pStaDs=0;
1165 tpPESession psessionEntry;
1166 if(pMsgBuf == NULL)
1167 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001168 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 return;
1170 }
1171 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1172 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001173 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 return;
1175 }
1176 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301178 pSirSmeAssocInd = vos_mem_malloc(len);
1179 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 {
1181 // Log error
1182 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301183 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 return;
1185 }
1186
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1188 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 msgQ.type = eWNI_SME_ASSOC_IND;
1190 msgQ.bodyptr = pSirSmeAssocInd;
1191 msgQ.bodyval = 0;
1192 pStaDs = dphGetHashEntry(pMac,
1193 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1194 if (! pStaDs)
1195 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001196 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301198 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001199
1200 return;
1201 }
1202 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001204 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001205#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1206 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1207#endif //FEATURE_WLAN_DIAG_SUPPORT
1208 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1209
1210 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001211 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 /*
1213 ** turn on a timer to detect the loss of ASSOC CNF
1214 **/
1215 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1216
1217// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1218#ifdef TEST_BTAMP_AP
1219//tANI_U32 *pMsgBuf;
1220{
1221 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301222 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1223 if ( NULL == pSmeAssoccnf )
1224 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1226 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301227 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1228 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1230 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301231 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1232 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301234 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001235 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1236 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301237 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238}
1239#endif
1240
1241
1242} /*** end limProcessMlmAssocInd() ***/
1243
1244
1245
1246
1247/**
1248 * limProcessMlmDisassocInd()
1249 *
1250 *FUNCTION:
1251 * This function is called to processes MLM_DISASSOC_IND
1252 * message from MLM State machine.
1253 *
1254 *LOGIC:
1255 *
1256 *ASSUMPTIONS:
1257 *
1258 *NOTE:
1259 *
1260 * @param pMac Pointer to Global MAC structure
1261 * @param pMsgBuf A pointer to the MLM message buffer
1262 *
1263 * @return None
1264 */
1265void
1266limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1267{
1268 tLimMlmDisassocInd *pMlmDisassocInd;
1269 tpPESession psessionEntry;
1270 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1271 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001273 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 return;
1275 }
1276 switch (psessionEntry->limSystemRole)
1277 {
1278 case eLIM_STA_IN_IBSS_ROLE:
1279 break;
1280 case eLIM_STA_ROLE:
1281 case eLIM_BT_AMP_STA_ROLE:
1282 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001283 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 break;
1285 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1286 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001287 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001288 pMlmDisassocInd->aid);)
1289 // Send SME_DISASOC_IND after Polaris cleanup
1290 // (after receiving LIM_MLM_PURGE_STA_IND)
1291 break;
1292 } // end switch (psessionEntry->limSystemRole)
1293} /*** end limProcessMlmDisassocInd() ***/
1294
1295/**
1296 * limProcessMlmDisassocCnf()
1297 *
1298 *FUNCTION:
1299 * This function is called to processes MLM_DISASSOC_CNF
1300 * message from MLM State machine.
1301 *
1302 *LOGIC:
1303 *
1304 *ASSUMPTIONS:
1305 *
1306 *NOTE:
1307 *
1308 * @param pMac Pointer to Global MAC structure
1309 * @param pMsgBuf A pointer to the MLM message buffer
1310 *
1311 * @return None
1312 */
1313void
1314limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1315{
1316 tSirResultCodes resultCode;
1317 tLimMlmDisassocCnf *pMlmDisassocCnf;
1318 tpPESession psessionEntry;
1319 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1320 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1321 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001322 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 return;
1324 }
1325 resultCode = (tSirResultCodes)
1326 (pMlmDisassocCnf->disassocTrigger ==
1327 eLIM_LINK_MONITORING_DISASSOC) ?
1328 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1329 pMlmDisassocCnf->resultCode;
1330 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1331 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 // Disassociate Confirm from MLM
1333 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1334 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1335 {
1336 /**
1337 * Should not have received
1338 * Disassocate confirm
1339 * from MLM in other states.
1340 * Log error
1341 */
1342 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001343 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 return;
1345 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 if (pMac->lim.gLimRspReqd)
1347 pMac->lim.gLimRspReqd = false;
1348 if (pMlmDisassocCnf->disassocTrigger ==
1349 eLIM_PROMISCUOUS_MODE_DISASSOC)
1350 {
1351 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1352 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1353 else
1354 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001355 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 // Send Promiscuous mode response to host
1357 limSendSmePromiscuousModeRsp(pMac);
1358 }
1359 else
1360 {
1361 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1362 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1363 else
1364 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001365 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1367 resultCode,
1368 pMlmDisassocCnf->disassocTrigger,
1369 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1370 }
1371 }
1372 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1373 {
1374 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1375 resultCode,
1376 pMlmDisassocCnf->disassocTrigger,
1377 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1378 }
1379} /*** end limProcessMlmDisassocCnf() ***/
1380
1381/**
1382 * limProcessMlmDeauthInd()
1383 *
1384 *FUNCTION:
1385 * This function is called to processes MLM_DEAUTH_IND
1386 * message from MLM State machine.
1387 *
1388 *LOGIC:
1389 *
1390 *ASSUMPTIONS:
1391 *
1392 *NOTE:
1393 *
1394 * @param pMac Pointer to Global MAC structure
1395 * @param pMsgBuf A pointer to the MLM message buffer
1396 *
1397 * @return None
1398 */
1399void
1400limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1401{
1402 tLimMlmDeauthInd *pMlmDeauthInd;
1403 tpPESession psessionEntry;
1404 tANI_U8 sessionId;
1405 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1406 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1407 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001408 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 return;
1410 }
1411 switch (psessionEntry->limSystemRole)
1412 {
1413 case eLIM_STA_IN_IBSS_ROLE:
1414 break;
1415 case eLIM_STA_ROLE:
1416 case eLIM_BT_AMP_STA_ROLE:
1417 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001418 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
1420 default: // eLIM_AP_ROLE
1421 {
1422 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001423 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 pMlmDeauthInd->aid);)
1425 }
1426 // Send SME_DEAUTH_IND after Polaris cleanup
1427 // (after receiving LIM_MLM_PURGE_STA_IND)
1428 break;
1429 } // end switch (psessionEntry->limSystemRole)
1430} /*** end limProcessMlmDeauthInd() ***/
1431
1432/**
1433 * limProcessMlmDeauthCnf()
1434 *
1435 *FUNCTION:
1436 * This function is called to processes MLM_DEAUTH_CNF
1437 * message from MLM State machine.
1438 *
1439 *LOGIC:
1440 *
1441 *ASSUMPTIONS:
1442 *
1443 *NOTE:
1444 *
1445 * @param pMac Pointer to Global MAC structure
1446 * @param pMsgBuf A pointer to the MLM message buffer
1447 *
1448 * @return None
1449 */
1450void
1451limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1452{
1453 tANI_U16 aid;
1454 tSirResultCodes resultCode;
1455 tLimMlmDeauthCnf *pMlmDeauthCnf;
1456 tpPESession psessionEntry;
1457
1458 if(pMsgBuf == NULL)
1459 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001460 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 return;
1462 }
1463 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1464 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1465 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001466 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 return;
1468 }
1469
1470 resultCode = (tSirResultCodes)
1471 (pMlmDeauthCnf->deauthTrigger ==
1472 eLIM_LINK_MONITORING_DEAUTH) ?
1473 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1474 pMlmDeauthCnf->resultCode;
1475 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1476 pMlmDeauthCnf->aid : 1;
1477 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1478 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 // Deauth Confirm from MLM
1480 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1481 {
1482 /**
1483 * Should not have received Deauth confirm
1484 * from MLM in other states.
1485 * Log error
1486 */
1487 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001488 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 psessionEntry->limSmeState);)
1490 return;
1491 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1493 {
1494 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1495 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001496 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 }
1498 else
1499 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001500 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001501
1502 if (pMac->lim.gLimRspReqd)
1503 pMac->lim.gLimRspReqd = false;
1504 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1506 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1507 resultCode,
1508 pMlmDeauthCnf->deauthTrigger,
1509 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001510} /*** end limProcessMlmDeauthCnf() ***/
1511
1512/**
1513 * limProcessMlmPurgeStaInd()
1514 *
1515 *FUNCTION:
1516 * This function is called to processes MLM_PURGE_STA_IND
1517 * message from MLM State machine.
1518 *
1519 *LOGIC:
1520 *
1521 *ASSUMPTIONS:
1522 *
1523 *NOTE:
1524 *
1525 * @param pMac Pointer to Global MAC structure
1526 * @param pMsgBuf A pointer to the MLM message buffer
1527 *
1528 * @return None
1529 */
1530void
1531limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1532{
1533 tSirResultCodes resultCode;
1534 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1535 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 if(pMsgBuf == NULL)
1537 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001538 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 return;
1540 }
1541 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1542 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1543 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001544 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 return;
1546 }
1547 // Purge STA indication from MLM
1548 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1549 switch (psessionEntry->limSystemRole)
1550 {
1551 case eLIM_STA_IN_IBSS_ROLE:
1552 break;
1553 case eLIM_STA_ROLE:
1554 case eLIM_BT_AMP_STA_ROLE:
1555 default: // eLIM_AP_ROLE
1556 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1557 (psessionEntry->limSmeState !=
1558 eLIM_SME_WT_DISASSOC_STATE) &&
1559 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1560 {
1561 /**
1562 * Should not have received
1563 * Purge STA indication
1564 * from MLM in other states.
1565 * Log error
1566 */
1567 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001568 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 psessionEntry->limSmeState);)
1570 break;
1571 }
1572 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001573 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 pMlmPurgeStaInd->aid);)
1575 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1576 {
1577 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001578 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001579
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 }
1581 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1582 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 limSendSmeDeauthNtf(pMac,
1584 pMlmPurgeStaInd->peerMacAddr,
1585 resultCode,
1586 pMlmPurgeStaInd->purgeTrigger,
1587 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
1589 else
1590 limSendSmeDisassocNtf(pMac,
1591 pMlmPurgeStaInd->peerMacAddr,
1592 resultCode,
1593 pMlmPurgeStaInd->purgeTrigger,
1594 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1595 } // end switch (psessionEntry->limSystemRole)
1596} /*** end limProcessMlmPurgeStaInd() ***/
1597
1598/**
1599 * limProcessMlmSetKeysCnf()
1600 *
1601 *FUNCTION:
1602 * This function is called to processes MLM_SETKEYS_CNF
1603 * message from MLM State machine.
1604 *
1605 *LOGIC:
1606 *
1607 *ASSUMPTIONS:
1608 *
1609 *NOTE:
1610 *
1611 * @param pMac Pointer to Global MAC structure
1612 * @param pMsgBuf A pointer to the MLM message buffer
1613 *
1614 * @return None
1615 */
1616void
1617limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1618{
1619 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001620 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 tpPESession psessionEntry;
1622
1623 if(pMsgBuf == NULL)
1624 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001625 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001626 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 }
1628 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1629 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1630 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001631 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 return;
1633 }
1634 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001635 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 pMlmSetKeysCnf->resultCode );
1637 limSendSmeSetContextRsp(pMac,
1638 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1641 psessionEntry->transactionId);
1642} /*** end limProcessMlmSetKeysCnf() ***/
1643/**
1644 * limProcessMlmRemoveKeyCnf()
1645 *
1646 *FUNCTION:
1647 * This function is called to processes MLM_REMOVEKEY_CNF
1648 * message from MLM State machine.
1649 *
1650 *LOGIC:
1651 *
1652 *ASSUMPTIONS:
1653 *
1654 *NOTE:
1655 *
1656 * @param pMac Pointer to Global MAC structure
1657 * @param pMsgBuf A pointer to the MLM message buffer
1658 *
1659 * @return None
1660 */
1661void
1662limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1663{
1664 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001665 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 tpPESession psessionEntry;
1667
1668 if(pMsgBuf == NULL)
1669 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001670 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001671 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001672 }
1673 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1674 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1675 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001676 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 return;
1678 }
1679 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001680 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 pMlmRemoveKeyCnf->resultCode );
1682 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001683 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1685 psessionEntry->smeSessionId,psessionEntry->transactionId);
1686} /*** end limProcessMlmRemoveKeyCnf() ***/
1687
1688
1689/**
1690 * limHandleSmeJoinResult()
1691 *
1692 *FUNCTION:
1693 * This function is called to process join/auth/assoc failures
1694 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1695 * MLM_ASSOC_CNF with a success code in case of STA role and
1696 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1697 *
1698 *LOGIC:
1699 *
1700 *ASSUMPTIONS:
1701 *
1702 *NOTE:
1703 *
1704 * @param pMac Pointer to Global MAC structure
1705 * @param resultCode Failure code to be sent
1706 *
1707 *
1708 * @return None
1709 */
1710static void
1711limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1712{
1713 tpDphHashNode pStaDs = NULL;
1714 tANI_U8 smesessionId;
1715 tANI_U16 smetransactionId;
1716
1717 /* Newly Added on oct 11 th*/
1718 if(psessionEntry == NULL)
1719 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001720 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001721 return;
1722 }
1723 smesessionId = psessionEntry->smeSessionId;
1724 smetransactionId = psessionEntry->transactionId;
1725 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1726 if(resultCode != eSIR_SME_SUCCESS)
1727 {
1728 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1729 if (pStaDs != NULL)
1730 {
1731 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1732 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1733 pStaDs->mlmStaContext.resultCode = resultCode;
1734 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1735 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1736 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301737 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001738 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001739 return;
1740 }
1741 }
1742
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301743 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 psessionEntry->pLimJoinReq = NULL;
1745 //Delete teh session if JOIN failure occurred.
1746 if(resultCode != eSIR_SME_SUCCESS)
1747 {
1748 if(NULL != psessionEntry)
1749 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001750 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1751 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001752 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 peDeleteSession(pMac,psessionEntry);
1754 psessionEntry = NULL;
1755 }
1756 }
1757 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1758 smesessionId, smetransactionId);
1759} /*** end limHandleSmeJoinResult() ***/
1760
1761/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001762 * limHandleSmeReaasocResult()
1763 *
1764 *FUNCTION:
1765 * This function is called to process reassoc failures
1766 * upon receiving REASSOC_CNF with a failure code or
1767 * MLM_REASSOC_CNF with a success code in case of STA role
1768 *
1769 *LOGIC:
1770 *
1771 *ASSUMPTIONS:
1772 *
1773 *NOTE:
1774 *
1775 * @param pMac Pointer to Global MAC structure
1776 * @param resultCode Failure code to be sent
1777 *
1778 *
1779 * @return None
1780 */
1781static void
1782limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1783{
1784 tpDphHashNode pStaDs = NULL;
1785 tANI_U8 smesessionId;
1786 tANI_U16 smetransactionId;
1787
1788 if(psessionEntry == NULL)
1789 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001790 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001791 return;
1792 }
1793 smesessionId = psessionEntry->smeSessionId;
1794 smetransactionId = psessionEntry->transactionId;
1795 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1796 if(resultCode != eSIR_SME_SUCCESS)
1797 {
1798 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1799 if (pStaDs != NULL)
1800 {
1801 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1802 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1803 pStaDs->mlmStaContext.resultCode = resultCode;
1804 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1805 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1806 return;
1807 }
1808 }
1809
1810 //Delete teh session if REASSOC failure occurred.
1811 if(resultCode != eSIR_SME_SUCCESS)
1812 {
1813 if(NULL != psessionEntry)
1814 {
1815 peDeleteSession(pMac,psessionEntry);
1816 psessionEntry = NULL;
1817 }
1818 }
1819 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1820 smesessionId, smetransactionId);
1821} /*** end limHandleSmeReassocResult() ***/
1822
1823/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 * limProcessMlmAddStaRsp()
1825 *
1826 *FUNCTION:
1827 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1828 * Upon receipt of this message from HAL, MLME -
1829 * > Determines the "state" in which this message was received
1830 * > Forwards it to the appropriate callback
1831 *
1832 *ASSUMPTIONS:
1833 *
1834 *NOTE:
1835 *
1836 * @param pMac Pointer to Global MAC structure
1837 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1838 *
1839 * @return None
1840 */
1841void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1842{
1843 //we need to process the deferred message since the initiating req. there might be nested request.
1844 //in the case of nested request the new request initiated from the response will take care of resetting
1845 //the deffered flag.
1846 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 )
1850 {
1851 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1852 return;
1853 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001854 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001855}
1856void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1857{
1858 tLimMlmAssocCnf mlmAssocCnf;
1859 tpDphHashNode pStaDs;
1860 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1861 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1862
1863 if(NULL == pAddStaParams )
1864 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001865 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 return;
1867 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301868 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301870 PELOGE(limLog(pMac, LOGE,
1871 FL("Received Deauth frame in ADD_STA_RESP state"));)
1872 pAddStaParams->status = eHAL_STATUS_FAILURE;
1873 }
1874
1875 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1876 {
1877 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 {
1879 //TODO: any response to be sent out here ?
1880 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001881 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 psessionEntry->limMlmState);
1883 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1884 goto end;
1885 }
1886 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1887 mesgType = LIM_MLM_REASSOC_CNF;
1888 //
1889 // Update the DPH Hash Entry for this STA
1890 // with proper state info
1891 //
1892 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1893 if( NULL != pStaDs)
1894 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1895 else
1896 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001897 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 DPH_STA_HASH_INDEX_PEER);
1899 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001900 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001901 /*
1902 * Storing the self StaIndex(Generated by HAL) in session context,
1903 * instead of storing it in DPH Hash entry for Self STA.
1904 * DPH entry for the self STA stores the sta index for the BSS entry
1905 * to which the STA is associated.
1906 */
1907 psessionEntry->staId = pAddStaParams->staIdx;
1908 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001909#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1910 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1911#endif
1912 {
1913 limReactivateHeartBeatTimer(pMac, psessionEntry);
1914 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001915 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001916
1917 //assign the sessionId to the timer Object
1918 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1919 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001920 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001921#ifdef WLAN_DEBUG
1922 pMac->lim.gLimNumLinkEsts++;
1923#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001924#ifdef FEATURE_WLAN_TDLS
1925 /* initialize TDLS peer related data */
1926 limInitTdlsData(pMac,psessionEntry);
1927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 // Return Assoc confirm to SME with success
1929 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1930 // be passed in here....
1931 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1932 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1933 }
1934 else
1935 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301936 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1938 }
1939end:
1940 if( 0 != limMsgQ->bodyptr )
1941 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301942 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001943 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 }
1945 /* Updating PE session Id*/
1946 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1947 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301948 if (true == psessionEntry->fDeauthReceived)
1949 {
1950 psessionEntry->fDeauthReceived = false;
1951 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 return;
1953}
1954void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1955{
1956 //we need to process the deferred message since the initiating req. there might be nested request.
1957 //in the case of nested request the new request initiated from the response will take care of resetting
1958 //the deffered flag.
1959 // tpPESession psessionEntry;
1960 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1961 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
1962 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001963 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 // return;
1965 // }
1966 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001967
1968 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
1969 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 ) &&
1972 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
1973 {
1974 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
1975 return;
1976 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08001978
1979 if(!limIsInMCC(pMac))
1980 {
1981 WDA_TrafficStatsTimerActivate(FALSE);
1982 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001983
1984#ifdef WLAN_FEATURE_11W
1985 if (psessionEntry->limRmfEnabled)
1986 {
1987 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
1988 {
1989 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001990 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07001991 }
1992 }
1993#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001994}
1995
1996void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1997{
1998 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
1999 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2000 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302001
2002 if (NULL == pDelBssParams)
2003 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002004 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302005 goto end;
2006 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2008 {
2009 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002010 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2012 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2013
2014 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002015 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 statusCode = eSIR_SME_REFUSED;
2017 goto end;
2018 }
2019 if(pStaDs == NULL)
2020 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002021 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 statusCode = eSIR_SME_REFUSED;
2023 goto end;
2024 }
2025 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2026 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002027 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 pStaDs->mlmStaContext.mlmState);)
2029 statusCode = eSIR_SME_REFUSED;
2030 goto end;
2031 }
2032 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2033 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2034 }
2035 else
2036 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302037 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302038 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002039 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 return;
2041 }
2042 end:
2043 if( 0 != limMsgQ->bodyptr )
2044 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302045 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002046 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048 if(pStaDs == NULL)
2049 return;
2050 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2051 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2052 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2053 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2054 {
2055 /** The Case where the DelBss is invoked from
2056 * context of other than normal DisAssoc / Deauth OR
2057 * as part of Join Failure.
2058 */
2059 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2060 return;
2061 }
2062 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2063 return;
2064}
2065
Jeff Johnson295189b2012-06-20 16:38:30 -07002066void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2067{
2068 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002069 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2071 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2072
2073 if(psessionEntry == NULL)
2074 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002075 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002076 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002077 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302078 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002079 limMsgQ->bodyptr = NULL;
2080 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002081 return;
2082 }
2083
2084 if (pDelBss == NULL)
2085 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002086 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 rc = eSIR_SME_REFUSED;
2088 goto end;
2089 }
2090 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002091 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2092
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2094 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002095 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002096 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2097 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002098 rc = eSIR_SME_REFUSED;
2099 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 }
2101 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2102 {
2103 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2104 pDelBss->status, pDelBss->bssIdx);
2105 rc = eSIR_SME_STOP_BSS_FAILURE;
2106 goto end;
2107 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002108 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002110 if (status != eSIR_SUCCESS)
2111 {
2112 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002114 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 /** Softmac may send all the buffered packets right after resuming the transmission hence
2116 * to occupy the medium during non channel occupancy period. So resume the transmission after
2117 * HAL gives back the response.
2118 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002119#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 if (LIM_IS_RADAR_DETECTED(pMac))
2121 {
2122 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2123 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2124 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002125#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2127 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002129 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 end:
2131 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2132 peDeleteSession(pMac, psessionEntry);
2133
2134 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002135 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302136 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002137 limMsgQ->bodyptr = NULL;
2138 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002139}
2140
2141void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2142{
2143 //we need to process the deferred message since the initiating req. there might be nested request.
2144 //in the case of nested request the new request initiated from the response will take care of resetting
2145 //the deffered flag.
2146
2147 tpPESession psessionEntry;
2148 tpDeleteStaParams pDeleteStaParams;
2149 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2150 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302151
2152 if(NULL == pDeleteStaParams ||
2153 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002155 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002156 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002157 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302158 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002159 limMsgQ->bodyptr = NULL;
2160 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 return;
2162 }
2163
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 )
2167 {
2168 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2169 return;
2170 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002172}
2173
Jeff Johnson295189b2012-06-20 16:38:30 -07002174void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2175{
2176 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2177 tpDphHashNode pStaDs;
2178 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2179 if(limMsgQ->bodyptr == NULL)
2180 {
2181 return;
2182 }
2183
2184 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2185 if(pStaDs == NULL)
2186 {
2187 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002188 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302190 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002191 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002192
2193 return;
2194 }
2195 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2196 {
2197 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002198 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002199
2200 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2201 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2202 {
2203 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002204 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2206 statusCode = eSIR_SME_REFUSED;
2207 goto end;
2208 }
2209
2210 limLog( pMac, LOG1,
2211 FL("Deleted STA AssocID %d staId %d MAC "),
2212 pStaDs->assocId, pStaDs->staIndex);
2213 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2214 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2215 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302216 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002217 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002218 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 {
2220 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002221 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 pStaDs->assocId);)
2223 // delete the TS if it has already been added.
2224 // send the response with error status.
2225 if(pStaDs->qos.addtsPresent)
2226 {
2227 tpLimTspecInfo pTspecInfo;
2228 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2229 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2230 {
2231 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2232 NULL, &pTspecInfo->idx);
2233 }
2234 }
2235 limRejectAssociation(pMac,
2236 pStaDs->staAddr,
2237 pStaDs->mlmStaContext.subType,
2238 true, pStaDs->mlmStaContext.authType,
2239 pStaDs->assocId, true,
2240 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2241 psessionEntry);
2242 }
2243 return;
2244 }
2245 }
2246 else
2247 {
2248 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002249 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 statusCode = eSIR_SME_REFUSED;
2251 }
2252 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302253 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002254 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2256 {
2257 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2258 }
2259 return;
2260}
2261
2262void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2263{
2264 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2265 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2266 tpDphHashNode pStaDs = NULL;
2267 if(NULL == pDelStaParams )
2268 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002269 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 goto end;
2271 }
2272 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2273 {
2274 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2275 if (pStaDs == NULL)
2276 {
2277 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002278 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 pDelStaParams->assocId);
2280 statusCode = eSIR_SME_REFUSED;
2281 goto end;
2282 }
2283 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2284 {
2285 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002286 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 limMlmStateStr(psessionEntry->limMlmState));
2288 statusCode = eSIR_SME_REFUSED;
2289 goto end;
2290 }
2291 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2292 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002293 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 //we must complete all cleanup related to delSta before calling limDelBSS.
2295 if( 0 != limMsgQ->bodyptr )
2296 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302297 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002298 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 }
2300 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2301 return;
2302 }
2303 else
2304 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002305 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 statusCode = eSIR_SME_REFUSED;
2307 }
2308end:
2309 if( 0 != limMsgQ->bodyptr )
2310 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302311 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002312 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 }
2314 return;
2315}
2316
Jeff Johnson295189b2012-06-20 16:38:30 -07002317void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2318{
2319 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302320 tpDphHashNode pStaDs = NULL;
2321
2322 if (NULL == pAddStaParams)
2323 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002324 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302325 goto end;
2326 }
2327
2328 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 if(pStaDs == NULL)
2330 {
2331 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002332 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 goto end;
2334 }
2335 //
2336 // TODO & FIXME_GEN4
2337 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2338 //
2339 //TODO: any check for pMac->lim.gLimMlmState ?
2340 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2341 {
2342 //TODO: any response to be sent out here ?
2343 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002344 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 pStaDs->mlmStaContext.mlmState);
2346 goto end;
2347 }
2348 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2349 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002350 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 limRejectAssociation(pMac, pStaDs->staAddr,
2352 pStaDs->mlmStaContext.subType,
2353 true, pStaDs->mlmStaContext.authType,
2354 pStaDs->assocId, true,
2355 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2356 psessionEntry);
2357 goto end;
2358 }
2359 pStaDs->bssId = pAddStaParams->bssIdx;
2360 pStaDs->staIndex = pAddStaParams->staIdx;
2361 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2362 pStaDs->valid = 1;
2363 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2364 limLog( pMac, LOG1,
2365 FL("STA AssocID %d staId %d MAC "),
2366 pStaDs->assocId,
2367 pStaDs->staIndex);
2368 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2369
2370 /* For BTAMP-AP, the flow sequence shall be:
2371 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2372 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2373 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2374 */
2375 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2376 // fall though to reclaim the original Add STA Response message
2377end:
2378 if( 0 != limMsgQ->bodyptr )
2379 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302380 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002381 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 }
2383 return;
2384}
2385
2386/**
2387 * limProcessApMlmAddBssRsp()
2388 *
2389 *FUNCTION:
2390 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2391 * Upon receipt of this message from HAL, MLME -
2392 * > Validates the result of WDA_ADD_BSS_REQ
2393 * > Init other remaining LIM variables
2394 * > Init the AID pool, for that BSSID
2395 * > Init the Pre-AUTH list, for that BSSID
2396 * > Create LIM timers, specific to that BSSID
2397 * > Init DPH related parameters that are specific to that BSSID
2398 * > TODO - When do we do the actual change channel?
2399 *
2400 *LOGIC:
2401 * SME sends eWNI_SME_START_BSS_REQ to LIM
2402 * LIM sends LIM_MLM_START_REQ to MLME
2403 * MLME sends WDA_ADD_BSS_REQ to HAL
2404 * HAL responds with WDA_ADD_BSS_RSP to MLME
2405 * MLME responds with LIM_MLM_START_CNF to LIM
2406 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2407 *
2408 *ASSUMPTIONS:
2409 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2410 * tSirMsgQ.body will now be freed by this routine
2411 *
2412 *NOTE:
2413 *
2414 * @param pMac Pointer to Global MAC structure
2415 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2416 *
2417 * @return None
2418 */
2419static void
2420limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2421{
2422 tLimMlmStartCnf mlmStartCnf;
2423 tANI_U32 val;
2424 tpPESession psessionEntry;
2425// tANI_U8 sessionId;
2426 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2427 if(NULL == pAddBssParams )
2428 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002429 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 goto end;
2431 }
2432 //TBD: free the memory before returning, do it for all places where lookup fails.
2433 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2434 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002435 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002436 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002437 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302438 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002439 limMsgQ->bodyptr = NULL;
2440 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 return;
2442 }
2443 /* Update PE session Id*/
2444 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2445 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2446 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002447 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2449 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2450 goto end;
2451 // Set MLME state
2452 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002453 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2455 {
2456 /** IBSS is 'active' when we receive
2457 * Beacon frames from other STAs that are part of same IBSS.
2458 * Mark internal state as inactive until then.
2459 */
2460 psessionEntry->limIbssActive = false;
2461 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2462 limResetHBPktCount( psessionEntry );
2463 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002464 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002465 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002466 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 }
2468 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2469
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002471
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2473 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2474 else
2475 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 schEdcaProfileUpdate(pMac, psessionEntry);
2477 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002478 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 // Create timers used by LIM
2480 if (!pMac->lim.gLimTimersCreated)
2481 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002482
2483 // Start OLBC timer
2484 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2485 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002486 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002487 }
2488
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2490 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002491 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2493 // Apply previously set configuration at HW
2494 limApplyConfiguration(pMac,psessionEntry);
2495 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2496 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2497 }
2498 else
2499 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002500 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2502 }
2503 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2504 end:
2505 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002506 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302507 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002508 limMsgQ->bodyptr = NULL;
2509 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002510}
2511
2512
2513/**
2514 * limProcessIbssMlmAddBssRsp()
2515 *
2516 *FUNCTION:
2517 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2518 * Upon receipt of this message from HAL, MLME -
2519 * > Validates the result of WDA_ADD_BSS_REQ
2520 * > Init other remaining LIM variables
2521 * > Init the AID pool, for that BSSID
2522 * > Init the Pre-AUTH list, for that BSSID
2523 * > Create LIM timers, specific to that BSSID
2524 * > Init DPH related parameters that are specific to that BSSID
2525 * > TODO - When do we do the actual change channel?
2526 *
2527 *LOGIC:
2528 * SME sends eWNI_SME_START_BSS_REQ to LIM
2529 * LIM sends LIM_MLM_START_REQ to MLME
2530 * MLME sends WDA_ADD_BSS_REQ to HAL
2531 * HAL responds with WDA_ADD_BSS_RSP to MLME
2532 * MLME responds with LIM_MLM_START_CNF to LIM
2533 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2534 *
2535 *ASSUMPTIONS:
2536 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2537 * tSirMsgQ.body will now be freed by this routine
2538 *
2539 *NOTE:
2540 *
2541 * @param pMac Pointer to Global MAC structure
2542 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2543 *
2544 * @return None
2545 */
2546static void
2547limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2548{
2549 tLimMlmStartCnf mlmStartCnf;
2550 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2551 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302552
2553 if (NULL == pAddBssParams)
2554 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002555 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302556 goto end;
2557 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2559 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002560 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2562 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2563 goto end;
2564 // Set MLME state
2565 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002566 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 /** IBSS is 'active' when we receive
2568 * Beacon frames from other STAs that are part of same IBSS.
2569 * Mark internal state as inactive until then.
2570 */
2571 psessionEntry->limIbssActive = false;
2572 limResetHBPktCount( psessionEntry );
2573 /* Timer related functions are not modified for BT-AMP : To be Done */
2574 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002576 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002577 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2579 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2580 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2581 schEdcaProfileUpdate(pMac, psessionEntry);
2582 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2583 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002584 if (0 == psessionEntry->freePeerIdxHead)
2585 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 // Create timers used by LIM
2587#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2588 if (!pMac->lim.gLimTimersCreated)
2589 limCreateTimers(pMac);
2590#endif
2591 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2592 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002593 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2595 // Apply previously set configuration at HW
2596 limApplyConfiguration(pMac,psessionEntry);
2597 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2598 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2599 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2600 if(true == pMac->lim.gLimIbssCoalescingHappened)
2601 {
2602 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2603 goto end;
2604 }
2605 }
2606 else
2607 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002608 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 pAddBssParams->status );
2610 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2611 }
2612 //Send this message to SME, when ADD_BSS is initiated by SME
2613 //If ADD_BSS is done as part of coalescing, this won't happen.
2614 /* Update PE session Id*/
2615 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2616 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2617 end:
2618 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002619 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302620 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002621 limMsgQ->bodyptr = NULL;
2622 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002623}
2624
2625static void
2626limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2627{
2628 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2629 tAniAuthType cfgAuthType, authMode;
2630 tLimMlmAuthReq *pMlmAuthReq;
2631 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302632
2633 if (NULL == pAddBssParams)
2634 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002635 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302636 goto joinFailure;
2637 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2639 {
2640 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2641 {
2642 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002643 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2645 goto joinFailure;
2646 }
2647 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2648 //Success, handle below
2649 pStaDs->bssId = pAddBssParams->bssIdx;
2650 //STA Index(genr by HAL) for the BSS entry is stored here
2651 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2652 // Trigger Authentication with AP
2653 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2654 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2655 {
2656 /**
2657 * Could not get AuthType from CFG.
2658 * Log error.
2659 */
2660 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002661 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 }
2663 if (cfgAuthType == eSIR_AUTO_SWITCH)
2664 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2665 else
2666 authMode = cfgAuthType;
2667
2668 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302669 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2670 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 {
2672 // Log error
2673 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302674 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 return;
2676 }
2677 #if 0
2678 val = sizeof(tSirMacAddr);
2679 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2680 pMlmAuthReq->peerMacAddr,
2681 &val) != eSIR_SUCCESS)
2682 {
2683 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002684 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 }
2686 #endif //TO SUPPORT BT-AMP
2687 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2688
2689 pMlmAuthReq->authType = authMode;
2690 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2691 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2692 != eSIR_SUCCESS)
2693 {
2694 /**
2695 * Could not get AuthFailureTimeout
2696 * value from CFG. Log error.
2697 */
2698 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002699 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 }
2701 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2702 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2703 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002704 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2706 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2707 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2708 // remember staId in case of assoc timeout/failure handling
2709 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2710
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 limPostMlmMessage(pMac,
2713 LIM_MLM_AUTH_REQ,
2714 (tANI_U32 *) pMlmAuthReq);
2715 return;
2716 }
2717
2718joinFailure:
2719 {
2720 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002721 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002722
2723 /// Send Join response to Host
2724 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2725
2726 }
2727
2728}
2729
2730#ifdef WLAN_FEATURE_VOWIFI_11R
2731/*------------------------------------------------------------------------------------------
2732 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002733 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2734 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002735 *
2736 *
2737 *------------------------------------------------------------------------------------------
2738 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002739static inline void
2740limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002741{
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002743 tpDphHashNode pStaDs = NULL;
2744 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002745 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002746 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002747 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002748
2749 if (pAddBssParams == NULL)
2750 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002751 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002752 goto end;
2753 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002754 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2755 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002756 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002757 goto end;
2758 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002759 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2760 {
2761 goto end;
2762 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002763
2764 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2765 &psessionEntry->dph.dphHashTable)) == NULL)
2766 {
2767 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002768 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2770 goto end;
2771 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002772 // Prepare and send Reassociation request frame
2773 // start reassoc timer.
2774 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2775 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002776 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2778 != TX_SUCCESS)
2779 {
2780 /// Could not start reassoc failure timer.
2781 // Log error
2782 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002783 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 // Return Reassoc confirm with
2785 // Resources Unavailable
2786 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2787 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2788 goto end;
2789 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002790#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2791 pMac->lim.pSessionEntry = psessionEntry;
2792 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2793 {
2794 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302795 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2796 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2797 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2798 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2799 psessionEntry->pLimMlmReassocReq,
2800 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002801 }
2802 pMac->lim.reAssocRetryAttempt = 0;
2803#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002805
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2807 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002808 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002809 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2811
2812 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2813
2814 //Success, handle below
2815 pStaDs->bssId = pAddBssParams->bssIdx;
2816 //STA Index(genr by HAL) for the BSS entry is stored here
2817 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2818 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2819 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2820
Jeff Johnson295189b2012-06-20 16:38:30 -07002821#if defined WLAN_FEATURE_VOWIFI
2822 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2823#endif
2824
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302825 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2826 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302828 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002829 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302831 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002832
2833 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302834 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2835 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002836
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302837 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2838 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002839
2840 // Update this when we get reassoc rsp , with success.
2841 // pAddStaParams->assocId = psessionEntry->limAID;
2842
2843 pAddStaParams->staType = STA_ENTRY_SELF;
2844 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2845 pAddStaParams->respReqd = 1;
2846
2847 /* Update PE session ID */
2848 pAddStaParams->sessionId = psessionEntry->peSessionId;
2849
2850 // This will indicate HAL to "allocate" a new STA index
2851 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2852 pAddStaParams->updateSta = FALSE;
2853
2854 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002855#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002856 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07002857#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002858 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002859#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002860
Jeff Johnsone7245742012-09-05 17:12:55 -07002861 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002863 pAddStaParams->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -07002864#ifdef DISABLE_GF_FOR_INTEROP
2865 /*
2866 * To resolve the interop problem with Broadcom AP,
2867 * where TQ STA could not pass traffic with GF enabled,
2868 * TQ STA will do Greenfield only with TQ AP, for
2869 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002870 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2872 {
2873 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2874 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2875 }
2876 else
2877#endif
2878
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
2880 pAddStaParams->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry);
2881 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2882 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2883 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2884 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2885 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2886 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2887 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2888 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2889 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2890 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 }
2892
2893 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002894 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
2896
2897 limFillSupportedRatesInfo(pMac, NULL, &pAddStaParams->supportedRates,psessionEntry);
2898
2899 // Lets save this for when we receive the Reassoc Rsp
2900 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002901
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002902 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002903 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002904 vos_mem_free(pAddBssParams);
2905 pAddBssParams = NULL;
2906 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002907 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 return;
2909
2910end:
2911 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002912 if (psessionEntry != NULL)
2913 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002915 vos_mem_free(psessionEntry->pLimMlmReassocReq);
2916 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002918
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002919 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002920 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002921 vos_mem_free(pAddBssParams);
2922 pAddBssParams = NULL;
2923 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002924 }
2925
2926 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2927 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302928 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002929 if (psessionEntry != NULL)
2930 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002931 else
2932 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002933
2934 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2935}
Jeff Johnson295189b2012-06-20 16:38:30 -07002936#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07002937/**
2938 * limProcessStaMlmAddBssRsp()
2939 *
2940 *FUNCTION:
2941 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2942 * Upon receipt of this message from HAL, MLME -
2943 * > Validates the result of WDA_ADD_BSS_REQ
2944 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2945 *
2946 *LOGIC:
2947 * MLME had sent WDA_ADD_BSS_REQ to HAL
2948 * HAL responded with WDA_ADD_BSS_RSP to MLME
2949 * MLME now sends WDA_ADD_STA_REQ to HAL
2950 *
2951 *ASSUMPTIONS:
2952 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2953 * tSirMsgQ.body will now be freed by this routine
2954 *
2955 *NOTE:
2956 *
2957 * @param pMac Pointer to Global MAC structure
2958 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2959 *
2960 * @return None
2961 */
2962static void
2963limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2964{
2965 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2966 tLimMlmAssocCnf mlmAssocCnf;
2967 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2968 tANI_U32 subType = LIM_ASSOC;
2969 tpDphHashNode pStaDs = NULL;
2970 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
2971 tANI_U8 updateSta = false;
2972 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
2973
2974 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
2975 {
2976 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
2977 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
2978 goto end;
2979 }
2980 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
2981 {
2982 mesgType = LIM_MLM_REASSOC_CNF;
2983 subType = LIM_REASSOC;
2984 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
2985 //to update the existing STA entry.
2986 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
2987 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
2988 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
2989 {
2990 staIdx = psessionEntry->staId;
2991 updateSta = true;
2992 }
2993 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08002994
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08002995 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08002996 goto end;
2997
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2999 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003000#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3002 {
3003#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003004 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 psessionEntry->limMlmState,
3006 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3007#endif
3008 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3009 goto end;
3010 }
3011#endif /* WLAN_FEATURE_VOWIFI_11R */
3012
3013 // Set MLME state
3014 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003015 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003016 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3017 // Now, send WDA_ADD_STA_REQ
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003018 limLog( pMac, LOGW, FL( "On STA: ADD_BSS was successful" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3020 if (pStaDs == NULL)
3021 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003022 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3024 }
3025 else
3026 {
3027 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3028 //Success, handle below
3029 pStaDs->bssId = pAddBssParams->bssIdx;
3030 //STA Index(genr by HAL) for the BSS entry is stored here
3031 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3032 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3033 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3034 // Downgrade the EDCA parameters if needed
3035 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3036 // Send the active EDCA parameters to HAL
3037 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3038 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3039 } else {
3040 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3041 }
3042#if defined WLAN_FEATURE_VOWIFI
3043 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3044#endif
3045
3046 if (subType == LIM_REASSOC)
3047 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3048 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3049 {
3050 // Add STA context at HW
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003051 PELOGE(limLog(pMac, LOGE, FL("could not Add Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003052 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3053 }
3054 }
3055 }
3056 else
3057 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003058 limLog( pMac, LOGP, FL( "ADD_BSS failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 // Return Assoc confirm to SME with failure
3060 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3061 }
3062
3063 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3064 {
3065 /* Update PE session Id*/
3066 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3067 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3068 }
3069 end:
3070 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003071 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303072 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003073 limMsgQ->bodyptr = NULL;
3074 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003075}
3076
3077
3078
3079/**
3080 * limProcessMlmAddBssRsp()
3081 *
3082 *FUNCTION:
3083 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3084 * Upon receipt of this message from HAL, MLME -
3085 * > Determines the "state" in which this message was received
3086 * > Forwards it to the appropriate callback
3087 *
3088 *LOGIC:
3089 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3090 * in the following two states:
3091 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3092 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3093 * Based on these two states, this API will determine where to
3094 * route the message to
3095 *
3096 *ASSUMPTIONS:
3097 *
3098 *NOTE:
3099 *
3100 * @param pMac Pointer to Global MAC structure
3101 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3102 *
3103 * @return None
3104 */
3105void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3106{
3107 tLimMlmStartCnf mlmStartCnf;
3108 tpPESession psessionEntry;
3109 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3110
3111 if(NULL == pAddBssParams )
3112 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003113 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003114 return;
3115 }
3116
3117 //
3118 // TODO & FIXME_GEN4
3119 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3120 //
3121 //we need to process the deferred message since the initiating req. there might be nested request.
3122 //in the case of nested request the new request initiated from the response will take care of resetting
3123 //the deffered flag.
3124 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3125 // Validate SME/LIM state
3126 // Validate MLME state
3127 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3128 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003129 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003130 if( NULL != pAddBssParams )
3131 {
3132 vos_mem_free(pAddBssParams);
3133 limMsgQ->bodyptr = NULL;
3134 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003135 return;
3136 }
3137 /* update PE session Id*/
3138 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3139 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3140 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3141 else
3142 {
3143 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3144 {
3145 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3146 {
3147 // Mesg received from HAL in Invalid state!
3148 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003149 FL( "Received unexpected WDA_ADD_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 psessionEntry->limMlmState );
3151 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3152 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003153 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303154 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003155 limMsgQ->bodyptr = NULL;
3156 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003157 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3158 }
3159 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3160 {
3161 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3162 }
3163 else
3164 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3165 }
3166 else
3167 /* Called while processing assoc response */
3168 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3169 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003170
3171 if(limIsInMCC(pMac))
3172 {
3173 WDA_TrafficStatsTimerActivate(TRUE);
3174 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003175
3176#ifdef WLAN_FEATURE_11W
3177 if (psessionEntry->limRmfEnabled)
3178 {
3179 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3180 {
3181 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003182 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003183 }
3184 }
3185#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003186}
3187/**
3188 * limProcessMlmSetKeyRsp()
3189 *
3190 *FUNCTION:
3191 * This function is called to process the following two
3192 * messages from HAL:
3193 * 1) WDA_SET_BSSKEY_RSP
3194 * 2) WDA_SET_STAKEY_RSP
3195 * 3) WDA_SET_STA_BCASTKEY_RSP
3196 * Upon receipt of this message from HAL,
3197 * MLME -
3198 * > Determines the "state" in which this message was received
3199 * > Forwards it to the appropriate callback
3200 *
3201 *LOGIC:
3202 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3203 * received by MLME while in the following state:
3204 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3205 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3206 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3207 * Based on this state, this API will determine where to
3208 * route the message to
3209 *
3210 *ASSUMPTIONS:
3211 * ONLY the MLME state is being taken into account for now.
3212 * This is because, it appears that the handling of the
3213 * SETKEYS REQ is handled symmetrically on both the AP & STA
3214 *
3215 *NOTE:
3216 *
3217 * @param pMac Pointer to Global MAC structure
3218 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3219 *
3220 * @return None
3221 */
3222void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3223{
Jeff Johnsone7245742012-09-05 17:12:55 -07003224 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 tLimMlmSetKeysCnf mlmSetKeysCnf;
3226 tANI_U8 sessionId = 0;
3227 tpPESession psessionEntry;
3228 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303229 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003231 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003233 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 return;
3235 }
3236 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3237 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3238 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003239 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303240 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003241 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003242 return;
3243 }
3244 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3245 {
3246 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003247 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 // There's not much that MLME can do at this stage...
3249 respReqd = 0;
3250 }
3251 else
3252 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3253
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303254 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003255 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003258 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 if( respReqd )
3260 {
3261 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3262 // Prepare and Send LIM_MLM_SETKEYS_CNF
3263 if( NULL != lpLimMlmSetKeysReq )
3264 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303265 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3266 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3267 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303269 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 pMac->lim.gpLimMlmSetKeysReq = NULL;
3271 }
3272 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003273 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 }
3275}
3276void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3277{
3278 tANI_U8 respReqd = 1;
3279 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003280 tANI_U16 resultCode;
3281 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 tpPESession psessionEntry;
3283 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303284 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003285 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003286 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003288 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 return;
3290 }
3291 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3292 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3293 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003294 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303295 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003296 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 return;
3298 }
3299 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3300 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3301 else
3302 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3303
Jeff Johnsone7245742012-09-05 17:12:55 -07003304 //
3305 // TODO & FIXME_GEN4
3306 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3307 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3309 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3310 //{
3311 // Validate MLME state
3312 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3313 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3314 {
3315 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003316 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003317 // There's not much that MLME can do at this stage...
3318 respReqd = 0;
3319 }
3320 else
3321 mlmSetKeysCnf.resultCode = resultCode;
3322
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303323 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003324 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3327
Jeff Johnsone7245742012-09-05 17:12:55 -07003328 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 if( respReqd )
3330 {
3331 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3332 mlmSetKeysCnf.sessionId = sessionId;
3333
3334 // Prepare and Send LIM_MLM_SETKEYS_CNF
3335 if( NULL != lpLimMlmSetKeysReq )
3336 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303337 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3338 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3339 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303341 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 pMac->lim.gpLimMlmSetKeysReq = NULL;
3343 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003344 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 }
3346}
3347/**
3348 * limProcessMlmRemoveKeyRsp()
3349 *
3350 *FUNCTION:
3351 *
3352 *LOGIC:
3353 *
3354 *ASSUMPTIONS:
3355 *
3356 *NOTE:
3357 *
3358 * @param pMac Pointer to Global MAC structure
3359 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3360 *
3361 * @return None
3362 */
3363void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3364{
Jeff Johnsone7245742012-09-05 17:12:55 -07003365 tANI_U8 respReqd = 1;
3366 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3367 tANI_U16 resultCode;
3368 tANI_U8 sessionId = 0;
3369 tpPESession psessionEntry;
3370 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303371 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003372
3373 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003375 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003376 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 }
3378
Jeff Johnsone7245742012-09-05 17:12:55 -07003379 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3380 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3381 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3382 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003383
Jeff Johnsone7245742012-09-05 17:12:55 -07003384 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003386 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003387 return;
3388 }
3389
3390 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3391 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3392 else
3393 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3394
3395 // Validate MLME state
3396 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3397 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3398 {
3399 // Mesg received from HAL in Invalid state!
3400 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003401 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003402 limMsgQ->type,
3403 psessionEntry->limMlmState );
3404 respReqd = 0;
3405 }
3406 else
3407 mlmRemoveCnf.resultCode = resultCode;
3408
3409 //
3410 // TODO & FIXME_GEN4
3411 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3412 //
3413
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303414 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003415 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003416
3417 // Restore MLME state
3418 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3419 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3420
3421 if( respReqd )
3422 {
3423 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3424 mlmRemoveCnf.sessionId = sessionId;
3425
3426 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3427 if( NULL != lpLimMlmRemoveKeyReq )
3428 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303429 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3430 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3431 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003432 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303433 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003434 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3435 }
3436 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003438}
3439
Jeff Johnson295189b2012-06-20 16:38:30 -07003440
3441/** ---------------------------------------------------------------------
3442\fn limProcessInitScanRsp
3443\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3444\ message from HAL. If status code is failure, then
3445\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3446\param tpAniSirGlobal pMac
3447\param tANI_U32 body
3448\return none
3449\ ----------------------------------------------------------------------- */
3450void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3451{
3452 tpInitScanParams pInitScanParam;
3453 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003454 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3455 pInitScanParam = (tpInitScanParams) body;
3456 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303457 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003458
3459 //Only abort scan if the we are scanning.
3460 if( pMac->lim.abortScan &&
3461 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3462 {
krunal sonid3d60e12013-07-17 13:24:09 -07003463 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 pMac->lim.abortScan = 0;
3465 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3466 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3467 //Set the resume channel to Any valid channel (invalid).
3468 //This will instruct HAL to set it to any previous valid channel.
3469 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003470 if (status != eHAL_STATUS_SUCCESS)
3471 {
3472 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3473 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3474 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3475 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3476 return;
3477 }
3478 else
3479 {
3480 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3481 }
3482
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 }
3484 switch(pMac->lim.gLimHalScanState)
3485 {
3486 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3487 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3488 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003489 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3491 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3492 /*
3493 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3494 * another Scan request in the same context (happens when 11d is enabled
3495 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3496 * scan in the same context but with bigger channel list), so the state needs to be
3497 * changed before this response message is sent.
3498 */
3499 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003500 return;
3501 }
3502 else if (status == eHAL_STATUS_SUCCESS)
3503 {
3504 /* since we have successfully triggered a background scan,
3505 * reset the "consecutive bkgnd scan failure" count to 0
3506 */
3507 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3508 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003509 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 }
3511 limContinueChannelScan(pMac);
3512 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003513//WLAN_SUSPEND_LINK Related
3514 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3515 if( pMac->lim.gpLimSuspendCallback )
3516 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303517 if( eHAL_STATUS_SUCCESS == status )
3518 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303520 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303522 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303524 pMac->lim.gLimSystemInScanLearnMode = 0;
3525 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003526
3527 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3528 pMac->lim.gpLimSuspendCallback = NULL;
3529 pMac->lim.gpLimSuspendData = NULL;
3530 }
3531 else
3532 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003533 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 return;
3535 }
3536 break;
3537//end WLAN_SUSPEND_LINK Related
3538 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003539 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 pMac->lim.gLimHalScanState);
3541 break;
3542 }
3543 return;
3544}
3545/**
3546 * limProcessSwitchChannelReAssocReq()
3547 *
3548 *FUNCTION:
3549 * This function is called to send the reassoc req mgmt frame after the
3550 * switchChannelRsp message is received from HAL.
3551 *
3552 *LOGIC:
3553 *
3554 *ASSUMPTIONS:
3555 * NA
3556 *
3557 *NOTE:
3558 * NA
3559 *
3560 * @param pMac - Pointer to Global MAC structure.
3561 * @param psessionEntry - session related information.
3562 * @param status - channel switch success/failure.
3563 *
3564 * @return None
3565 */
3566static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3567{
3568 tLimMlmReassocCnf mlmReassocCnf;
3569 tLimMlmReassocReq *pMlmReassocReq;
3570 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3571 if(pMlmReassocReq == NULL)
3572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003573 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3575 goto end;
3576 }
3577
3578 if(status != eHAL_STATUS_SUCCESS)
3579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003580 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3582 goto end;
3583 }
3584 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003585 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3587 != TX_SUCCESS)
3588 {
3589 /// Could not start reassoc failure timer.
3590 // Log error
3591 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003592 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 // Return Reassoc confirm with
3594 // Resources Unavailable
3595 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3596 goto end;
3597 }
3598 /// Prepare and send Reassociation request frame
3599 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3600 return;
3601end:
3602 // Free up buffer allocated for reassocReq
3603 if(pMlmReassocReq != NULL)
3604 {
3605 /* Update PE session Id*/
3606 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303607 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003608 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 }
3610 else
3611 {
3612 mlmReassocCnf.sessionId = 0;
3613 }
3614
3615 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3616 /* Update PE sessio Id*/
3617 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3618
3619 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3620}
3621/**
3622 * limProcessSwitchChannelJoinReq()
3623 *
3624 *FUNCTION:
3625 * This function is called to send the probe req mgmt frame after the
3626 * switchChannelRsp message is received from HAL.
3627 *
3628 *LOGIC:
3629 *
3630 *ASSUMPTIONS:
3631 * NA
3632 *
3633 *NOTE:
3634 * NA
3635 *
3636 * @param pMac - Pointer to Global MAC structure.
3637 * @param psessionEntry - session related information.
3638 * @param status - channel switch success/failure.
3639 *
3640 * @return None
3641 */
3642static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3643{
3644 tANI_U32 val;
3645 tSirMacSSid ssId;
3646 tLimMlmJoinCnf mlmJoinCnf;
3647 if(status != eHAL_STATUS_SUCCESS)
3648 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003649 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 goto error;
3651 }
3652
3653 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3654 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003655 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003656 goto error;
3657 }
3658
Jeff Johnsone7245742012-09-05 17:12:55 -07003659
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3661 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3662 {
3663 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3664 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303665 {
3666 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3667 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3668 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303670 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003672
3673 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3674 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003675 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003676 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3677 // Apply previously set configuration at HW
3678 limApplyConfiguration(pMac, psessionEntry);
3679 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303680 vos_mem_copy(ssId.ssId,
3681 psessionEntry->ssId.ssId,
3682 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003684
3685 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3686
3687 //assign appropriate sessionId to the timer object
3688 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303689 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %s "
3690 "BSSID: "MAC_ADDRESS_STR), psessionEntry->peSessionId,
3691 psessionEntry->currentOperChannel, ssId.ssId,
3692 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003693 // include additional IE if there is
3694 limSendProbeReqMgmtFrame( pMac, &ssId,
3695 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3696 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3697 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003698
3699 // Sending mgmt frame is a blocking call activate Join failure timer now
3700 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3701 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3702 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003703 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003704 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3705 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3706 //memory is freed up below.
3707 psessionEntry->pLimMlmJoinReq = NULL;
3708 goto error;
3709 }
3710
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003711 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3712 {
Yathish9f22e662012-12-10 14:21:35 -08003713 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003714 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3715 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003716 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003717 goto error;
3718 }
3719 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003720
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 return;
3722error:
3723 if(NULL != psessionEntry)
3724 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303725 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003726 psessionEntry->pLimMlmJoinReq = NULL;
3727 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3728 }
3729 else
3730 {
3731 mlmJoinCnf.sessionId = 0;
3732 }
3733 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3734 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3735 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3736}
3737
3738/**
3739 * limProcessSwitchChannelRsp()
3740 *
3741 *FUNCTION:
3742 * This function is called to process switchChannelRsp message from HAL.
3743 *
3744 *LOGIC:
3745 *
3746 *ASSUMPTIONS:
3747 * NA
3748 *
3749 *NOTE:
3750 * NA
3751 *
3752 * @param pMac - Pointer to Global MAC structure
3753 * @param body - message body.
3754 *
3755 * @return None
3756 */
3757void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3758{
3759 tpSwitchChannelParams pChnlParams = NULL;
3760 eHalStatus status;
3761 tANI_U16 channelChangeReasonCode;
3762 tANI_U8 peSessionId;
3763 tpPESession psessionEntry;
3764 //we need to process the deferred message since the initiating req. there might be nested request.
3765 //in the case of nested request the new request initiated from the response will take care of resetting
3766 //the deffered flag.
3767 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3768 pChnlParams = (tpSwitchChannelParams) body;
3769 status = pChnlParams->status;
3770 peSessionId = pChnlParams->peSessionId;
3771 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3772 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303773 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003774 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 return;
3776 }
3777#if defined WLAN_FEATURE_VOWIFI
3778 //HAL fills in the tx power used for mgmt frames in this field.
3779 //Store this value to use in TPC report IE.
3780 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3781#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303782 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3784 // initialize it back to invalid id
3785 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303786 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 switch(channelChangeReasonCode)
3788 {
3789 case LIM_SWITCH_CHANNEL_REASSOC:
3790 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3791 break;
3792 case LIM_SWITCH_CHANNEL_JOIN:
3793 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3794 break;
3795
3796 case LIM_SWITCH_CHANNEL_OPERATION:
3797 /*
3798 * The above code should also use the callback.
3799 * mechanism below, there is scope for cleanup here.
3800 * THat way all this response handler does is call the call back
3801 * We can get rid of the reason code here.
3802 */
3803 if (pMac->lim.gpchangeChannelCallback)
3804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003805 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3807 }
3808 break;
3809 default:
3810 break;
3811 }
3812}
3813/**
3814 * limProcessStartScanRsp()
3815 *
3816 *FUNCTION:
3817 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3818 * then it will start scan/learn on the next channel.
3819 *
3820 *LOGIC:
3821 *
3822 *ASSUMPTIONS:
3823 * NA
3824 *
3825 *NOTE:
3826 * NA
3827 *
3828 * @param pMac - Pointer to Global MAC structure
3829 * @param body - message body.
3830 *
3831 * @return None
3832 */
3833
3834void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3835{
3836 tpStartScanParams pStartScanParam;
3837 eHalStatus status;
3838 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3839 pStartScanParam = (tpStartScanParams) body;
3840 status = pStartScanParam->status;
3841#if defined WLAN_FEATURE_VOWIFI
3842 //HAL fills in the tx power used for mgmt frames in this field.
3843 //Store this value to use in TPC report IE.
3844 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3845 //Store start TSF of scan start. This will be stored in BSS params.
3846 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3847#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303848 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003849 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003850 if( pMac->lim.abortScan )
3851 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003852 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003853 pMac->lim.abortScan = 0;
3854 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3855 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3856 //Set the resume channel to Any valid channel (invalid).
3857 //This will instruct HAL to set it to any previous valid channel.
3858 peSetResumeChannel(pMac, 0, 0);
3859 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3860 }
3861 switch(pMac->lim.gLimHalScanState)
3862 {
3863 case eLIM_HAL_START_SCAN_WAIT_STATE:
3864 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3865 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003866 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 //
3868 // FIXME - With this, LIM will try and recover state, but
3869 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3870 // status back to the SME
3871 //
3872 //Set the resume channel to Any valid channel (invalid).
3873 //This will instruct HAL to set it to any previous valid channel.
3874 peSetResumeChannel(pMac, 0, 0);
3875 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3876 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3877 }
3878 else
3879 {
3880 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3881 limContinuePostChannelScan(pMac);
3882 }
3883 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003885 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003886 pMac->lim.gLimHalScanState);
3887 break;
3888 }
3889 return;
3890}
3891void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3892{
3893 tpEndScanParams pEndScanParam;
3894 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3896 pEndScanParam = (tpEndScanParams) body;
3897 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303898 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003899 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 switch(pMac->lim.gLimHalScanState)
3901 {
3902 case eLIM_HAL_END_SCAN_WAIT_STATE:
3903 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3904 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003905 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3907 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3908 }
3909 else
3910 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08003911 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07003912 limContinueChannelScan(pMac);
3913 }
3914 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003916 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 pMac->lim.gLimHalScanState);
3918 break;
3919 }
3920 return;
3921}
Jeff Johnsone7245742012-09-05 17:12:55 -07003922/**
3923 * limStopTxAndSwitch()
3924 *
3925 *FUNCTION:
3926 * Start channel switch on all sessions that is in channel switch state.
3927 *
3928 * @param pMac - pointer to global adapter context
3929 *
3930 * @return None
3931 *
3932 */
3933static void
3934limStopTxAndSwitch (tpAniSirGlobal pMac)
3935{
3936 tANI_U8 i;
3937
3938 for(i =0; i < pMac->lim.maxBssId; i++)
3939 {
3940 if(pMac->lim.gpSession[i].valid &&
3941 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
3942 {
3943 limStopTxAndSwitchChannel(pMac, i);
3944 }
3945 }
3946 return;
3947}
3948/**
3949 * limStartQuietOnSession()
3950 *
3951 *FUNCTION:
3952 * This function is called to start quiet timer after finish scan if there is
3953 * qeuieting on any session.
3954 *
3955 *LOGIC:
3956 *
3957 *ASSUMPTIONS:
3958 * NA
3959 *
3960 *NOTE:
3961 * NA
3962 *
3963 * @param pMac - Pointer to Global MAC structure
3964 *
3965 * @return None
3966 */
3967static void
3968limStartQuietOnSession (tpAniSirGlobal pMac)
3969{
3970 tANI_U8 i;
3971
3972 for(i =0; i < pMac->lim.maxBssId; i++)
3973 {
3974 if(pMac->lim.gpSession[i].valid &&
3975 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
3976 {
3977 limStartQuietTimer(pMac, i);
3978 }
3979 }
3980 return;
3981}
Jeff Johnson295189b2012-06-20 16:38:30 -07003982void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
3983{
3984 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 eHalStatus status;
3986 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3987 pFinishScanParam = (tpFinishScanParams) body;
3988 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303989 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003990 body = NULL;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07003991
3992 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp in state %d"),
3993 pMac->lim.gLimHalScanState);
3994
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 switch(pMac->lim.gLimHalScanState)
3996 {
3997 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
3998 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3999 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004000 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 {
4002 /** Right time to stop tx and start the timer for channel switch */
4003 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4004 * be any associated session id
4005 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004006 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004008 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 {
4010 /** Start the quieting */
4011 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4012 * be any associated session id
4013 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004014 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004015 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004016 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004018 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 }
4020 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004021//WLAN_SUSPEND_LINK Related
4022 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4023 if( pMac->lim.gpLimResumeCallback )
4024 {
4025 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4026 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4027 pMac->lim.gpLimResumeCallback = NULL;
4028 pMac->lim.gpLimResumeData = NULL;
4029 pMac->lim.gLimSystemInScanLearnMode = 0;
4030 }
4031 else
4032 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004033 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07004034 return;
4035 }
4036 break;
4037//end WLAN_SUSPEND_LINK Related
4038
4039 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004040 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 pMac->lim.gLimHalScanState);
4042 break;
4043 }
4044 return;
4045}
4046/**
4047 * @function : limProcessMlmHalAddBARsp
4048 *
4049 * @brief: Process WDA_ADDBA_RSP coming from HAL
4050 *
4051 *
4052 * @param pMac The global tpAniSirGlobal object
4053 *
4054 * @param tSirMsgQ The MsgQ header containing the response buffer
4055 *
4056 * @return none
4057 */
4058void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4059 tpSirMsgQ limMsgQ )
4060{
4061 // Send LIM_MLM_ADDBA_CNF to LIM
4062 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004063 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004065
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 //now LIM can process any defer message.
4067 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4068 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004069 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 return;
4071 }
4072 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4073 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004074 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304075 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004076 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 return;
4078 }
4079#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4080 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4081#endif //FEATURE_WLAN_DIAG_SUPPORT
4082
4083 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304084 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4085 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004086 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304087 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004088 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004089 return;
4090 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304091 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304093 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4094 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 // Copy other ADDBA Rsp parameters
4096 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4097 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4098 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4099 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4100 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4101 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4102 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4103 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4104 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4105 else
4106 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304107 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004108 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004109 // Send ADDBA CNF to LIM
4110 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4111}
4112/**
4113 * \brief Process LIM_MLM_ADDBA_CNF
4114 *
4115 * \sa limProcessMlmAddBACnf
4116 *
4117 * \param pMac The global tpAniSirGlobal object
4118 *
4119 * \param tSirMsgQ The MsgQ header containing the response buffer
4120 *
4121 * \return none
4122 */
4123void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4124 tANI_U32 *pMsgBuf )
4125{
4126tpLimMlmAddBACnf pMlmAddBACnf;
4127tpDphHashNode pSta;
4128tANI_U16 aid;
4129tLimBAState curBaState;
4130tpPESession psessionEntry = NULL;
4131if(pMsgBuf == NULL)
4132{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004133 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 return;
4135}
4136pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4137 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4138 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004139 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304140 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 return;
4142 }
4143 // First, extract the DPH entry
4144 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4145 if( NULL == pSta )
4146 {
4147 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004148 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304149 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 return;
4151 }
4152 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4153 // Need to validate SME state
4154 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4155 {
4156 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004157 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004158 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304159 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 return;
4161 }
4162 // Restore STA BA state
4163 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004164 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 {
4166 // Update LIM internal cache...
4167 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4168 {
4169 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4170 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4171 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4172 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4173 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004174 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4175 // status code. MLME will then send an ADDBA RSP
4176 // over the air to the peer MAC entity
4177 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4178 pMlmAddBACnf->peerMacAddr,
4179 pMlmAddBACnf->addBAResultCode,
4180 pMlmAddBACnf->baDialogToken,
4181 (tANI_U8) pMlmAddBACnf->baTID,
4182 (tANI_U8) pMlmAddBACnf->baPolicy,
4183 pMlmAddBACnf->baBufferSize,
4184 pMlmAddBACnf->baTimeout,psessionEntry))
4185 {
4186 PELOGW(limLog( pMac, LOGW,
4187 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4188 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4189 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 }
4191 else
4192 {
4193 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4194 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4195 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4196 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4197 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4198 }
4199 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304201 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004202 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004203}
4204/**
4205 * \brief Process LIM_MLM_DELBA_CNF
4206 *
4207 * \sa limProcessMlmDelBACnf
4208 *
4209 * \param pMac The global tpAniSirGlobal object
4210 *
4211 * \param tSirMsgQ The MsgQ header containing the response buffer
4212 *
4213 * \return none
4214 */
4215void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4216 tANI_U32 *pMsgBuf )
4217{
4218 tpLimMlmDelBACnf pMlmDelBACnf;
4219 tpDphHashNode pSta;
4220 tANI_U16 aid;
4221// tANI_U8 sessionId;
4222 tLimBAState curBaState;
4223 tpPESession psessionEntry;
4224
4225 if(pMsgBuf == NULL)
4226 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004227 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 return;
4229 }
4230 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4231 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4232 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004233 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304234 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 return;
4236 }
4237 // First, extract the DPH entry
4238 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4239 if( NULL == pSta )
4240 {
4241 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004242 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304243 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 return;
4245 }
4246 if(NULL == pMlmDelBACnf)
4247 {
4248 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004249 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004250 return;
4251 }
4252 // Need to validate baState
4253 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4254 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4255 {
4256 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004257 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304259 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 return;
4261 }
4262 // Restore STA BA state
4263 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4264 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304265 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004266}
4267/**
4268 * \brief Process SIR_LIM_DEL_BA_IND
4269 *
4270 * \sa limProcessMlmHalBADeleteInd
4271 *
4272 * \param pMac The global tpAniSirGlobal object
4273 *
4274 * \param tSirMsgQ The MsgQ header containing the indication buffer
4275 *
4276 * \return none
4277 */
4278void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4279 tpSirMsgQ limMsgQ )
4280{
4281 tSirRetStatus status = eSIR_SUCCESS;
4282 tpBADeleteParams pBADeleteParams;
4283 tpDphHashNode pSta;
4284 tANI_U16 aid;
4285 tLimBAState curBaState;
4286 tpPESession psessionEntry;
4287 tANI_U8 sessionId;
4288
4289 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4290
4291 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4292 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004293 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304294 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004295 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 return;
4297 }
4298 // First, extract the DPH entry
4299 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4300 if( NULL == pSta )
4301 {
4302 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004303 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 goto returnAfterCleanup;
4305 }
4306
4307 // Need to validate BA state
4308 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4309 if( eLIM_BA_STATE_IDLE != curBaState )
4310 {
4311 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004312 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 curBaState );
4314 goto returnAfterCleanup;
4315 }
4316
4317 // Validate if a BA is active for the requested TID
4318 // AND in that desired direction
4319 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4320 {
4321 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4322 status = eSIR_FAILURE;
4323 }
4324 else
4325 {
4326 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4327 status = eSIR_FAILURE;
4328 }
4329 if( eSIR_FAILURE == status )
4330 {
4331 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004332 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 pBADeleteParams->baTID );
4334 }
4335 else
4336 {
4337 // Post DELBA REQ to MLME...
4338 if( eSIR_SUCCESS !=
4339 (status = limPostMlmDelBAReq( pMac,
4340 pSta,
4341 pBADeleteParams->baDirection,
4342 pBADeleteParams->baTID,
4343 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4344 {
4345 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004346 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 }
4348 else
4349 {
4350 limLog( pMac, LOGE,
4351 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4352 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4353 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4354 }
4355 }
4356returnAfterCleanup:
4357 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304358 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004359 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004360}
4361/**
4362 * @function : limProcessSetMimoRsp()
4363 *
4364 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4365 * after Processing the Req from the SME (PMC)
4366 *
4367 * LOGIC:
4368 *
4369 * ASSUMPTIONS:
4370 * NA
4371 *
4372 * NOTE:
4373 * NA
4374 *
4375 * @param pMac - Pointer to Global MAC structure
4376 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4377 * @return None
4378 */
4379
4380void
4381limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4382{
4383#if 0
4384 tSirRetStatus retStatus;
4385 tpSetMIMOPS pMIMO_PSParams;
4386
4387
4388 do {
4389
4390 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4391 if( NULL == pMIMO_PSParams ) {
4392 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4393 return;
4394 }
4395
4396 /** If Updation of the HAL Fail's*/
4397 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004398 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 break;
4400 }
4401
4402 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4403 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4404 break;
4405
4406 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4407 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4408
4409 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4410 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4411 * the Action Frame is being sent at first before setting the internal structures
4412 */
4413 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4414 tSirMacAddr macAddr;
4415
4416 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304417 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004418
4419 /** Send Action Frame with the corresponding mode */
4420 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4421 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004422 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004423 break;
4424 }
4425 }
4426 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4427 }while(0);
4428
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304429 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004430#endif
4431}
4432/**
4433 * @function : limHandleDelBssInReAssocContext
4434 * @brief : While Processing the ReAssociation Response Frame in STA,
4435 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4436 * being issued and the end of DelBSS the new BSS is being added.
4437 *
4438 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4439 * change, We need to update CSR with ReAssocCNF Response with the
4440 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4441 * context only
4442 *
4443 * @param : pMac - tpAniSirGlobal
4444 * pStaDs - Station Descriptor
4445 *
4446 * @return : none
4447 */
4448static void
4449limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4450{
4451 tLimMlmReassocCnf mlmReassocCnf;
4452 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4453 /** Set the MlmState to IDLE*/
4454 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 /* Update PE session Id*/
4456 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4457 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 case eLIM_SME_WT_REASSOC_STATE :
4459 {
4460 tpSirAssocRsp assocRsp;
4461 tpDphHashNode pStaDs;
4462 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 /** Delete the older STA Table entry */
4465 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4466 /**
4467 * Add an entry for AP to hash table
4468 * maintained by DPH module
4469 */
4470 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4471 {
4472 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004473 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004474 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4475 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4476 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4477 goto Error;
4478 }
4479 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4480 * is being stored to be used here for sending ADDBSS
4481 */
4482 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4483 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4484 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004485 limExtractApCapabilities( pMac,
4486 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4487 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4488 &beaconStruct );
4489 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4490 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4491 if(beaconStruct.erpPresent) {
4492 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4493 psessionEntry->beaconParams.fShortPreamble = 0;
4494 else
4495 psessionEntry->beaconParams.fShortPreamble = 1;
4496 }
4497 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4498 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4499 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004500 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 retStatus = eSIR_FAILURE;
4502 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 if (retStatus != eSIR_SUCCESS)
4504 {
4505 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4506 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304507 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 pMac->lim.gLimAssocResponseData = NULL;
4509 goto Error;
4510 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304511 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 psessionEntry->limAssocResponseData = NULL;
4513 }
4514 break;
4515 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4516 {
4517 /** Case wherein the DisAssoc / Deauth
4518 * being sent as response to ReAssoc Req*/
4519 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4520 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4521 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4522 /** Set the SME State back to WT_Reassoc State*/
4523 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004524 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4525 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4526 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4527 {
4528 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 }
4530 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4531 }
4532 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004534 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4536 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4537 goto Error;
4538 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004539 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004540Error:
4541 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4542}
4543
4544/* Added For BT -AMP Support */
4545static void
4546limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4547{
4548 tLimMlmStartCnf mlmStartCnf;
4549 tANI_U32 val;
4550 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4551
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304552 if (NULL == pAddBssParams)
4553 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004554 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304555 goto end;
4556 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004557 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4558 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004559 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4561 {
4562 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4563 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4564 goto end;
4565 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4566 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4567 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4568 goto end;
4569 }
4570
4571 // Set MLME state
4572 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4573 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4574 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4575 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004576 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 // Create timers used by LIM
4578 if (!pMac->lim.gLimTimersCreated)
4579 limCreateTimers(pMac);
4580 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4581 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004582 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4584 // Apply previously set configuration at HW
4585 limApplyConfiguration(pMac,psessionEntry);
4586 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4587 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4588 }
4589 else
4590 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004591 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4593 }
4594 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4595 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4596 end:
4597 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004598 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304599 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004600 limMsgQ->bodyptr = NULL;
4601 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004602}
4603
4604/**
4605 * @function : limHandleAddBssInReAssocContext
4606 * @brief : While Processing the ReAssociation Response Frame in STA,
4607 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4608 * being issued and the end of DelBSS the new BSS is being added.
4609 *
4610 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4611 * change, We need to update CSR with ReAssocCNF Response with the
4612 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4613 * context only
4614 *
4615 * @param : pMac - tpAniSirGlobal
4616 * pStaDs - Station Descriptor
4617 *
4618 * @return : none
4619 */
4620void
4621limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4622{
4623 tLimMlmReassocCnf mlmReassocCnf;
4624 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4625 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004626 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4627 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004629 case eLIM_SME_WT_REASSOC_STATE : {
4630 tpSirAssocRsp assocRsp;
4631 tpDphHashNode pStaDs;
4632 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004633 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304634 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4635 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004636 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304637 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004638 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4639 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4640 goto Error;
4641 }
4642
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 // Get the AP entry from DPH hash table
4644 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4645 if (pStaDs == NULL )
4646 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004647 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004648 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4649 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304650 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 goto Error;
4652 }
4653 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4654 * is being stored to be used here for sending ADDBSS
4655 */
4656 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4657 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4658 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004659 limExtractApCapabilities( pMac,
4660 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4661 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004662 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004664 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4665
4666 if(pBeaconStruct->erpPresent)
4667 {
4668 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 psessionEntry->beaconParams.fShortPreamble = 0;
4670 else
4671 psessionEntry->beaconParams.fShortPreamble = 1;
4672 }
4673
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004674 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004675 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004676 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 retStatus = eSIR_FAILURE;
4678 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004679 if (retStatus != eSIR_SUCCESS)
4680 {
4681 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4682 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304683 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304685 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 goto Error;
4687 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304688 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304690 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 }
4692 break;
4693 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4694 * being sent as response to ReAssoc Req*/
4695 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4696 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4697 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4698 /** Set the SME State back to WT_Reassoc State*/
4699 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4700 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4701 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004702 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004704 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004706
4707 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4708 }
4709 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004711 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004712 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4713 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4714 goto Error;
4715 }
4716return;
4717Error:
4718 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4719}
4720
4721#if 0
4722 static void
4723limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4724{
4725 tSirSmeAssocCnf assocCnf;
4726 tpDphHashNode pStaDs;
4727 tpPESession psessionEntry;
4728 tANI_U8 sessionId;
4729
4730 if(pMsgBuf == NULL)
4731 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004732 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004733 goto end;
4734 }
4735 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4736 !__limIsSmeAssocCnfValid(&assocCnf))
4737 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004738 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 goto end;
4740 }
4741 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4742 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004743 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004744 goto end;
4745 }
4746 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4747 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4748 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004749 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004750 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4751 goto end;
4752 }
4753 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4754 if (pStaDs == NULL)
4755 {
4756 limLog(pMac, LOG1,
4757 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4758 msgType, assocCnf.aid);
4759 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4760 /*
4761 ** send a DISASSOC_IND message to WSM to make sure
4762 ** the state in WSM and LIM is the same
4763 **/
4764 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4765 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4766 goto end;
4767 }
4768 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304769 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 (tANI_U8 *) assocCnf.peerMacAddr,
4771 sizeof(tSirMacAddr)) ) ||
4772 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4773 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4774 (msgType != eWNI_SME_ASSOC_CNF)) ||
4775 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4776 (msgType != eWNI_SME_REASSOC_CNF)))))
4777 {
4778 limLog(pMac, LOG1,
4779 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4780 msgType, assocCnf.aid);
4781 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4782 goto end;
4783 }
4784 /*
4785 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4786 ** has been received
4787 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004788 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4790 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4791 {
4792 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4793 * when it had received Assoc Request frame. Now, PE just needs to send
4794 * Association Response frame to the requesting BTAMP-STA.
4795 */
4796 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004797 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004798 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4799 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4800 goto end;
4801 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4802 else
4803 {
4804 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4805 limRejectAssociation(pMac, pStaDs->staAddr,
4806 pStaDs->mlmStaContext.subType,
4807 true, pStaDs->mlmStaContext.authType,
4808 pStaDs->assocId, true,
4809 assocCnf.statusCode, psessionEntry);
4810 return;
4811 }
4812end:
4813 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4814 {
4815 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4816 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304817 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4819 }
4820
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304821 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4823 }
4824} /*** end __limProcessSmeAssocCnfNew() ***/
4825#endif
4826
Jeff Johnson295189b2012-06-20 16:38:30 -07004827void
4828limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4829 tBeaconGenParams *pBeaconGenParams = NULL;
4830 tSirMsgQ limMsg;
4831 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4832 if(psessionEntry == NULL ){
4833 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004834 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 return;
4836 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304837 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4838 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 {
4840 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304841 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 return;
4843 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304844 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4845 vos_mem_copy((void *) pBeaconGenParams->bssId,
4846 (void *)psessionEntry->bssId,
4847 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 limMsg.bodyptr = pBeaconGenParams;
4849 schProcessPreBeaconInd(pMac, &limMsg);
4850 return;
4851}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304852
4853void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4854 tSirResultCodes reasonCode)
4855{
4856 tANI_U16 scanRspLen = 0;
4857
4858 pMac->lim.gLimSmeScanResultLength +=
4859 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304860 pMac->lim.gLimRspReqd = false;
4861 if ((reasonCode == eSIR_SME_SUCCESS) ||
4862 pMac->lim.gLimSmeScanResultLength) {
4863 scanRspLen = sizeof(tSirSmeScanRsp) +
4864 pMac->lim.gLimSmeScanResultLength -
4865 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304866 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304867 else
4868 scanRspLen = sizeof(tSirSmeScanRsp);
4869
4870 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4871 pMac->lim.gSmeSessionId,
4872 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304873}
4874
4875
4876void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4877{
4878 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4879
4880 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004881 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304882
4883 switch (pScanEvent->event)
4884 {
4885 case SCAN_EVENT_STARTED:
4886 break;
4887 case SCAN_EVENT_START_FAILED:
4888 case SCAN_EVENT_COMPLETED:
4889 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
4890 break;
4891 case SCAN_EVENT_BSS_CHANNEL:
4892 case SCAN_EVENT_FOREIGN_CHANNEL:
4893 case SCAN_EVENT_DEQUEUED:
4894 case SCAN_EVENT_PREEMPTED:
4895 default:
4896 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004897 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304898 }
4899}