blob: 9a2a42665857ec382d0f3632f70a5d9872561019 [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
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053063#ifdef DEBUG_ROAM_DELAY
64#include "vos_utils.h"
65#endif
66
Jeff Johnson295189b2012-06-20 16:38:30 -070067static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070068static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070069void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070070#ifdef FEATURE_OEM_DATA_SUPPORT
71void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
72#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070073void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
74void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
86void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
87void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
88void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
89void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
90static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
91void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
92static void
93limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080094
95void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
96 eHalStatus status, tANI_U32* mlmAddBssRsp);
97
Jeff Johnson295189b2012-06-20 16:38:30 -070098/**
99 * limProcessMlmRspMessages()
100 *
101 *FUNCTION:
102 * This function is called to processes various MLM response (CNF/IND
103 * messages from MLM State machine.
104 *
105 *LOGIC:
106 *
107 *ASSUMPTIONS:
108 *
109 *NOTE:
110 *
111 * @param pMac Pointer to Global MAC structure
112 * @param msgType Indicates the MLM message type
113 * @param *pMsgBuf A pointer to the MLM message buffer
114 *
115 * @return None
116 */
117void
118limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
119{
120
121 if(pMsgBuf == NULL)
122 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700123 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700124 return;
125 }
126 switch (msgType)
127 {
128 case LIM_MLM_SCAN_CNF:
129 limProcessMlmScanCnf(pMac, pMsgBuf);
130 break;
131
Jeff Johnsone7245742012-09-05 17:12:55 -0700132#ifdef FEATURE_OEM_DATA_SUPPORT
133 case LIM_MLM_OEM_DATA_CNF:
134 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800135 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700136 break;
137#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700138
139 case LIM_MLM_AUTH_CNF:
140 limProcessMlmAuthCnf(pMac, pMsgBuf);
141 break;
142 case LIM_MLM_AUTH_IND:
143 limProcessMlmAuthInd(pMac, pMsgBuf);
144 break;
145 case LIM_MLM_ASSOC_CNF:
146 limProcessMlmAssocCnf(pMac, pMsgBuf);
147 break;
148 case LIM_MLM_START_CNF:
149 limProcessMlmStartCnf(pMac, pMsgBuf);
150 break;
151 case LIM_MLM_JOIN_CNF:
152 limProcessMlmJoinCnf(pMac, pMsgBuf);
153 break;
154 case LIM_MLM_ASSOC_IND:
155 limProcessMlmAssocInd(pMac, pMsgBuf);
156 break;
157 case LIM_MLM_REASSOC_CNF:
158 limProcessMlmReassocCnf(pMac, pMsgBuf);
159 break;
160 case LIM_MLM_REASSOC_IND:
161 limProcessMlmReassocInd(pMac, pMsgBuf);
162 break;
163 case LIM_MLM_DISASSOC_CNF:
164 limProcessMlmDisassocCnf(pMac, pMsgBuf);
165 break;
166 case LIM_MLM_DISASSOC_IND:
167 limProcessMlmDisassocInd(pMac, pMsgBuf);
168 break;
169 case LIM_MLM_PURGE_STA_IND:
170 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
171 break;
172 case LIM_MLM_DEAUTH_CNF:
173 limProcessMlmDeauthCnf(pMac, pMsgBuf);
174 break;
175 case LIM_MLM_DEAUTH_IND:
176 limProcessMlmDeauthInd(pMac, pMsgBuf);
177 break;
178 case LIM_MLM_SETKEYS_CNF:
179 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
180 break;
181 case LIM_MLM_REMOVEKEY_CNF:
182 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
183 break;
184 case LIM_MLM_TSPEC_CNF:
185 break;
186 case LIM_MLM_ADDBA_CNF:
187 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800188 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 break;
190 case LIM_MLM_DELBA_CNF:
191 limProcessMlmDelBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800192 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 break;
194 default:
195 break;
196 } // switch (msgType)
197 return;
198} /*** end limProcessMlmRspMessages() ***/
199
200/**
201 * limProcessMlmScanCnf()
202 *
203 *FUNCTION:
204 * This function is called to processes MLM_SCAN_CNF
205 * message from MLM State machine.
206 *
207 *LOGIC:
208 *
209 *ASSUMPTIONS:
210 *
211 *NOTE:
212 *
213 * @param pMac Pointer to Global MAC structure
214 * @param pMsgBuf A pointer to the MLM message buffer
215 *
216 * @return None
217 */
218void
219limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
220{
221 switch(pMac->lim.gLimSmeState)
222 {
223 case eLIM_SME_WT_SCAN_STATE:
224 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
225 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
226 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700227 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 pMac->lim.gLimSystemInScanLearnMode = 0;
229 break;
230 default:
231 /**
232 * Should not have received scan confirm
233 * from MLM in other states.
234 * Log error
235 */
236 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700237 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 pMac->lim.gLimSmeState);)
239 return;
240 }
241
242 /// Process received scan confirm
243 /// Increment length of cached scan results
244 pMac->lim.gLimSmeScanResultLength +=
245 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
246 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
247 {
248 tANI_U16 scanRspLen = 0;
249 /// Need to send response to Host
250 pMac->lim.gLimRspReqd = false;
251 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
252 eSIR_SME_SUCCESS) ||
253 pMac->lim.gLimSmeScanResultLength)
254 {
255 scanRspLen = sizeof(tSirSmeScanRsp) +
256 pMac->lim.gLimSmeScanResultLength -
257 sizeof(tSirBssDescription);
258 }
259 else
260 {
261 scanRspLen = sizeof(tSirSmeScanRsp);
262 }
263 if(pMac->lim.gLimReportBackgroundScanResults)
264 {
265 pMac->lim.gLimBackgroundScanTerminate = TRUE;
266 }
267 if (pMac->lim.gLimSmeScanResultLength == 0)
268 {
269 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
270 }
271 else
272 {
273 limSendSmeScanRsp(pMac, scanRspLen,
274 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
275 }
276 } // if (pMac->lim.gLimRspReqd)
277 //check to see whether we need to run bgScan timer
278 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
279 {
280 if (tx_timer_activate(
281 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
282 {
283 /// Could not activate background scan timer.
284 // Log error
285 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700286 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 pMac->lim.gLimBackgroundScanStarted = FALSE;
288 }
289 else
290 {
291 pMac->lim.gLimBackgroundScanStarted = TRUE;
292 }
293 }
294} /*** end limProcessMlmScanCnf() ***/
295
Jeff Johnsone7245742012-09-05 17:12:55 -0700296#ifdef FEATURE_OEM_DATA_SUPPORT
297
298/**
299 * limProcessMlmOemDataReqCnf()
300 *
301 *FUNCTION:
302 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
303 * message from MLM State machine.
304 *
305 *LOGIC:
306 *
307 *ASSUMPTIONS:
308 *
309 *NOTE:
310 *
311 * @param pMac Pointer to Global MAC structure
312 * @param pMsgBuf A pointer to the MLM message buffer
313 *
314 * @return None
315 */
316
317void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
318{
319 tLimMlmOemDataRsp* measRsp;
320
321 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
322
323 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
324
325 //Now send the meas confirm message to the sme
326 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
327
328 //Dont free the memory here. It will be freed up by the callee
329
330 return;
331}
332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700333
334/**
335 * limProcessMlmStartCnf()
336 *
337 *FUNCTION:
338 * This function is called to processes MLM_START_CNF
339 * message from MLM State machine.
340 *
341 *LOGIC:
342 *
343 *ASSUMPTIONS:
344 *
345 *NOTE:
346 *
347 * @param pMac Pointer to Global MAC structure
348 * @param pMsgBuf A pointer to the MLM message buffer
349 *
350 * @return None
351 */
352void
353limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
354{
355 tpPESession psessionEntry = NULL;
356 tLimMlmStartCnf *pLimMlmStartCnf;
357 tANI_U8 smesessionId;
358 tANI_U16 smetransactionId;
359
360 if(pMsgBuf == NULL)
361 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700362 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 return;
364 }
365 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
366 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
367 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700368 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 return;
370 }
371 smesessionId = psessionEntry->smeSessionId;
372 smetransactionId = psessionEntry->transactionId;
373
374 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
375 {
376 /**
377 * Should not have received Start confirm from MLM
378 * in other states.
379 * Log error
380 */
381 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700382 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 psessionEntry->limSmeState);)
384 return;
385 }
386 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
387 eSIR_SME_SUCCESS)
388 {
389
390 /**
391 * Update global SME state so that Beacon Generation
392 * module starts writing Beacon frames into TFP's
393 * Beacon file register.
394 */
395 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700396 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 }
401 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700403 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
406 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700407 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700410 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 }
412 else
413 {
414 /// Start BSS is a failure
415 peDeleteSession(pMac,psessionEntry);
416 psessionEntry = NULL;
Leela Venkata Kiran Kumar Reddy Chiralac7a12152014-02-03 11:20:14 -0800417 PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
418 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 }
420 /// Send response to Host
421 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
422 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
423 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
425 {
426 //Configure beacon and send beacons to HAL
427 limSendBeaconInd(pMac, psessionEntry);
428 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700429}
430
431 /*** end limProcessMlmStartCnf() ***/
432
433/**
434 * limProcessMlmJoinCnf()
435 *
436 *FUNCTION:
437 * This function is called to processes MLM_JOIN_CNF
438 * message from MLM State machine.
439 *
440 *LOGIC:
441 *
442 *ASSUMPTIONS:
443 *
444 *NOTE:
445 *
446 * @param pMac Pointer to Global MAC structure
447 * @param pMsgBuf A pointer to the MLM message buffer
448 *
449 * @return None
450 */
451void
452limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
453{
454 tSirResultCodes resultCode;
455 tLimMlmJoinCnf *pLimMlmJoinCnf;
456 tpPESession psessionEntry;
457 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
458 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
459 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530460 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
461 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return;
463 }
464
465 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
466 {
467 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700468 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 psessionEntry->limSmeState);)
470 return;
471 }
472
473 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
474 /// Process Join confirm from MLM
475 if (resultCode == eSIR_SME_SUCCESS)
476 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530477 PELOG1(limLog(pMac, LOG1, FL("***SessionId:%d Joined ESS ***"),
478 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
481 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
482 return;
483 else
484 resultCode = eSIR_SME_REFUSED;
485 }
486 {
487 /// Join failure
488 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700489 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 /// Send Join response to Host
491 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
492 }
493} /*** end limProcessMlmJoinCnf() ***/
494
495/**
496 * limProcessMlmAuthCnf()
497 *
498 *FUNCTION:
499 * This function is called to processes MLM_AUTH_CNF
500 * message from MLM State machine.
501 *
502 *LOGIC:
503 *
504 *ASSUMPTIONS:
505 *
506 *NOTE:
507 *
508 * @param pMac Pointer to Global MAC structure
509 * @param pMsgBuf A pointer to the MLM message buffer
510 *
511 * @return None
512 */
513void
514limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
515{
516 tANI_U16 caps;
517 tANI_U32 val;
518 tAniAuthType cfgAuthType, authMode;
519 tLimMlmAuthReq *pMlmAuthReq;
520 tLimMlmAssocReq *pMlmAssocReq;
521 tLimMlmAuthCnf *pMlmAuthCnf;
522 tpPESession psessionEntry;
523 tANI_U32 teleBcnEn = 0;
524// tANI_U8 sessionId;
525
526 if(pMsgBuf == NULL)
527 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700528 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 return;
530 }
531 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
532 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
533 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530534 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),
535 pMlmAuthCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 return;
537 }
538
539 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
540 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
541 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
542 {
543 /**
544 * Should not have received AUTH confirm
545 * from MLM in other states or on AP.
546 * Log error
547 */
548 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530549 FL("SessionId:%d received unexpected MLM_AUTH_CNF in state %X"),
550 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 return;
552 }
553 /// Process AUTH confirm from MLM
554 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
555 {
556 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
557 {
558 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
559 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
560 {
561 /**
562 * Could not get AuthType value from CFG.
563 * Log error.
564 */
565 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700566 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 }
568 }
569 else
570 cfgAuthType = pMac->lim.gLimPreAuthType;
571
572 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
573 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
574 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
575 {
576 /**
577 * When Open authentication fails with reason code "13" and
578 * authType set to 'auto switch', Try with Shared Authentication
579 */
580 authMode = eSIR_SHARED_KEY;
581 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530582 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
583 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 {
585 // Log error
586 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530587 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 return;
589 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530590 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 val = sizeof(tSirMacAddr);
592 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
593 {
594 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
595 }
596 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530597 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
598 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 sizeof(tSirMacAddr));
600 pMlmAuthReq->authType = authMode;
601 /* Update PE session Id*/
602 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
603 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
604 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
605 != eSIR_SUCCESS)
606 {
607 /**
608 * Could not get AuthFailureTimeout value from CFG.
609 * Log error.
610 */
611 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700612 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 }
614 limPostMlmMessage(pMac,
615 LIM_MLM_AUTH_REQ,
616 (tANI_U32 *) pMlmAuthReq);
617 return;
618 }
619 else
620 {
621 // MAC based authentication failure
622 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
623 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700624 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700626 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700628 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
629
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 /**
631 * Need to send Join response with
632 * auth failure to Host.
633 */
634 limHandleSmeJoinResult(pMac,
635 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
636 }
637 else
638 {
639 /**
640 * Pre-authentication failure.
641 * Send Pre-auth failure response to host
642 */
643 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700644 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 limSendSmeAuthRsp(
646 pMac,
647 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
648 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
649 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
650 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
651 }
652 } // end if (cfgAuthType == eAUTO_SWITCH)
653 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
654 else
655 {
656 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
657 {
658 /**
659 * Successful MAC based authentication
660 * Trigger Association with BSS
661 */
662 PELOG1(limLog(pMac, LOG1,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530663 FL("SessionId:%d Authenticated with BSS"),
664 psessionEntry->peSessionId);)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530665 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
666 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 {
668 // Log error
669 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530670 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 return;
672 }
673 val = sizeof(tSirMacAddr);
674 #if 0
675 if (cfgGetStr(pMac, WNI_CFG_BSSID,
676 pMlmAssocReq->peerMacAddr,
677 &val) != eSIR_SUCCESS)
678 {
679 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700680 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 }
682 #endif //SUPPORT BT-AMP
683 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
684 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
685 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
686 != eSIR_SUCCESS)
687 {
688 /**
689 * Could not get AssocFailureTimeout value
690 * from CFG. Log error.
691 */
692 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700693 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 }
695 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
696 {
697 /**
698 * Could not get Capabilities value
699 * from CFG. Log error.
700 */
701 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700702 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 }
704 /*Clear spectrum management bit if AP doesn't support it*/
705 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
706 {
707 /*AP doesn't support spectrum management clear spectrum management bit*/
708 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
709 }
710
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530711 /* Clear rrm bit if AP doesn't support it */
712 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
713 & LIM_RRM_BIT_MASK))
714 {
715 caps &= (~LIM_RRM_BIT_MASK);
716 }
717
Chandrasekaran, Manishekarc949a8b2014-06-27 12:34:09 +0530718 /* Clear short preamble bit if AP does not support it */
719 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
720 (LIM_SHORT_PREAMBLE_BIT_MASK)))
721 {
722 caps &= (~LIM_SHORT_PREAMBLE_BIT_MASK);
723 limLog(pMac, LOG1, FL("Clearing short preamble:no AP support"));
724 }
725
726 /* Clear immediate block ack bit if AP does not support it */
727 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo &
728 (LIM_IMMEDIATE_BLOCK_ACK_MASK)))
729 {
730 caps &= (~LIM_IMMEDIATE_BLOCK_ACK_MASK);
731 limLog(pMac, LOG1, FL("Clearing Immed Blk Ack:no AP support"));
732 }
733
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 pMlmAssocReq->capabilityInfo = caps;
735 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700736 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700738 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
739 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
741 /* If telescopic beaconing is enabled, set listen interval to
742 WNI_CFG_TELE_BCN_MAX_LI */
743 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
744 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700745 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700746
747 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
748
749 if(teleBcnEn)
750 {
751 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
752 eSIR_SUCCESS)
753 {
754 /**
755 * Could not get ListenInterval value
756 * from CFG. Log error.
757 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700758 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 }
760 }
761 else
762 {
763 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
764 {
765 /**
766 * Could not get ListenInterval value
767 * from CFG. Log error.
768 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700769 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 }
771 }
772
773 pMlmAssocReq->listenInterval = (tANI_U16)val;
774 /* Update PE session ID*/
775 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
776 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
777 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700778 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530779 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
780 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 limPostMlmMessage(pMac,
782 LIM_MLM_ASSOC_REQ,
783 (tANI_U32 *) pMlmAssocReq);
784 }
785 else
786 {
787 /**
788 * Successful Pre-authentication.
789 * Send Pre-auth response to host
790 */
791 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700792 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 limSendSmeAuthRsp(
794 pMac,
795 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
796 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
797 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
798 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
799 }
800 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
801} /*** end limProcessMlmAuthCnf() ***/
802
803/**
804 * limProcessMlmAssocCnf()
805 *
806 *FUNCTION:
807 * This function is called to processes MLM_ASSOC_CNF
808 * message from MLM State machine.
809 *
810 *LOGIC:
811 *
812 *ASSUMPTIONS:
813 *
814 *NOTE:
815 *
816 * @param pMac Pointer to Global MAC structure
817 * @param pMsgBuf A pointer to the MLM message buffer
818 *
819 * @return None
820 */
821void
822limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
823{
824 tpPESession psessionEntry;
825 tLimMlmAssocCnf *pLimMlmAssocCnf;
826
827 if(pMsgBuf == NULL)
828 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700829 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 return;
831 }
832 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
833 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
834 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530835 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
836 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 return;
838 }
839 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
840 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
841 {
842 /**
843 * Should not have received Assocication confirm
844 * from MLM in other states OR on AP.
845 * Log error
846 */
847 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530848 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %X"),
849 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 return;
851 }
852 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
853 {
854 // Association failure
c_hpothua9dc89c2014-03-22 19:22:31 +0530855 PELOG1(limLog(pMac, LOG1,
856 FL("SessionId:%d Association failure resultCode: resultCode:%d"
857 "limSmeState:%d"), psessionEntry->peSessionId,
858 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
859 psessionEntry->limSmeState);)
860
861 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
862 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
863 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
864 */
865 if(((tLimMlmAssocCnf *) pMsgBuf)->resultCode
866 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
867 {
868 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
869 }
870 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
871 pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 /**
873 * Need to send Join response with
874 * Association failure to Host.
875 */
876 limHandleSmeJoinResult(pMac,
877 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
878 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
879 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
880 else
881 {
882 // Successful Association
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530883 PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Associated with BSS"),
884 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700886 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 /**
888 * Need to send Join response with
889 * Association success to Host.
890 */
891 limHandleSmeJoinResult(pMac,
892 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
893 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
894 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
895} /*** end limProcessMlmAssocCnf() ***/
896
897/**
898 * limProcessMlmReassocCnf()
899 *
900 *FUNCTION:
901 * This function is called to processes MLM_REASSOC_CNF
902 * message from MLM State machine.
903 *
904 *LOGIC:
905 *
906 *ASSUMPTIONS:
907 *
908 *NOTE:
909 *
910 * @param pMac Pointer to Global MAC structure
911 * @param pMsgBuf A pointer to the MLM message buffer
912 *
913 * @return None
914 */
915void
916limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
917{
918 tpPESession psessionEntry;
919 tLimMlmReassocCnf *pLimMlmReassocCnf;
920
921 if(pMsgBuf == NULL)
922 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700923 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 return;
925 }
926 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
927 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
928 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700929 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 return;
931 }
932 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
933 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
934 {
935 /**
936 * Should not have received Reassocication confirm
937 * from MLM in other states OR on AP.
938 * Log error
939 */
940 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700941 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
943 return;
944 }
945 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530946 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 psessionEntry->pLimReAssocReq = NULL;
948 }
949
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530950 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
952 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700953 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700954
955 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700956 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
958 /**
959 * Need to send Reassoc response with
960 * Reassociation success to Host.
961 */
962 limSendSmeJoinReassocRsp(
963 pMac, eWNI_SME_REASSOC_RSP,
964 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
965 psessionEntry->smeSessionId,psessionEntry->transactionId);
966 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
967 /** Reassociation failure With the New AP
968 * but we still have the link with the Older AP
969 */
970 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700971 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700972
973 /**
974 * Need to send Reassoc response with
975 * Association failure to Host.
976 */
977 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
978 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
979 psessionEntry->smeSessionId,psessionEntry->transactionId);
980 }else {
Mukul Sharmaa052e3d2014-09-08 23:47:06 +0530981 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
982 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
983 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
984 */
985 if(pLimMlmReassocCnf->resultCode
986 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
987 {
988 // Reassociation failure
989 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
990 }
991 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 /**
993 * Need to send Reassoc response with
994 * Association failure to Host.
995 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700996 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 }
998} /*** end limProcessMlmReassocCnf() ***/
999
1000/**
1001 * limProcessMlmReassocInd()
1002 *
1003 *FUNCTION:
1004 * This function is called to processes MLM_REASSOC_IND
1005 * message from MLM State machine.
1006 *
1007 *LOGIC:
1008 *
1009 *ASSUMPTIONS:
1010 *
1011 *NOTE:
1012 *
1013 * @param pMac Pointer to Global MAC structure
1014 * @param pMsgBuf A pointer to the MLM message buffer
1015 *
1016 * @return None
1017 */
1018void
1019limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1020{
1021 tANI_U32 len;
1022 tSirMsgQ msgQ;
1023 tSirSmeReassocInd *pSirSmeReassocInd;
1024 tpDphHashNode pStaDs=0;
1025 tpPESession psessionEntry;
1026 tANI_U8 sessionId;
1027 if(pMsgBuf == NULL)
1028 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001029 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 return;
1031 }
1032 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1033 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001034 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 return;
1036 }
1037 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301039 pSirSmeReassocInd = vos_mem_malloc(len);
1040 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 {
1042 // Log error
1043 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301044 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 return;
1046
1047 }
1048 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1049 eWNI_SME_REASSOC_IND);
1050 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1051 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1052
1053 // Required for indicating the frames to upper layer
1054 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1055 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1056 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1057 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1058
1059 msgQ.type = eWNI_SME_REASSOC_IND;
1060 msgQ.bodyptr = pSirSmeReassocInd;
1061 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001062 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001063#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1064 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1065#endif //FEATURE_WLAN_DIAG_SUPPORT
1066 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1067 if (! pStaDs)
1068 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001069 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301071 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 return;
1073 }
1074
1075 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1076 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001077 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 /*
1079 ** turn on a timer to detect the loss of REASSOC CNF
1080 **/
1081 limActivateCnfTimer(pMac,
1082 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1083} /*** end limProcessMlmReassocInd() ***/
1084
1085/**
1086 * limProcessMlmAuthInd()
1087 *
1088 *FUNCTION:
1089 * This function is called to processes MLM_AUTH_IND
1090 * message from MLM State machine.
1091 *
1092 *LOGIC:
1093 *
1094 *ASSUMPTIONS:
1095 *
1096 *NOTE:
1097 *
1098 * @param pMac Pointer to Global MAC structure
1099 * @param pMsgBuf A pointer to the MLM message buffer
1100 *
1101 * @return None
1102 */
1103void
1104limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1105{
1106 tSirMsgQ msgQ;
1107 tSirSmeAuthInd *pSirSmeAuthInd;
1108
1109 if(pMsgBuf == NULL)
1110 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001111 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 return;
1113 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301114 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1115 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 {
1117 // Log error
1118 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301119 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 }
1121 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1122 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1123 (tANI_U8 *) &(pSirSmeAuthInd->length));
1124 msgQ.type = eWNI_SME_AUTH_IND;
1125 msgQ.bodyptr = pSirSmeAuthInd;
1126 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001127 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001128#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1129 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1130#endif //FEATURE_WLAN_DIAG_SUPPORT
1131 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1132} /*** end limProcessMlmAuthInd() ***/
1133
1134
1135
1136
1137void
1138limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1139 tSirSmeAssocInd *pSirSmeAssocInd,
1140 tpPESession psessionEntry)
1141{
1142 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1143 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1144
1145 // Required for indicating the frames to upper layer
1146 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1147 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1148
1149 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1150 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1151
1152 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301153 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1154 sizeof(tSirMacAddr));
1155
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 // Fill in aid
1157 pSirSmeAssocInd->aid = pAssocInd->aid;
1158 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301159 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 // Fill in staId
1161 //pSirSmeAssocInd->staId = psessionEntry->staId;
1162 // Fill in authType
1163 pSirSmeAssocInd->authType = pAssocInd->authType;
1164 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301165 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1166 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301168 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1169 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1170 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001171
1172 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301173 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1174 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1175 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001176
1177 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1179 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1180 {
1181 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1182 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1183 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301184 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301186 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 // Fill in WmmInfo
1189 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001190} /*** end limAssocIndSerDes() ***/
1191
1192
1193
1194/**
1195 * limProcessMlmAssocInd()
1196 *
1197 *FUNCTION:
1198 * This function is called to processes MLM_ASSOC_IND
1199 * message from MLM State machine.
1200 *
1201 *LOGIC:
1202 *
1203 *ASSUMPTIONS:
1204 *
1205 *NOTE:
1206 *
1207 * @param pMac Pointer to Global MAC structure
1208 * @param pMsgBuf A pointer to the MLM message buffer
1209 *
1210 * @return None
1211 */
1212void
1213limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1214{
1215 tANI_U32 len;
1216 tSirMsgQ msgQ;
1217 tSirSmeAssocInd *pSirSmeAssocInd;
1218 tpDphHashNode pStaDs=0;
1219 tpPESession psessionEntry;
1220 if(pMsgBuf == NULL)
1221 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001222 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 return;
1224 }
1225 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1226 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001227 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 return;
1229 }
1230 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301232 pSirSmeAssocInd = vos_mem_malloc(len);
1233 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 {
1235 // Log error
1236 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301237 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 return;
1239 }
1240
Jeff Johnson295189b2012-06-20 16:38:30 -07001241 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1242 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 msgQ.type = eWNI_SME_ASSOC_IND;
1244 msgQ.bodyptr = pSirSmeAssocInd;
1245 msgQ.bodyval = 0;
1246 pStaDs = dphGetHashEntry(pMac,
1247 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1248 if (! pStaDs)
1249 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001250 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301252 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001253
1254 return;
1255 }
1256 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001258 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001259#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1260 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1261#endif //FEATURE_WLAN_DIAG_SUPPORT
1262 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1263
1264 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001265 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 /*
1267 ** turn on a timer to detect the loss of ASSOC CNF
1268 **/
1269 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1270
1271// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1272#ifdef TEST_BTAMP_AP
1273//tANI_U32 *pMsgBuf;
1274{
1275 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301276 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1277 if ( NULL == pSmeAssoccnf )
1278 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1280 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301281 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1282 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1284 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301285 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1286 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301288 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1290 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301291 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001292}
1293#endif
1294
1295
1296} /*** end limProcessMlmAssocInd() ***/
1297
1298
1299
1300
1301/**
1302 * limProcessMlmDisassocInd()
1303 *
1304 *FUNCTION:
1305 * This function is called to processes MLM_DISASSOC_IND
1306 * message from MLM State machine.
1307 *
1308 *LOGIC:
1309 *
1310 *ASSUMPTIONS:
1311 *
1312 *NOTE:
1313 *
1314 * @param pMac Pointer to Global MAC structure
1315 * @param pMsgBuf A pointer to the MLM message buffer
1316 *
1317 * @return None
1318 */
1319void
1320limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1321{
1322 tLimMlmDisassocInd *pMlmDisassocInd;
1323 tpPESession psessionEntry;
1324 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1325 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1326 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001327 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 return;
1329 }
1330 switch (psessionEntry->limSystemRole)
1331 {
1332 case eLIM_STA_IN_IBSS_ROLE:
1333 break;
1334 case eLIM_STA_ROLE:
1335 case eLIM_BT_AMP_STA_ROLE:
1336 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001337 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 break;
1339 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1340 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001341 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 pMlmDisassocInd->aid);)
1343 // Send SME_DISASOC_IND after Polaris cleanup
1344 // (after receiving LIM_MLM_PURGE_STA_IND)
1345 break;
1346 } // end switch (psessionEntry->limSystemRole)
1347} /*** end limProcessMlmDisassocInd() ***/
1348
1349/**
1350 * limProcessMlmDisassocCnf()
1351 *
1352 *FUNCTION:
1353 * This function is called to processes MLM_DISASSOC_CNF
1354 * message from MLM State machine.
1355 *
1356 *LOGIC:
1357 *
1358 *ASSUMPTIONS:
1359 *
1360 *NOTE:
1361 *
1362 * @param pMac Pointer to Global MAC structure
1363 * @param pMsgBuf A pointer to the MLM message buffer
1364 *
1365 * @return None
1366 */
1367void
1368limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1369{
1370 tSirResultCodes resultCode;
1371 tLimMlmDisassocCnf *pMlmDisassocCnf;
1372 tpPESession psessionEntry;
1373 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1374 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1375 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001376 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 return;
1378 }
1379 resultCode = (tSirResultCodes)
1380 (pMlmDisassocCnf->disassocTrigger ==
1381 eLIM_LINK_MONITORING_DISASSOC) ?
1382 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1383 pMlmDisassocCnf->resultCode;
1384 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1385 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 // Disassociate Confirm from MLM
1387 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1388 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1389 {
1390 /**
1391 * Should not have received
1392 * Disassocate confirm
1393 * from MLM in other states.
1394 * Log error
1395 */
1396 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001397 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 return;
1399 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 if (pMac->lim.gLimRspReqd)
1401 pMac->lim.gLimRspReqd = false;
1402 if (pMlmDisassocCnf->disassocTrigger ==
1403 eLIM_PROMISCUOUS_MODE_DISASSOC)
1404 {
1405 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1406 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1407 else
1408 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001409 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 // Send Promiscuous mode response to host
1411 limSendSmePromiscuousModeRsp(pMac);
1412 }
1413 else
1414 {
1415 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1416 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1417 else
1418 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001419 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001420 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1421 resultCode,
1422 pMlmDisassocCnf->disassocTrigger,
1423 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1424 }
1425 }
1426 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1427 {
1428 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1429 resultCode,
1430 pMlmDisassocCnf->disassocTrigger,
1431 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1432 }
1433} /*** end limProcessMlmDisassocCnf() ***/
1434
1435/**
1436 * limProcessMlmDeauthInd()
1437 *
1438 *FUNCTION:
1439 * This function is called to processes MLM_DEAUTH_IND
1440 * message from MLM State machine.
1441 *
1442 *LOGIC:
1443 *
1444 *ASSUMPTIONS:
1445 *
1446 *NOTE:
1447 *
1448 * @param pMac Pointer to Global MAC structure
1449 * @param pMsgBuf A pointer to the MLM message buffer
1450 *
1451 * @return None
1452 */
1453void
1454limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1455{
1456 tLimMlmDeauthInd *pMlmDeauthInd;
1457 tpPESession psessionEntry;
1458 tANI_U8 sessionId;
1459 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1460 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001462 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 return;
1464 }
1465 switch (psessionEntry->limSystemRole)
1466 {
1467 case eLIM_STA_IN_IBSS_ROLE:
1468 break;
1469 case eLIM_STA_ROLE:
1470 case eLIM_BT_AMP_STA_ROLE:
1471 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001472 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001473
1474 default: // eLIM_AP_ROLE
1475 {
1476 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001477 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 pMlmDeauthInd->aid);)
1479 }
1480 // Send SME_DEAUTH_IND after Polaris cleanup
1481 // (after receiving LIM_MLM_PURGE_STA_IND)
1482 break;
1483 } // end switch (psessionEntry->limSystemRole)
1484} /*** end limProcessMlmDeauthInd() ***/
1485
1486/**
1487 * limProcessMlmDeauthCnf()
1488 *
1489 *FUNCTION:
1490 * This function is called to processes MLM_DEAUTH_CNF
1491 * message from MLM State machine.
1492 *
1493 *LOGIC:
1494 *
1495 *ASSUMPTIONS:
1496 *
1497 *NOTE:
1498 *
1499 * @param pMac Pointer to Global MAC structure
1500 * @param pMsgBuf A pointer to the MLM message buffer
1501 *
1502 * @return None
1503 */
1504void
1505limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1506{
1507 tANI_U16 aid;
1508 tSirResultCodes resultCode;
1509 tLimMlmDeauthCnf *pMlmDeauthCnf;
1510 tpPESession psessionEntry;
1511
1512 if(pMsgBuf == NULL)
1513 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001514 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 return;
1516 }
1517 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1518 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1519 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001520 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 return;
1522 }
1523
1524 resultCode = (tSirResultCodes)
1525 (pMlmDeauthCnf->deauthTrigger ==
1526 eLIM_LINK_MONITORING_DEAUTH) ?
1527 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1528 pMlmDeauthCnf->resultCode;
1529 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1530 pMlmDeauthCnf->aid : 1;
1531 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1532 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 // Deauth Confirm from MLM
1534 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1535 {
1536 /**
1537 * Should not have received Deauth confirm
1538 * from MLM in other states.
1539 * Log error
1540 */
1541 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001542 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 psessionEntry->limSmeState);)
1544 return;
1545 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1547 {
1548 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1549 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001550 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001551 }
1552 else
1553 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001554 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001555
1556 if (pMac->lim.gLimRspReqd)
1557 pMac->lim.gLimRspReqd = false;
1558 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1560 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1561 resultCode,
1562 pMlmDeauthCnf->deauthTrigger,
1563 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001564} /*** end limProcessMlmDeauthCnf() ***/
1565
1566/**
1567 * limProcessMlmPurgeStaInd()
1568 *
1569 *FUNCTION:
1570 * This function is called to processes MLM_PURGE_STA_IND
1571 * message from MLM State machine.
1572 *
1573 *LOGIC:
1574 *
1575 *ASSUMPTIONS:
1576 *
1577 *NOTE:
1578 *
1579 * @param pMac Pointer to Global MAC structure
1580 * @param pMsgBuf A pointer to the MLM message buffer
1581 *
1582 * @return None
1583 */
1584void
1585limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1586{
1587 tSirResultCodes resultCode;
1588 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1589 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 if(pMsgBuf == NULL)
1591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001592 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 return;
1594 }
1595 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1596 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1597 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001598 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 return;
1600 }
1601 // Purge STA indication from MLM
1602 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1603 switch (psessionEntry->limSystemRole)
1604 {
1605 case eLIM_STA_IN_IBSS_ROLE:
1606 break;
1607 case eLIM_STA_ROLE:
1608 case eLIM_BT_AMP_STA_ROLE:
1609 default: // eLIM_AP_ROLE
1610 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1611 (psessionEntry->limSmeState !=
1612 eLIM_SME_WT_DISASSOC_STATE) &&
1613 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1614 {
1615 /**
1616 * Should not have received
1617 * Purge STA indication
1618 * from MLM in other states.
1619 * Log error
1620 */
1621 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001622 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 psessionEntry->limSmeState);)
1624 break;
1625 }
1626 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001627 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 pMlmPurgeStaInd->aid);)
1629 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1630 {
1631 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001632 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001633
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 }
1635 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1636 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 limSendSmeDeauthNtf(pMac,
1638 pMlmPurgeStaInd->peerMacAddr,
1639 resultCode,
1640 pMlmPurgeStaInd->purgeTrigger,
1641 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 }
1643 else
1644 limSendSmeDisassocNtf(pMac,
1645 pMlmPurgeStaInd->peerMacAddr,
1646 resultCode,
1647 pMlmPurgeStaInd->purgeTrigger,
1648 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1649 } // end switch (psessionEntry->limSystemRole)
1650} /*** end limProcessMlmPurgeStaInd() ***/
1651
1652/**
1653 * limProcessMlmSetKeysCnf()
1654 *
1655 *FUNCTION:
1656 * This function is called to processes MLM_SETKEYS_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
1671limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1672{
1673 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001674 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
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 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1683 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1684 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001685 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
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_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 pMlmSetKeysCnf->resultCode );
1691 limSendSmeSetContextRsp(pMac,
1692 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1695 psessionEntry->transactionId);
1696} /*** end limProcessMlmSetKeysCnf() ***/
1697/**
1698 * limProcessMlmRemoveKeyCnf()
1699 *
1700 *FUNCTION:
1701 * This function is called to processes MLM_REMOVEKEY_CNF
1702 * message from MLM State machine.
1703 *
1704 *LOGIC:
1705 *
1706 *ASSUMPTIONS:
1707 *
1708 *NOTE:
1709 *
1710 * @param pMac Pointer to Global MAC structure
1711 * @param pMsgBuf A pointer to the MLM message buffer
1712 *
1713 * @return None
1714 */
1715void
1716limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1717{
1718 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001719 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001720 tpPESession psessionEntry;
1721
1722 if(pMsgBuf == NULL)
1723 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001724 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001725 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 }
1727 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1728 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1729 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001730 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 return;
1732 }
1733 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001734 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 pMlmRemoveKeyCnf->resultCode );
1736 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001737 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1739 psessionEntry->smeSessionId,psessionEntry->transactionId);
1740} /*** end limProcessMlmRemoveKeyCnf() ***/
1741
1742
1743/**
1744 * limHandleSmeJoinResult()
1745 *
1746 *FUNCTION:
1747 * This function is called to process join/auth/assoc failures
1748 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1749 * MLM_ASSOC_CNF with a success code in case of STA role and
1750 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1751 *
1752 *LOGIC:
1753 *
1754 *ASSUMPTIONS:
1755 *
1756 *NOTE:
1757 *
1758 * @param pMac Pointer to Global MAC structure
1759 * @param resultCode Failure code to be sent
1760 *
1761 *
1762 * @return None
1763 */
1764static void
1765limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1766{
1767 tpDphHashNode pStaDs = NULL;
1768 tANI_U8 smesessionId;
1769 tANI_U16 smetransactionId;
1770
1771 /* Newly Added on oct 11 th*/
1772 if(psessionEntry == NULL)
1773 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001774 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 return;
1776 }
1777 smesessionId = psessionEntry->smeSessionId;
1778 smetransactionId = psessionEntry->transactionId;
1779 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1780 if(resultCode != eSIR_SME_SUCCESS)
1781 {
1782 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1783 if (pStaDs != NULL)
1784 {
1785 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1786 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1787 pStaDs->mlmStaContext.resultCode = resultCode;
1788 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1789 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1790 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301791 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001792 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 return;
1794 }
1795 }
1796
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301797 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 psessionEntry->pLimJoinReq = NULL;
1799 //Delete teh session if JOIN failure occurred.
1800 if(resultCode != eSIR_SME_SUCCESS)
1801 {
1802 if(NULL != psessionEntry)
1803 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001804 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1805 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001806 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 peDeleteSession(pMac,psessionEntry);
1808 psessionEntry = NULL;
1809 }
1810 }
1811 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1812 smesessionId, smetransactionId);
1813} /*** end limHandleSmeJoinResult() ***/
1814
1815/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001816 * limHandleSmeReaasocResult()
1817 *
1818 *FUNCTION:
1819 * This function is called to process reassoc failures
1820 * upon receiving REASSOC_CNF with a failure code or
1821 * MLM_REASSOC_CNF with a success code in case of STA role
1822 *
1823 *LOGIC:
1824 *
1825 *ASSUMPTIONS:
1826 *
1827 *NOTE:
1828 *
1829 * @param pMac Pointer to Global MAC structure
1830 * @param resultCode Failure code to be sent
1831 *
1832 *
1833 * @return None
1834 */
1835static void
1836limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1837{
1838 tpDphHashNode pStaDs = NULL;
1839 tANI_U8 smesessionId;
1840 tANI_U16 smetransactionId;
1841
1842 if(psessionEntry == NULL)
1843 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001844 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001845 return;
1846 }
1847 smesessionId = psessionEntry->smeSessionId;
1848 smetransactionId = psessionEntry->transactionId;
1849 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1850 if(resultCode != eSIR_SME_SUCCESS)
1851 {
1852 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1853 if (pStaDs != NULL)
1854 {
1855 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1856 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1857 pStaDs->mlmStaContext.resultCode = resultCode;
1858 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1859 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1860 return;
1861 }
1862 }
1863
1864 //Delete teh session if REASSOC failure occurred.
1865 if(resultCode != eSIR_SME_SUCCESS)
1866 {
1867 if(NULL != psessionEntry)
1868 {
1869 peDeleteSession(pMac,psessionEntry);
1870 psessionEntry = NULL;
1871 }
1872 }
1873 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1874 smesessionId, smetransactionId);
1875} /*** end limHandleSmeReassocResult() ***/
1876
1877/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 * limProcessMlmAddStaRsp()
1879 *
1880 *FUNCTION:
1881 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1882 * Upon receipt of this message from HAL, MLME -
1883 * > Determines the "state" in which this message was received
1884 * > Forwards it to the appropriate callback
1885 *
1886 *ASSUMPTIONS:
1887 *
1888 *NOTE:
1889 *
1890 * @param pMac Pointer to Global MAC structure
1891 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1892 *
1893 * @return None
1894 */
1895void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1896{
1897 //we need to process the deferred message since the initiating req. there might be nested request.
1898 //in the case of nested request the new request initiated from the response will take care of resetting
1899 //the deffered flag.
1900 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001901 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 )
1904 {
1905 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1906 return;
1907 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001909}
1910void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1911{
1912 tLimMlmAssocCnf mlmAssocCnf;
1913 tpDphHashNode pStaDs;
1914 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1915 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1916
1917 if(NULL == pAddStaParams )
1918 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001919 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 return;
1921 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301922
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301923 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301925 PELOGE(limLog(pMac, LOGE,
1926 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05301927
1928 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
1929 {
1930 PELOGE(limLog(pMac, LOGE,
1931 FL("ADD_STA success, send update result code with"
1932 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
1933 "limMlmState: %d"), pAddStaParams->staIdx,
1934 psessionEntry->limMlmState);)
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301935 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1936 mesgType = LIM_MLM_REASSOC_CNF;
1937 //We are sending result code eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA
1938 //which will trigger proper cleanup (DEL_STA/DEL_BSS both required) in
1939 //either assoc cnf or reassoc cnf handler.
c_hpothua9dc89c2014-03-22 19:22:31 +05301940 mlmAssocCnf.resultCode =
1941 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
1942 psessionEntry->staId = pAddStaParams->staIdx;
1943 goto end;
1944 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301945 }
1946
1947 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1948 {
1949 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001950 {
1951 //TODO: any response to be sent out here ?
1952 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001953 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 psessionEntry->limMlmState);
1955 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1956 goto end;
1957 }
Mukul Sharmaef9d3ec2014-07-22 00:16:09 +05301958
1959 if(psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1960 mesgType = LIM_MLM_REASSOC_CNF;
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 //
1962 // Update the DPH Hash Entry for this STA
1963 // with proper state info
1964 //
1965 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1966 if( NULL != pStaDs)
1967 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1968 else
1969 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001970 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 DPH_STA_HASH_INDEX_PEER);
1972 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001973 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 /*
1975 * Storing the self StaIndex(Generated by HAL) in session context,
1976 * instead of storing it in DPH Hash entry for Self STA.
1977 * DPH entry for the self STA stores the sta index for the BSS entry
1978 * to which the STA is associated.
1979 */
1980 psessionEntry->staId = pAddStaParams->staIdx;
1981 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001982#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1983 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1984#endif
1985 {
1986 limReactivateHeartBeatTimer(pMac, psessionEntry);
1987 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001988 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001989
1990 //assign the sessionId to the timer Object
1991 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1992 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001993 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001994#ifdef WLAN_DEBUG
1995 pMac->lim.gLimNumLinkEsts++;
1996#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001997#ifdef FEATURE_WLAN_TDLS
1998 /* initialize TDLS peer related data */
1999 limInitTdlsData(pMac,psessionEntry);
2000#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 // Return Assoc confirm to SME with success
2002 // FIXME_GEN4 - Need the correct ASSOC RSP code to
2003 // be passed in here....
2004 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
2005 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
2006 }
2007 else
2008 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302009 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
2011 }
2012end:
2013 if( 0 != limMsgQ->bodyptr )
2014 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302015 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002016 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 }
2018 /* Updating PE session Id*/
2019 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2020 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05302021 if (true == psessionEntry->fDeauthReceived)
2022 {
2023 psessionEntry->fDeauthReceived = false;
2024 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 return;
2026}
2027void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2028{
2029 //we need to process the deferred message since the initiating req. there might be nested request.
2030 //in the case of nested request the new request initiated from the response will take care of resetting
2031 //the deffered flag.
2032 // tpPESession psessionEntry;
2033 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
2034 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2035 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002036 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 // return;
2038 // }
2039 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002040
2041 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2042 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 ) &&
2045 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2046 {
2047 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2048 return;
2049 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002051
2052 if(!limIsInMCC(pMac))
2053 {
2054 WDA_TrafficStatsTimerActivate(FALSE);
2055 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002056
2057#ifdef WLAN_FEATURE_11W
2058 if (psessionEntry->limRmfEnabled)
2059 {
2060 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2061 {
2062 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002063 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002064 }
2065 }
2066#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002067}
2068
2069void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2070{
2071 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2072 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2073 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302074
2075 if (NULL == pDelBssParams)
2076 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002077 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302078 goto end;
2079 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2081 {
2082 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002083 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2085 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2086
2087 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002088 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 statusCode = eSIR_SME_REFUSED;
2090 goto end;
2091 }
2092 if(pStaDs == NULL)
2093 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002094 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 statusCode = eSIR_SME_REFUSED;
2096 goto end;
2097 }
2098 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2099 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002100 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 pStaDs->mlmStaContext.mlmState);)
2102 statusCode = eSIR_SME_REFUSED;
2103 goto end;
2104 }
2105 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2106 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2107 }
2108 else
2109 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302110 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302111 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002112 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 return;
2114 }
2115 end:
2116 if( 0 != limMsgQ->bodyptr )
2117 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302118 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002119 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 }
2121 if(pStaDs == NULL)
2122 return;
2123 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2124 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2125 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2126 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2127 {
2128 /** The Case where the DelBss is invoked from
2129 * context of other than normal DisAssoc / Deauth OR
2130 * as part of Join Failure.
2131 */
2132 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2133 return;
2134 }
2135 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2136 return;
2137}
2138
Jeff Johnson295189b2012-06-20 16:38:30 -07002139void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2140{
2141 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002142 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2144 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2145
2146 if(psessionEntry == NULL)
2147 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002148 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002149 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002150 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302151 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002152 limMsgQ->bodyptr = NULL;
2153 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 return;
2155 }
2156
2157 if (pDelBss == NULL)
2158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002159 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 rc = eSIR_SME_REFUSED;
2161 goto end;
2162 }
2163 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002164 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2165
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2167 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002168 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002169 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2170 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002171 rc = eSIR_SME_REFUSED;
2172 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 }
2174 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2175 {
2176 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2177 pDelBss->status, pDelBss->bssIdx);
2178 rc = eSIR_SME_STOP_BSS_FAILURE;
2179 goto end;
2180 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002181 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002183 if (status != eSIR_SUCCESS)
2184 {
2185 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002187 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 /** Softmac may send all the buffered packets right after resuming the transmission hence
2189 * to occupy the medium during non channel occupancy period. So resume the transmission after
2190 * HAL gives back the response.
2191 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002192#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 if (LIM_IS_RADAR_DETECTED(pMac))
2194 {
2195 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2196 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2197 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2200 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002202 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 end:
2204 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2205 peDeleteSession(pMac, psessionEntry);
2206
2207 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002208 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302209 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002210 limMsgQ->bodyptr = NULL;
2211 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002212}
2213
2214void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2215{
2216 //we need to process the deferred message since the initiating req. there might be nested request.
2217 //in the case of nested request the new request initiated from the response will take care of resetting
2218 //the deffered flag.
2219
2220 tpPESession psessionEntry;
2221 tpDeleteStaParams pDeleteStaParams;
2222 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2223 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302224
2225 if(NULL == pDeleteStaParams ||
2226 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002228 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002229 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002230 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302231 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002232 limMsgQ->bodyptr = NULL;
2233 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 return;
2235 }
2236
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 )
2240 {
2241 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2242 return;
2243 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002245}
2246
Jeff Johnson295189b2012-06-20 16:38:30 -07002247void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2248{
2249 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2250 tpDphHashNode pStaDs;
2251 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2252 if(limMsgQ->bodyptr == NULL)
2253 {
2254 return;
2255 }
2256
2257 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2258 if(pStaDs == NULL)
2259 {
2260 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002261 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302263 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002264 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002265
2266 return;
2267 }
2268 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2269 {
2270 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002271 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002272
2273 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2274 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2275 {
2276 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002277 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2279 statusCode = eSIR_SME_REFUSED;
2280 goto end;
2281 }
2282
2283 limLog( pMac, LOG1,
2284 FL("Deleted STA AssocID %d staId %d MAC "),
2285 pStaDs->assocId, pStaDs->staIndex);
2286 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2287 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2288 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302289 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002290 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002291 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 {
2293 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002294 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 pStaDs->assocId);)
2296 // delete the TS if it has already been added.
2297 // send the response with error status.
2298 if(pStaDs->qos.addtsPresent)
2299 {
2300 tpLimTspecInfo pTspecInfo;
2301 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2302 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2303 {
2304 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2305 NULL, &pTspecInfo->idx);
2306 }
2307 }
2308 limRejectAssociation(pMac,
2309 pStaDs->staAddr,
2310 pStaDs->mlmStaContext.subType,
2311 true, pStaDs->mlmStaContext.authType,
2312 pStaDs->assocId, true,
2313 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2314 psessionEntry);
2315 }
2316 return;
2317 }
2318 }
2319 else
2320 {
2321 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002322 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 statusCode = eSIR_SME_REFUSED;
2324 }
2325 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302326 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002327 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2329 {
2330 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2331 }
2332 return;
2333}
2334
2335void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2336{
2337 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2338 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2339 tpDphHashNode pStaDs = NULL;
2340 if(NULL == pDelStaParams )
2341 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002342 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002343 goto end;
2344 }
2345 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2346 {
2347 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2348 if (pStaDs == NULL)
2349 {
2350 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002351 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 pDelStaParams->assocId);
2353 statusCode = eSIR_SME_REFUSED;
2354 goto end;
2355 }
2356 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2357 {
2358 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002359 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 limMlmStateStr(psessionEntry->limMlmState));
2361 statusCode = eSIR_SME_REFUSED;
2362 goto end;
2363 }
2364 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2365 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002366 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 //we must complete all cleanup related to delSta before calling limDelBSS.
2368 if( 0 != limMsgQ->bodyptr )
2369 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302370 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002371 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 }
2373 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2374 return;
2375 }
2376 else
2377 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002378 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 statusCode = eSIR_SME_REFUSED;
2380 }
2381end:
2382 if( 0 != limMsgQ->bodyptr )
2383 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302384 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002385 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 }
2387 return;
2388}
2389
Jeff Johnson295189b2012-06-20 16:38:30 -07002390void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2391{
2392 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302393 tpDphHashNode pStaDs = NULL;
2394
2395 if (NULL == pAddStaParams)
2396 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002397 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302398 goto end;
2399 }
2400
2401 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 if(pStaDs == NULL)
2403 {
2404 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002405 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 goto end;
2407 }
2408 //
2409 // TODO & FIXME_GEN4
2410 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2411 //
2412 //TODO: any check for pMac->lim.gLimMlmState ?
2413 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2414 {
2415 //TODO: any response to be sent out here ?
2416 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002417 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 pStaDs->mlmStaContext.mlmState);
2419 goto end;
2420 }
2421 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2422 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002423 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 limRejectAssociation(pMac, pStaDs->staAddr,
2425 pStaDs->mlmStaContext.subType,
2426 true, pStaDs->mlmStaContext.authType,
2427 pStaDs->assocId, true,
2428 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2429 psessionEntry);
2430 goto end;
2431 }
2432 pStaDs->bssId = pAddStaParams->bssIdx;
2433 pStaDs->staIndex = pAddStaParams->staIdx;
2434 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2435 pStaDs->valid = 1;
2436 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2437 limLog( pMac, LOG1,
2438 FL("STA AssocID %d staId %d MAC "),
2439 pStaDs->assocId,
2440 pStaDs->staIndex);
2441 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2442
2443 /* For BTAMP-AP, the flow sequence shall be:
2444 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2445 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2446 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2447 */
2448 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2449 // fall though to reclaim the original Add STA Response message
2450end:
2451 if( 0 != limMsgQ->bodyptr )
2452 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302453 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002454 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 }
2456 return;
2457}
2458
2459/**
2460 * limProcessApMlmAddBssRsp()
2461 *
2462 *FUNCTION:
2463 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2464 * Upon receipt of this message from HAL, MLME -
2465 * > Validates the result of WDA_ADD_BSS_REQ
2466 * > Init other remaining LIM variables
2467 * > Init the AID pool, for that BSSID
2468 * > Init the Pre-AUTH list, for that BSSID
2469 * > Create LIM timers, specific to that BSSID
2470 * > Init DPH related parameters that are specific to that BSSID
2471 * > TODO - When do we do the actual change channel?
2472 *
2473 *LOGIC:
2474 * SME sends eWNI_SME_START_BSS_REQ to LIM
2475 * LIM sends LIM_MLM_START_REQ to MLME
2476 * MLME sends WDA_ADD_BSS_REQ to HAL
2477 * HAL responds with WDA_ADD_BSS_RSP to MLME
2478 * MLME responds with LIM_MLM_START_CNF to LIM
2479 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2480 *
2481 *ASSUMPTIONS:
2482 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2483 * tSirMsgQ.body will now be freed by this routine
2484 *
2485 *NOTE:
2486 *
2487 * @param pMac Pointer to Global MAC structure
2488 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2489 *
2490 * @return None
2491 */
2492static void
2493limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2494{
2495 tLimMlmStartCnf mlmStartCnf;
2496 tANI_U32 val;
2497 tpPESession psessionEntry;
2498// tANI_U8 sessionId;
2499 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2500 if(NULL == pAddBssParams )
2501 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002502 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 goto end;
2504 }
2505 //TBD: free the memory before returning, do it for all places where lookup fails.
2506 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2507 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002508 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002509 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002510 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302511 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002512 limMsgQ->bodyptr = NULL;
2513 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 return;
2515 }
2516 /* Update PE session Id*/
2517 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2518 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2519 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002520 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2522 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2523 goto end;
2524 // Set MLME state
2525 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002526 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2528 {
2529 /** IBSS is 'active' when we receive
2530 * Beacon frames from other STAs that are part of same IBSS.
2531 * Mark internal state as inactive until then.
2532 */
2533 psessionEntry->limIbssActive = false;
2534 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2535 limResetHBPktCount( psessionEntry );
2536 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002537 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002538 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002539 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002540 }
2541 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2542
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002544
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2546 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2547 else
2548 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002549 schEdcaProfileUpdate(pMac, psessionEntry);
2550 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002551 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 // Create timers used by LIM
2553 if (!pMac->lim.gLimTimersCreated)
2554 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002555
2556 // Start OLBC timer
2557 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2558 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002559 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002560 }
2561
Jeff Johnson295189b2012-06-20 16:38:30 -07002562 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2563 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2566 // Apply previously set configuration at HW
2567 limApplyConfiguration(pMac,psessionEntry);
2568 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2569 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2570 }
2571 else
2572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002573 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2575 }
2576 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2577 end:
2578 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002579 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302580 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002581 limMsgQ->bodyptr = NULL;
2582 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002583}
2584
2585
2586/**
2587 * limProcessIbssMlmAddBssRsp()
2588 *
2589 *FUNCTION:
2590 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2591 * Upon receipt of this message from HAL, MLME -
2592 * > Validates the result of WDA_ADD_BSS_REQ
2593 * > Init other remaining LIM variables
2594 * > Init the AID pool, for that BSSID
2595 * > Init the Pre-AUTH list, for that BSSID
2596 * > Create LIM timers, specific to that BSSID
2597 * > Init DPH related parameters that are specific to that BSSID
2598 * > TODO - When do we do the actual change channel?
2599 *
2600 *LOGIC:
2601 * SME sends eWNI_SME_START_BSS_REQ to LIM
2602 * LIM sends LIM_MLM_START_REQ to MLME
2603 * MLME sends WDA_ADD_BSS_REQ to HAL
2604 * HAL responds with WDA_ADD_BSS_RSP to MLME
2605 * MLME responds with LIM_MLM_START_CNF to LIM
2606 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2607 *
2608 *ASSUMPTIONS:
2609 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2610 * tSirMsgQ.body will now be freed by this routine
2611 *
2612 *NOTE:
2613 *
2614 * @param pMac Pointer to Global MAC structure
2615 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2616 *
2617 * @return None
2618 */
2619static void
2620limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2621{
2622 tLimMlmStartCnf mlmStartCnf;
2623 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2624 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302625
2626 if (NULL == pAddBssParams)
2627 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002628 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302629 goto end;
2630 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2632 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002633 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2635 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2636 goto end;
2637 // Set MLME state
2638 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002639 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 /** IBSS is 'active' when we receive
2641 * Beacon frames from other STAs that are part of same IBSS.
2642 * Mark internal state as inactive until then.
2643 */
2644 psessionEntry->limIbssActive = false;
2645 limResetHBPktCount( psessionEntry );
2646 /* Timer related functions are not modified for BT-AMP : To be Done */
2647 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002648 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002649 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002650 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2652 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2653 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2654 schEdcaProfileUpdate(pMac, psessionEntry);
2655 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2656 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002657 if (0 == psessionEntry->freePeerIdxHead)
2658 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 // Create timers used by LIM
2660#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2661 if (!pMac->lim.gLimTimersCreated)
2662 limCreateTimers(pMac);
2663#endif
2664 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2665 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002666 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2668 // Apply previously set configuration at HW
2669 limApplyConfiguration(pMac,psessionEntry);
2670 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2671 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2672 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2673 if(true == pMac->lim.gLimIbssCoalescingHappened)
2674 {
2675 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2676 goto end;
2677 }
2678 }
2679 else
2680 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002681 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 pAddBssParams->status );
2683 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2684 }
2685 //Send this message to SME, when ADD_BSS is initiated by SME
2686 //If ADD_BSS is done as part of coalescing, this won't happen.
2687 /* Update PE session Id*/
2688 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2689 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2690 end:
2691 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002692 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302693 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002694 limMsgQ->bodyptr = NULL;
2695 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002696}
2697
2698static void
2699limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2700{
2701 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2702 tAniAuthType cfgAuthType, authMode;
2703 tLimMlmAuthReq *pMlmAuthReq;
2704 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302705
2706 if (NULL == pAddBssParams)
2707 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002708 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302709 goto joinFailure;
2710 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2712 {
2713 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2714 {
2715 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002716 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2718 goto joinFailure;
2719 }
2720 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2721 //Success, handle below
2722 pStaDs->bssId = pAddBssParams->bssIdx;
2723 //STA Index(genr by HAL) for the BSS entry is stored here
2724 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2725 // Trigger Authentication with AP
2726 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2727 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2728 {
2729 /**
2730 * Could not get AuthType from CFG.
2731 * Log error.
2732 */
2733 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002734 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002735 }
2736 if (cfgAuthType == eSIR_AUTO_SWITCH)
2737 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2738 else
2739 authMode = cfgAuthType;
2740
2741 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302742 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2743 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 {
2745 // Log error
2746 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302747 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002748 return;
2749 }
2750 #if 0
2751 val = sizeof(tSirMacAddr);
2752 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2753 pMlmAuthReq->peerMacAddr,
2754 &val) != eSIR_SUCCESS)
2755 {
2756 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002757 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 }
2759 #endif //TO SUPPORT BT-AMP
2760 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2761
2762 pMlmAuthReq->authType = authMode;
2763 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2764 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2765 != eSIR_SUCCESS)
2766 {
2767 /**
2768 * Could not get AuthFailureTimeout
2769 * value from CFG. Log error.
2770 */
2771 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002772 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002773 }
2774 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2775 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2776 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002777 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2779 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2780 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2781 // remember staId in case of assoc timeout/failure handling
2782 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2783
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302784 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2785 psessionEntry->peSessionId, psessionEntry->limSmeState));
2786 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2787 "with limSmeState:%d",psessionEntry->peSessionId,
2788 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002789 limPostMlmMessage(pMac,
2790 LIM_MLM_AUTH_REQ,
2791 (tANI_U32 *) pMlmAuthReq);
2792 return;
2793 }
2794
2795joinFailure:
2796 {
2797 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002798 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002799
2800 /// Send Join response to Host
2801 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2802
2803 }
2804
2805}
2806
2807#ifdef WLAN_FEATURE_VOWIFI_11R
2808/*------------------------------------------------------------------------------------------
2809 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002810 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2811 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 *
2813 *
2814 *------------------------------------------------------------------------------------------
2815 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002816static inline void
2817limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002818{
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002820 tpDphHashNode pStaDs = NULL;
2821 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002822 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002823 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002824 tANI_U32 selfStaDot11Mode = 0;
2825
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002826 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002827
2828 if (pAddBssParams == NULL)
2829 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002830 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002831 goto end;
2832 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002833 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2834 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002835 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002836 goto end;
2837 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002838 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2839 {
2840 goto end;
2841 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002842
2843 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2844 &psessionEntry->dph.dphHashTable)) == NULL)
2845 {
2846 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002847 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2849 goto end;
2850 }
Mukul Sharma38a6bbc2014-06-30 00:25:39 +05302851#ifdef DEBUG_ROAM_DELAY
2852 vos_record_roam_event(e_LIM_ADD_BS_RSP, NULL, 0);
2853#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 // Prepare and send Reassociation request frame
2855 // start reassoc timer.
2856 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2857 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002858 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2860 != TX_SUCCESS)
2861 {
2862 /// Could not start reassoc failure timer.
2863 // Log error
2864 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002865 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 // Return Reassoc confirm with
2867 // Resources Unavailable
2868 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2869 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2870 goto end;
2871 }
Mihir Shete63561c82014-08-23 16:58:07 +05302872 // remember staId
2873 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2874
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002875#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002876 pMac->lim.pSessionEntry = psessionEntry;
2877 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2878 {
2879 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302880 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2881 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2882 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2883 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2884 psessionEntry->pLimMlmReassocReq,
2885 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002886 }
2887 pMac->lim.reAssocRetryAttempt = 0;
2888#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002889 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Mukul Sharma38a6bbc2014-06-30 00:25:39 +05302890#ifdef DEBUG_ROAM_DELAY
2891 vos_record_roam_event(e_LIM_SEND_REASSOC_REQ, NULL, 0);
2892#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2894 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002895 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002896 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002897 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2898
2899 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2900
2901 //Success, handle below
2902 pStaDs->bssId = pAddBssParams->bssIdx;
2903 //STA Index(genr by HAL) for the BSS entry is stored here
2904 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2905 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2906 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2907
Jeff Johnson295189b2012-06-20 16:38:30 -07002908#if defined WLAN_FEATURE_VOWIFI
2909 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2910#endif
2911
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302912 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2913 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302915 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002916 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302918 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002919
2920 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302921 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2922 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002923
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302924 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2925 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002926
2927 // Update this when we get reassoc rsp , with success.
2928 // pAddStaParams->assocId = psessionEntry->limAID;
2929
2930 pAddStaParams->staType = STA_ENTRY_SELF;
2931 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2932 pAddStaParams->respReqd = 1;
2933
2934 /* Update PE session ID */
2935 pAddStaParams->sessionId = psessionEntry->peSessionId;
2936
2937 // This will indicate HAL to "allocate" a new STA index
2938 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2939 pAddStaParams->updateSta = FALSE;
2940
2941 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002942#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002943 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07002944#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002945 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002946#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002947
Jeff Johnsone7245742012-09-05 17:12:55 -07002948 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002949 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002950 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002951#ifdef WLAN_FEATURE_11AC
2952 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2953 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
2954#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002955#ifdef DISABLE_GF_FOR_INTEROP
2956 /*
2957 * To resolve the interop problem with Broadcom AP,
2958 * where TQ STA could not pass traffic with GF enabled,
2959 * TQ STA will do Greenfield only with TQ AP, for
2960 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002961 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002962 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2963 {
2964 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2965 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2966 }
2967 else
2968#endif
2969
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002971 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
2972 {
2973 pAddStaParams->txChannelWidthSet =
2974 pMac->roam.configParam.channelBondingMode24GHz;
2975 }
2976 else
2977 {
2978 pAddStaParams->txChannelWidthSet =
2979 pMac->roam.configParam.channelBondingMode5GHz;
2980 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2982 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2983 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2984 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2985 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2986 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2987 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2988 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2989 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2990 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 }
2992
2993 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002994 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002996 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
2997 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 // Lets save this for when we receive the Reassoc Rsp
2999 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003000
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003001 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003002 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003003 vos_mem_free(pAddBssParams);
3004 pAddBssParams = NULL;
3005 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003006 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 return;
3008
3009end:
3010 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003011 if (psessionEntry != NULL)
3012 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003014 vos_mem_free(psessionEntry->pLimMlmReassocReq);
3015 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003016 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003017
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003018 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003019 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07003020 vos_mem_free(pAddBssParams);
3021 pAddBssParams = NULL;
3022 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003023 }
3024
3025 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3026 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05303027 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07003028 if (psessionEntry != NULL)
3029 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07003030 else
3031 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08003032
3033 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3034}
Jeff Johnson295189b2012-06-20 16:38:30 -07003035#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07003036/**
3037 * limProcessStaMlmAddBssRsp()
3038 *
3039 *FUNCTION:
3040 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3041 * Upon receipt of this message from HAL, MLME -
3042 * > Validates the result of WDA_ADD_BSS_REQ
3043 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3044 *
3045 *LOGIC:
3046 * MLME had sent WDA_ADD_BSS_REQ to HAL
3047 * HAL responded with WDA_ADD_BSS_RSP to MLME
3048 * MLME now sends WDA_ADD_STA_REQ to HAL
3049 *
3050 *ASSUMPTIONS:
3051 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3052 * tSirMsgQ.body will now be freed by this routine
3053 *
3054 *NOTE:
3055 *
3056 * @param pMac Pointer to Global MAC structure
3057 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3058 *
3059 * @return None
3060 */
3061static void
3062limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3063{
3064 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3065 tLimMlmAssocCnf mlmAssocCnf;
3066 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3067 tANI_U32 subType = LIM_ASSOC;
3068 tpDphHashNode pStaDs = NULL;
3069 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3070 tANI_U8 updateSta = false;
3071 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3072
3073 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3074 {
3075 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303076 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3077 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3079 goto end;
3080 }
3081 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3082 {
3083 mesgType = LIM_MLM_REASSOC_CNF;
3084 subType = LIM_REASSOC;
3085 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3086 //to update the existing STA entry.
3087 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3088 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3089 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3090 {
3091 staIdx = psessionEntry->staId;
3092 updateSta = true;
3093 }
3094 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003095
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003096 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003097 goto end;
3098
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3100 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003101#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3103 {
3104#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003105 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 psessionEntry->limMlmState,
3107 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3108#endif
3109 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3110 goto end;
3111 }
3112#endif /* WLAN_FEATURE_VOWIFI_11R */
3113
3114 // Set MLME state
3115 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003116 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3118 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303119 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3120 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3122 if (pStaDs == NULL)
3123 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303124 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3125 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3127 }
3128 else
3129 {
3130 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3131 //Success, handle below
3132 pStaDs->bssId = pAddBssParams->bssIdx;
3133 //STA Index(genr by HAL) for the BSS entry is stored here
3134 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3135 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3136 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3137 // Downgrade the EDCA parameters if needed
3138 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3139 // Send the active EDCA parameters to HAL
3140 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3141 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3142 } else {
3143 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3144 }
3145#if defined WLAN_FEATURE_VOWIFI
3146 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3147#endif
3148
3149 if (subType == LIM_REASSOC)
3150 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3151 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3152 {
3153 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303154 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3155 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3157 }
3158 }
3159 }
3160 else
3161 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303162 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed!" ),
3163 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 // Return Assoc confirm to SME with failure
3165 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3166 }
3167
3168 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3169 {
3170 /* Update PE session Id*/
3171 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3172 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3173 }
3174 end:
3175 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003176 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303177 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003178 limMsgQ->bodyptr = NULL;
3179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003180}
3181
3182
3183
3184/**
3185 * limProcessMlmAddBssRsp()
3186 *
3187 *FUNCTION:
3188 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3189 * Upon receipt of this message from HAL, MLME -
3190 * > Determines the "state" in which this message was received
3191 * > Forwards it to the appropriate callback
3192 *
3193 *LOGIC:
3194 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3195 * in the following two states:
3196 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3197 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3198 * Based on these two states, this API will determine where to
3199 * route the message to
3200 *
3201 *ASSUMPTIONS:
3202 *
3203 *NOTE:
3204 *
3205 * @param pMac Pointer to Global MAC structure
3206 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3207 *
3208 * @return None
3209 */
3210void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3211{
3212 tLimMlmStartCnf mlmStartCnf;
3213 tpPESession psessionEntry;
3214 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3215
3216 if(NULL == pAddBssParams )
3217 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003218 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 return;
3220 }
3221
3222 //
3223 // TODO & FIXME_GEN4
3224 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3225 //
3226 //we need to process the deferred message since the initiating req. there might be nested request.
3227 //in the case of nested request the new request initiated from the response will take care of resetting
3228 //the deffered flag.
3229 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3230 // Validate SME/LIM state
3231 // Validate MLME state
3232 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3233 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303234 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3235 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003236 if( NULL != pAddBssParams )
3237 {
3238 vos_mem_free(pAddBssParams);
3239 limMsgQ->bodyptr = NULL;
3240 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 return;
3242 }
3243 /* update PE session Id*/
3244 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3245 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3246 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3247 else
3248 {
3249 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3250 {
3251 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3252 {
3253 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303254 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
3255 "WDA_ADD_BSS_RSP in state %X" ),
3256 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3258 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003259 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303260 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003261 limMsgQ->bodyptr = NULL;
3262 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003263 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3264 }
3265 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3266 {
3267 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3268 }
3269 else
3270 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3271 }
3272 else
3273 /* Called while processing assoc response */
3274 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3275 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003276
3277 if(limIsInMCC(pMac))
3278 {
3279 WDA_TrafficStatsTimerActivate(TRUE);
3280 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003281
3282#ifdef WLAN_FEATURE_11W
3283 if (psessionEntry->limRmfEnabled)
3284 {
3285 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3286 {
3287 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003288 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003289 }
3290 }
3291#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003292}
3293/**
3294 * limProcessMlmSetKeyRsp()
3295 *
3296 *FUNCTION:
3297 * This function is called to process the following two
3298 * messages from HAL:
3299 * 1) WDA_SET_BSSKEY_RSP
3300 * 2) WDA_SET_STAKEY_RSP
3301 * 3) WDA_SET_STA_BCASTKEY_RSP
3302 * Upon receipt of this message from HAL,
3303 * MLME -
3304 * > Determines the "state" in which this message was received
3305 * > Forwards it to the appropriate callback
3306 *
3307 *LOGIC:
3308 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3309 * received by MLME while in the following state:
3310 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3311 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3312 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3313 * Based on this state, this API will determine where to
3314 * route the message to
3315 *
3316 *ASSUMPTIONS:
3317 * ONLY the MLME state is being taken into account for now.
3318 * This is because, it appears that the handling of the
3319 * SETKEYS REQ is handled symmetrically on both the AP & STA
3320 *
3321 *NOTE:
3322 *
3323 * @param pMac Pointer to Global MAC structure
3324 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3325 *
3326 * @return None
3327 */
3328void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3329{
Jeff Johnsone7245742012-09-05 17:12:55 -07003330 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 tLimMlmSetKeysCnf mlmSetKeysCnf;
3332 tANI_U8 sessionId = 0;
3333 tpPESession psessionEntry;
3334 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303335 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003337 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003339 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 return;
3341 }
3342 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3343 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3344 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003345 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303346 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003347 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 return;
3349 }
3350 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3351 {
3352 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003353 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 // There's not much that MLME can do at this stage...
3355 respReqd = 0;
3356 }
3357 else
3358 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3359
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303360 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003361 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003364 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 if( respReqd )
3366 {
3367 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
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 }
3378 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003379 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 }
3381}
3382void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3383{
3384 tANI_U8 respReqd = 1;
3385 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003386 tANI_U16 resultCode;
3387 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 tpPESession psessionEntry;
3389 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303390 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003392 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003394 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 return;
3396 }
3397 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3398 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3399 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003400 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303401 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003402 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 return;
3404 }
3405 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3406 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3407 else
3408 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3409
Jeff Johnsone7245742012-09-05 17:12:55 -07003410 //
3411 // TODO & FIXME_GEN4
3412 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3413 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3415 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3416 //{
3417 // Validate MLME state
3418 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3419 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3420 {
3421 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003422 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 // There's not much that MLME can do at this stage...
3424 respReqd = 0;
3425 }
3426 else
3427 mlmSetKeysCnf.resultCode = resultCode;
3428
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303429 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003430 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003432 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3433
Jeff Johnsone7245742012-09-05 17:12:55 -07003434 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003435 if( respReqd )
3436 {
3437 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3438 mlmSetKeysCnf.sessionId = sessionId;
3439
3440 // Prepare and Send LIM_MLM_SETKEYS_CNF
3441 if( NULL != lpLimMlmSetKeysReq )
3442 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303443 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3444 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3445 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303447 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 pMac->lim.gpLimMlmSetKeysReq = NULL;
3449 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003450 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 }
3452}
3453/**
3454 * limProcessMlmRemoveKeyRsp()
3455 *
3456 *FUNCTION:
3457 *
3458 *LOGIC:
3459 *
3460 *ASSUMPTIONS:
3461 *
3462 *NOTE:
3463 *
3464 * @param pMac Pointer to Global MAC structure
3465 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3466 *
3467 * @return None
3468 */
3469void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3470{
Jeff Johnsone7245742012-09-05 17:12:55 -07003471 tANI_U8 respReqd = 1;
3472 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3473 tANI_U16 resultCode;
3474 tANI_U8 sessionId = 0;
3475 tpPESession psessionEntry;
3476 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303477 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003478
3479 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003481 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003482 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 }
3484
Jeff Johnsone7245742012-09-05 17:12:55 -07003485 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3486 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3487 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3488 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
Jeff Johnsone7245742012-09-05 17:12:55 -07003490 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003492 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003493 return;
3494 }
3495
3496 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3497 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3498 else
3499 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3500
3501 // Validate MLME state
3502 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3503 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3504 {
3505 // Mesg received from HAL in Invalid state!
3506 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003507 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003508 limMsgQ->type,
3509 psessionEntry->limMlmState );
3510 respReqd = 0;
3511 }
3512 else
3513 mlmRemoveCnf.resultCode = resultCode;
3514
3515 //
3516 // TODO & FIXME_GEN4
3517 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3518 //
3519
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303520 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003521 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003522
3523 // Restore MLME state
3524 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3525 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3526
3527 if( respReqd )
3528 {
3529 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3530 mlmRemoveCnf.sessionId = sessionId;
3531
3532 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3533 if( NULL != lpLimMlmRemoveKeyReq )
3534 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303535 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3536 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3537 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003538 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303539 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003540 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3541 }
3542 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3543 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003544}
3545
Jeff Johnson295189b2012-06-20 16:38:30 -07003546
3547/** ---------------------------------------------------------------------
3548\fn limProcessInitScanRsp
3549\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3550\ message from HAL. If status code is failure, then
3551\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3552\param tpAniSirGlobal pMac
3553\param tANI_U32 body
3554\return none
3555\ ----------------------------------------------------------------------- */
3556void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3557{
3558 tpInitScanParams pInitScanParam;
3559 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003560 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3561 pInitScanParam = (tpInitScanParams) body;
3562 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303563 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003564
3565 //Only abort scan if the we are scanning.
3566 if( pMac->lim.abortScan &&
3567 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3568 {
krunal sonid3d60e12013-07-17 13:24:09 -07003569 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 pMac->lim.abortScan = 0;
3571 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3572 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3573 //Set the resume channel to Any valid channel (invalid).
3574 //This will instruct HAL to set it to any previous valid channel.
3575 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003576 if (status != eHAL_STATUS_SUCCESS)
3577 {
3578 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3579 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3580 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3581 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3582 return;
3583 }
3584 else
3585 {
3586 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3587 }
3588
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 }
3590 switch(pMac->lim.gLimHalScanState)
3591 {
3592 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3593 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3594 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003595 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003596 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3597 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3598 /*
3599 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3600 * another Scan request in the same context (happens when 11d is enabled
3601 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3602 * scan in the same context but with bigger channel list), so the state needs to be
3603 * changed before this response message is sent.
3604 */
3605 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 return;
3607 }
3608 else if (status == eHAL_STATUS_SUCCESS)
3609 {
3610 /* since we have successfully triggered a background scan,
3611 * reset the "consecutive bkgnd scan failure" count to 0
3612 */
3613 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3614 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003615 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 }
3617 limContinueChannelScan(pMac);
3618 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003619//WLAN_SUSPEND_LINK Related
3620 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3621 if( pMac->lim.gpLimSuspendCallback )
3622 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303623 if( eHAL_STATUS_SUCCESS == status )
3624 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303626 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303628 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003629 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303630 pMac->lim.gLimSystemInScanLearnMode = 0;
3631 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003632
3633 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3634 pMac->lim.gpLimSuspendCallback = NULL;
3635 pMac->lim.gpLimSuspendData = NULL;
3636 }
3637 else
3638 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003639 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003640 return;
3641 }
3642 break;
3643//end WLAN_SUSPEND_LINK Related
3644 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003645 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 pMac->lim.gLimHalScanState);
3647 break;
3648 }
3649 return;
3650}
3651/**
3652 * limProcessSwitchChannelReAssocReq()
3653 *
3654 *FUNCTION:
3655 * This function is called to send the reassoc req mgmt frame after the
3656 * switchChannelRsp message is received from HAL.
3657 *
3658 *LOGIC:
3659 *
3660 *ASSUMPTIONS:
3661 * NA
3662 *
3663 *NOTE:
3664 * NA
3665 *
3666 * @param pMac - Pointer to Global MAC structure.
3667 * @param psessionEntry - session related information.
3668 * @param status - channel switch success/failure.
3669 *
3670 * @return None
3671 */
3672static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3673{
3674 tLimMlmReassocCnf mlmReassocCnf;
3675 tLimMlmReassocReq *pMlmReassocReq;
3676 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3677 if(pMlmReassocReq == NULL)
3678 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003679 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003680 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3681 goto end;
3682 }
3683
3684 if(status != eHAL_STATUS_SUCCESS)
3685 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003686 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003687 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3688 goto end;
3689 }
3690 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003691 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3693 != TX_SUCCESS)
3694 {
3695 /// Could not start reassoc failure timer.
3696 // Log error
3697 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003698 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 // Return Reassoc confirm with
3700 // Resources Unavailable
3701 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3702 goto end;
3703 }
3704 /// Prepare and send Reassociation request frame
3705 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3706 return;
3707end:
3708 // Free up buffer allocated for reassocReq
3709 if(pMlmReassocReq != NULL)
3710 {
3711 /* Update PE session Id*/
3712 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303713 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003714 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003715 }
3716 else
3717 {
3718 mlmReassocCnf.sessionId = 0;
3719 }
3720
3721 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3722 /* Update PE sessio Id*/
3723 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3724
3725 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3726}
3727/**
3728 * limProcessSwitchChannelJoinReq()
3729 *
3730 *FUNCTION:
3731 * This function is called to send the probe req mgmt frame after the
3732 * switchChannelRsp message is received from HAL.
3733 *
3734 *LOGIC:
3735 *
3736 *ASSUMPTIONS:
3737 * NA
3738 *
3739 *NOTE:
3740 * NA
3741 *
3742 * @param pMac - Pointer to Global MAC structure.
3743 * @param psessionEntry - session related information.
3744 * @param status - channel switch success/failure.
3745 *
3746 * @return None
3747 */
3748static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3749{
3750 tANI_U32 val;
3751 tSirMacSSid ssId;
3752 tLimMlmJoinCnf mlmJoinCnf;
3753 if(status != eHAL_STATUS_SUCCESS)
3754 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003755 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 goto error;
3757 }
3758
3759 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3760 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003761 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 goto error;
3763 }
3764
Jeff Johnsone7245742012-09-05 17:12:55 -07003765
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3767 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3768 {
3769 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3770 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303771 {
3772 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3773 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3774 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303776 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003777 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003778
3779 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3780 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003781 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3783 // Apply previously set configuration at HW
3784 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05303785
3786 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
3787 * disconnection was caused by HB failure.
3788 */
3789 if(pMac->roam.configParam.sendDeauthBeforeCon)
3790 {
3791 int apCount;
3792
3793 for(apCount = 0; apCount < 2; apCount++)
3794 {
3795
3796 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3797 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
3798 {
3799 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
3800 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
3801 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
3802 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
3803
3804 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
3805 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3806 psessionEntry, FALSE );
3807
3808 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
3809 sizeof(tSirMacAddr));
3810 break;
3811 }
3812 }
3813 }
3814
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303816 vos_mem_copy(ssId.ssId,
3817 psessionEntry->ssId.ssId,
3818 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003820
3821 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3822
3823 //assign appropriate sessionId to the timer object
3824 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05303825 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
3826 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
3827 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303828 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 // include additional IE if there is
3830 limSendProbeReqMgmtFrame( pMac, &ssId,
3831 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3832 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3833 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003834
3835 // Sending mgmt frame is a blocking call activate Join failure timer now
3836 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3837 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3838 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003839 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003840 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3841 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3842 //memory is freed up below.
3843 psessionEntry->pLimMlmJoinReq = NULL;
3844 goto error;
3845 }
3846
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003847 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3848 {
Yathish9f22e662012-12-10 14:21:35 -08003849 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003850 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3851 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003852 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003853 goto error;
3854 }
3855 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003856
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 return;
3858error:
3859 if(NULL != psessionEntry)
3860 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303861 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003862 psessionEntry->pLimMlmJoinReq = NULL;
3863 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3864 }
3865 else
3866 {
3867 mlmJoinCnf.sessionId = 0;
3868 }
3869 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3870 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3871 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3872}
3873
3874/**
3875 * limProcessSwitchChannelRsp()
3876 *
3877 *FUNCTION:
3878 * This function is called to process switchChannelRsp message from HAL.
3879 *
3880 *LOGIC:
3881 *
3882 *ASSUMPTIONS:
3883 * NA
3884 *
3885 *NOTE:
3886 * NA
3887 *
3888 * @param pMac - Pointer to Global MAC structure
3889 * @param body - message body.
3890 *
3891 * @return None
3892 */
3893void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3894{
3895 tpSwitchChannelParams pChnlParams = NULL;
3896 eHalStatus status;
3897 tANI_U16 channelChangeReasonCode;
3898 tANI_U8 peSessionId;
3899 tpPESession psessionEntry;
3900 //we need to process the deferred message since the initiating req. there might be nested request.
3901 //in the case of nested request the new request initiated from the response will take care of resetting
3902 //the deffered flag.
3903 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3904 pChnlParams = (tpSwitchChannelParams) body;
3905 status = pChnlParams->status;
3906 peSessionId = pChnlParams->peSessionId;
3907 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3908 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303909 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003910 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 return;
3912 }
3913#if defined WLAN_FEATURE_VOWIFI
3914 //HAL fills in the tx power used for mgmt frames in this field.
3915 //Store this value to use in TPC report IE.
3916 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3917#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3919 // initialize it back to invalid id
3920 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303921 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003922 switch(channelChangeReasonCode)
3923 {
3924 case LIM_SWITCH_CHANNEL_REASSOC:
3925 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3926 break;
3927 case LIM_SWITCH_CHANNEL_JOIN:
3928 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3929 break;
3930
3931 case LIM_SWITCH_CHANNEL_OPERATION:
3932 /*
3933 * The above code should also use the callback.
3934 * mechanism below, there is scope for cleanup here.
3935 * THat way all this response handler does is call the call back
3936 * We can get rid of the reason code here.
3937 */
3938 if (pMac->lim.gpchangeChannelCallback)
3939 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003940 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08003941 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
3942 {
3943 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
3944 {
3945 if ( psessionEntry && psessionEntry->limSmeState
3946 == eLIM_SME_LINK_EST_STATE )
3947 {
3948 peSetResumeChannel( pMac,
3949 psessionEntry->currentOperChannel,
3950 psessionEntry->htSecondaryChannelOffset);
3951 }
3952 else
3953 {
3954 peSetResumeChannel( pMac, 0, 0);
3955 }
3956 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
3957 }
3958 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3960 }
3961 break;
3962 default:
3963 break;
3964 }
Mukul Sharma307aa212014-07-15 16:21:57 +05303965 vos_mem_free(body);
3966 body = NULL;
3967
Jeff Johnson295189b2012-06-20 16:38:30 -07003968}
3969/**
3970 * limProcessStartScanRsp()
3971 *
3972 *FUNCTION:
3973 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3974 * then it will start scan/learn on the next channel.
3975 *
3976 *LOGIC:
3977 *
3978 *ASSUMPTIONS:
3979 * NA
3980 *
3981 *NOTE:
3982 * NA
3983 *
3984 * @param pMac - Pointer to Global MAC structure
3985 * @param body - message body.
3986 *
3987 * @return None
3988 */
3989
3990void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3991{
3992 tpStartScanParams pStartScanParam;
3993 eHalStatus status;
3994 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3995 pStartScanParam = (tpStartScanParams) body;
3996 status = pStartScanParam->status;
3997#if defined WLAN_FEATURE_VOWIFI
3998 //HAL fills in the tx power used for mgmt frames in this field.
3999 //Store this value to use in TPC report IE.
4000 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
4001 //Store start TSF of scan start. This will be stored in BSS params.
4002 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
4003#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304004 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004005 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 if( pMac->lim.abortScan )
4007 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004008 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004009 pMac->lim.abortScan = 0;
4010 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
4011 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
4012 //Set the resume channel to Any valid channel (invalid).
4013 //This will instruct HAL to set it to any previous valid channel.
4014 peSetResumeChannel(pMac, 0, 0);
4015 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
4016 }
4017 switch(pMac->lim.gLimHalScanState)
4018 {
4019 case eLIM_HAL_START_SCAN_WAIT_STATE:
4020 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4021 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004022 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 //
4024 // FIXME - With this, LIM will try and recover state, but
4025 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
4026 // status back to the SME
4027 //
4028 //Set the resume channel to Any valid channel (invalid).
4029 //This will instruct HAL to set it to any previous valid channel.
4030 peSetResumeChannel(pMac, 0, 0);
4031 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
4032 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4033 }
4034 else
4035 {
4036 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
4037 limContinuePostChannelScan(pMac);
4038 }
4039 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004041 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 pMac->lim.gLimHalScanState);
4043 break;
4044 }
4045 return;
4046}
4047void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4048{
4049 tpEndScanParams pEndScanParam;
4050 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4052 pEndScanParam = (tpEndScanParams) body;
4053 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304054 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004055 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004056 switch(pMac->lim.gLimHalScanState)
4057 {
4058 case eLIM_HAL_END_SCAN_WAIT_STATE:
4059 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4060 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004061 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004062 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4063 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4064 }
4065 else
4066 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004067 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 limContinueChannelScan(pMac);
4069 }
4070 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004072 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004073 pMac->lim.gLimHalScanState);
4074 break;
4075 }
4076 return;
4077}
Jeff Johnsone7245742012-09-05 17:12:55 -07004078/**
4079 * limStopTxAndSwitch()
4080 *
4081 *FUNCTION:
4082 * Start channel switch on all sessions that is in channel switch state.
4083 *
4084 * @param pMac - pointer to global adapter context
4085 *
4086 * @return None
4087 *
4088 */
4089static void
4090limStopTxAndSwitch (tpAniSirGlobal pMac)
4091{
4092 tANI_U8 i;
4093
4094 for(i =0; i < pMac->lim.maxBssId; i++)
4095 {
4096 if(pMac->lim.gpSession[i].valid &&
4097 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4098 {
4099 limStopTxAndSwitchChannel(pMac, i);
4100 }
4101 }
4102 return;
4103}
4104/**
4105 * limStartQuietOnSession()
4106 *
4107 *FUNCTION:
4108 * This function is called to start quiet timer after finish scan if there is
4109 * qeuieting on any session.
4110 *
4111 *LOGIC:
4112 *
4113 *ASSUMPTIONS:
4114 * NA
4115 *
4116 *NOTE:
4117 * NA
4118 *
4119 * @param pMac - Pointer to Global MAC structure
4120 *
4121 * @return None
4122 */
4123static void
4124limStartQuietOnSession (tpAniSirGlobal pMac)
4125{
4126 tANI_U8 i;
4127
4128 for(i =0; i < pMac->lim.maxBssId; i++)
4129 {
4130 if(pMac->lim.gpSession[i].valid &&
4131 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4132 {
4133 limStartQuietTimer(pMac, i);
4134 }
4135 }
4136 return;
4137}
Jeff Johnson295189b2012-06-20 16:38:30 -07004138void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4139{
4140 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 eHalStatus status;
4142 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4143 pFinishScanParam = (tpFinishScanParams) body;
4144 status = pFinishScanParam->status;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004145
Sushant Kaushik826de802014-05-08 18:04:11 +05304146 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4147 pMac->lim.gLimHalScanState,
4148 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004149
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 switch(pMac->lim.gLimHalScanState)
4151 {
4152 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4153 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4154 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004155 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 {
4157 /** Right time to stop tx and start the timer for channel switch */
4158 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4159 * be any associated session id
4160 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004161 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004162 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004163 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 {
4165 /** Start the quieting */
4166 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4167 * be any associated session id
4168 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004169 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004171 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4172 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004173 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 }
4175 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004176//WLAN_SUSPEND_LINK Related
4177 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4178 if( pMac->lim.gpLimResumeCallback )
4179 {
4180 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4181 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4182 pMac->lim.gpLimResumeCallback = NULL;
4183 pMac->lim.gpLimResumeData = NULL;
4184 pMac->lim.gLimSystemInScanLearnMode = 0;
4185 }
4186 else
4187 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004188 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Mukul Sharma307aa212014-07-15 16:21:57 +05304189 vos_mem_free(body);
4190 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 return;
4192 }
4193 break;
4194//end WLAN_SUSPEND_LINK Related
4195
4196 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004197 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 pMac->lim.gLimHalScanState);
4199 break;
4200 }
Mukul Sharma307aa212014-07-15 16:21:57 +05304201 vos_mem_free(body);
4202 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004203 return;
4204}
4205/**
4206 * @function : limProcessMlmHalAddBARsp
4207 *
4208 * @brief: Process WDA_ADDBA_RSP coming from HAL
4209 *
4210 *
4211 * @param pMac The global tpAniSirGlobal object
4212 *
4213 * @param tSirMsgQ The MsgQ header containing the response buffer
4214 *
4215 * @return none
4216 */
4217void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4218 tpSirMsgQ limMsgQ )
4219{
4220 // Send LIM_MLM_ADDBA_CNF to LIM
4221 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004222 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004224
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 //now LIM can process any defer message.
4226 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4227 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004228 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 return;
4230 }
4231 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4232 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004233 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304234 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004235 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004236 return;
4237 }
4238#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4239 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4240#endif //FEATURE_WLAN_DIAG_SUPPORT
4241
4242 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304243 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4244 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004245 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304246 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004247 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004248 return;
4249 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304250 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304252 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4253 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 // Copy other ADDBA Rsp parameters
4255 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4256 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4257 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4258 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4259 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4260 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4261 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4262 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4263 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4264 else
4265 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304266 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004267 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 // Send ADDBA CNF to LIM
4269 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4270}
4271/**
4272 * \brief Process LIM_MLM_ADDBA_CNF
4273 *
4274 * \sa limProcessMlmAddBACnf
4275 *
4276 * \param pMac The global tpAniSirGlobal object
4277 *
4278 * \param tSirMsgQ The MsgQ header containing the response buffer
4279 *
4280 * \return none
4281 */
4282void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4283 tANI_U32 *pMsgBuf )
4284{
4285tpLimMlmAddBACnf pMlmAddBACnf;
4286tpDphHashNode pSta;
4287tANI_U16 aid;
4288tLimBAState curBaState;
4289tpPESession psessionEntry = NULL;
4290if(pMsgBuf == NULL)
4291{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004292 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 return;
4294}
4295pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4296 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4297 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004298 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304299 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 return;
4301 }
4302 // First, extract the DPH entry
4303 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4304 if( NULL == pSta )
4305 {
4306 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004307 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304308 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 return;
4310 }
4311 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4312 // Need to validate SME state
4313 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4314 {
4315 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004316 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304318 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 return;
4320 }
4321 // Restore STA BA state
4322 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004323 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 {
4325 // Update LIM internal cache...
4326 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4327 {
4328 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4329 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4330 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4331 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4332 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004333 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4334 // status code. MLME will then send an ADDBA RSP
4335 // over the air to the peer MAC entity
4336 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4337 pMlmAddBACnf->peerMacAddr,
4338 pMlmAddBACnf->addBAResultCode,
4339 pMlmAddBACnf->baDialogToken,
4340 (tANI_U8) pMlmAddBACnf->baTID,
4341 (tANI_U8) pMlmAddBACnf->baPolicy,
4342 pMlmAddBACnf->baBufferSize,
4343 pMlmAddBACnf->baTimeout,psessionEntry))
4344 {
4345 PELOGW(limLog( pMac, LOGW,
4346 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4347 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 }
4350 else
4351 {
4352 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4353 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4354 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4355 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4356 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4357 }
4358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004359 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304360 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004361 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004362}
4363/**
4364 * \brief Process LIM_MLM_DELBA_CNF
4365 *
4366 * \sa limProcessMlmDelBACnf
4367 *
4368 * \param pMac The global tpAniSirGlobal object
4369 *
4370 * \param tSirMsgQ The MsgQ header containing the response buffer
4371 *
4372 * \return none
4373 */
4374void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4375 tANI_U32 *pMsgBuf )
4376{
4377 tpLimMlmDelBACnf pMlmDelBACnf;
4378 tpDphHashNode pSta;
4379 tANI_U16 aid;
4380// tANI_U8 sessionId;
4381 tLimBAState curBaState;
4382 tpPESession psessionEntry;
4383
4384 if(pMsgBuf == NULL)
4385 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004386 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 return;
4388 }
4389 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4390 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4391 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304392 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4393 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304394 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004395 return;
4396 }
4397 // First, extract the DPH entry
4398 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4399 if( NULL == pSta )
4400 {
4401 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004402 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304403 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 return;
4405 }
4406 if(NULL == pMlmDelBACnf)
4407 {
4408 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004409 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 return;
4411 }
4412 // Need to validate baState
4413 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4414 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4415 {
4416 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004417 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004418 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304419 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 return;
4421 }
4422 // Restore STA BA state
4423 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4424 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304425 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004426}
4427/**
4428 * \brief Process SIR_LIM_DEL_BA_IND
4429 *
4430 * \sa limProcessMlmHalBADeleteInd
4431 *
4432 * \param pMac The global tpAniSirGlobal object
4433 *
4434 * \param tSirMsgQ The MsgQ header containing the indication buffer
4435 *
4436 * \return none
4437 */
4438void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4439 tpSirMsgQ limMsgQ )
4440{
4441 tSirRetStatus status = eSIR_SUCCESS;
4442 tpBADeleteParams pBADeleteParams;
4443 tpDphHashNode pSta;
4444 tANI_U16 aid;
4445 tLimBAState curBaState;
4446 tpPESession psessionEntry;
4447 tANI_U8 sessionId;
4448
4449 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4450
4451 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4452 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004453 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304454 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004455 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 return;
4457 }
4458 // First, extract the DPH entry
4459 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4460 if( NULL == pSta )
4461 {
4462 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004463 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004464 goto returnAfterCleanup;
4465 }
4466
4467 // Need to validate BA state
4468 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4469 if( eLIM_BA_STATE_IDLE != curBaState )
4470 {
4471 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004472 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 curBaState );
4474 goto returnAfterCleanup;
Abhishek Singh66c16762014-08-14 19:13:19 +05304475 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004476
Abhishek Singh66c16762014-08-14 19:13:19 +05304477 // Post DELBA REQ to MLME...
4478 if( eSIR_SUCCESS !=
4479 (status = limPostMlmDelBAReq( pMac,
4480 pSta,
4481 pBADeleteParams->baDirection,
4482 pBADeleteParams->baTID,
4483 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304485 limLog( pMac, LOGE,
4486 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 }
4488 else
4489 {
Abhishek Singh66c16762014-08-14 19:13:19 +05304490 limLog( pMac, LOGE,
4491 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4492 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4493 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 }
4495returnAfterCleanup:
4496 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304497 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004498 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004499}
4500/**
4501 * @function : limProcessSetMimoRsp()
4502 *
4503 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4504 * after Processing the Req from the SME (PMC)
4505 *
4506 * LOGIC:
4507 *
4508 * ASSUMPTIONS:
4509 * NA
4510 *
4511 * NOTE:
4512 * NA
4513 *
4514 * @param pMac - Pointer to Global MAC structure
4515 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4516 * @return None
4517 */
4518
4519void
4520limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4521{
4522#if 0
4523 tSirRetStatus retStatus;
4524 tpSetMIMOPS pMIMO_PSParams;
4525
4526
4527 do {
4528
4529 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4530 if( NULL == pMIMO_PSParams ) {
4531 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4532 return;
4533 }
4534
4535 /** If Updation of the HAL Fail's*/
4536 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004537 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 break;
4539 }
4540
4541 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4542 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4543 break;
4544
4545 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4546 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4547
4548 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4549 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4550 * the Action Frame is being sent at first before setting the internal structures
4551 */
4552 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4553 tSirMacAddr macAddr;
4554
4555 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304556 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004557
4558 /** Send Action Frame with the corresponding mode */
4559 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4560 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004561 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 break;
4563 }
4564 }
4565 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4566 }while(0);
4567
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304568 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004569#endif
4570}
4571/**
4572 * @function : limHandleDelBssInReAssocContext
4573 * @brief : While Processing the ReAssociation Response Frame in STA,
4574 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4575 * being issued and the end of DelBSS the new BSS is being added.
4576 *
4577 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4578 * change, We need to update CSR with ReAssocCNF Response with the
4579 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4580 * context only
4581 *
4582 * @param : pMac - tpAniSirGlobal
4583 * pStaDs - Station Descriptor
4584 *
4585 * @return : none
4586 */
4587static void
4588limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4589{
4590 tLimMlmReassocCnf mlmReassocCnf;
4591 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4592 /** Set the MlmState to IDLE*/
4593 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 /* Update PE session Id*/
4595 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4596 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 case eLIM_SME_WT_REASSOC_STATE :
4598 {
4599 tpSirAssocRsp assocRsp;
4600 tpDphHashNode pStaDs;
4601 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 /** Delete the older STA Table entry */
4604 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4605 /**
4606 * Add an entry for AP to hash table
4607 * maintained by DPH module
4608 */
4609 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4610 {
4611 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004612 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004613 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4614 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4615 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4616 goto Error;
4617 }
4618 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4619 * is being stored to be used here for sending ADDBSS
4620 */
4621 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4622 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4623 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004624 limExtractApCapabilities( pMac,
4625 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4626 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4627 &beaconStruct );
4628 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4629 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4630 if(beaconStruct.erpPresent) {
4631 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4632 psessionEntry->beaconParams.fShortPreamble = 0;
4633 else
4634 psessionEntry->beaconParams.fShortPreamble = 1;
4635 }
4636 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4637 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4638 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004639 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 retStatus = eSIR_FAILURE;
4641 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 if (retStatus != eSIR_SUCCESS)
4643 {
4644 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4645 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304646 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004647 pMac->lim.gLimAssocResponseData = NULL;
4648 goto Error;
4649 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304650 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 psessionEntry->limAssocResponseData = NULL;
4652 }
4653 break;
4654 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4655 {
4656 /** Case wherein the DisAssoc / Deauth
4657 * being sent as response to ReAssoc Req*/
4658 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4659 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4660 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4661 /** Set the SME State back to WT_Reassoc State*/
4662 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4664 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4665 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4666 {
4667 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 }
4669 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4670 }
4671 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004672 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004673 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004674 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4675 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4676 goto Error;
4677 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004678 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004679Error:
4680 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4681}
4682
4683/* Added For BT -AMP Support */
4684static void
4685limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4686{
4687 tLimMlmStartCnf mlmStartCnf;
4688 tANI_U32 val;
4689 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4690
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304691 if (NULL == pAddBssParams)
4692 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004693 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304694 goto end;
4695 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4697 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004698 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4700 {
4701 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4702 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4703 goto end;
4704 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4705 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4706 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4707 goto end;
4708 }
4709
4710 // Set MLME state
4711 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4712 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4713 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4714 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004715 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004716 // Create timers used by LIM
4717 if (!pMac->lim.gLimTimersCreated)
4718 limCreateTimers(pMac);
4719 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4720 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004721 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004722 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4723 // Apply previously set configuration at HW
4724 limApplyConfiguration(pMac,psessionEntry);
4725 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4726 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4727 }
4728 else
4729 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004730 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004731 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4732 }
4733 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4734 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4735 end:
4736 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004737 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304738 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004739 limMsgQ->bodyptr = NULL;
4740 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004741}
4742
4743/**
4744 * @function : limHandleAddBssInReAssocContext
4745 * @brief : While Processing the ReAssociation Response Frame in STA,
4746 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4747 * being issued and the end of DelBSS the new BSS is being added.
4748 *
4749 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4750 * change, We need to update CSR with ReAssocCNF Response with the
4751 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4752 * context only
4753 *
4754 * @param : pMac - tpAniSirGlobal
4755 * pStaDs - Station Descriptor
4756 *
4757 * @return : none
4758 */
4759void
4760limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4761{
4762 tLimMlmReassocCnf mlmReassocCnf;
4763 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4764 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004765 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4766 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004768 case eLIM_SME_WT_REASSOC_STATE : {
4769 tpSirAssocRsp assocRsp;
4770 tpDphHashNode pStaDs;
4771 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004772 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304773 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4774 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004775 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304776 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004777 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4778 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4779 goto Error;
4780 }
4781
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 // Get the AP entry from DPH hash table
4783 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4784 if (pStaDs == NULL )
4785 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004786 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004787 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4788 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304789 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 goto Error;
4791 }
4792 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4793 * is being stored to be used here for sending ADDBSS
4794 */
4795 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4796 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4797 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004798 limExtractApCapabilities( pMac,
4799 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4800 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004801 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004803 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4804
4805 if(pBeaconStruct->erpPresent)
4806 {
4807 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004808 psessionEntry->beaconParams.fShortPreamble = 0;
4809 else
4810 psessionEntry->beaconParams.fShortPreamble = 1;
4811 }
4812
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004813 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004815 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 retStatus = eSIR_FAILURE;
4817 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004818 if (retStatus != eSIR_SUCCESS)
4819 {
4820 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4821 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304822 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304824 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 goto Error;
4826 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304827 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304829 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004830 }
4831 break;
4832 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4833 * being sent as response to ReAssoc Req*/
4834 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4835 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4836 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4837 /** Set the SME State back to WT_Reassoc State*/
4838 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4839 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4840 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004841 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004842 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004843 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4844 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004845
4846 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4847 }
4848 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004850 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4852 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4853 goto Error;
4854 }
4855return;
4856Error:
4857 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4858}
4859
4860#if 0
4861 static void
4862limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4863{
4864 tSirSmeAssocCnf assocCnf;
4865 tpDphHashNode pStaDs;
4866 tpPESession psessionEntry;
4867 tANI_U8 sessionId;
4868
4869 if(pMsgBuf == NULL)
4870 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004871 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004872 goto end;
4873 }
4874 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4875 !__limIsSmeAssocCnfValid(&assocCnf))
4876 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004877 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 goto end;
4879 }
4880 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4881 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004882 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 goto end;
4884 }
4885 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4886 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4887 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004888 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4890 goto end;
4891 }
4892 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4893 if (pStaDs == NULL)
4894 {
4895 limLog(pMac, LOG1,
4896 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4897 msgType, assocCnf.aid);
4898 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4899 /*
4900 ** send a DISASSOC_IND message to WSM to make sure
4901 ** the state in WSM and LIM is the same
4902 **/
4903 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4904 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4905 goto end;
4906 }
4907 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304908 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004909 (tANI_U8 *) assocCnf.peerMacAddr,
4910 sizeof(tSirMacAddr)) ) ||
4911 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4912 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4913 (msgType != eWNI_SME_ASSOC_CNF)) ||
4914 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4915 (msgType != eWNI_SME_REASSOC_CNF)))))
4916 {
4917 limLog(pMac, LOG1,
4918 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4919 msgType, assocCnf.aid);
4920 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4921 goto end;
4922 }
4923 /*
4924 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4925 ** has been received
4926 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004927 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4929 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4930 {
4931 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4932 * when it had received Assoc Request frame. Now, PE just needs to send
4933 * Association Response frame to the requesting BTAMP-STA.
4934 */
4935 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004936 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004937 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4938 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4939 goto end;
4940 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4941 else
4942 {
4943 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4944 limRejectAssociation(pMac, pStaDs->staAddr,
4945 pStaDs->mlmStaContext.subType,
4946 true, pStaDs->mlmStaContext.authType,
4947 pStaDs->assocId, true,
4948 assocCnf.statusCode, psessionEntry);
4949 return;
4950 }
4951end:
4952 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4953 {
4954 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4955 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304956 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004957 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4958 }
4959
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304960 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4962 }
4963} /*** end __limProcessSmeAssocCnfNew() ***/
4964#endif
4965
Jeff Johnson295189b2012-06-20 16:38:30 -07004966void
4967limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4968 tBeaconGenParams *pBeaconGenParams = NULL;
4969 tSirMsgQ limMsg;
4970 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4971 if(psessionEntry == NULL ){
4972 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004973 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 return;
4975 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304976 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4977 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004978 {
4979 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304980 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 return;
4982 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304983 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4984 vos_mem_copy((void *) pBeaconGenParams->bssId,
4985 (void *)psessionEntry->bssId,
4986 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004987 limMsg.bodyptr = pBeaconGenParams;
4988 schProcessPreBeaconInd(pMac, &limMsg);
4989 return;
4990}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304991
4992void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4993 tSirResultCodes reasonCode)
4994{
4995 tANI_U16 scanRspLen = 0;
4996
4997 pMac->lim.gLimSmeScanResultLength +=
4998 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304999 pMac->lim.gLimRspReqd = false;
5000 if ((reasonCode == eSIR_SME_SUCCESS) ||
5001 pMac->lim.gLimSmeScanResultLength) {
5002 scanRspLen = sizeof(tSirSmeScanRsp) +
5003 pMac->lim.gLimSmeScanResultLength -
5004 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305005 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05305006 else
5007 scanRspLen = sizeof(tSirSmeScanRsp);
5008
5009 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
5010 pMac->lim.gSmeSessionId,
5011 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305012}
5013
5014
5015void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
5016{
5017 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
5018
5019 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005020 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305021
5022 switch (pScanEvent->event)
5023 {
5024 case SCAN_EVENT_STARTED:
5025 break;
5026 case SCAN_EVENT_START_FAILED:
5027 case SCAN_EVENT_COMPLETED:
5028 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5029 break;
5030 case SCAN_EVENT_BSS_CHANNEL:
5031 case SCAN_EVENT_FOREIGN_CHANNEL:
5032 case SCAN_EVENT_DEQUEUED:
5033 case SCAN_EVENT_PREEMPTED:
5034 default:
5035 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005036 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305037 }
5038}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005039
5040void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5041 eHalStatus status,
5042 tANI_U32* mlmAddBssRsp)
5043{
5044 if (status != eHAL_STATUS_SUCCESS)
5045 {
5046 limLog(pMac, LOGE,
5047 FL(" CSA failed to get the response for resume link"));
5048 }
5049 return;
5050}