blob: 93d9319cd4b4884d272bfbf56d522fc51b52fa8e [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 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530452 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
453 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 return;
455 }
456
457 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
458 {
459 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700460 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 psessionEntry->limSmeState);)
462 return;
463 }
464
465 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
466 /// Process Join confirm from MLM
467 if (resultCode == eSIR_SME_SUCCESS)
468 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530469 PELOG1(limLog(pMac, LOG1, FL("***SessionId:%d Joined ESS ***"),
470 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
473 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
474 return;
475 else
476 resultCode = eSIR_SME_REFUSED;
477 }
478 {
479 /// Join failure
480 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700481 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 /// Send Join response to Host
483 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
484 }
485} /*** end limProcessMlmJoinCnf() ***/
486
487/**
488 * limProcessMlmAuthCnf()
489 *
490 *FUNCTION:
491 * This function is called to processes MLM_AUTH_CNF
492 * message from MLM State machine.
493 *
494 *LOGIC:
495 *
496 *ASSUMPTIONS:
497 *
498 *NOTE:
499 *
500 * @param pMac Pointer to Global MAC structure
501 * @param pMsgBuf A pointer to the MLM message buffer
502 *
503 * @return None
504 */
505void
506limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
507{
508 tANI_U16 caps;
509 tANI_U32 val;
510 tAniAuthType cfgAuthType, authMode;
511 tLimMlmAuthReq *pMlmAuthReq;
512 tLimMlmAssocReq *pMlmAssocReq;
513 tLimMlmAuthCnf *pMlmAuthCnf;
514 tpPESession psessionEntry;
515 tANI_U32 teleBcnEn = 0;
516// tANI_U8 sessionId;
517
518 if(pMsgBuf == NULL)
519 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700520 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 return;
522 }
523 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
524 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
525 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530526 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),
527 pMlmAuthCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 return;
529 }
530
531 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
532 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
533 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
534 {
535 /**
536 * Should not have received AUTH confirm
537 * from MLM in other states or on AP.
538 * Log error
539 */
540 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530541 FL("SessionId:%d received unexpected MLM_AUTH_CNF in state %X"),
542 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 return;
544 }
545 /// Process AUTH confirm from MLM
546 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
547 {
548 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
549 {
550 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
551 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
552 {
553 /**
554 * Could not get AuthType value from CFG.
555 * Log error.
556 */
557 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700558 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 }
560 }
561 else
562 cfgAuthType = pMac->lim.gLimPreAuthType;
563
564 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
565 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
566 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
567 {
568 /**
569 * When Open authentication fails with reason code "13" and
570 * authType set to 'auto switch', Try with Shared Authentication
571 */
572 authMode = eSIR_SHARED_KEY;
573 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530574 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
575 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 {
577 // Log error
578 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530579 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 return;
581 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530582 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 val = sizeof(tSirMacAddr);
584 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
585 {
586 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
587 }
588 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530589 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
590 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 sizeof(tSirMacAddr));
592 pMlmAuthReq->authType = authMode;
593 /* Update PE session Id*/
594 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
595 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
596 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
597 != eSIR_SUCCESS)
598 {
599 /**
600 * Could not get AuthFailureTimeout value from CFG.
601 * Log error.
602 */
603 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700604 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 }
606 limPostMlmMessage(pMac,
607 LIM_MLM_AUTH_REQ,
608 (tANI_U32 *) pMlmAuthReq);
609 return;
610 }
611 else
612 {
613 // MAC based authentication failure
614 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
615 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700616 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700618 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700620 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
621
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 /**
623 * Need to send Join response with
624 * auth failure to Host.
625 */
626 limHandleSmeJoinResult(pMac,
627 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
628 }
629 else
630 {
631 /**
632 * Pre-authentication failure.
633 * Send Pre-auth failure response to host
634 */
635 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700636 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 limSendSmeAuthRsp(
638 pMac,
639 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
640 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
641 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
642 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
643 }
644 } // end if (cfgAuthType == eAUTO_SWITCH)
645 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
646 else
647 {
648 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
649 {
650 /**
651 * Successful MAC based authentication
652 * Trigger Association with BSS
653 */
654 PELOG1(limLog(pMac, LOG1,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530655 FL("SessionId:%d Authenticated with BSS"),
656 psessionEntry->peSessionId);)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530657 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
658 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 {
660 // Log error
661 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530662 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 return;
664 }
665 val = sizeof(tSirMacAddr);
666 #if 0
667 if (cfgGetStr(pMac, WNI_CFG_BSSID,
668 pMlmAssocReq->peerMacAddr,
669 &val) != eSIR_SUCCESS)
670 {
671 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700672 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 }
674 #endif //SUPPORT BT-AMP
675 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
676 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
677 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
678 != eSIR_SUCCESS)
679 {
680 /**
681 * Could not get AssocFailureTimeout value
682 * from CFG. Log error.
683 */
684 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700685 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 }
687 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
688 {
689 /**
690 * Could not get Capabilities value
691 * from CFG. Log error.
692 */
693 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700694 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 }
696 /*Clear spectrum management bit if AP doesn't support it*/
697 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
698 {
699 /*AP doesn't support spectrum management clear spectrum management bit*/
700 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
701 }
702
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530703 /* Clear rrm bit if AP doesn't support it */
704 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
705 & LIM_RRM_BIT_MASK))
706 {
707 caps &= (~LIM_RRM_BIT_MASK);
708 }
709
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 pMlmAssocReq->capabilityInfo = caps;
711 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700712 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700714 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
715 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
717 /* If telescopic beaconing is enabled, set listen interval to
718 WNI_CFG_TELE_BCN_MAX_LI */
719 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
720 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700721 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700722
723 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
724
725 if(teleBcnEn)
726 {
727 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
728 eSIR_SUCCESS)
729 {
730 /**
731 * Could not get ListenInterval value
732 * from CFG. Log error.
733 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700734 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700735 }
736 }
737 else
738 {
739 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
740 {
741 /**
742 * Could not get ListenInterval value
743 * from CFG. Log error.
744 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700745 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 }
747 }
748
749 pMlmAssocReq->listenInterval = (tANI_U16)val;
750 /* Update PE session ID*/
751 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
752 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
753 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700754 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530755 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
756 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 limPostMlmMessage(pMac,
758 LIM_MLM_ASSOC_REQ,
759 (tANI_U32 *) pMlmAssocReq);
760 }
761 else
762 {
763 /**
764 * Successful Pre-authentication.
765 * Send Pre-auth response to host
766 */
767 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700768 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 limSendSmeAuthRsp(
770 pMac,
771 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
772 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
773 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
774 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
775 }
776 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
777} /*** end limProcessMlmAuthCnf() ***/
778
779/**
780 * limProcessMlmAssocCnf()
781 *
782 *FUNCTION:
783 * This function is called to processes MLM_ASSOC_CNF
784 * message from MLM State machine.
785 *
786 *LOGIC:
787 *
788 *ASSUMPTIONS:
789 *
790 *NOTE:
791 *
792 * @param pMac Pointer to Global MAC structure
793 * @param pMsgBuf A pointer to the MLM message buffer
794 *
795 * @return None
796 */
797void
798limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
799{
800 tpPESession psessionEntry;
801 tLimMlmAssocCnf *pLimMlmAssocCnf;
802
803 if(pMsgBuf == NULL)
804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700805 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 return;
807 }
808 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
809 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
810 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530811 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
812 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 return;
814 }
815 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
816 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
817 {
818 /**
819 * Should not have received Assocication confirm
820 * from MLM in other states OR on AP.
821 * Log error
822 */
823 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530824 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %X"),
825 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 return;
827 }
828 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
829 {
830 // Association failure
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530831 PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Association failure"),
832 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700834 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 /**
836 * Need to send Join response with
837 * Association failure to Host.
838 */
839 limHandleSmeJoinResult(pMac,
840 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
841 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
842 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
843 else
844 {
845 // Successful Association
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530846 PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Associated with BSS"),
847 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700849 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 /**
851 * Need to send Join response with
852 * Association success to Host.
853 */
854 limHandleSmeJoinResult(pMac,
855 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
856 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
857 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
858} /*** end limProcessMlmAssocCnf() ***/
859
860/**
861 * limProcessMlmReassocCnf()
862 *
863 *FUNCTION:
864 * This function is called to processes MLM_REASSOC_CNF
865 * message from MLM State machine.
866 *
867 *LOGIC:
868 *
869 *ASSUMPTIONS:
870 *
871 *NOTE:
872 *
873 * @param pMac Pointer to Global MAC structure
874 * @param pMsgBuf A pointer to the MLM message buffer
875 *
876 * @return None
877 */
878void
879limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
880{
881 tpPESession psessionEntry;
882 tLimMlmReassocCnf *pLimMlmReassocCnf;
883
884 if(pMsgBuf == NULL)
885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700886 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 return;
888 }
889 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
890 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
891 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700892 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 return;
894 }
895 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
896 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
897 {
898 /**
899 * Should not have received Reassocication confirm
900 * from MLM in other states OR on AP.
901 * Log error
902 */
903 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700904 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
906 return;
907 }
908 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530909 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 psessionEntry->pLimReAssocReq = NULL;
911 }
912
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530913 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
915 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700916 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700917
918 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700919 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700920
921 /**
922 * Need to send Reassoc response with
923 * Reassociation success to Host.
924 */
925 limSendSmeJoinReassocRsp(
926 pMac, eWNI_SME_REASSOC_RSP,
927 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
928 psessionEntry->smeSessionId,psessionEntry->transactionId);
929 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
930 /** Reassociation failure With the New AP
931 * but we still have the link with the Older AP
932 */
933 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700934 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700935
936 /**
937 * Need to send Reassoc response with
938 * Association failure to Host.
939 */
940 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
941 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
942 psessionEntry->smeSessionId,psessionEntry->transactionId);
943 }else {
944 // Reassociation failure
945 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700946 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 /**
948 * Need to send Reassoc response with
949 * Association failure to Host.
950 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700951 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 }
953} /*** end limProcessMlmReassocCnf() ***/
954
955/**
956 * limProcessMlmReassocInd()
957 *
958 *FUNCTION:
959 * This function is called to processes MLM_REASSOC_IND
960 * message from MLM State machine.
961 *
962 *LOGIC:
963 *
964 *ASSUMPTIONS:
965 *
966 *NOTE:
967 *
968 * @param pMac Pointer to Global MAC structure
969 * @param pMsgBuf A pointer to the MLM message buffer
970 *
971 * @return None
972 */
973void
974limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
975{
976 tANI_U32 len;
977 tSirMsgQ msgQ;
978 tSirSmeReassocInd *pSirSmeReassocInd;
979 tpDphHashNode pStaDs=0;
980 tpPESession psessionEntry;
981 tANI_U8 sessionId;
982 if(pMsgBuf == NULL)
983 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700984 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 return;
986 }
987 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
988 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700989 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 return;
991 }
992 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530994 pSirSmeReassocInd = vos_mem_malloc(len);
995 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 {
997 // Log error
998 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530999 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 return;
1001
1002 }
1003 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1004 eWNI_SME_REASSOC_IND);
1005 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1006 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1007
1008 // Required for indicating the frames to upper layer
1009 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1010 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1011 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1012 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1013
1014 msgQ.type = eWNI_SME_REASSOC_IND;
1015 msgQ.bodyptr = pSirSmeReassocInd;
1016 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001017 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001018#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1019 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1020#endif //FEATURE_WLAN_DIAG_SUPPORT
1021 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1022 if (! pStaDs)
1023 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001024 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301026 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 return;
1028 }
1029
1030 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1031 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001032 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 /*
1034 ** turn on a timer to detect the loss of REASSOC CNF
1035 **/
1036 limActivateCnfTimer(pMac,
1037 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1038} /*** end limProcessMlmReassocInd() ***/
1039
1040/**
1041 * limProcessMlmAuthInd()
1042 *
1043 *FUNCTION:
1044 * This function is called to processes MLM_AUTH_IND
1045 * message from MLM State machine.
1046 *
1047 *LOGIC:
1048 *
1049 *ASSUMPTIONS:
1050 *
1051 *NOTE:
1052 *
1053 * @param pMac Pointer to Global MAC structure
1054 * @param pMsgBuf A pointer to the MLM message buffer
1055 *
1056 * @return None
1057 */
1058void
1059limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1060{
1061 tSirMsgQ msgQ;
1062 tSirSmeAuthInd *pSirSmeAuthInd;
1063
1064 if(pMsgBuf == NULL)
1065 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001066 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 return;
1068 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301069 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1070 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 {
1072 // Log error
1073 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301074 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 }
1076 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1077 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1078 (tANI_U8 *) &(pSirSmeAuthInd->length));
1079 msgQ.type = eWNI_SME_AUTH_IND;
1080 msgQ.bodyptr = pSirSmeAuthInd;
1081 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001082 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001083#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1084 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1085#endif //FEATURE_WLAN_DIAG_SUPPORT
1086 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1087} /*** end limProcessMlmAuthInd() ***/
1088
1089
1090
1091
1092void
1093limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1094 tSirSmeAssocInd *pSirSmeAssocInd,
1095 tpPESession psessionEntry)
1096{
1097 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1098 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1099
1100 // Required for indicating the frames to upper layer
1101 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1102 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1103
1104 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1105 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1106
1107 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301108 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1109 sizeof(tSirMacAddr));
1110
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 // Fill in aid
1112 pSirSmeAssocInd->aid = pAssocInd->aid;
1113 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301114 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 // Fill in staId
1116 //pSirSmeAssocInd->staId = psessionEntry->staId;
1117 // Fill in authType
1118 pSirSmeAssocInd->authType = pAssocInd->authType;
1119 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301120 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1121 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301123 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1124 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1125 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001126
1127 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301128 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1129 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1130 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001131
1132 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1134 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1135 {
1136 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1137 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1138 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301139 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301141 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001142 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 // Fill in WmmInfo
1144 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001145} /*** end limAssocIndSerDes() ***/
1146
1147
1148
1149/**
1150 * limProcessMlmAssocInd()
1151 *
1152 *FUNCTION:
1153 * This function is called to processes MLM_ASSOC_IND
1154 * message from MLM State machine.
1155 *
1156 *LOGIC:
1157 *
1158 *ASSUMPTIONS:
1159 *
1160 *NOTE:
1161 *
1162 * @param pMac Pointer to Global MAC structure
1163 * @param pMsgBuf A pointer to the MLM message buffer
1164 *
1165 * @return None
1166 */
1167void
1168limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1169{
1170 tANI_U32 len;
1171 tSirMsgQ msgQ;
1172 tSirSmeAssocInd *pSirSmeAssocInd;
1173 tpDphHashNode pStaDs=0;
1174 tpPESession psessionEntry;
1175 if(pMsgBuf == NULL)
1176 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001177 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 return;
1179 }
1180 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1181 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001182 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 return;
1184 }
1185 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301187 pSirSmeAssocInd = vos_mem_malloc(len);
1188 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 {
1190 // Log error
1191 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301192 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 return;
1194 }
1195
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1197 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 msgQ.type = eWNI_SME_ASSOC_IND;
1199 msgQ.bodyptr = pSirSmeAssocInd;
1200 msgQ.bodyval = 0;
1201 pStaDs = dphGetHashEntry(pMac,
1202 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1203 if (! pStaDs)
1204 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001205 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301207 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001208
1209 return;
1210 }
1211 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001213 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001214#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1215 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1216#endif //FEATURE_WLAN_DIAG_SUPPORT
1217 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1218
1219 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001220 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001221 /*
1222 ** turn on a timer to detect the loss of ASSOC CNF
1223 **/
1224 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1225
1226// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1227#ifdef TEST_BTAMP_AP
1228//tANI_U32 *pMsgBuf;
1229{
1230 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301231 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1232 if ( NULL == pSmeAssoccnf )
1233 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1235 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301236 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1237 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1239 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301240 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1241 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301243 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1245 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301246 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001247}
1248#endif
1249
1250
1251} /*** end limProcessMlmAssocInd() ***/
1252
1253
1254
1255
1256/**
1257 * limProcessMlmDisassocInd()
1258 *
1259 *FUNCTION:
1260 * This function is called to processes MLM_DISASSOC_IND
1261 * message from MLM State machine.
1262 *
1263 *LOGIC:
1264 *
1265 *ASSUMPTIONS:
1266 *
1267 *NOTE:
1268 *
1269 * @param pMac Pointer to Global MAC structure
1270 * @param pMsgBuf A pointer to the MLM message buffer
1271 *
1272 * @return None
1273 */
1274void
1275limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1276{
1277 tLimMlmDisassocInd *pMlmDisassocInd;
1278 tpPESession psessionEntry;
1279 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1280 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1281 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001282 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 return;
1284 }
1285 switch (psessionEntry->limSystemRole)
1286 {
1287 case eLIM_STA_IN_IBSS_ROLE:
1288 break;
1289 case eLIM_STA_ROLE:
1290 case eLIM_BT_AMP_STA_ROLE:
1291 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001292 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 break;
1294 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1295 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001296 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 pMlmDisassocInd->aid);)
1298 // Send SME_DISASOC_IND after Polaris cleanup
1299 // (after receiving LIM_MLM_PURGE_STA_IND)
1300 break;
1301 } // end switch (psessionEntry->limSystemRole)
1302} /*** end limProcessMlmDisassocInd() ***/
1303
1304/**
1305 * limProcessMlmDisassocCnf()
1306 *
1307 *FUNCTION:
1308 * This function is called to processes MLM_DISASSOC_CNF
1309 * message from MLM State machine.
1310 *
1311 *LOGIC:
1312 *
1313 *ASSUMPTIONS:
1314 *
1315 *NOTE:
1316 *
1317 * @param pMac Pointer to Global MAC structure
1318 * @param pMsgBuf A pointer to the MLM message buffer
1319 *
1320 * @return None
1321 */
1322void
1323limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1324{
1325 tSirResultCodes resultCode;
1326 tLimMlmDisassocCnf *pMlmDisassocCnf;
1327 tpPESession psessionEntry;
1328 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1329 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1330 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001331 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 return;
1333 }
1334 resultCode = (tSirResultCodes)
1335 (pMlmDisassocCnf->disassocTrigger ==
1336 eLIM_LINK_MONITORING_DISASSOC) ?
1337 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1338 pMlmDisassocCnf->resultCode;
1339 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1340 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 // Disassociate Confirm from MLM
1342 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1343 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1344 {
1345 /**
1346 * Should not have received
1347 * Disassocate confirm
1348 * from MLM in other states.
1349 * Log error
1350 */
1351 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001352 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 return;
1354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 if (pMac->lim.gLimRspReqd)
1356 pMac->lim.gLimRspReqd = false;
1357 if (pMlmDisassocCnf->disassocTrigger ==
1358 eLIM_PROMISCUOUS_MODE_DISASSOC)
1359 {
1360 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1361 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1362 else
1363 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001364 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 // Send Promiscuous mode response to host
1366 limSendSmePromiscuousModeRsp(pMac);
1367 }
1368 else
1369 {
1370 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1371 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1372 else
1373 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001374 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1376 resultCode,
1377 pMlmDisassocCnf->disassocTrigger,
1378 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1379 }
1380 }
1381 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1382 {
1383 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1384 resultCode,
1385 pMlmDisassocCnf->disassocTrigger,
1386 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1387 }
1388} /*** end limProcessMlmDisassocCnf() ***/
1389
1390/**
1391 * limProcessMlmDeauthInd()
1392 *
1393 *FUNCTION:
1394 * This function is called to processes MLM_DEAUTH_IND
1395 * message from MLM State machine.
1396 *
1397 *LOGIC:
1398 *
1399 *ASSUMPTIONS:
1400 *
1401 *NOTE:
1402 *
1403 * @param pMac Pointer to Global MAC structure
1404 * @param pMsgBuf A pointer to the MLM message buffer
1405 *
1406 * @return None
1407 */
1408void
1409limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1410{
1411 tLimMlmDeauthInd *pMlmDeauthInd;
1412 tpPESession psessionEntry;
1413 tANI_U8 sessionId;
1414 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1415 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1416 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001417 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 return;
1419 }
1420 switch (psessionEntry->limSystemRole)
1421 {
1422 case eLIM_STA_IN_IBSS_ROLE:
1423 break;
1424 case eLIM_STA_ROLE:
1425 case eLIM_BT_AMP_STA_ROLE:
1426 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001427 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
1429 default: // eLIM_AP_ROLE
1430 {
1431 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001432 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 pMlmDeauthInd->aid);)
1434 }
1435 // Send SME_DEAUTH_IND after Polaris cleanup
1436 // (after receiving LIM_MLM_PURGE_STA_IND)
1437 break;
1438 } // end switch (psessionEntry->limSystemRole)
1439} /*** end limProcessMlmDeauthInd() ***/
1440
1441/**
1442 * limProcessMlmDeauthCnf()
1443 *
1444 *FUNCTION:
1445 * This function is called to processes MLM_DEAUTH_CNF
1446 * message from MLM State machine.
1447 *
1448 *LOGIC:
1449 *
1450 *ASSUMPTIONS:
1451 *
1452 *NOTE:
1453 *
1454 * @param pMac Pointer to Global MAC structure
1455 * @param pMsgBuf A pointer to the MLM message buffer
1456 *
1457 * @return None
1458 */
1459void
1460limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1461{
1462 tANI_U16 aid;
1463 tSirResultCodes resultCode;
1464 tLimMlmDeauthCnf *pMlmDeauthCnf;
1465 tpPESession psessionEntry;
1466
1467 if(pMsgBuf == NULL)
1468 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001469 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 return;
1471 }
1472 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1473 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1474 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001475 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 return;
1477 }
1478
1479 resultCode = (tSirResultCodes)
1480 (pMlmDeauthCnf->deauthTrigger ==
1481 eLIM_LINK_MONITORING_DEAUTH) ?
1482 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1483 pMlmDeauthCnf->resultCode;
1484 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1485 pMlmDeauthCnf->aid : 1;
1486 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1487 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 // Deauth Confirm from MLM
1489 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1490 {
1491 /**
1492 * Should not have received Deauth confirm
1493 * from MLM in other states.
1494 * Log error
1495 */
1496 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001497 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 psessionEntry->limSmeState);)
1499 return;
1500 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1502 {
1503 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1504 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001505 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 }
1507 else
1508 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001509 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001510
1511 if (pMac->lim.gLimRspReqd)
1512 pMac->lim.gLimRspReqd = false;
1513 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1515 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1516 resultCode,
1517 pMlmDeauthCnf->deauthTrigger,
1518 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001519} /*** end limProcessMlmDeauthCnf() ***/
1520
1521/**
1522 * limProcessMlmPurgeStaInd()
1523 *
1524 *FUNCTION:
1525 * This function is called to processes MLM_PURGE_STA_IND
1526 * message from MLM State machine.
1527 *
1528 *LOGIC:
1529 *
1530 *ASSUMPTIONS:
1531 *
1532 *NOTE:
1533 *
1534 * @param pMac Pointer to Global MAC structure
1535 * @param pMsgBuf A pointer to the MLM message buffer
1536 *
1537 * @return None
1538 */
1539void
1540limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1541{
1542 tSirResultCodes resultCode;
1543 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1544 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 if(pMsgBuf == NULL)
1546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001547 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 return;
1549 }
1550 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1551 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1552 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001553 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 return;
1555 }
1556 // Purge STA indication from MLM
1557 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1558 switch (psessionEntry->limSystemRole)
1559 {
1560 case eLIM_STA_IN_IBSS_ROLE:
1561 break;
1562 case eLIM_STA_ROLE:
1563 case eLIM_BT_AMP_STA_ROLE:
1564 default: // eLIM_AP_ROLE
1565 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1566 (psessionEntry->limSmeState !=
1567 eLIM_SME_WT_DISASSOC_STATE) &&
1568 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1569 {
1570 /**
1571 * Should not have received
1572 * Purge STA indication
1573 * from MLM in other states.
1574 * Log error
1575 */
1576 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001577 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 psessionEntry->limSmeState);)
1579 break;
1580 }
1581 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001582 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 pMlmPurgeStaInd->aid);)
1584 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1585 {
1586 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001587 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001588
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 }
1590 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1591 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001592 limSendSmeDeauthNtf(pMac,
1593 pMlmPurgeStaInd->peerMacAddr,
1594 resultCode,
1595 pMlmPurgeStaInd->purgeTrigger,
1596 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 }
1598 else
1599 limSendSmeDisassocNtf(pMac,
1600 pMlmPurgeStaInd->peerMacAddr,
1601 resultCode,
1602 pMlmPurgeStaInd->purgeTrigger,
1603 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1604 } // end switch (psessionEntry->limSystemRole)
1605} /*** end limProcessMlmPurgeStaInd() ***/
1606
1607/**
1608 * limProcessMlmSetKeysCnf()
1609 *
1610 *FUNCTION:
1611 * This function is called to processes MLM_SETKEYS_CNF
1612 * message from MLM State machine.
1613 *
1614 *LOGIC:
1615 *
1616 *ASSUMPTIONS:
1617 *
1618 *NOTE:
1619 *
1620 * @param pMac Pointer to Global MAC structure
1621 * @param pMsgBuf A pointer to the MLM message buffer
1622 *
1623 * @return None
1624 */
1625void
1626limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1627{
1628 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001629 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 tpPESession psessionEntry;
1631
1632 if(pMsgBuf == NULL)
1633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001634 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001635 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 }
1637 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1638 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001640 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 return;
1642 }
1643 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001644 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 pMlmSetKeysCnf->resultCode );
1646 limSendSmeSetContextRsp(pMac,
1647 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1650 psessionEntry->transactionId);
1651} /*** end limProcessMlmSetKeysCnf() ***/
1652/**
1653 * limProcessMlmRemoveKeyCnf()
1654 *
1655 *FUNCTION:
1656 * This function is called to processes MLM_REMOVEKEY_CNF
1657 * message from MLM State machine.
1658 *
1659 *LOGIC:
1660 *
1661 *ASSUMPTIONS:
1662 *
1663 *NOTE:
1664 *
1665 * @param pMac Pointer to Global MAC structure
1666 * @param pMsgBuf A pointer to the MLM message buffer
1667 *
1668 * @return None
1669 */
1670void
1671limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1672{
1673 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001674 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 tpPESession psessionEntry;
1676
1677 if(pMsgBuf == NULL)
1678 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001679 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001680 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 }
1682 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1683 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1684 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001685 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 return;
1687 }
1688 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001689 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 pMlmRemoveKeyCnf->resultCode );
1691 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001692 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1694 psessionEntry->smeSessionId,psessionEntry->transactionId);
1695} /*** end limProcessMlmRemoveKeyCnf() ***/
1696
1697
1698/**
1699 * limHandleSmeJoinResult()
1700 *
1701 *FUNCTION:
1702 * This function is called to process join/auth/assoc failures
1703 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1704 * MLM_ASSOC_CNF with a success code in case of STA role and
1705 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1706 *
1707 *LOGIC:
1708 *
1709 *ASSUMPTIONS:
1710 *
1711 *NOTE:
1712 *
1713 * @param pMac Pointer to Global MAC structure
1714 * @param resultCode Failure code to be sent
1715 *
1716 *
1717 * @return None
1718 */
1719static void
1720limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1721{
1722 tpDphHashNode pStaDs = NULL;
1723 tANI_U8 smesessionId;
1724 tANI_U16 smetransactionId;
1725
1726 /* Newly Added on oct 11 th*/
1727 if(psessionEntry == NULL)
1728 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001729 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 return;
1731 }
1732 smesessionId = psessionEntry->smeSessionId;
1733 smetransactionId = psessionEntry->transactionId;
1734 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1735 if(resultCode != eSIR_SME_SUCCESS)
1736 {
1737 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1738 if (pStaDs != NULL)
1739 {
1740 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1741 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1742 pStaDs->mlmStaContext.resultCode = resultCode;
1743 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1744 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1745 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301746 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001747 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 return;
1749 }
1750 }
1751
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301752 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 psessionEntry->pLimJoinReq = NULL;
1754 //Delete teh session if JOIN failure occurred.
1755 if(resultCode != eSIR_SME_SUCCESS)
1756 {
1757 if(NULL != psessionEntry)
1758 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001759 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1760 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001761 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001762 peDeleteSession(pMac,psessionEntry);
1763 psessionEntry = NULL;
1764 }
1765 }
1766 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1767 smesessionId, smetransactionId);
1768} /*** end limHandleSmeJoinResult() ***/
1769
1770/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001771 * limHandleSmeReaasocResult()
1772 *
1773 *FUNCTION:
1774 * This function is called to process reassoc failures
1775 * upon receiving REASSOC_CNF with a failure code or
1776 * MLM_REASSOC_CNF with a success code in case of STA role
1777 *
1778 *LOGIC:
1779 *
1780 *ASSUMPTIONS:
1781 *
1782 *NOTE:
1783 *
1784 * @param pMac Pointer to Global MAC structure
1785 * @param resultCode Failure code to be sent
1786 *
1787 *
1788 * @return None
1789 */
1790static void
1791limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1792{
1793 tpDphHashNode pStaDs = NULL;
1794 tANI_U8 smesessionId;
1795 tANI_U16 smetransactionId;
1796
1797 if(psessionEntry == NULL)
1798 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001799 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001800 return;
1801 }
1802 smesessionId = psessionEntry->smeSessionId;
1803 smetransactionId = psessionEntry->transactionId;
1804 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1805 if(resultCode != eSIR_SME_SUCCESS)
1806 {
1807 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1808 if (pStaDs != NULL)
1809 {
1810 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1811 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1812 pStaDs->mlmStaContext.resultCode = resultCode;
1813 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1814 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1815 return;
1816 }
1817 }
1818
1819 //Delete teh session if REASSOC failure occurred.
1820 if(resultCode != eSIR_SME_SUCCESS)
1821 {
1822 if(NULL != psessionEntry)
1823 {
1824 peDeleteSession(pMac,psessionEntry);
1825 psessionEntry = NULL;
1826 }
1827 }
1828 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1829 smesessionId, smetransactionId);
1830} /*** end limHandleSmeReassocResult() ***/
1831
1832/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 * limProcessMlmAddStaRsp()
1834 *
1835 *FUNCTION:
1836 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1837 * Upon receipt of this message from HAL, MLME -
1838 * > Determines the "state" in which this message was received
1839 * > Forwards it to the appropriate callback
1840 *
1841 *ASSUMPTIONS:
1842 *
1843 *NOTE:
1844 *
1845 * @param pMac Pointer to Global MAC structure
1846 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1847 *
1848 * @return None
1849 */
1850void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1851{
1852 //we need to process the deferred message since the initiating req. there might be nested request.
1853 //in the case of nested request the new request initiated from the response will take care of resetting
1854 //the deffered flag.
1855 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 )
1859 {
1860 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1861 return;
1862 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864}
1865void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1866{
1867 tLimMlmAssocCnf mlmAssocCnf;
1868 tpDphHashNode pStaDs;
1869 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1870 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1871
1872 if(NULL == pAddStaParams )
1873 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001874 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 return;
1876 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301877 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301879 PELOGE(limLog(pMac, LOGE,
1880 FL("Received Deauth frame in ADD_STA_RESP state"));)
1881 pAddStaParams->status = eHAL_STATUS_FAILURE;
1882 }
1883
1884 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1885 {
1886 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 {
1888 //TODO: any response to be sent out here ?
1889 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001890 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 psessionEntry->limMlmState);
1892 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1893 goto end;
1894 }
1895 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1896 mesgType = LIM_MLM_REASSOC_CNF;
1897 //
1898 // Update the DPH Hash Entry for this STA
1899 // with proper state info
1900 //
1901 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1902 if( NULL != pStaDs)
1903 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1904 else
1905 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001906 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 DPH_STA_HASH_INDEX_PEER);
1908 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001909 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001910 /*
1911 * Storing the self StaIndex(Generated by HAL) in session context,
1912 * instead of storing it in DPH Hash entry for Self STA.
1913 * DPH entry for the self STA stores the sta index for the BSS entry
1914 * to which the STA is associated.
1915 */
1916 psessionEntry->staId = pAddStaParams->staIdx;
1917 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001918#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1919 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1920#endif
1921 {
1922 limReactivateHeartBeatTimer(pMac, psessionEntry);
1923 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001924 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001925
1926 //assign the sessionId to the timer Object
1927 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1928 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001929 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001930#ifdef WLAN_DEBUG
1931 pMac->lim.gLimNumLinkEsts++;
1932#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001933#ifdef FEATURE_WLAN_TDLS
1934 /* initialize TDLS peer related data */
1935 limInitTdlsData(pMac,psessionEntry);
1936#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 // Return Assoc confirm to SME with success
1938 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1939 // be passed in here....
1940 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1941 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1942 }
1943 else
1944 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301945 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1947 }
1948end:
1949 if( 0 != limMsgQ->bodyptr )
1950 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301951 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001952 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 }
1954 /* Updating PE session Id*/
1955 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1956 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301957 if (true == psessionEntry->fDeauthReceived)
1958 {
1959 psessionEntry->fDeauthReceived = false;
1960 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 return;
1962}
1963void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1964{
1965 //we need to process the deferred message since the initiating req. there might be nested request.
1966 //in the case of nested request the new request initiated from the response will take care of resetting
1967 //the deffered flag.
1968 // tpPESession psessionEntry;
1969 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1970 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
1971 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001972 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 // return;
1974 // }
1975 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001976
1977 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
1978 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 ) &&
1981 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
1982 {
1983 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
1984 return;
1985 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001986 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08001987
1988 if(!limIsInMCC(pMac))
1989 {
1990 WDA_TrafficStatsTimerActivate(FALSE);
1991 }
Chet Lanctot186b5732013-03-18 10:26:30 -07001992
1993#ifdef WLAN_FEATURE_11W
1994 if (psessionEntry->limRmfEnabled)
1995 {
1996 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
1997 {
1998 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001999 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002000 }
2001 }
2002#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002003}
2004
2005void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2006{
2007 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2008 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2009 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302010
2011 if (NULL == pDelBssParams)
2012 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002013 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302014 goto end;
2015 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2017 {
2018 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002019 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2021 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2022
2023 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002024 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 statusCode = eSIR_SME_REFUSED;
2026 goto end;
2027 }
2028 if(pStaDs == NULL)
2029 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002030 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 statusCode = eSIR_SME_REFUSED;
2032 goto end;
2033 }
2034 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2035 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002036 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 pStaDs->mlmStaContext.mlmState);)
2038 statusCode = eSIR_SME_REFUSED;
2039 goto end;
2040 }
2041 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2042 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2043 }
2044 else
2045 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302046 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302047 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002048 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 return;
2050 }
2051 end:
2052 if( 0 != limMsgQ->bodyptr )
2053 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302054 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002055 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 }
2057 if(pStaDs == NULL)
2058 return;
2059 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2060 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2061 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2062 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2063 {
2064 /** The Case where the DelBss is invoked from
2065 * context of other than normal DisAssoc / Deauth OR
2066 * as part of Join Failure.
2067 */
2068 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2069 return;
2070 }
2071 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2072 return;
2073}
2074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2076{
2077 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002078 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2080 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2081
2082 if(psessionEntry == NULL)
2083 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002084 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002085 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002086 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302087 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002088 limMsgQ->bodyptr = NULL;
2089 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 return;
2091 }
2092
2093 if (pDelBss == NULL)
2094 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002095 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 rc = eSIR_SME_REFUSED;
2097 goto end;
2098 }
2099 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002100 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2101
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2103 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002104 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002105 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2106 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002107 rc = eSIR_SME_REFUSED;
2108 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 }
2110 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2111 {
2112 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2113 pDelBss->status, pDelBss->bssIdx);
2114 rc = eSIR_SME_STOP_BSS_FAILURE;
2115 goto end;
2116 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002117 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002119 if (status != eSIR_SUCCESS)
2120 {
2121 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002123 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 /** Softmac may send all the buffered packets right after resuming the transmission hence
2125 * to occupy the medium during non channel occupancy period. So resume the transmission after
2126 * HAL gives back the response.
2127 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002128#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 if (LIM_IS_RADAR_DETECTED(pMac))
2130 {
2131 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2132 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2133 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002134#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2136 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002138 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 end:
2140 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2141 peDeleteSession(pMac, psessionEntry);
2142
2143 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002144 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302145 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002146 limMsgQ->bodyptr = NULL;
2147 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002148}
2149
2150void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2151{
2152 //we need to process the deferred message since the initiating req. there might be nested request.
2153 //in the case of nested request the new request initiated from the response will take care of resetting
2154 //the deffered flag.
2155
2156 tpPESession psessionEntry;
2157 tpDeleteStaParams pDeleteStaParams;
2158 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2159 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302160
2161 if(NULL == pDeleteStaParams ||
2162 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002164 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002165 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002166 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302167 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002168 limMsgQ->bodyptr = NULL;
2169 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 return;
2171 }
2172
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 )
2176 {
2177 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2178 return;
2179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002181}
2182
Jeff Johnson295189b2012-06-20 16:38:30 -07002183void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2184{
2185 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2186 tpDphHashNode pStaDs;
2187 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2188 if(limMsgQ->bodyptr == NULL)
2189 {
2190 return;
2191 }
2192
2193 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2194 if(pStaDs == NULL)
2195 {
2196 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002197 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302199 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002200 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002201
2202 return;
2203 }
2204 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2205 {
2206 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002207 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002208
2209 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2210 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2211 {
2212 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002213 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2215 statusCode = eSIR_SME_REFUSED;
2216 goto end;
2217 }
2218
2219 limLog( pMac, LOG1,
2220 FL("Deleted STA AssocID %d staId %d MAC "),
2221 pStaDs->assocId, pStaDs->staIndex);
2222 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2223 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2224 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302225 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002226 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002227 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 {
2229 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002230 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 pStaDs->assocId);)
2232 // delete the TS if it has already been added.
2233 // send the response with error status.
2234 if(pStaDs->qos.addtsPresent)
2235 {
2236 tpLimTspecInfo pTspecInfo;
2237 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2238 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2239 {
2240 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2241 NULL, &pTspecInfo->idx);
2242 }
2243 }
2244 limRejectAssociation(pMac,
2245 pStaDs->staAddr,
2246 pStaDs->mlmStaContext.subType,
2247 true, pStaDs->mlmStaContext.authType,
2248 pStaDs->assocId, true,
2249 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2250 psessionEntry);
2251 }
2252 return;
2253 }
2254 }
2255 else
2256 {
2257 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002258 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 statusCode = eSIR_SME_REFUSED;
2260 }
2261 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302262 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002263 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2265 {
2266 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2267 }
2268 return;
2269}
2270
2271void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2272{
2273 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2274 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2275 tpDphHashNode pStaDs = NULL;
2276 if(NULL == pDelStaParams )
2277 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002278 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 goto end;
2280 }
2281 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2282 {
2283 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2284 if (pStaDs == NULL)
2285 {
2286 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002287 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 pDelStaParams->assocId);
2289 statusCode = eSIR_SME_REFUSED;
2290 goto end;
2291 }
2292 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2293 {
2294 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002295 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 limMlmStateStr(psessionEntry->limMlmState));
2297 statusCode = eSIR_SME_REFUSED;
2298 goto end;
2299 }
2300 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2301 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002302 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 //we must complete all cleanup related to delSta before calling limDelBSS.
2304 if( 0 != limMsgQ->bodyptr )
2305 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302306 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002307 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 }
2309 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2310 return;
2311 }
2312 else
2313 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002314 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 statusCode = eSIR_SME_REFUSED;
2316 }
2317end:
2318 if( 0 != limMsgQ->bodyptr )
2319 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302320 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002321 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 }
2323 return;
2324}
2325
Jeff Johnson295189b2012-06-20 16:38:30 -07002326void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2327{
2328 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302329 tpDphHashNode pStaDs = NULL;
2330
2331 if (NULL == pAddStaParams)
2332 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002333 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302334 goto end;
2335 }
2336
2337 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 if(pStaDs == NULL)
2339 {
2340 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002341 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 goto end;
2343 }
2344 //
2345 // TODO & FIXME_GEN4
2346 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2347 //
2348 //TODO: any check for pMac->lim.gLimMlmState ?
2349 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2350 {
2351 //TODO: any response to be sent out here ?
2352 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002353 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 pStaDs->mlmStaContext.mlmState);
2355 goto end;
2356 }
2357 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2358 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002359 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 limRejectAssociation(pMac, pStaDs->staAddr,
2361 pStaDs->mlmStaContext.subType,
2362 true, pStaDs->mlmStaContext.authType,
2363 pStaDs->assocId, true,
2364 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2365 psessionEntry);
2366 goto end;
2367 }
2368 pStaDs->bssId = pAddStaParams->bssIdx;
2369 pStaDs->staIndex = pAddStaParams->staIdx;
2370 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2371 pStaDs->valid = 1;
2372 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2373 limLog( pMac, LOG1,
2374 FL("STA AssocID %d staId %d MAC "),
2375 pStaDs->assocId,
2376 pStaDs->staIndex);
2377 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2378
2379 /* For BTAMP-AP, the flow sequence shall be:
2380 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2381 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2382 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2383 */
2384 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2385 // fall though to reclaim the original Add STA Response message
2386end:
2387 if( 0 != limMsgQ->bodyptr )
2388 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302389 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002390 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 }
2392 return;
2393}
2394
2395/**
2396 * limProcessApMlmAddBssRsp()
2397 *
2398 *FUNCTION:
2399 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2400 * Upon receipt of this message from HAL, MLME -
2401 * > Validates the result of WDA_ADD_BSS_REQ
2402 * > Init other remaining LIM variables
2403 * > Init the AID pool, for that BSSID
2404 * > Init the Pre-AUTH list, for that BSSID
2405 * > Create LIM timers, specific to that BSSID
2406 * > Init DPH related parameters that are specific to that BSSID
2407 * > TODO - When do we do the actual change channel?
2408 *
2409 *LOGIC:
2410 * SME sends eWNI_SME_START_BSS_REQ to LIM
2411 * LIM sends LIM_MLM_START_REQ to MLME
2412 * MLME sends WDA_ADD_BSS_REQ to HAL
2413 * HAL responds with WDA_ADD_BSS_RSP to MLME
2414 * MLME responds with LIM_MLM_START_CNF to LIM
2415 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2416 *
2417 *ASSUMPTIONS:
2418 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2419 * tSirMsgQ.body will now be freed by this routine
2420 *
2421 *NOTE:
2422 *
2423 * @param pMac Pointer to Global MAC structure
2424 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2425 *
2426 * @return None
2427 */
2428static void
2429limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2430{
2431 tLimMlmStartCnf mlmStartCnf;
2432 tANI_U32 val;
2433 tpPESession psessionEntry;
2434// tANI_U8 sessionId;
2435 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2436 if(NULL == pAddBssParams )
2437 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002438 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 goto end;
2440 }
2441 //TBD: free the memory before returning, do it for all places where lookup fails.
2442 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2443 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002444 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002445 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002446 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302447 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002448 limMsgQ->bodyptr = NULL;
2449 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 return;
2451 }
2452 /* Update PE session Id*/
2453 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2454 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2455 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002456 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002457 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2458 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2459 goto end;
2460 // Set MLME state
2461 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002462 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2464 {
2465 /** IBSS is 'active' when we receive
2466 * Beacon frames from other STAs that are part of same IBSS.
2467 * Mark internal state as inactive until then.
2468 */
2469 psessionEntry->limIbssActive = false;
2470 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2471 limResetHBPktCount( psessionEntry );
2472 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002473 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002474 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002475 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 }
2477 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2478
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002480
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2482 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2483 else
2484 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 schEdcaProfileUpdate(pMac, psessionEntry);
2486 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002487 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 // Create timers used by LIM
2489 if (!pMac->lim.gLimTimersCreated)
2490 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002491
2492 // Start OLBC timer
2493 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2494 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002495 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002496 }
2497
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2499 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002500 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2502 // Apply previously set configuration at HW
2503 limApplyConfiguration(pMac,psessionEntry);
2504 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2505 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2506 }
2507 else
2508 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002509 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2511 }
2512 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2513 end:
2514 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002515 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302516 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002517 limMsgQ->bodyptr = NULL;
2518 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002519}
2520
2521
2522/**
2523 * limProcessIbssMlmAddBssRsp()
2524 *
2525 *FUNCTION:
2526 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2527 * Upon receipt of this message from HAL, MLME -
2528 * > Validates the result of WDA_ADD_BSS_REQ
2529 * > Init other remaining LIM variables
2530 * > Init the AID pool, for that BSSID
2531 * > Init the Pre-AUTH list, for that BSSID
2532 * > Create LIM timers, specific to that BSSID
2533 * > Init DPH related parameters that are specific to that BSSID
2534 * > TODO - When do we do the actual change channel?
2535 *
2536 *LOGIC:
2537 * SME sends eWNI_SME_START_BSS_REQ to LIM
2538 * LIM sends LIM_MLM_START_REQ to MLME
2539 * MLME sends WDA_ADD_BSS_REQ to HAL
2540 * HAL responds with WDA_ADD_BSS_RSP to MLME
2541 * MLME responds with LIM_MLM_START_CNF to LIM
2542 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2543 *
2544 *ASSUMPTIONS:
2545 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2546 * tSirMsgQ.body will now be freed by this routine
2547 *
2548 *NOTE:
2549 *
2550 * @param pMac Pointer to Global MAC structure
2551 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2552 *
2553 * @return None
2554 */
2555static void
2556limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2557{
2558 tLimMlmStartCnf mlmStartCnf;
2559 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2560 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302561
2562 if (NULL == pAddBssParams)
2563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302565 goto end;
2566 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2568 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002569 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2571 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2572 goto end;
2573 // Set MLME state
2574 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002576 /** IBSS is 'active' when we receive
2577 * Beacon frames from other STAs that are part of same IBSS.
2578 * Mark internal state as inactive until then.
2579 */
2580 psessionEntry->limIbssActive = false;
2581 limResetHBPktCount( psessionEntry );
2582 /* Timer related functions are not modified for BT-AMP : To be Done */
2583 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002584 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002585 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002586 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2588 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2589 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2590 schEdcaProfileUpdate(pMac, psessionEntry);
2591 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2592 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002593 if (0 == psessionEntry->freePeerIdxHead)
2594 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 // Create timers used by LIM
2596#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2597 if (!pMac->lim.gLimTimersCreated)
2598 limCreateTimers(pMac);
2599#endif
2600 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2601 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002602 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2604 // Apply previously set configuration at HW
2605 limApplyConfiguration(pMac,psessionEntry);
2606 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2607 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2608 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2609 if(true == pMac->lim.gLimIbssCoalescingHappened)
2610 {
2611 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2612 goto end;
2613 }
2614 }
2615 else
2616 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002617 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 pAddBssParams->status );
2619 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2620 }
2621 //Send this message to SME, when ADD_BSS is initiated by SME
2622 //If ADD_BSS is done as part of coalescing, this won't happen.
2623 /* Update PE session Id*/
2624 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2625 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2626 end:
2627 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002628 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302629 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002630 limMsgQ->bodyptr = NULL;
2631 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002632}
2633
2634static void
2635limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2636{
2637 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2638 tAniAuthType cfgAuthType, authMode;
2639 tLimMlmAuthReq *pMlmAuthReq;
2640 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302641
2642 if (NULL == pAddBssParams)
2643 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002644 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302645 goto joinFailure;
2646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2648 {
2649 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2650 {
2651 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002652 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2654 goto joinFailure;
2655 }
2656 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2657 //Success, handle below
2658 pStaDs->bssId = pAddBssParams->bssIdx;
2659 //STA Index(genr by HAL) for the BSS entry is stored here
2660 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2661 // Trigger Authentication with AP
2662 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2663 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2664 {
2665 /**
2666 * Could not get AuthType from CFG.
2667 * Log error.
2668 */
2669 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002670 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 }
2672 if (cfgAuthType == eSIR_AUTO_SWITCH)
2673 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2674 else
2675 authMode = cfgAuthType;
2676
2677 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302678 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2679 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 {
2681 // Log error
2682 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302683 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 return;
2685 }
2686 #if 0
2687 val = sizeof(tSirMacAddr);
2688 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2689 pMlmAuthReq->peerMacAddr,
2690 &val) != eSIR_SUCCESS)
2691 {
2692 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002693 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 }
2695 #endif //TO SUPPORT BT-AMP
2696 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2697
2698 pMlmAuthReq->authType = authMode;
2699 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2700 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2701 != eSIR_SUCCESS)
2702 {
2703 /**
2704 * Could not get AuthFailureTimeout
2705 * value from CFG. Log error.
2706 */
2707 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002708 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 }
2710 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2711 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2712 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002713 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2715 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2716 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2717 // remember staId in case of assoc timeout/failure handling
2718 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2719
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302720 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2721 psessionEntry->peSessionId, psessionEntry->limSmeState));
2722 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2723 "with limSmeState:%d",psessionEntry->peSessionId,
2724 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 limPostMlmMessage(pMac,
2726 LIM_MLM_AUTH_REQ,
2727 (tANI_U32 *) pMlmAuthReq);
2728 return;
2729 }
2730
2731joinFailure:
2732 {
2733 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002734 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002735
2736 /// Send Join response to Host
2737 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2738
2739 }
2740
2741}
2742
2743#ifdef WLAN_FEATURE_VOWIFI_11R
2744/*------------------------------------------------------------------------------------------
2745 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002746 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2747 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 *
2749 *
2750 *------------------------------------------------------------------------------------------
2751 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002752static inline void
2753limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002754{
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002756 tpDphHashNode pStaDs = NULL;
2757 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002758 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002759 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002760 tANI_U32 selfStaDot11Mode = 0;
2761
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002762 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002763
2764 if (pAddBssParams == NULL)
2765 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002766 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002767 goto end;
2768 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002769 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2770 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002771 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002772 goto end;
2773 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002774 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2775 {
2776 goto end;
2777 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002778
2779 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2780 &psessionEntry->dph.dphHashTable)) == NULL)
2781 {
2782 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002783 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2785 goto end;
2786 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 // Prepare and send Reassociation request frame
2788 // start reassoc timer.
2789 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2790 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002791 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2793 != TX_SUCCESS)
2794 {
2795 /// Could not start reassoc failure timer.
2796 // Log error
2797 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002798 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002799 // Return Reassoc confirm with
2800 // Resources Unavailable
2801 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2802 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2803 goto end;
2804 }
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002805#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
2806 pMac->lim.pSessionEntry = psessionEntry;
2807 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2808 {
2809 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302810 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2811 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2812 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2813 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2814 psessionEntry->pLimMlmReassocReq,
2815 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002816 }
2817 pMac->lim.reAssocRetryAttempt = 0;
2818#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002820
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2822 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002823 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002824 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002825 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2826
2827 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2828
2829 //Success, handle below
2830 pStaDs->bssId = pAddBssParams->bssIdx;
2831 //STA Index(genr by HAL) for the BSS entry is stored here
2832 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2833 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2834 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2835
Jeff Johnson295189b2012-06-20 16:38:30 -07002836#if defined WLAN_FEATURE_VOWIFI
2837 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2838#endif
2839
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302840 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2841 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302843 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002844 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002845 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302846 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002847
2848 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302849 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2850 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002851
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302852 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2853 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002854
2855 // Update this when we get reassoc rsp , with success.
2856 // pAddStaParams->assocId = psessionEntry->limAID;
2857
2858 pAddStaParams->staType = STA_ENTRY_SELF;
2859 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2860 pAddStaParams->respReqd = 1;
2861
2862 /* Update PE session ID */
2863 pAddStaParams->sessionId = psessionEntry->peSessionId;
2864
2865 // This will indicate HAL to "allocate" a new STA index
2866 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2867 pAddStaParams->updateSta = FALSE;
2868
2869 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002870#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002871 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07002872#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002873 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002874#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002875
Jeff Johnsone7245742012-09-05 17:12:55 -07002876 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002878 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002879#ifdef WLAN_FEATURE_11AC
2880 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2881 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
2882#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002883#ifdef DISABLE_GF_FOR_INTEROP
2884 /*
2885 * To resolve the interop problem with Broadcom AP,
2886 * where TQ STA could not pass traffic with GF enabled,
2887 * TQ STA will do Greenfield only with TQ AP, for
2888 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002889 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002890 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2891 {
2892 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2893 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2894 }
2895 else
2896#endif
2897
Jeff Johnson295189b2012-06-20 16:38:30 -07002898 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002899 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
2900 {
2901 pAddStaParams->txChannelWidthSet =
2902 pMac->roam.configParam.channelBondingMode24GHz;
2903 }
2904 else
2905 {
2906 pAddStaParams->txChannelWidthSet =
2907 pMac->roam.configParam.channelBondingMode5GHz;
2908 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2910 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2911 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2912 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2913 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2914 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2915 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2916 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2917 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2918 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 }
2920
2921 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002922 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002924 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
2925 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002926 // Lets save this for when we receive the Reassoc Rsp
2927 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002928
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002929 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002930 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002931 vos_mem_free(pAddBssParams);
2932 pAddBssParams = NULL;
2933 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002934 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002935 return;
2936
2937end:
2938 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002939 if (psessionEntry != NULL)
2940 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002942 vos_mem_free(psessionEntry->pLimMlmReassocReq);
2943 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002945
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002946 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002947 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002948 vos_mem_free(pAddBssParams);
2949 pAddBssParams = NULL;
2950 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002951 }
2952
2953 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2954 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302955 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002956 if (psessionEntry != NULL)
2957 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002958 else
2959 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002960
2961 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2962}
Jeff Johnson295189b2012-06-20 16:38:30 -07002963#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07002964/**
2965 * limProcessStaMlmAddBssRsp()
2966 *
2967 *FUNCTION:
2968 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2969 * Upon receipt of this message from HAL, MLME -
2970 * > Validates the result of WDA_ADD_BSS_REQ
2971 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
2972 *
2973 *LOGIC:
2974 * MLME had sent WDA_ADD_BSS_REQ to HAL
2975 * HAL responded with WDA_ADD_BSS_RSP to MLME
2976 * MLME now sends WDA_ADD_STA_REQ to HAL
2977 *
2978 *ASSUMPTIONS:
2979 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
2980 * tSirMsgQ.body will now be freed by this routine
2981 *
2982 *NOTE:
2983 *
2984 * @param pMac Pointer to Global MAC structure
2985 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2986 *
2987 * @return None
2988 */
2989static void
2990limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2991{
2992 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2993 tLimMlmAssocCnf mlmAssocCnf;
2994 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
2995 tANI_U32 subType = LIM_ASSOC;
2996 tpDphHashNode pStaDs = NULL;
2997 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
2998 tANI_U8 updateSta = false;
2999 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3000
3001 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3002 {
3003 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303004 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3005 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003006 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3007 goto end;
3008 }
3009 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3010 {
3011 mesgType = LIM_MLM_REASSOC_CNF;
3012 subType = LIM_REASSOC;
3013 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3014 //to update the existing STA entry.
3015 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3016 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3017 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3018 {
3019 staIdx = psessionEntry->staId;
3020 updateSta = true;
3021 }
3022 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003023
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003024 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003025 goto end;
3026
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3028 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003029#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3031 {
3032#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003033 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 psessionEntry->limMlmState,
3035 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3036#endif
3037 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3038 goto end;
3039 }
3040#endif /* WLAN_FEATURE_VOWIFI_11R */
3041
3042 // Set MLME state
3043 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003044 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3046 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303047 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3048 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3050 if (pStaDs == NULL)
3051 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303052 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3053 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3055 }
3056 else
3057 {
3058 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3059 //Success, handle below
3060 pStaDs->bssId = pAddBssParams->bssIdx;
3061 //STA Index(genr by HAL) for the BSS entry is stored here
3062 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3063 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3064 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3065 // Downgrade the EDCA parameters if needed
3066 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3067 // Send the active EDCA parameters to HAL
3068 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3069 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3070 } else {
3071 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3072 }
3073#if defined WLAN_FEATURE_VOWIFI
3074 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3075#endif
3076
3077 if (subType == LIM_REASSOC)
3078 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3079 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3080 {
3081 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303082 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3083 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003084 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3085 }
3086 }
3087 }
3088 else
3089 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303090 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed!" ),
3091 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 // Return Assoc confirm to SME with failure
3093 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3094 }
3095
3096 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3097 {
3098 /* Update PE session Id*/
3099 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3100 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3101 }
3102 end:
3103 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003104 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303105 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003106 limMsgQ->bodyptr = NULL;
3107 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003108}
3109
3110
3111
3112/**
3113 * limProcessMlmAddBssRsp()
3114 *
3115 *FUNCTION:
3116 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3117 * Upon receipt of this message from HAL, MLME -
3118 * > Determines the "state" in which this message was received
3119 * > Forwards it to the appropriate callback
3120 *
3121 *LOGIC:
3122 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3123 * in the following two states:
3124 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3125 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3126 * Based on these two states, this API will determine where to
3127 * route the message to
3128 *
3129 *ASSUMPTIONS:
3130 *
3131 *NOTE:
3132 *
3133 * @param pMac Pointer to Global MAC structure
3134 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3135 *
3136 * @return None
3137 */
3138void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3139{
3140 tLimMlmStartCnf mlmStartCnf;
3141 tpPESession psessionEntry;
3142 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3143
3144 if(NULL == pAddBssParams )
3145 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003146 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 return;
3148 }
3149
3150 //
3151 // TODO & FIXME_GEN4
3152 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3153 //
3154 //we need to process the deferred message since the initiating req. there might be nested request.
3155 //in the case of nested request the new request initiated from the response will take care of resetting
3156 //the deffered flag.
3157 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3158 // Validate SME/LIM state
3159 // Validate MLME state
3160 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3161 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303162 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3163 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003164 if( NULL != pAddBssParams )
3165 {
3166 vos_mem_free(pAddBssParams);
3167 limMsgQ->bodyptr = NULL;
3168 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 return;
3170 }
3171 /* update PE session Id*/
3172 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3173 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3174 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3175 else
3176 {
3177 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3178 {
3179 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3180 {
3181 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303182 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
3183 "WDA_ADD_BSS_RSP in state %X" ),
3184 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3186 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003187 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303188 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003189 limMsgQ->bodyptr = NULL;
3190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3192 }
3193 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3194 {
3195 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3196 }
3197 else
3198 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3199 }
3200 else
3201 /* Called while processing assoc response */
3202 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3203 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003204
3205 if(limIsInMCC(pMac))
3206 {
3207 WDA_TrafficStatsTimerActivate(TRUE);
3208 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003209
3210#ifdef WLAN_FEATURE_11W
3211 if (psessionEntry->limRmfEnabled)
3212 {
3213 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3214 {
3215 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003216 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003217 }
3218 }
3219#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003220}
3221/**
3222 * limProcessMlmSetKeyRsp()
3223 *
3224 *FUNCTION:
3225 * This function is called to process the following two
3226 * messages from HAL:
3227 * 1) WDA_SET_BSSKEY_RSP
3228 * 2) WDA_SET_STAKEY_RSP
3229 * 3) WDA_SET_STA_BCASTKEY_RSP
3230 * Upon receipt of this message from HAL,
3231 * MLME -
3232 * > Determines the "state" in which this message was received
3233 * > Forwards it to the appropriate callback
3234 *
3235 *LOGIC:
3236 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3237 * received by MLME while in the following state:
3238 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3239 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3240 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3241 * Based on this state, this API will determine where to
3242 * route the message to
3243 *
3244 *ASSUMPTIONS:
3245 * ONLY the MLME state is being taken into account for now.
3246 * This is because, it appears that the handling of the
3247 * SETKEYS REQ is handled symmetrically on both the AP & STA
3248 *
3249 *NOTE:
3250 *
3251 * @param pMac Pointer to Global MAC structure
3252 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3253 *
3254 * @return None
3255 */
3256void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3257{
Jeff Johnsone7245742012-09-05 17:12:55 -07003258 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003259 tLimMlmSetKeysCnf mlmSetKeysCnf;
3260 tANI_U8 sessionId = 0;
3261 tpPESession psessionEntry;
3262 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303263 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003265 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003266 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003267 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 return;
3269 }
3270 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3271 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003273 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303274 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003275 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 return;
3277 }
3278 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3279 {
3280 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003281 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 // There's not much that MLME can do at this stage...
3283 respReqd = 0;
3284 }
3285 else
3286 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3287
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303288 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003289 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003292 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 if( respReqd )
3294 {
3295 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3296 // Prepare and Send LIM_MLM_SETKEYS_CNF
3297 if( NULL != lpLimMlmSetKeysReq )
3298 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303299 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3300 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3301 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303303 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003304 pMac->lim.gpLimMlmSetKeysReq = NULL;
3305 }
3306 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003307 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003308 }
3309}
3310void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3311{
3312 tANI_U8 respReqd = 1;
3313 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003314 tANI_U16 resultCode;
3315 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 tpPESession psessionEntry;
3317 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303318 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003320 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003322 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 return;
3324 }
3325 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3326 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3327 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003328 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303329 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003330 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 return;
3332 }
3333 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3334 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3335 else
3336 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3337
Jeff Johnsone7245742012-09-05 17:12:55 -07003338 //
3339 // TODO & FIXME_GEN4
3340 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3341 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3343 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3344 //{
3345 // Validate MLME state
3346 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3347 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3348 {
3349 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003350 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 // There's not much that MLME can do at this stage...
3352 respReqd = 0;
3353 }
3354 else
3355 mlmSetKeysCnf.resultCode = resultCode;
3356
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303357 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003358 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3361
Jeff Johnsone7245742012-09-05 17:12:55 -07003362 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 if( respReqd )
3364 {
3365 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3366 mlmSetKeysCnf.sessionId = sessionId;
3367
3368 // Prepare and Send LIM_MLM_SETKEYS_CNF
3369 if( NULL != lpLimMlmSetKeysReq )
3370 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303371 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3372 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3373 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303375 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 pMac->lim.gpLimMlmSetKeysReq = NULL;
3377 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003378 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 }
3380}
3381/**
3382 * limProcessMlmRemoveKeyRsp()
3383 *
3384 *FUNCTION:
3385 *
3386 *LOGIC:
3387 *
3388 *ASSUMPTIONS:
3389 *
3390 *NOTE:
3391 *
3392 * @param pMac Pointer to Global MAC structure
3393 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3394 *
3395 * @return None
3396 */
3397void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3398{
Jeff Johnsone7245742012-09-05 17:12:55 -07003399 tANI_U8 respReqd = 1;
3400 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3401 tANI_U16 resultCode;
3402 tANI_U8 sessionId = 0;
3403 tpPESession psessionEntry;
3404 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303405 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003406
3407 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003409 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003410 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003411 }
3412
Jeff Johnsone7245742012-09-05 17:12:55 -07003413 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3414 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3415 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3416 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003417
Jeff Johnsone7245742012-09-05 17:12:55 -07003418 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003420 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003421 return;
3422 }
3423
3424 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3425 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3426 else
3427 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3428
3429 // Validate MLME state
3430 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3431 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3432 {
3433 // Mesg received from HAL in Invalid state!
3434 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003435 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003436 limMsgQ->type,
3437 psessionEntry->limMlmState );
3438 respReqd = 0;
3439 }
3440 else
3441 mlmRemoveCnf.resultCode = resultCode;
3442
3443 //
3444 // TODO & FIXME_GEN4
3445 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3446 //
3447
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303448 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003449 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003450
3451 // Restore MLME state
3452 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3453 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3454
3455 if( respReqd )
3456 {
3457 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3458 mlmRemoveCnf.sessionId = sessionId;
3459
3460 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3461 if( NULL != lpLimMlmRemoveKeyReq )
3462 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303463 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3464 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3465 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003466 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303467 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003468 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3469 }
3470 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3471 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003472}
3473
Jeff Johnson295189b2012-06-20 16:38:30 -07003474
3475/** ---------------------------------------------------------------------
3476\fn limProcessInitScanRsp
3477\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3478\ message from HAL. If status code is failure, then
3479\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3480\param tpAniSirGlobal pMac
3481\param tANI_U32 body
3482\return none
3483\ ----------------------------------------------------------------------- */
3484void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3485{
3486 tpInitScanParams pInitScanParam;
3487 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3489 pInitScanParam = (tpInitScanParams) body;
3490 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303491 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003492
3493 //Only abort scan if the we are scanning.
3494 if( pMac->lim.abortScan &&
3495 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3496 {
krunal sonid3d60e12013-07-17 13:24:09 -07003497 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 pMac->lim.abortScan = 0;
3499 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3500 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3501 //Set the resume channel to Any valid channel (invalid).
3502 //This will instruct HAL to set it to any previous valid channel.
3503 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003504 if (status != eHAL_STATUS_SUCCESS)
3505 {
3506 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3507 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3508 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3509 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3510 return;
3511 }
3512 else
3513 {
3514 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3515 }
3516
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 }
3518 switch(pMac->lim.gLimHalScanState)
3519 {
3520 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3521 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3522 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003523 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3525 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3526 /*
3527 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3528 * another Scan request in the same context (happens when 11d is enabled
3529 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3530 * scan in the same context but with bigger channel list), so the state needs to be
3531 * changed before this response message is sent.
3532 */
3533 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 return;
3535 }
3536 else if (status == eHAL_STATUS_SUCCESS)
3537 {
3538 /* since we have successfully triggered a background scan,
3539 * reset the "consecutive bkgnd scan failure" count to 0
3540 */
3541 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3542 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003543 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 }
3545 limContinueChannelScan(pMac);
3546 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003547//WLAN_SUSPEND_LINK Related
3548 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3549 if( pMac->lim.gpLimSuspendCallback )
3550 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303551 if( eHAL_STATUS_SUCCESS == status )
3552 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303554 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303556 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303558 pMac->lim.gLimSystemInScanLearnMode = 0;
3559 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003560
3561 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3562 pMac->lim.gpLimSuspendCallback = NULL;
3563 pMac->lim.gpLimSuspendData = NULL;
3564 }
3565 else
3566 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003567 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003568 return;
3569 }
3570 break;
3571//end WLAN_SUSPEND_LINK Related
3572 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003573 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 pMac->lim.gLimHalScanState);
3575 break;
3576 }
3577 return;
3578}
3579/**
3580 * limProcessSwitchChannelReAssocReq()
3581 *
3582 *FUNCTION:
3583 * This function is called to send the reassoc req mgmt frame after the
3584 * switchChannelRsp message is received from HAL.
3585 *
3586 *LOGIC:
3587 *
3588 *ASSUMPTIONS:
3589 * NA
3590 *
3591 *NOTE:
3592 * NA
3593 *
3594 * @param pMac - Pointer to Global MAC structure.
3595 * @param psessionEntry - session related information.
3596 * @param status - channel switch success/failure.
3597 *
3598 * @return None
3599 */
3600static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3601{
3602 tLimMlmReassocCnf mlmReassocCnf;
3603 tLimMlmReassocReq *pMlmReassocReq;
3604 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3605 if(pMlmReassocReq == NULL)
3606 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003607 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3609 goto end;
3610 }
3611
3612 if(status != eHAL_STATUS_SUCCESS)
3613 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003614 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3616 goto end;
3617 }
3618 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003619 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3621 != TX_SUCCESS)
3622 {
3623 /// Could not start reassoc failure timer.
3624 // Log error
3625 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003626 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 // Return Reassoc confirm with
3628 // Resources Unavailable
3629 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3630 goto end;
3631 }
3632 /// Prepare and send Reassociation request frame
3633 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3634 return;
3635end:
3636 // Free up buffer allocated for reassocReq
3637 if(pMlmReassocReq != NULL)
3638 {
3639 /* Update PE session Id*/
3640 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303641 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003642 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 }
3644 else
3645 {
3646 mlmReassocCnf.sessionId = 0;
3647 }
3648
3649 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3650 /* Update PE sessio Id*/
3651 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3652
3653 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3654}
3655/**
3656 * limProcessSwitchChannelJoinReq()
3657 *
3658 *FUNCTION:
3659 * This function is called to send the probe req mgmt frame after the
3660 * switchChannelRsp message is received from HAL.
3661 *
3662 *LOGIC:
3663 *
3664 *ASSUMPTIONS:
3665 * NA
3666 *
3667 *NOTE:
3668 * NA
3669 *
3670 * @param pMac - Pointer to Global MAC structure.
3671 * @param psessionEntry - session related information.
3672 * @param status - channel switch success/failure.
3673 *
3674 * @return None
3675 */
3676static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3677{
3678 tANI_U32 val;
3679 tSirMacSSid ssId;
3680 tLimMlmJoinCnf mlmJoinCnf;
3681 if(status != eHAL_STATUS_SUCCESS)
3682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003683 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 goto error;
3685 }
3686
3687 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3688 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003689 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 goto error;
3691 }
3692
Jeff Johnsone7245742012-09-05 17:12:55 -07003693
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3695 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3696 {
3697 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3698 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303699 {
3700 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3701 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3702 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303704 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003706
3707 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3708 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003709 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3711 // Apply previously set configuration at HW
3712 limApplyConfiguration(pMac, psessionEntry);
3713 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303714 vos_mem_copy(ssId.ssId,
3715 psessionEntry->ssId.ssId,
3716 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003718
3719 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3720
3721 //assign appropriate sessionId to the timer object
3722 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303723 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %s "
3724 "BSSID: "MAC_ADDRESS_STR), psessionEntry->peSessionId,
3725 psessionEntry->currentOperChannel, ssId.ssId,
3726 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 // include additional IE if there is
3728 limSendProbeReqMgmtFrame( pMac, &ssId,
3729 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3730 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3731 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003732
3733 // Sending mgmt frame is a blocking call activate Join failure timer now
3734 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3735 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3736 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003737 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003738 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3739 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3740 //memory is freed up below.
3741 psessionEntry->pLimMlmJoinReq = NULL;
3742 goto error;
3743 }
3744
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003745 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3746 {
Yathish9f22e662012-12-10 14:21:35 -08003747 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003748 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3749 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003750 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003751 goto error;
3752 }
3753 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003754
Jeff Johnson295189b2012-06-20 16:38:30 -07003755 return;
3756error:
3757 if(NULL != psessionEntry)
3758 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303759 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003760 psessionEntry->pLimMlmJoinReq = NULL;
3761 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3762 }
3763 else
3764 {
3765 mlmJoinCnf.sessionId = 0;
3766 }
3767 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3768 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3769 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3770}
3771
3772/**
3773 * limProcessSwitchChannelRsp()
3774 *
3775 *FUNCTION:
3776 * This function is called to process switchChannelRsp message from HAL.
3777 *
3778 *LOGIC:
3779 *
3780 *ASSUMPTIONS:
3781 * NA
3782 *
3783 *NOTE:
3784 * NA
3785 *
3786 * @param pMac - Pointer to Global MAC structure
3787 * @param body - message body.
3788 *
3789 * @return None
3790 */
3791void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3792{
3793 tpSwitchChannelParams pChnlParams = NULL;
3794 eHalStatus status;
3795 tANI_U16 channelChangeReasonCode;
3796 tANI_U8 peSessionId;
3797 tpPESession psessionEntry;
3798 //we need to process the deferred message since the initiating req. there might be nested request.
3799 //in the case of nested request the new request initiated from the response will take care of resetting
3800 //the deffered flag.
3801 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3802 pChnlParams = (tpSwitchChannelParams) body;
3803 status = pChnlParams->status;
3804 peSessionId = pChnlParams->peSessionId;
3805 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3806 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303807 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003808 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 return;
3810 }
3811#if defined WLAN_FEATURE_VOWIFI
3812 //HAL fills in the tx power used for mgmt frames in this field.
3813 //Store this value to use in TPC report IE.
3814 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3815#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303816 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3818 // initialize it back to invalid id
3819 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303820 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 switch(channelChangeReasonCode)
3822 {
3823 case LIM_SWITCH_CHANNEL_REASSOC:
3824 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3825 break;
3826 case LIM_SWITCH_CHANNEL_JOIN:
3827 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3828 break;
3829
3830 case LIM_SWITCH_CHANNEL_OPERATION:
3831 /*
3832 * The above code should also use the callback.
3833 * mechanism below, there is scope for cleanup here.
3834 * THat way all this response handler does is call the call back
3835 * We can get rid of the reason code here.
3836 */
3837 if (pMac->lim.gpchangeChannelCallback)
3838 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003839 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003840 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3841 }
3842 break;
3843 default:
3844 break;
3845 }
3846}
3847/**
3848 * limProcessStartScanRsp()
3849 *
3850 *FUNCTION:
3851 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3852 * then it will start scan/learn on the next channel.
3853 *
3854 *LOGIC:
3855 *
3856 *ASSUMPTIONS:
3857 * NA
3858 *
3859 *NOTE:
3860 * NA
3861 *
3862 * @param pMac - Pointer to Global MAC structure
3863 * @param body - message body.
3864 *
3865 * @return None
3866 */
3867
3868void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3869{
3870 tpStartScanParams pStartScanParam;
3871 eHalStatus status;
3872 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3873 pStartScanParam = (tpStartScanParams) body;
3874 status = pStartScanParam->status;
3875#if defined WLAN_FEATURE_VOWIFI
3876 //HAL fills in the tx power used for mgmt frames in this field.
3877 //Store this value to use in TPC report IE.
3878 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3879 //Store start TSF of scan start. This will be stored in BSS params.
3880 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3881#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303882 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003883 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 if( pMac->lim.abortScan )
3885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003886 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 pMac->lim.abortScan = 0;
3888 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3889 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3890 //Set the resume channel to Any valid channel (invalid).
3891 //This will instruct HAL to set it to any previous valid channel.
3892 peSetResumeChannel(pMac, 0, 0);
3893 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3894 }
3895 switch(pMac->lim.gLimHalScanState)
3896 {
3897 case eLIM_HAL_START_SCAN_WAIT_STATE:
3898 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3899 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003900 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003901 //
3902 // FIXME - With this, LIM will try and recover state, but
3903 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3904 // status back to the SME
3905 //
3906 //Set the resume channel to Any valid channel (invalid).
3907 //This will instruct HAL to set it to any previous valid channel.
3908 peSetResumeChannel(pMac, 0, 0);
3909 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3910 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3911 }
3912 else
3913 {
3914 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3915 limContinuePostChannelScan(pMac);
3916 }
3917 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003919 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 pMac->lim.gLimHalScanState);
3921 break;
3922 }
3923 return;
3924}
3925void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
3926{
3927 tpEndScanParams pEndScanParam;
3928 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3930 pEndScanParam = (tpEndScanParams) body;
3931 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303932 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003933 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003934 switch(pMac->lim.gLimHalScanState)
3935 {
3936 case eLIM_HAL_END_SCAN_WAIT_STATE:
3937 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3938 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003939 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3941 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3942 }
3943 else
3944 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08003945 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 limContinueChannelScan(pMac);
3947 }
3948 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003950 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 pMac->lim.gLimHalScanState);
3952 break;
3953 }
3954 return;
3955}
Jeff Johnsone7245742012-09-05 17:12:55 -07003956/**
3957 * limStopTxAndSwitch()
3958 *
3959 *FUNCTION:
3960 * Start channel switch on all sessions that is in channel switch state.
3961 *
3962 * @param pMac - pointer to global adapter context
3963 *
3964 * @return None
3965 *
3966 */
3967static void
3968limStopTxAndSwitch (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.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
3976 {
3977 limStopTxAndSwitchChannel(pMac, i);
3978 }
3979 }
3980 return;
3981}
3982/**
3983 * limStartQuietOnSession()
3984 *
3985 *FUNCTION:
3986 * This function is called to start quiet timer after finish scan if there is
3987 * qeuieting on any session.
3988 *
3989 *LOGIC:
3990 *
3991 *ASSUMPTIONS:
3992 * NA
3993 *
3994 *NOTE:
3995 * NA
3996 *
3997 * @param pMac - Pointer to Global MAC structure
3998 *
3999 * @return None
4000 */
4001static void
4002limStartQuietOnSession (tpAniSirGlobal pMac)
4003{
4004 tANI_U8 i;
4005
4006 for(i =0; i < pMac->lim.maxBssId; i++)
4007 {
4008 if(pMac->lim.gpSession[i].valid &&
4009 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4010 {
4011 limStartQuietTimer(pMac, i);
4012 }
4013 }
4014 return;
4015}
Jeff Johnson295189b2012-06-20 16:38:30 -07004016void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4017{
4018 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 eHalStatus status;
4020 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4021 pFinishScanParam = (tpFinishScanParams) body;
4022 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304023 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004024 body = NULL;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004025
4026 limLog(pMac, LOGW, FL("Rcvd FinishScanRsp in state %d"),
4027 pMac->lim.gLimHalScanState);
4028
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 switch(pMac->lim.gLimHalScanState)
4030 {
4031 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4032 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4033 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004034 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 {
4036 /** Right time to stop tx and start the timer for channel switch */
4037 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4038 * be any associated session id
4039 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004040 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004042 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 {
4044 /** Start the quieting */
4045 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4046 * be any associated session id
4047 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004048 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004049 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004050 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4051 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004052 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 }
4054 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004055//WLAN_SUSPEND_LINK Related
4056 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4057 if( pMac->lim.gpLimResumeCallback )
4058 {
4059 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4060 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4061 pMac->lim.gpLimResumeCallback = NULL;
4062 pMac->lim.gpLimResumeData = NULL;
4063 pMac->lim.gLimSystemInScanLearnMode = 0;
4064 }
4065 else
4066 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004067 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 return;
4069 }
4070 break;
4071//end WLAN_SUSPEND_LINK Related
4072
4073 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004074 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 pMac->lim.gLimHalScanState);
4076 break;
4077 }
4078 return;
4079}
4080/**
4081 * @function : limProcessMlmHalAddBARsp
4082 *
4083 * @brief: Process WDA_ADDBA_RSP coming from HAL
4084 *
4085 *
4086 * @param pMac The global tpAniSirGlobal object
4087 *
4088 * @param tSirMsgQ The MsgQ header containing the response buffer
4089 *
4090 * @return none
4091 */
4092void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4093 tpSirMsgQ limMsgQ )
4094{
4095 // Send LIM_MLM_ADDBA_CNF to LIM
4096 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004097 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004099
Jeff Johnson295189b2012-06-20 16:38:30 -07004100 //now LIM can process any defer message.
4101 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4102 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004103 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 return;
4105 }
4106 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4107 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004108 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304109 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004110 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 return;
4112 }
4113#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4114 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4115#endif //FEATURE_WLAN_DIAG_SUPPORT
4116
4117 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304118 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4119 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004120 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304121 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004122 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 return;
4124 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304125 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304127 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4128 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004129 // Copy other ADDBA Rsp parameters
4130 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4131 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4132 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4133 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4134 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4135 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4136 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4137 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4138 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4139 else
4140 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304141 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004142 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004143 // Send ADDBA CNF to LIM
4144 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4145}
4146/**
4147 * \brief Process LIM_MLM_ADDBA_CNF
4148 *
4149 * \sa limProcessMlmAddBACnf
4150 *
4151 * \param pMac The global tpAniSirGlobal object
4152 *
4153 * \param tSirMsgQ The MsgQ header containing the response buffer
4154 *
4155 * \return none
4156 */
4157void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4158 tANI_U32 *pMsgBuf )
4159{
4160tpLimMlmAddBACnf pMlmAddBACnf;
4161tpDphHashNode pSta;
4162tANI_U16 aid;
4163tLimBAState curBaState;
4164tpPESession psessionEntry = NULL;
4165if(pMsgBuf == NULL)
4166{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004167 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 return;
4169}
4170pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4171 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4172 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004173 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304174 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004175 return;
4176 }
4177 // First, extract the DPH entry
4178 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4179 if( NULL == pSta )
4180 {
4181 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004182 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304183 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 return;
4185 }
4186 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4187 // Need to validate SME state
4188 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4189 {
4190 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004191 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304193 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 return;
4195 }
4196 // Restore STA BA state
4197 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004198 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 {
4200 // Update LIM internal cache...
4201 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4202 {
4203 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4204 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4205 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4206 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4207 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004208 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4209 // status code. MLME will then send an ADDBA RSP
4210 // over the air to the peer MAC entity
4211 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4212 pMlmAddBACnf->peerMacAddr,
4213 pMlmAddBACnf->addBAResultCode,
4214 pMlmAddBACnf->baDialogToken,
4215 (tANI_U8) pMlmAddBACnf->baTID,
4216 (tANI_U8) pMlmAddBACnf->baPolicy,
4217 pMlmAddBACnf->baBufferSize,
4218 pMlmAddBACnf->baTimeout,psessionEntry))
4219 {
4220 PELOGW(limLog( pMac, LOGW,
4221 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4222 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4223 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 }
4225 else
4226 {
4227 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4228 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4229 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4230 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4231 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4232 }
4233 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004234 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304235 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004236 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004237}
4238/**
4239 * \brief Process LIM_MLM_DELBA_CNF
4240 *
4241 * \sa limProcessMlmDelBACnf
4242 *
4243 * \param pMac The global tpAniSirGlobal object
4244 *
4245 * \param tSirMsgQ The MsgQ header containing the response buffer
4246 *
4247 * \return none
4248 */
4249void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4250 tANI_U32 *pMsgBuf )
4251{
4252 tpLimMlmDelBACnf pMlmDelBACnf;
4253 tpDphHashNode pSta;
4254 tANI_U16 aid;
4255// tANI_U8 sessionId;
4256 tLimBAState curBaState;
4257 tpPESession psessionEntry;
4258
4259 if(pMsgBuf == NULL)
4260 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004261 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 return;
4263 }
4264 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4265 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4266 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304267 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4268 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304269 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 return;
4271 }
4272 // First, extract the DPH entry
4273 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4274 if( NULL == pSta )
4275 {
4276 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004277 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304278 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004279 return;
4280 }
4281 if(NULL == pMlmDelBACnf)
4282 {
4283 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004284 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 return;
4286 }
4287 // Need to validate baState
4288 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4289 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4290 {
4291 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004292 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304294 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 return;
4296 }
4297 // Restore STA BA state
4298 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4299 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304300 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004301}
4302/**
4303 * \brief Process SIR_LIM_DEL_BA_IND
4304 *
4305 * \sa limProcessMlmHalBADeleteInd
4306 *
4307 * \param pMac The global tpAniSirGlobal object
4308 *
4309 * \param tSirMsgQ The MsgQ header containing the indication buffer
4310 *
4311 * \return none
4312 */
4313void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4314 tpSirMsgQ limMsgQ )
4315{
4316 tSirRetStatus status = eSIR_SUCCESS;
4317 tpBADeleteParams pBADeleteParams;
4318 tpDphHashNode pSta;
4319 tANI_U16 aid;
4320 tLimBAState curBaState;
4321 tpPESession psessionEntry;
4322 tANI_U8 sessionId;
4323
4324 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4325
4326 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4327 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004328 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304329 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004330 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 return;
4332 }
4333 // First, extract the DPH entry
4334 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4335 if( NULL == pSta )
4336 {
4337 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004338 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 goto returnAfterCleanup;
4340 }
4341
4342 // Need to validate BA state
4343 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4344 if( eLIM_BA_STATE_IDLE != curBaState )
4345 {
4346 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004347 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 curBaState );
4349 goto returnAfterCleanup;
4350 }
4351
4352 // Validate if a BA is active for the requested TID
4353 // AND in that desired direction
4354 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4355 {
4356 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4357 status = eSIR_FAILURE;
4358 }
4359 else
4360 {
4361 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4362 status = eSIR_FAILURE;
4363 }
4364 if( eSIR_FAILURE == status )
4365 {
4366 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004367 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004368 pBADeleteParams->baTID );
4369 }
4370 else
4371 {
4372 // Post DELBA REQ to MLME...
4373 if( eSIR_SUCCESS !=
4374 (status = limPostMlmDelBAReq( pMac,
4375 pSta,
4376 pBADeleteParams->baDirection,
4377 pBADeleteParams->baTID,
4378 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4379 {
4380 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004381 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004382 }
4383 else
4384 {
4385 limLog( pMac, LOGE,
4386 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4387 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4388 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4389 }
4390 }
4391returnAfterCleanup:
4392 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304393 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004394 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004395}
4396/**
4397 * @function : limProcessSetMimoRsp()
4398 *
4399 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4400 * after Processing the Req from the SME (PMC)
4401 *
4402 * LOGIC:
4403 *
4404 * ASSUMPTIONS:
4405 * NA
4406 *
4407 * NOTE:
4408 * NA
4409 *
4410 * @param pMac - Pointer to Global MAC structure
4411 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4412 * @return None
4413 */
4414
4415void
4416limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4417{
4418#if 0
4419 tSirRetStatus retStatus;
4420 tpSetMIMOPS pMIMO_PSParams;
4421
4422
4423 do {
4424
4425 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4426 if( NULL == pMIMO_PSParams ) {
4427 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4428 return;
4429 }
4430
4431 /** If Updation of the HAL Fail's*/
4432 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004433 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 break;
4435 }
4436
4437 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4438 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4439 break;
4440
4441 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4442 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4443
4444 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4445 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4446 * the Action Frame is being sent at first before setting the internal structures
4447 */
4448 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4449 tSirMacAddr macAddr;
4450
4451 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304452 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004453
4454 /** Send Action Frame with the corresponding mode */
4455 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4456 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004457 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 break;
4459 }
4460 }
4461 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4462 }while(0);
4463
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304464 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004465#endif
4466}
4467/**
4468 * @function : limHandleDelBssInReAssocContext
4469 * @brief : While Processing the ReAssociation Response Frame in STA,
4470 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4471 * being issued and the end of DelBSS the new BSS is being added.
4472 *
4473 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4474 * change, We need to update CSR with ReAssocCNF Response with the
4475 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4476 * context only
4477 *
4478 * @param : pMac - tpAniSirGlobal
4479 * pStaDs - Station Descriptor
4480 *
4481 * @return : none
4482 */
4483static void
4484limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4485{
4486 tLimMlmReassocCnf mlmReassocCnf;
4487 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4488 /** Set the MlmState to IDLE*/
4489 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 /* Update PE session Id*/
4491 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4492 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 case eLIM_SME_WT_REASSOC_STATE :
4494 {
4495 tpSirAssocRsp assocRsp;
4496 tpDphHashNode pStaDs;
4497 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004498 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 /** Delete the older STA Table entry */
4500 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4501 /**
4502 * Add an entry for AP to hash table
4503 * maintained by DPH module
4504 */
4505 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4506 {
4507 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004508 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4510 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4511 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4512 goto Error;
4513 }
4514 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4515 * is being stored to be used here for sending ADDBSS
4516 */
4517 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4518 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4519 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 limExtractApCapabilities( pMac,
4521 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4522 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4523 &beaconStruct );
4524 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4525 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4526 if(beaconStruct.erpPresent) {
4527 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4528 psessionEntry->beaconParams.fShortPreamble = 0;
4529 else
4530 psessionEntry->beaconParams.fShortPreamble = 1;
4531 }
4532 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4533 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4534 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004535 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 retStatus = eSIR_FAILURE;
4537 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 if (retStatus != eSIR_SUCCESS)
4539 {
4540 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4541 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304542 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 pMac->lim.gLimAssocResponseData = NULL;
4544 goto Error;
4545 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304546 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 psessionEntry->limAssocResponseData = NULL;
4548 }
4549 break;
4550 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4551 {
4552 /** Case wherein the DisAssoc / Deauth
4553 * being sent as response to ReAssoc Req*/
4554 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4555 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4556 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4557 /** Set the SME State back to WT_Reassoc State*/
4558 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4560 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4561 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4562 {
4563 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 }
4565 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4566 }
4567 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004569 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4571 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4572 goto Error;
4573 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004574 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004575Error:
4576 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4577}
4578
4579/* Added For BT -AMP Support */
4580static void
4581limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4582{
4583 tLimMlmStartCnf mlmStartCnf;
4584 tANI_U32 val;
4585 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4586
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304587 if (NULL == pAddBssParams)
4588 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004589 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304590 goto end;
4591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4593 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004594 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4596 {
4597 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4598 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4599 goto end;
4600 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4601 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4602 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4603 goto end;
4604 }
4605
4606 // Set MLME state
4607 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4608 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4609 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4610 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004611 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 // Create timers used by LIM
4613 if (!pMac->lim.gLimTimersCreated)
4614 limCreateTimers(pMac);
4615 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4616 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004617 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4619 // Apply previously set configuration at HW
4620 limApplyConfiguration(pMac,psessionEntry);
4621 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4622 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4623 }
4624 else
4625 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004626 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004627 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4628 }
4629 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4630 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4631 end:
4632 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004633 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304634 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004635 limMsgQ->bodyptr = NULL;
4636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004637}
4638
4639/**
4640 * @function : limHandleAddBssInReAssocContext
4641 * @brief : While Processing the ReAssociation Response Frame in STA,
4642 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4643 * being issued and the end of DelBSS the new BSS is being added.
4644 *
4645 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4646 * change, We need to update CSR with ReAssocCNF Response with the
4647 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4648 * context only
4649 *
4650 * @param : pMac - tpAniSirGlobal
4651 * pStaDs - Station Descriptor
4652 *
4653 * @return : none
4654 */
4655void
4656limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4657{
4658 tLimMlmReassocCnf mlmReassocCnf;
4659 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4660 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004661 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4662 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 case eLIM_SME_WT_REASSOC_STATE : {
4665 tpSirAssocRsp assocRsp;
4666 tpDphHashNode pStaDs;
4667 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004668 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304669 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4670 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004671 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304672 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004673 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4674 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4675 goto Error;
4676 }
4677
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 // Get the AP entry from DPH hash table
4679 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4680 if (pStaDs == NULL )
4681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004682 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004683 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4684 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304685 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 goto Error;
4687 }
4688 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4689 * is being stored to be used here for sending ADDBSS
4690 */
4691 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4692 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4693 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004694 limExtractApCapabilities( pMac,
4695 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4696 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004697 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004698 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004699 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4700
4701 if(pBeaconStruct->erpPresent)
4702 {
4703 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004704 psessionEntry->beaconParams.fShortPreamble = 0;
4705 else
4706 psessionEntry->beaconParams.fShortPreamble = 1;
4707 }
4708
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004709 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004711 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004712 retStatus = eSIR_FAILURE;
4713 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 if (retStatus != eSIR_SUCCESS)
4715 {
4716 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4717 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304718 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004719 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304720 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004721 goto Error;
4722 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304723 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304725 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004726 }
4727 break;
4728 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4729 * being sent as response to ReAssoc Req*/
4730 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4731 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4732 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4733 /** Set the SME State back to WT_Reassoc State*/
4734 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4735 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4736 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004737 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004738 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004739 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4740 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004741
4742 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4743 }
4744 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004746 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004747 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4748 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4749 goto Error;
4750 }
4751return;
4752Error:
4753 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4754}
4755
4756#if 0
4757 static void
4758limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4759{
4760 tSirSmeAssocCnf assocCnf;
4761 tpDphHashNode pStaDs;
4762 tpPESession psessionEntry;
4763 tANI_U8 sessionId;
4764
4765 if(pMsgBuf == NULL)
4766 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004767 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004768 goto end;
4769 }
4770 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4771 !__limIsSmeAssocCnfValid(&assocCnf))
4772 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004773 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 goto end;
4775 }
4776 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4777 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004778 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 goto end;
4780 }
4781 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4782 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4783 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004784 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4786 goto end;
4787 }
4788 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4789 if (pStaDs == NULL)
4790 {
4791 limLog(pMac, LOG1,
4792 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4793 msgType, assocCnf.aid);
4794 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4795 /*
4796 ** send a DISASSOC_IND message to WSM to make sure
4797 ** the state in WSM and LIM is the same
4798 **/
4799 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4800 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4801 goto end;
4802 }
4803 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304804 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004805 (tANI_U8 *) assocCnf.peerMacAddr,
4806 sizeof(tSirMacAddr)) ) ||
4807 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4808 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4809 (msgType != eWNI_SME_ASSOC_CNF)) ||
4810 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4811 (msgType != eWNI_SME_REASSOC_CNF)))))
4812 {
4813 limLog(pMac, LOG1,
4814 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4815 msgType, assocCnf.aid);
4816 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4817 goto end;
4818 }
4819 /*
4820 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4821 ** has been received
4822 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004823 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4825 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4826 {
4827 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4828 * when it had received Assoc Request frame. Now, PE just needs to send
4829 * Association Response frame to the requesting BTAMP-STA.
4830 */
4831 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004832 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4834 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4835 goto end;
4836 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4837 else
4838 {
4839 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4840 limRejectAssociation(pMac, pStaDs->staAddr,
4841 pStaDs->mlmStaContext.subType,
4842 true, pStaDs->mlmStaContext.authType,
4843 pStaDs->assocId, true,
4844 assocCnf.statusCode, psessionEntry);
4845 return;
4846 }
4847end:
4848 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4849 {
4850 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4851 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304852 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4854 }
4855
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304856 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4858 }
4859} /*** end __limProcessSmeAssocCnfNew() ***/
4860#endif
4861
Jeff Johnson295189b2012-06-20 16:38:30 -07004862void
4863limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4864 tBeaconGenParams *pBeaconGenParams = NULL;
4865 tSirMsgQ limMsg;
4866 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4867 if(psessionEntry == NULL ){
4868 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004869 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 return;
4871 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304872 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4873 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 {
4875 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304876 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004877 return;
4878 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304879 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4880 vos_mem_copy((void *) pBeaconGenParams->bssId,
4881 (void *)psessionEntry->bssId,
4882 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 limMsg.bodyptr = pBeaconGenParams;
4884 schProcessPreBeaconInd(pMac, &limMsg);
4885 return;
4886}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304887
4888void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4889 tSirResultCodes reasonCode)
4890{
4891 tANI_U16 scanRspLen = 0;
4892
4893 pMac->lim.gLimSmeScanResultLength +=
4894 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304895 pMac->lim.gLimRspReqd = false;
4896 if ((reasonCode == eSIR_SME_SUCCESS) ||
4897 pMac->lim.gLimSmeScanResultLength) {
4898 scanRspLen = sizeof(tSirSmeScanRsp) +
4899 pMac->lim.gLimSmeScanResultLength -
4900 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304901 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304902 else
4903 scanRspLen = sizeof(tSirSmeScanRsp);
4904
4905 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4906 pMac->lim.gSmeSessionId,
4907 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304908}
4909
4910
4911void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4912{
4913 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4914
4915 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004916 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304917
4918 switch (pScanEvent->event)
4919 {
4920 case SCAN_EVENT_STARTED:
4921 break;
4922 case SCAN_EVENT_START_FAILED:
4923 case SCAN_EVENT_COMPLETED:
4924 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
4925 break;
4926 case SCAN_EVENT_BSS_CHANNEL:
4927 case SCAN_EVENT_FOREIGN_CHANNEL:
4928 case SCAN_EVENT_DEQUEUED:
4929 case SCAN_EVENT_PREEMPTED:
4930 default:
4931 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004932 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304933 }
4934}