blob: a27c16f1ac5afd02c0d78ef5af7d3656c8f94d2a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limProcessMlmRspMessages.cc contains the code
30 * for processing response messages from MLM state machine.
31 * Author: Chandra Modumudi
32 * Date: 02/11/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070039#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070040#include "cfgApi.h"
41#include "sirApi.h"
42#include "schApi.h"
43#include "utilsApi.h"
44#include "limUtils.h"
45#include "limAssocUtils.h"
46#include "limSecurityUtils.h"
47#include "limSerDesUtils.h"
48#include "limTimerUtils.h"
49#include "limSendMessages.h"
50#include "limAdmitControl.h"
51#include "limSendMessages.h"
52#include "limIbssPeerMgmt.h"
53#include "limSession.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070054#include "limSessionUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055#if defined WLAN_FEATURE_VOWIFI
56#include "rrmApi.h"
57#endif
58#if defined WLAN_FEATURE_VOWIFI_11R
59#include <limFT.h>
60#endif
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63static void limHandleSmeJoinResult(tpAniSirGlobal, tSirResultCodes, tANI_U16,tpPESession);
Jeff Johnsone7245742012-09-05 17:12:55 -070064static void limHandleSmeReaasocResult(tpAniSirGlobal, tSirResultCodes, tANI_U16, tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -070065void limProcessMlmScanCnf(tpAniSirGlobal, tANI_U32 *);
Jeff Johnsone7245742012-09-05 17:12:55 -070066#ifdef FEATURE_OEM_DATA_SUPPORT
67void limProcessMlmOemDataReqCnf(tpAniSirGlobal, tANI_U32 *);
68#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070069void limProcessMlmJoinCnf(tpAniSirGlobal, tANI_U32 *);
70void limProcessMlmAuthCnf(tpAniSirGlobal, tANI_U32 *);
71void limProcessMlmStartCnf(tpAniSirGlobal, tANI_U32 *);
72void limProcessMlmAuthInd(tpAniSirGlobal, tANI_U32 *);
73void limProcessMlmAssocInd(tpAniSirGlobal, tANI_U32 *);
74void limProcessMlmAssocCnf(tpAniSirGlobal, tANI_U32 *);
75void limProcessMlmReassocCnf(tpAniSirGlobal, tANI_U32 *);
76void limProcessMlmReassocInd(tpAniSirGlobal, tANI_U32 *);
77void limProcessMlmSetKeysCnf(tpAniSirGlobal, tANI_U32 *);
78void limProcessMlmDisassocInd(tpAniSirGlobal, tANI_U32 *);
79void limProcessMlmDisassocCnf(tpAniSirGlobal, tANI_U32 *);
80void limProcessMlmDeauthInd(tpAniSirGlobal, tANI_U32 *);
81void limProcessMlmDeauthCnf(tpAniSirGlobal, tANI_U32 *);
82void limProcessMlmPurgeStaInd(tpAniSirGlobal, tANI_U32 *);
83void limProcessMlmAddBACnf(tpAniSirGlobal, tANI_U32 *);
84void limProcessMlmDelBACnf(tpAniSirGlobal, tANI_U32 *);
85void limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf);
86static void limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry);
87void limGetSessionInfo(tpAniSirGlobal pMac, tANI_U8 *, tANI_U8 *, tANI_U16 *);
88static void
89limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry);
Kalikinkar dhara085c02f2014-02-28 15:32:12 -080090
91void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
92 eHalStatus status, tANI_U32* mlmAddBssRsp);
93
Jeff Johnson295189b2012-06-20 16:38:30 -070094/**
95 * limProcessMlmRspMessages()
96 *
97 *FUNCTION:
98 * This function is called to processes various MLM response (CNF/IND
99 * messages from MLM State machine.
100 *
101 *LOGIC:
102 *
103 *ASSUMPTIONS:
104 *
105 *NOTE:
106 *
107 * @param pMac Pointer to Global MAC structure
108 * @param msgType Indicates the MLM message type
109 * @param *pMsgBuf A pointer to the MLM message buffer
110 *
111 * @return None
112 */
113void
114limProcessMlmRspMessages(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
115{
116
117 if(pMsgBuf == NULL)
118 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700119 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700120 return;
121 }
122 switch (msgType)
123 {
124 case LIM_MLM_SCAN_CNF:
125 limProcessMlmScanCnf(pMac, pMsgBuf);
126 break;
127
Jeff Johnsone7245742012-09-05 17:12:55 -0700128#ifdef FEATURE_OEM_DATA_SUPPORT
129 case LIM_MLM_OEM_DATA_CNF:
130 limProcessMlmOemDataReqCnf(pMac, pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800131 pMsgBuf = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700132 break;
133#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700134
135 case LIM_MLM_AUTH_CNF:
136 limProcessMlmAuthCnf(pMac, pMsgBuf);
137 break;
138 case LIM_MLM_AUTH_IND:
139 limProcessMlmAuthInd(pMac, pMsgBuf);
140 break;
141 case LIM_MLM_ASSOC_CNF:
142 limProcessMlmAssocCnf(pMac, pMsgBuf);
143 break;
144 case LIM_MLM_START_CNF:
145 limProcessMlmStartCnf(pMac, pMsgBuf);
146 break;
147 case LIM_MLM_JOIN_CNF:
148 limProcessMlmJoinCnf(pMac, pMsgBuf);
149 break;
150 case LIM_MLM_ASSOC_IND:
151 limProcessMlmAssocInd(pMac, pMsgBuf);
152 break;
153 case LIM_MLM_REASSOC_CNF:
154 limProcessMlmReassocCnf(pMac, pMsgBuf);
155 break;
156 case LIM_MLM_REASSOC_IND:
157 limProcessMlmReassocInd(pMac, pMsgBuf);
158 break;
159 case LIM_MLM_DISASSOC_CNF:
160 limProcessMlmDisassocCnf(pMac, pMsgBuf);
161 break;
162 case LIM_MLM_DISASSOC_IND:
163 limProcessMlmDisassocInd(pMac, pMsgBuf);
164 break;
165 case LIM_MLM_PURGE_STA_IND:
166 limProcessMlmPurgeStaInd(pMac, pMsgBuf);
167 break;
168 case LIM_MLM_DEAUTH_CNF:
169 limProcessMlmDeauthCnf(pMac, pMsgBuf);
170 break;
171 case LIM_MLM_DEAUTH_IND:
172 limProcessMlmDeauthInd(pMac, pMsgBuf);
173 break;
174 case LIM_MLM_SETKEYS_CNF:
175 limProcessMlmSetKeysCnf(pMac, pMsgBuf);
176 break;
177 case LIM_MLM_REMOVEKEY_CNF:
178 limProcessMlmRemoveKeyCnf(pMac, pMsgBuf);
179 break;
180 case LIM_MLM_TSPEC_CNF:
181 break;
182 case LIM_MLM_ADDBA_CNF:
183 limProcessMlmAddBACnf( pMac, pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -0800184 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700185 break;
186 case LIM_MLM_DELBA_CNF:
187 limProcessMlmDelBACnf( 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 default:
191 break;
192 } // switch (msgType)
193 return;
194} /*** end limProcessMlmRspMessages() ***/
195
196/**
197 * limProcessMlmScanCnf()
198 *
199 *FUNCTION:
200 * This function is called to processes MLM_SCAN_CNF
201 * message from MLM State machine.
202 *
203 *LOGIC:
204 *
205 *ASSUMPTIONS:
206 *
207 *NOTE:
208 *
209 * @param pMac Pointer to Global MAC structure
210 * @param pMsgBuf A pointer to the MLM message buffer
211 *
212 * @return None
213 */
214void
215limProcessMlmScanCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
216{
217 switch(pMac->lim.gLimSmeState)
218 {
219 case eLIM_SME_WT_SCAN_STATE:
220 //case eLIM_SME_LINK_EST_WT_SCAN_STATE: //TO SUPPORT BT-AMP
221 //case eLIM_SME_NORMAL_CHANNEL_SCAN_STATE: //TO SUPPORT BT-AMP
222 pMac->lim.gLimSmeState = pMac->lim.gLimPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700223 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 pMac->lim.gLimSystemInScanLearnMode = 0;
225 break;
226 default:
227 /**
228 * Should not have received scan confirm
229 * from MLM in other states.
230 * Log error
231 */
232 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700233 FL("received unexpected MLM_SCAN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 pMac->lim.gLimSmeState);)
235 return;
236 }
237
238 /// Process received scan confirm
239 /// Increment length of cached scan results
240 pMac->lim.gLimSmeScanResultLength +=
241 ((tLimMlmScanCnf *) pMsgBuf)->scanResultLength;
242 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
243 {
244 tANI_U16 scanRspLen = 0;
245 /// Need to send response to Host
246 pMac->lim.gLimRspReqd = false;
247 if ((((tLimMlmScanCnf *) pMsgBuf)->resultCode ==
248 eSIR_SME_SUCCESS) ||
249 pMac->lim.gLimSmeScanResultLength)
250 {
251 scanRspLen = sizeof(tSirSmeScanRsp) +
252 pMac->lim.gLimSmeScanResultLength -
253 sizeof(tSirBssDescription);
254 }
255 else
256 {
257 scanRspLen = sizeof(tSirSmeScanRsp);
258 }
259 if(pMac->lim.gLimReportBackgroundScanResults)
260 {
261 pMac->lim.gLimBackgroundScanTerminate = TRUE;
262 }
263 if (pMac->lim.gLimSmeScanResultLength == 0)
264 {
265 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
266 }
267 else
268 {
269 limSendSmeScanRsp(pMac, scanRspLen,
270 eSIR_SME_SUCCESS,pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
271 }
272 } // if (pMac->lim.gLimRspReqd)
273 //check to see whether we need to run bgScan timer
274 if(pMac->lim.gLimBackgroundScanTerminate == FALSE)
275 {
276 if (tx_timer_activate(
277 &pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
278 {
279 /// Could not activate background scan timer.
280 // Log error
281 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700282 FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 pMac->lim.gLimBackgroundScanStarted = FALSE;
284 }
285 else
286 {
287 pMac->lim.gLimBackgroundScanStarted = TRUE;
288 }
289 }
290} /*** end limProcessMlmScanCnf() ***/
291
Jeff Johnsone7245742012-09-05 17:12:55 -0700292#ifdef FEATURE_OEM_DATA_SUPPORT
293
294/**
295 * limProcessMlmOemDataReqCnf()
296 *
297 *FUNCTION:
298 * This function is called to processes LIM_MLM_OEM_DATA_REQ_CNF
299 * message from MLM State machine.
300 *
301 *LOGIC:
302 *
303 *ASSUMPTIONS:
304 *
305 *NOTE:
306 *
307 * @param pMac Pointer to Global MAC structure
308 * @param pMsgBuf A pointer to the MLM message buffer
309 *
310 * @return None
311 */
312
313void limProcessMlmOemDataReqCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
314{
315 tLimMlmOemDataRsp* measRsp;
316
317 tSirResultCodes resultCode = eSIR_SME_SUCCESS;
318
319 measRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
320
321 //Now send the meas confirm message to the sme
322 limSendSmeOemDataRsp(pMac, (tANI_U32*)measRsp, resultCode);
323
324 //Dont free the memory here. It will be freed up by the callee
325
326 return;
327}
328#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700329
330/**
331 * limProcessMlmStartCnf()
332 *
333 *FUNCTION:
334 * This function is called to processes MLM_START_CNF
335 * message from MLM State machine.
336 *
337 *LOGIC:
338 *
339 *ASSUMPTIONS:
340 *
341 *NOTE:
342 *
343 * @param pMac Pointer to Global MAC structure
344 * @param pMsgBuf A pointer to the MLM message buffer
345 *
346 * @return None
347 */
348void
349limProcessMlmStartCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
350{
351 tpPESession psessionEntry = NULL;
352 tLimMlmStartCnf *pLimMlmStartCnf;
353 tANI_U8 smesessionId;
354 tANI_U16 smetransactionId;
355
356 if(pMsgBuf == NULL)
357 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700358 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 return;
360 }
361 pLimMlmStartCnf = (tLimMlmStartCnf*)pMsgBuf;
362 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmStartCnf->sessionId))==NULL)
363 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700364 PELOGE(limLog(pMac, LOGE,FL("Session does Not exist with given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 return;
366 }
367 smesessionId = psessionEntry->smeSessionId;
368 smetransactionId = psessionEntry->transactionId;
369
370 if (psessionEntry->limSmeState != eLIM_SME_WT_START_BSS_STATE)
371 {
372 /**
373 * Should not have received Start confirm from MLM
374 * in other states.
375 * Log error
376 */
377 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700378 FL("received unexpected MLM_START_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 psessionEntry->limSmeState);)
380 return;
381 }
382 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode ==
383 eSIR_SME_SUCCESS)
384 {
385
386 /**
387 * Update global SME state so that Beacon Generation
388 * module starts writing Beacon frames into TFP's
389 * Beacon file register.
390 */
391 psessionEntry->limSmeState = eLIM_SME_NORMAL_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700392 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 if(psessionEntry->bssType == eSIR_BTAMP_STA_MODE)
394 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700395 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP STA SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 }
397 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOG1, FL("*** Started BSS in BT_AMP AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 else if(psessionEntry->bssType == eSIR_INFRA_AP_MODE)
402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700403 limLog(pMac, LOG1, FL("*** Started BSS in INFRA AP SIDE***"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700406 PELOG1(limLog(pMac, LOG1, FL("*** Started BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 }
408 else
409 {
410 /// Start BSS is a failure
411 peDeleteSession(pMac,psessionEntry);
412 psessionEntry = NULL;
Leela Venkata Kiran Kumar Reddy Chiralac7a12152014-02-03 11:20:14 -0800413 PELOGE(limLog(pMac, LOGE,FL("Start BSS Failed "));)
414 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 }
416 /// Send response to Host
417 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP,
418 ((tLimMlmStartCnf *) pMsgBuf)->resultCode,psessionEntry,
419 smesessionId,smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 if (((tLimMlmStartCnf *) pMsgBuf)->resultCode == eSIR_SME_SUCCESS)
421 {
422 //Configure beacon and send beacons to HAL
423 limSendBeaconInd(pMac, psessionEntry);
424 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700425}
426
427 /*** end limProcessMlmStartCnf() ***/
428
429/**
430 * limProcessMlmJoinCnf()
431 *
432 *FUNCTION:
433 * This function is called to processes MLM_JOIN_CNF
434 * message from MLM State machine.
435 *
436 *LOGIC:
437 *
438 *ASSUMPTIONS:
439 *
440 *NOTE:
441 *
442 * @param pMac Pointer to Global MAC structure
443 * @param pMsgBuf A pointer to the MLM message buffer
444 *
445 * @return None
446 */
447void
448limProcessMlmJoinCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
449{
450 tSirResultCodes resultCode;
451 tLimMlmJoinCnf *pLimMlmJoinCnf;
452 tpPESession psessionEntry;
453 pLimMlmJoinCnf = (tLimMlmJoinCnf*)pMsgBuf;
454 if( (psessionEntry = peFindSessionBySessionId(pMac,pLimMlmJoinCnf->sessionId))== NULL)
455 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530456 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
457 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 return;
459 }
460
461 if (psessionEntry->limSmeState!= eLIM_SME_WT_JOIN_STATE)
462 {
463 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700464 FL("received unexpected MLM_JOIN_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 psessionEntry->limSmeState);)
466 return;
467 }
468
469 resultCode = ((tLimMlmJoinCnf *) pMsgBuf)->resultCode ;
470 /// Process Join confirm from MLM
471 if (resultCode == eSIR_SME_SUCCESS)
472 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530473 PELOG1(limLog(pMac, LOG1, FL("***SessionId:%d Joined ESS ***"),
474 pLimMlmJoinCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 //Setup hardware upfront
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 //Done: 7-27-2009. JIM_FIX_ME sessionize the following function
477 if(limStaSendAddBssPreAssoc( pMac, false, psessionEntry) == eSIR_SUCCESS)
478 return;
479 else
480 resultCode = eSIR_SME_REFUSED;
481 }
482 {
483 /// Join failure
484 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700485 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 /// Send Join response to Host
487 limHandleSmeJoinResult(pMac, resultCode, ((tLimMlmJoinCnf *) pMsgBuf)->protStatusCode, psessionEntry );
488 }
489} /*** end limProcessMlmJoinCnf() ***/
490
491/**
492 * limProcessMlmAuthCnf()
493 *
494 *FUNCTION:
495 * This function is called to processes MLM_AUTH_CNF
496 * message from MLM State machine.
497 *
498 *LOGIC:
499 *
500 *ASSUMPTIONS:
501 *
502 *NOTE:
503 *
504 * @param pMac Pointer to Global MAC structure
505 * @param pMsgBuf A pointer to the MLM message buffer
506 *
507 * @return None
508 */
509void
510limProcessMlmAuthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
511{
512 tANI_U16 caps;
513 tANI_U32 val;
514 tAniAuthType cfgAuthType, authMode;
515 tLimMlmAuthReq *pMlmAuthReq;
516 tLimMlmAssocReq *pMlmAssocReq;
517 tLimMlmAuthCnf *pMlmAuthCnf;
518 tpPESession psessionEntry;
519 tANI_U32 teleBcnEn = 0;
520// tANI_U8 sessionId;
521
522 if(pMsgBuf == NULL)
523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700524 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 return;
526 }
527 pMlmAuthCnf = (tLimMlmAuthCnf*)pMsgBuf;
528 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAuthCnf->sessionId))== NULL)
529 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530530 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),
531 pMlmAuthCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 return;
533 }
534
535 if (((psessionEntry->limSmeState != eLIM_SME_WT_AUTH_STATE) &&
536 (psessionEntry->limSmeState != eLIM_SME_WT_PRE_AUTH_STATE)) ||
537 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
538 {
539 /**
540 * Should not have received AUTH confirm
541 * from MLM in other states or on AP.
542 * Log error
543 */
544 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530545 FL("SessionId:%d received unexpected MLM_AUTH_CNF in state %X"),
546 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 return;
548 }
549 /// Process AUTH confirm from MLM
550 if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
551 {
552 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
553 {
554 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
555 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
556 {
557 /**
558 * Could not get AuthType value from CFG.
559 * Log error.
560 */
561 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700562 FL("could not retrieve AuthType value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 }
564 }
565 else
566 cfgAuthType = pMac->lim.gLimPreAuthType;
567
568 if ((cfgAuthType == eSIR_AUTO_SWITCH) &&
569 (((tLimMlmAuthCnf *) pMsgBuf)->authType == eSIR_OPEN_SYSTEM)
570 && (eSIR_MAC_AUTH_ALGO_NOT_SUPPORTED_STATUS == ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode))
571 {
572 /**
573 * When Open authentication fails with reason code "13" and
574 * authType set to 'auto switch', Try with Shared Authentication
575 */
576 authMode = eSIR_SHARED_KEY;
577 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530578 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
579 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 {
581 // Log error
582 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530583 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 return;
585 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530586 vos_mem_set((tANI_U8 *) pMlmAuthReq, sizeof(tLimMlmAuthReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700587 val = sizeof(tSirMacAddr);
588 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
589 {
590 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
591 }
592 else
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530593 vos_mem_copy((tANI_U8 *) &pMlmAuthReq->peerMacAddr,
594 (tANI_U8 *) &pMac->lim.gLimPreAuthPeerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 sizeof(tSirMacAddr));
596 pMlmAuthReq->authType = authMode;
597 /* Update PE session Id*/
598 pMlmAuthReq->sessionId = pMlmAuthCnf->sessionId;
599 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
600 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
601 != eSIR_SUCCESS)
602 {
603 /**
604 * Could not get AuthFailureTimeout value from CFG.
605 * Log error.
606 */
607 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700608 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 }
610 limPostMlmMessage(pMac,
611 LIM_MLM_AUTH_REQ,
612 (tANI_U32 *) pMlmAuthReq);
613 return;
614 }
615 else
616 {
617 // MAC based authentication failure
618 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
619 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700620 PELOGE(limLog(pMac, LOGE, FL("Auth Failure occurred."));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700622 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700624 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
625
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 /**
627 * Need to send Join response with
628 * auth failure to Host.
629 */
630 limHandleSmeJoinResult(pMac,
631 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode, ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry);
632 }
633 else
634 {
635 /**
636 * Pre-authentication failure.
637 * Send Pre-auth failure response to host
638 */
639 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700640 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 limSendSmeAuthRsp(
642 pMac,
643 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
644 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
645 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
646 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
647 }
648 } // end if (cfgAuthType == eAUTO_SWITCH)
649 } // if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
650 else
651 {
652 if (psessionEntry->limSmeState == eLIM_SME_WT_AUTH_STATE)
653 {
654 /**
655 * Successful MAC based authentication
656 * Trigger Association with BSS
657 */
658 PELOG1(limLog(pMac, LOG1,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530659 FL("SessionId:%d Authenticated with BSS"),
660 psessionEntry->peSessionId);)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530661 pMlmAssocReq = vos_mem_malloc(sizeof(tLimMlmAssocReq));
662 if ( NULL == pMlmAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 {
664 // Log error
665 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530666 FL("call to AllocateMemory failed for mlmAssocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 return;
668 }
669 val = sizeof(tSirMacAddr);
670 #if 0
671 if (cfgGetStr(pMac, WNI_CFG_BSSID,
672 pMlmAssocReq->peerMacAddr,
673 &val) != eSIR_SUCCESS)
674 {
675 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700676 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 }
678 #endif //SUPPORT BT-AMP
679 sirCopyMacAddr(pMlmAssocReq->peerMacAddr,psessionEntry->bssId);
680 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOCIATION_FAILURE_TIMEOUT,
681 (tANI_U32 *) &pMlmAssocReq->assocFailureTimeout)
682 != eSIR_SUCCESS)
683 {
684 /**
685 * Could not get AssocFailureTimeout value
686 * from CFG. Log error.
687 */
688 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700689 FL("could not retrieve AssocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
692 {
693 /**
694 * Could not get Capabilities value
695 * from CFG. Log error.
696 */
697 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700698 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 }
700 /*Clear spectrum management bit if AP doesn't support it*/
701 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo & LIM_SPECTRUM_MANAGEMENT_BIT_MASK))
702 {
703 /*AP doesn't support spectrum management clear spectrum management bit*/
704 caps &= (~LIM_SPECTRUM_MANAGEMENT_BIT_MASK);
705 }
706
Hema Aparna Medicharlafa1d2bb2013-12-23 02:28:09 +0530707 /* Clear rrm bit if AP doesn't support it */
708 if(!(psessionEntry->pLimJoinReq->bssDescription.capabilityInfo
709 & LIM_RRM_BIT_MASK))
710 {
711 caps &= (~LIM_RRM_BIT_MASK);
712 }
713
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 pMlmAssocReq->capabilityInfo = caps;
715 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700716 FL("Capabilities to be used in AssocReq=0x%X, privacy bit=%x shortSlotTime %x"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 caps,
Jeff Johnsone7245742012-09-05 17:12:55 -0700718 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->privacy,
719 ((tpSirMacCapabilityInfo) &pMlmAssocReq->capabilityInfo)->shortSlotTime);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700720
721 /* If telescopic beaconing is enabled, set listen interval to
722 WNI_CFG_TELE_BCN_MAX_LI */
723 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
724 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700725 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700726
727 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
728
729 if(teleBcnEn)
730 {
731 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
732 eSIR_SUCCESS)
733 {
734 /**
735 * Could not get ListenInterval value
736 * from CFG. Log error.
737 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700738 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 }
740 }
741 else
742 {
743 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
744 {
745 /**
746 * Could not get ListenInterval value
747 * from CFG. Log error.
748 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700749 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 }
751 }
752
753 pMlmAssocReq->listenInterval = (tANI_U16)val;
754 /* Update PE session ID*/
755 pMlmAssocReq->sessionId = psessionEntry->peSessionId;
756 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
757 psessionEntry->limSmeState = eLIM_SME_WT_ASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530759 limLog(pMac,LOG1,"SessionId:%d PostMLMMessage: LIM_MLM_ASSOC_REQ",
760 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 limPostMlmMessage(pMac,
762 LIM_MLM_ASSOC_REQ,
763 (tANI_U32 *) pMlmAssocReq);
764 }
765 else
766 {
767 /**
768 * Successful Pre-authentication.
769 * Send Pre-auth response to host
770 */
771 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -0700772 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 limSendSmeAuthRsp(
774 pMac,
775 ((tLimMlmAuthCnf *) pMsgBuf)->resultCode,
776 ((tLimMlmAuthCnf *) pMsgBuf)->peerMacAddr,
777 ((tLimMlmAuthCnf *) pMsgBuf)->authType,
778 ((tLimMlmAuthCnf *) pMsgBuf)->protStatusCode,psessionEntry,psessionEntry->smeSessionId,psessionEntry->transactionId);
779 }
780 } // end if (((tLimMlmAuthCnf *) pMsgBuf)->resultCode != ...
781} /*** end limProcessMlmAuthCnf() ***/
782
783/**
784 * limProcessMlmAssocCnf()
785 *
786 *FUNCTION:
787 * This function is called to processes MLM_ASSOC_CNF
788 * message from MLM State machine.
789 *
790 *LOGIC:
791 *
792 *ASSUMPTIONS:
793 *
794 *NOTE:
795 *
796 * @param pMac Pointer to Global MAC structure
797 * @param pMsgBuf A pointer to the MLM message buffer
798 *
799 * @return None
800 */
801void
802limProcessMlmAssocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
803{
804 tpPESession psessionEntry;
805 tLimMlmAssocCnf *pLimMlmAssocCnf;
806
807 if(pMsgBuf == NULL)
808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700809 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 return;
811 }
812 pLimMlmAssocCnf = (tLimMlmAssocCnf*)pMsgBuf;
813 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmAssocCnf->sessionId)) == NULL)
814 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530815 PELOGE(limLog(pMac, LOGE,FL("SessionId:%d Session does not exist"),
816 pLimMlmAssocCnf->sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 return;
818 }
819 if (psessionEntry->limSmeState != eLIM_SME_WT_ASSOC_STATE ||
820 psessionEntry->limSystemRole == eLIM_AP_ROLE || psessionEntry ->limSystemRole == eLIM_BT_AMP_AP_ROLE)
821 {
822 /**
823 * Should not have received Assocication confirm
824 * from MLM in other states OR on AP.
825 * Log error
826 */
827 PELOGE(limLog(pMac, LOGE,
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530828 FL("SessionId:%d Received unexpected MLM_ASSOC_CNF in state %X"),
829 psessionEntry->peSessionId,psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 return;
831 }
832 if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != eSIR_SME_SUCCESS)
833 {
834 // Association failure
c_hpothua9dc89c2014-03-22 19:22:31 +0530835 PELOG1(limLog(pMac, LOG1,
836 FL("SessionId:%d Association failure resultCode: resultCode:%d"
837 "limSmeState:%d"), psessionEntry->peSessionId,
838 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
839 psessionEntry->limSmeState);)
840
841 /* If driver gets deauth when its waiting for ADD_STA_RSP then we need
842 * to do DEL_STA followed by DEL_BSS. So based on below reason-code here
843 * we decide whether to do only DEL_BSS or DEL_STA + DEL_BSS
844 */
845 if(((tLimMlmAssocCnf *) pMsgBuf)->resultCode
846 != eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA)
847 {
848 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
849 }
850 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId,
851 pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 /**
853 * Need to send Join response with
854 * Association failure to Host.
855 */
856 limHandleSmeJoinResult(pMac,
857 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
858 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
859 } // if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ...
860 else
861 {
862 // Successful Association
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530863 PELOG1(limLog(pMac, LOG1, FL("SessionId:%d Associated with BSS"),
864 psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700866 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 /**
868 * Need to send Join response with
869 * Association success to Host.
870 */
871 limHandleSmeJoinResult(pMac,
872 ((tLimMlmAssocCnf *) pMsgBuf)->resultCode,
873 ((tLimMlmAssocCnf *) pMsgBuf)->protStatusCode,psessionEntry);
874 } // end if (((tLimMlmAssocCnf *) pMsgBuf)->resultCode != ....
875} /*** end limProcessMlmAssocCnf() ***/
876
877/**
878 * limProcessMlmReassocCnf()
879 *
880 *FUNCTION:
881 * This function is called to processes MLM_REASSOC_CNF
882 * message from MLM State machine.
883 *
884 *LOGIC:
885 *
886 *ASSUMPTIONS:
887 *
888 *NOTE:
889 *
890 * @param pMac Pointer to Global MAC structure
891 * @param pMsgBuf A pointer to the MLM message buffer
892 *
893 * @return None
894 */
895void
896limProcessMlmReassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
897{
898 tpPESession psessionEntry;
899 tLimMlmReassocCnf *pLimMlmReassocCnf;
900
901 if(pMsgBuf == NULL)
902 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700903 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 return;
905 }
906 pLimMlmReassocCnf = (tLimMlmReassocCnf*) pMsgBuf;
907 if((psessionEntry = peFindSessionBySessionId(pMac,pLimMlmReassocCnf->sessionId))==NULL)
908 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700909 PELOGE(limLog(pMac, LOGE, FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 return;
911 }
912 if ((psessionEntry->limSmeState != eLIM_SME_WT_REASSOC_STATE) ||
913 (psessionEntry->limSystemRole == eLIM_AP_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE))
914 {
915 /**
916 * Should not have received Reassocication confirm
917 * from MLM in other states OR on AP.
918 * Log error
919 */
920 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700921 FL("Rcv unexpected MLM_REASSOC_CNF in role %d, sme state 0x%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 psessionEntry->limSystemRole, psessionEntry->limSmeState);)
923 return;
924 }
925 if (psessionEntry->pLimReAssocReq) {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530926 vos_mem_free(psessionEntry->pLimReAssocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 psessionEntry->pLimReAssocReq = NULL;
928 }
929
Kaushik, Sushant8489f472014-01-27 11:41:22 +0530930 PELOGE(limLog(pMac, LOG1, FL("Rcv MLM_REASSOC_CNF with result code %d"), pLimMlmReassocCnf->resultCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 if (pLimMlmReassocCnf->resultCode == eSIR_SME_SUCCESS) {
932 // Successful Reassociation
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700933 PELOG1(limLog(pMac, LOG1, FL("*** Reassociated with new BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700934
935 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700936 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700937
938 /**
939 * Need to send Reassoc response with
940 * Reassociation success to Host.
941 */
942 limSendSmeJoinReassocRsp(
943 pMac, eWNI_SME_REASSOC_RSP,
944 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
945 psessionEntry->smeSessionId,psessionEntry->transactionId);
946 }else if (pLimMlmReassocCnf->resultCode == eSIR_SME_REASSOC_REFUSED) {
947 /** Reassociation failure With the New AP
948 * but we still have the link with the Older AP
949 */
950 psessionEntry->limSmeState = eLIM_SME_LINK_EST_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700951 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700952
953 /**
954 * Need to send Reassoc response with
955 * Association failure to Host.
956 */
957 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
958 pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode,psessionEntry,
959 psessionEntry->smeSessionId,psessionEntry->transactionId);
960 }else {
961 // Reassociation failure
962 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700963 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 /**
965 * Need to send Reassoc response with
966 * Association failure to Host.
967 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700968 limHandleSmeReaasocResult(pMac, pLimMlmReassocCnf->resultCode, pLimMlmReassocCnf->protStatusCode, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 }
970} /*** end limProcessMlmReassocCnf() ***/
971
972/**
973 * limProcessMlmReassocInd()
974 *
975 *FUNCTION:
976 * This function is called to processes MLM_REASSOC_IND
977 * message from MLM State machine.
978 *
979 *LOGIC:
980 *
981 *ASSUMPTIONS:
982 *
983 *NOTE:
984 *
985 * @param pMac Pointer to Global MAC structure
986 * @param pMsgBuf A pointer to the MLM message buffer
987 *
988 * @return None
989 */
990void
991limProcessMlmReassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
992{
993 tANI_U32 len;
994 tSirMsgQ msgQ;
995 tSirSmeReassocInd *pSirSmeReassocInd;
996 tpDphHashNode pStaDs=0;
997 tpPESession psessionEntry;
998 tANI_U8 sessionId;
999 if(pMsgBuf == NULL)
1000 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001001 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 return;
1003 }
1004 if((psessionEntry = peFindSessionByBssid(pMac,((tpLimMlmReassocInd)pMsgBuf)->peerMacAddr, &sessionId))== NULL)
1005 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001006 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 return;
1008 }
1009 /// Inform Host of STA reassociation
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 len = sizeof(tSirSmeReassocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301011 pSirSmeReassocInd = vos_mem_malloc(len);
1012 if ( NULL == pSirSmeReassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 {
1014 // Log error
1015 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301016 FL("call to AllocateMemory failed for eWNI_SME_REASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 return;
1018
1019 }
1020 sirStoreU16N((tANI_U8 *) &pSirSmeReassocInd->messageType,
1021 eWNI_SME_REASSOC_IND);
1022 limReassocIndSerDes(pMac, (tpLimMlmReassocInd) pMsgBuf,
1023 (tANI_U8 *) &(pSirSmeReassocInd->length), psessionEntry);
1024
1025 // Required for indicating the frames to upper layer
1026 pSirSmeReassocInd->assocReqLength = ((tpLimMlmReassocInd) pMsgBuf)->assocReqLength;
1027 pSirSmeReassocInd->assocReqPtr = ((tpLimMlmReassocInd) pMsgBuf)->assocReqPtr;
1028 pSirSmeReassocInd->beaconPtr = psessionEntry->beacon;
1029 pSirSmeReassocInd->beaconLength = psessionEntry->bcnLen;
1030
1031 msgQ.type = eWNI_SME_REASSOC_IND;
1032 msgQ.bodyptr = pSirSmeReassocInd;
1033 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001034 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001035#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1036 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_IND_EVENT, psessionEntry, 0, 0);
1037#endif //FEATURE_WLAN_DIAG_SUPPORT
1038 pStaDs = dphGetHashEntry(pMac, ((tpLimMlmReassocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1039 if (! pStaDs)
1040 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001041 limLog( pMac, LOGP, FL("MLM ReAssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 ((tpLimMlmReassocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301043 vos_mem_free(pSirSmeReassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return;
1045 }
1046
1047 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1048 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001049 FL("Create CNF_WAIT_TIMER after received LIM_MLM_REASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 /*
1051 ** turn on a timer to detect the loss of REASSOC CNF
1052 **/
1053 limActivateCnfTimer(pMac,
1054 (tANI_U16) ((tpLimMlmReassocInd) pMsgBuf)->aid, psessionEntry);
1055} /*** end limProcessMlmReassocInd() ***/
1056
1057/**
1058 * limProcessMlmAuthInd()
1059 *
1060 *FUNCTION:
1061 * This function is called to processes MLM_AUTH_IND
1062 * message from MLM State machine.
1063 *
1064 *LOGIC:
1065 *
1066 *ASSUMPTIONS:
1067 *
1068 *NOTE:
1069 *
1070 * @param pMac Pointer to Global MAC structure
1071 * @param pMsgBuf A pointer to the MLM message buffer
1072 *
1073 * @return None
1074 */
1075void
1076limProcessMlmAuthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1077{
1078 tSirMsgQ msgQ;
1079 tSirSmeAuthInd *pSirSmeAuthInd;
1080
1081 if(pMsgBuf == NULL)
1082 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001083 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 return;
1085 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301086 pSirSmeAuthInd = vos_mem_malloc(sizeof(tSirSmeAuthInd));
1087 if ( NULL == pSirSmeAuthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 {
1089 // Log error
1090 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301091 FL("call to AllocateMemory failed for eWNI_SME_AUTH_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 }
1093 limCopyU16((tANI_U8 *) &pSirSmeAuthInd->messageType, eWNI_SME_AUTH_IND);
1094 limAuthIndSerDes(pMac, (tpLimMlmAuthInd) pMsgBuf,
1095 (tANI_U8 *) &(pSirSmeAuthInd->length));
1096 msgQ.type = eWNI_SME_AUTH_IND;
1097 msgQ.bodyptr = pSirSmeAuthInd;
1098 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001099 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001100#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1101 limDiagEventReport(pMac, WLAN_PE_DIAG_AUTH_IND_EVENT, NULL, 0, 0);
1102#endif //FEATURE_WLAN_DIAG_SUPPORT
1103 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1104} /*** end limProcessMlmAuthInd() ***/
1105
1106
1107
1108
1109void
1110limFillAssocIndParams(tpAniSirGlobal pMac, tpLimMlmAssocInd pAssocInd,
1111 tSirSmeAssocInd *pSirSmeAssocInd,
1112 tpPESession psessionEntry)
1113{
1114 pSirSmeAssocInd->length = sizeof(tSirSmeAssocInd);
1115 pSirSmeAssocInd->sessionId = psessionEntry->smeSessionId;
1116
1117 // Required for indicating the frames to upper layer
1118 pSirSmeAssocInd->assocReqLength = pAssocInd->assocReqLength;
1119 pSirSmeAssocInd->assocReqPtr = pAssocInd->assocReqPtr;
1120
1121 pSirSmeAssocInd->beaconPtr = psessionEntry->beacon;
1122 pSirSmeAssocInd->beaconLength = psessionEntry->bcnLen;
1123
1124 // Fill in peerMacAddr
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301125 vos_mem_copy(pSirSmeAssocInd->peerMacAddr, pAssocInd->peerMacAddr,
1126 sizeof(tSirMacAddr));
1127
Jeff Johnson295189b2012-06-20 16:38:30 -07001128 // Fill in aid
1129 pSirSmeAssocInd->aid = pAssocInd->aid;
1130 // Fill in bssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301131 vos_mem_copy(pSirSmeAssocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 // Fill in staId
1133 //pSirSmeAssocInd->staId = psessionEntry->staId;
1134 // Fill in authType
1135 pSirSmeAssocInd->authType = pAssocInd->authType;
1136 // Fill in ssId
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301137 vos_mem_copy((tANI_U8*)&pSirSmeAssocInd->ssId,
1138 (tANI_U8 *) &(pAssocInd->ssId), pAssocInd->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 pSirSmeAssocInd->rsnIE.length = pAssocInd->rsnIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301140 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->rsnIE.rsnIEdata,
1141 (tANI_U8 *) &(pAssocInd->rsnIE.rsnIEdata),
1142 pAssocInd->rsnIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001143
1144 pSirSmeAssocInd->addIE.length = pAssocInd->addIE.length;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301145 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->addIE.addIEdata,
1146 (tANI_U8 *) &(pAssocInd->addIE.addIEdata),
1147 pAssocInd->addIE.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001148
1149 // Copy the new TITAN capabilities
Jeff Johnson295189b2012-06-20 16:38:30 -07001150 pSirSmeAssocInd->spectrumMgtIndicator = pAssocInd->spectrumMgtIndicator;
1151 if (pAssocInd->spectrumMgtIndicator == eSIR_TRUE)
1152 {
1153 pSirSmeAssocInd->powerCap.minTxPower = pAssocInd->powerCap.minTxPower;
1154 pSirSmeAssocInd->powerCap.maxTxPower = pAssocInd->powerCap.maxTxPower;
1155 pSirSmeAssocInd->supportedChannels.numChnl = pAssocInd->supportedChannels.numChnl;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301156 vos_mem_copy((tANI_U8*) &pSirSmeAssocInd->supportedChannels.channelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 (tANI_U8 *) &(pAssocInd->supportedChannels.channelList),
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301158 pAssocInd->supportedChannels.numChnl);
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 // Fill in WmmInfo
1161 pSirSmeAssocInd->wmmEnabledSta = pAssocInd->WmmStaInfoPresent;
Jeff Johnson295189b2012-06-20 16:38:30 -07001162} /*** end limAssocIndSerDes() ***/
1163
1164
1165
1166/**
1167 * limProcessMlmAssocInd()
1168 *
1169 *FUNCTION:
1170 * This function is called to processes MLM_ASSOC_IND
1171 * message from MLM State machine.
1172 *
1173 *LOGIC:
1174 *
1175 *ASSUMPTIONS:
1176 *
1177 *NOTE:
1178 *
1179 * @param pMac Pointer to Global MAC structure
1180 * @param pMsgBuf A pointer to the MLM message buffer
1181 *
1182 * @return None
1183 */
1184void
1185limProcessMlmAssocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1186{
1187 tANI_U32 len;
1188 tSirMsgQ msgQ;
1189 tSirSmeAssocInd *pSirSmeAssocInd;
1190 tpDphHashNode pStaDs=0;
1191 tpPESession psessionEntry;
1192 if(pMsgBuf == NULL)
1193 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001194 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 return;
1196 }
1197 if((psessionEntry = peFindSessionBySessionId(pMac,((tpLimMlmAssocInd) pMsgBuf)->sessionId))== NULL)
1198 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001199 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 return;
1201 }
1202 /// Inform Host of STA association
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 len = sizeof(tSirSmeAssocInd);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301204 pSirSmeAssocInd = vos_mem_malloc(len);
1205 if ( NULL == pSirSmeAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 {
1207 // Log error
1208 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301209 FL("call to AllocateMemory failed for eWNI_SME_ASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 return;
1211 }
1212
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 pSirSmeAssocInd->messageType = eWNI_SME_ASSOC_IND;
1214 limFillAssocIndParams(pMac, (tpLimMlmAssocInd) pMsgBuf, pSirSmeAssocInd, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 msgQ.type = eWNI_SME_ASSOC_IND;
1216 msgQ.bodyptr = pSirSmeAssocInd;
1217 msgQ.bodyval = 0;
1218 pStaDs = dphGetHashEntry(pMac,
1219 ((tpLimMlmAssocInd) pMsgBuf)->aid, &psessionEntry->dph.dphHashTable);
1220 if (! pStaDs)
1221 { // good time to panic...
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001222 limLog(pMac, LOGE, FL("MLM AssocInd: Station context no longer valid (aid %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 ((tpLimMlmAssocInd) pMsgBuf)->aid);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301224 vos_mem_free(pSirSmeAssocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001225
1226 return;
1227 }
1228 pSirSmeAssocInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 pSirSmeAssocInd->reassocReq = pStaDs->mlmStaContext.subType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001230 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001231#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1232 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_IND_EVENT, psessionEntry, 0, 0);
1233#endif //FEATURE_WLAN_DIAG_SUPPORT
1234 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
1235
1236 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001237 FL("Create CNF_WAIT_TIMER after received LIM_MLM_ASSOC_IND"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 /*
1239 ** turn on a timer to detect the loss of ASSOC CNF
1240 **/
1241 limActivateCnfTimer(pMac, (tANI_U16) ((tpLimMlmAssocInd) pMsgBuf)->aid, psessionEntry);
1242
1243// Enable this Compile flag to test the BT-AMP -AP assoc sequence
1244#ifdef TEST_BTAMP_AP
1245//tANI_U32 *pMsgBuf;
1246{
1247 tpSirSmeAssocCnf pSmeAssoccnf;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301248 pSmeAssoccnf = vos_mem_malloc(sizeof(tSirSmeAssocCnf));
1249 if ( NULL == pSmeAssoccnf )
1250 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pSmeAssoccnf "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 pSmeAssoccnf->messageType = eWNI_SME_ASSOC_CNF;
1252 pSmeAssoccnf->length = sizeof(tSirSmeAssocCnf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301253 vos_mem_copy(pSmeAssoccnf->peerMacAddr,
1254 ((tpLimMlmAssocInd)pMsgBuf)->peerMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 pSmeAssoccnf->statusCode = eSIR_SME_SUCCESS;
1256 pSmeAssoccnf->aid = ((tpLimMlmAssocInd)pMsgBuf)->aid;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301257 vos_mem_copy(pSmeAssoccnf->alternateBssId,
1258 pSmeAssoccnf->peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 pSmeAssoccnf->alternateChannelId = 6;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301260 vos_mem_copy(pSmeAssoccnf->bssId, psessionEntry->selfMacAddr, 6);
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 pMsgBuf = (tANI_U32)pSmeAssoccnf;
1262 __limProcessSmeAssocCnfNew(pMac, eWNI_SME_ASSOC_CNF, pMsgBuf);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301263 vos_mem_free(pSmeAssoccnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07001264}
1265#endif
1266
1267
1268} /*** end limProcessMlmAssocInd() ***/
1269
1270
1271
1272
1273/**
1274 * limProcessMlmDisassocInd()
1275 *
1276 *FUNCTION:
1277 * This function is called to processes MLM_DISASSOC_IND
1278 * message from MLM State machine.
1279 *
1280 *LOGIC:
1281 *
1282 *ASSUMPTIONS:
1283 *
1284 *NOTE:
1285 *
1286 * @param pMac Pointer to Global MAC structure
1287 * @param pMsgBuf A pointer to the MLM message buffer
1288 *
1289 * @return None
1290 */
1291void
1292limProcessMlmDisassocInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1293{
1294 tLimMlmDisassocInd *pMlmDisassocInd;
1295 tpPESession psessionEntry;
1296 pMlmDisassocInd = (tLimMlmDisassocInd *) pMsgBuf;
1297 if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocInd->sessionId) )== NULL)
1298 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001299 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 return;
1301 }
1302 switch (psessionEntry->limSystemRole)
1303 {
1304 case eLIM_STA_IN_IBSS_ROLE:
1305 break;
1306 case eLIM_STA_ROLE:
1307 case eLIM_BT_AMP_STA_ROLE:
1308 psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001309 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 break;
1311 default: // eLIM_AP_ROLE //eLIM_BT_AMP_AP_ROLE
1312 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001313 FL("*** Peer staId=%d Disassociated ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 pMlmDisassocInd->aid);)
1315 // Send SME_DISASOC_IND after Polaris cleanup
1316 // (after receiving LIM_MLM_PURGE_STA_IND)
1317 break;
1318 } // end switch (psessionEntry->limSystemRole)
1319} /*** end limProcessMlmDisassocInd() ***/
1320
1321/**
1322 * limProcessMlmDisassocCnf()
1323 *
1324 *FUNCTION:
1325 * This function is called to processes MLM_DISASSOC_CNF
1326 * message from MLM State machine.
1327 *
1328 *LOGIC:
1329 *
1330 *ASSUMPTIONS:
1331 *
1332 *NOTE:
1333 *
1334 * @param pMac Pointer to Global MAC structure
1335 * @param pMsgBuf A pointer to the MLM message buffer
1336 *
1337 * @return None
1338 */
1339void
1340limProcessMlmDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1341{
1342 tSirResultCodes resultCode;
1343 tLimMlmDisassocCnf *pMlmDisassocCnf;
1344 tpPESession psessionEntry;
1345 pMlmDisassocCnf = (tLimMlmDisassocCnf *) pMsgBuf;
1346 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocCnf->sessionId))== NULL)
1347 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001348 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 return;
1350 }
1351 resultCode = (tSirResultCodes)
1352 (pMlmDisassocCnf->disassocTrigger ==
1353 eLIM_LINK_MONITORING_DISASSOC) ?
1354 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1355 pMlmDisassocCnf->resultCode;
1356 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1357 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 // Disassociate Confirm from MLM
1359 if ( (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
1360 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) )
1361 {
1362 /**
1363 * Should not have received
1364 * Disassocate confirm
1365 * from MLM in other states.
1366 * Log error
1367 */
1368 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001369 FL("received unexpected MLM_DISASSOC_CNF in state %X"),psessionEntry->limSmeState);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 return;
1371 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001372 if (pMac->lim.gLimRspReqd)
1373 pMac->lim.gLimRspReqd = false;
1374 if (pMlmDisassocCnf->disassocTrigger ==
1375 eLIM_PROMISCUOUS_MODE_DISASSOC)
1376 {
1377 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1378 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1379 else
1380 psessionEntry->limSmeState = eLIM_SME_OFFLINE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001381 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 // Send Promiscuous mode response to host
1383 limSendSmePromiscuousModeRsp(pMac);
1384 }
1385 else
1386 {
1387 if (pMlmDisassocCnf->resultCode != eSIR_SME_SUCCESS)
1388 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
1389 else
1390 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001391 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1393 resultCode,
1394 pMlmDisassocCnf->disassocTrigger,
1395 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1396 }
1397 }
1398 else if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
1399 {
1400 limSendSmeDisassocNtf(pMac, pMlmDisassocCnf->peerMacAddr,
1401 resultCode,
1402 pMlmDisassocCnf->disassocTrigger,
1403 pMlmDisassocCnf->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1404 }
1405} /*** end limProcessMlmDisassocCnf() ***/
1406
1407/**
1408 * limProcessMlmDeauthInd()
1409 *
1410 *FUNCTION:
1411 * This function is called to processes MLM_DEAUTH_IND
1412 * message from MLM State machine.
1413 *
1414 *LOGIC:
1415 *
1416 *ASSUMPTIONS:
1417 *
1418 *NOTE:
1419 *
1420 * @param pMac Pointer to Global MAC structure
1421 * @param pMsgBuf A pointer to the MLM message buffer
1422 *
1423 * @return None
1424 */
1425void
1426limProcessMlmDeauthInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1427{
1428 tLimMlmDeauthInd *pMlmDeauthInd;
1429 tpPESession psessionEntry;
1430 tANI_U8 sessionId;
1431 pMlmDeauthInd = (tLimMlmDeauthInd *) pMsgBuf;
1432 if((psessionEntry = peFindSessionByBssid(pMac,pMlmDeauthInd->peerMacAddr,&sessionId))== NULL)
1433 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001434 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 return;
1436 }
1437 switch (psessionEntry->limSystemRole)
1438 {
1439 case eLIM_STA_IN_IBSS_ROLE:
1440 break;
1441 case eLIM_STA_ROLE:
1442 case eLIM_BT_AMP_STA_ROLE:
1443 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001444 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001445
1446 default: // eLIM_AP_ROLE
1447 {
1448 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001449 FL("*** Received Deauthentication from staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 pMlmDeauthInd->aid);)
1451 }
1452 // Send SME_DEAUTH_IND after Polaris cleanup
1453 // (after receiving LIM_MLM_PURGE_STA_IND)
1454 break;
1455 } // end switch (psessionEntry->limSystemRole)
1456} /*** end limProcessMlmDeauthInd() ***/
1457
1458/**
1459 * limProcessMlmDeauthCnf()
1460 *
1461 *FUNCTION:
1462 * This function is called to processes MLM_DEAUTH_CNF
1463 * message from MLM State machine.
1464 *
1465 *LOGIC:
1466 *
1467 *ASSUMPTIONS:
1468 *
1469 *NOTE:
1470 *
1471 * @param pMac Pointer to Global MAC structure
1472 * @param pMsgBuf A pointer to the MLM message buffer
1473 *
1474 * @return None
1475 */
1476void
1477limProcessMlmDeauthCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1478{
1479 tANI_U16 aid;
1480 tSirResultCodes resultCode;
1481 tLimMlmDeauthCnf *pMlmDeauthCnf;
1482 tpPESession psessionEntry;
1483
1484 if(pMsgBuf == NULL)
1485 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001486 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 return;
1488 }
1489 pMlmDeauthCnf = (tLimMlmDeauthCnf *) pMsgBuf;
1490 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthCnf->sessionId))==NULL)
1491 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001492 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given session Id "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 return;
1494 }
1495
1496 resultCode = (tSirResultCodes)
1497 (pMlmDeauthCnf->deauthTrigger ==
1498 eLIM_LINK_MONITORING_DEAUTH) ?
1499 eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE :
1500 pMlmDeauthCnf->resultCode;
1501 aid = (psessionEntry->limSystemRole == eLIM_AP_ROLE) ?
1502 pMlmDeauthCnf->aid : 1;
1503 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1504 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 // Deauth Confirm from MLM
1506 if (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE)
1507 {
1508 /**
1509 * Should not have received Deauth confirm
1510 * from MLM in other states.
1511 * Log error
1512 */
1513 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001514 FL("received unexpected MLM_DEAUTH_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 psessionEntry->limSmeState);)
1516 return;
1517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 if (pMlmDeauthCnf->resultCode == eSIR_SME_SUCCESS)
1519 {
1520 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
1521 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001522 FL("*** Deauthenticated with BSS ***"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 }
1524 else
1525 psessionEntry->limSmeState = psessionEntry->limPrevSmeState;
Jeff Johnsone7245742012-09-05 17:12:55 -07001526 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001527
1528 if (pMac->lim.gLimRspReqd)
1529 pMac->lim.gLimRspReqd = false;
1530 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001531 // On STA or on BASIC AP, send SME_DEAUTH_RSP to host
1532 limSendSmeDeauthNtf(pMac, pMlmDeauthCnf->peerMacAddr,
1533 resultCode,
1534 pMlmDeauthCnf->deauthTrigger,
1535 aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001536} /*** end limProcessMlmDeauthCnf() ***/
1537
1538/**
1539 * limProcessMlmPurgeStaInd()
1540 *
1541 *FUNCTION:
1542 * This function is called to processes MLM_PURGE_STA_IND
1543 * message from MLM State machine.
1544 *
1545 *LOGIC:
1546 *
1547 *ASSUMPTIONS:
1548 *
1549 *NOTE:
1550 *
1551 * @param pMac Pointer to Global MAC structure
1552 * @param pMsgBuf A pointer to the MLM message buffer
1553 *
1554 * @return None
1555 */
1556void
1557limProcessMlmPurgeStaInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1558{
1559 tSirResultCodes resultCode;
1560 tpLimMlmPurgeStaInd pMlmPurgeStaInd;
1561 tpPESession psessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 if(pMsgBuf == NULL)
1563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001564 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 return;
1566 }
1567 pMlmPurgeStaInd = (tpLimMlmPurgeStaInd) pMsgBuf;
1568 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmPurgeStaInd->sessionId))==NULL)
1569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001570 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 return;
1572 }
1573 // Purge STA indication from MLM
1574 resultCode = (tSirResultCodes) pMlmPurgeStaInd->reasonCode;
1575 switch (psessionEntry->limSystemRole)
1576 {
1577 case eLIM_STA_IN_IBSS_ROLE:
1578 break;
1579 case eLIM_STA_ROLE:
1580 case eLIM_BT_AMP_STA_ROLE:
1581 default: // eLIM_AP_ROLE
1582 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
1583 (psessionEntry->limSmeState !=
1584 eLIM_SME_WT_DISASSOC_STATE) &&
1585 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
1586 {
1587 /**
1588 * Should not have received
1589 * Purge STA indication
1590 * from MLM in other states.
1591 * Log error
1592 */
1593 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001594 FL("received unexpected MLM_PURGE_STA_IND in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 psessionEntry->limSmeState);)
1596 break;
1597 }
1598 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001599 FL("*** Polaris cleanup completed for staId=%d ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 pMlmPurgeStaInd->aid);)
1601 if ((psessionEntry->limSystemRole == eLIM_STA_ROLE)||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
1602 {
1603 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001604 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001605
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 }
1607 if (pMlmPurgeStaInd->purgeTrigger == eLIM_PEER_ENTITY_DEAUTH)
1608 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 limSendSmeDeauthNtf(pMac,
1610 pMlmPurgeStaInd->peerMacAddr,
1611 resultCode,
1612 pMlmPurgeStaInd->purgeTrigger,
1613 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 }
1615 else
1616 limSendSmeDisassocNtf(pMac,
1617 pMlmPurgeStaInd->peerMacAddr,
1618 resultCode,
1619 pMlmPurgeStaInd->purgeTrigger,
1620 pMlmPurgeStaInd->aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
1621 } // end switch (psessionEntry->limSystemRole)
1622} /*** end limProcessMlmPurgeStaInd() ***/
1623
1624/**
1625 * limProcessMlmSetKeysCnf()
1626 *
1627 *FUNCTION:
1628 * This function is called to processes MLM_SETKEYS_CNF
1629 * message from MLM State machine.
1630 *
1631 *LOGIC:
1632 *
1633 *ASSUMPTIONS:
1634 *
1635 *NOTE:
1636 *
1637 * @param pMac Pointer to Global MAC structure
1638 * @param pMsgBuf A pointer to the MLM message buffer
1639 *
1640 * @return None
1641 */
1642void
1643limProcessMlmSetKeysCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1644{
1645 // Prepare and send SME_SETCONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001646 tLimMlmSetKeysCnf *pMlmSetKeysCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 tpPESession psessionEntry;
1648
1649 if(pMsgBuf == NULL)
1650 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001651 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001652 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 }
1654 pMlmSetKeysCnf = (tLimMlmSetKeysCnf *) pMsgBuf;
1655 if ((psessionEntry = peFindSessionBySessionId(pMac, pMlmSetKeysCnf->sessionId))== NULL)
1656 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001657 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 return;
1659 }
1660 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001661 FL("Received MLM_SETKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 pMlmSetKeysCnf->resultCode );
1663 limSendSmeSetContextRsp(pMac,
1664 pMlmSetKeysCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 (tSirResultCodes) pMlmSetKeysCnf->resultCode,psessionEntry,psessionEntry->smeSessionId,
1667 psessionEntry->transactionId);
1668} /*** end limProcessMlmSetKeysCnf() ***/
1669/**
1670 * limProcessMlmRemoveKeyCnf()
1671 *
1672 *FUNCTION:
1673 * This function is called to processes MLM_REMOVEKEY_CNF
1674 * message from MLM State machine.
1675 *
1676 *LOGIC:
1677 *
1678 *ASSUMPTIONS:
1679 *
1680 *NOTE:
1681 *
1682 * @param pMac Pointer to Global MAC structure
1683 * @param pMsgBuf A pointer to the MLM message buffer
1684 *
1685 * @return None
1686 */
1687void
1688limProcessMlmRemoveKeyCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1689{
1690 // Prepare and send SME_REMOVECONTEXT_RSP message
Jeff Johnsone7245742012-09-05 17:12:55 -07001691 tLimMlmRemoveKeyCnf *pMlmRemoveKeyCnf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 tpPESession psessionEntry;
1693
1694 if(pMsgBuf == NULL)
1695 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001696 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001697 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 }
1699 pMlmRemoveKeyCnf = (tLimMlmRemoveKeyCnf *) pMsgBuf;
1700 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyCnf->sessionId))== NULL)
1701 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001702 PELOGE(limLog(pMac, LOGE,FL("session Does not exist for given session Id"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 return;
1704 }
1705 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001706 FL("Received MLM_REMOVEKEYS_CNF with resultCode = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 pMlmRemoveKeyCnf->resultCode );
1708 limSendSmeRemoveKeyRsp(pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -07001709 pMlmRemoveKeyCnf->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 (tSirResultCodes) pMlmRemoveKeyCnf->resultCode,psessionEntry,
1711 psessionEntry->smeSessionId,psessionEntry->transactionId);
1712} /*** end limProcessMlmRemoveKeyCnf() ***/
1713
1714
1715/**
1716 * limHandleSmeJoinResult()
1717 *
1718 *FUNCTION:
1719 * This function is called to process join/auth/assoc failures
1720 * upon receiving MLM_JOIN/AUTH/ASSOC_CNF with a failure code or
1721 * MLM_ASSOC_CNF with a success code in case of STA role and
1722 * MLM_JOIN_CNF with success in case of STA in IBSS role.
1723 *
1724 *LOGIC:
1725 *
1726 *ASSUMPTIONS:
1727 *
1728 *NOTE:
1729 *
1730 * @param pMac Pointer to Global MAC structure
1731 * @param resultCode Failure code to be sent
1732 *
1733 *
1734 * @return None
1735 */
1736static void
1737limHandleSmeJoinResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1738{
1739 tpDphHashNode pStaDs = NULL;
1740 tANI_U8 smesessionId;
1741 tANI_U16 smetransactionId;
1742
1743 /* Newly Added on oct 11 th*/
1744 if(psessionEntry == NULL)
1745 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001746 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 return;
1748 }
1749 smesessionId = psessionEntry->smeSessionId;
1750 smetransactionId = psessionEntry->transactionId;
1751 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1752 if(resultCode != eSIR_SME_SUCCESS)
1753 {
1754 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1755 if (pStaDs != NULL)
1756 {
1757 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1758 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1759 pStaDs->mlmStaContext.resultCode = resultCode;
1760 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1761 //Done: 7-27-2009. JIM_FIX_ME: at the end of limCleanupRxPath, make sure PE is sending eWNI_SME_JOIN_RSP to SME
1762 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301763 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001764 psessionEntry->pLimJoinReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 return;
1766 }
1767 }
1768
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301769 vos_mem_free(psessionEntry->pLimJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 psessionEntry->pLimJoinReq = NULL;
1771 //Delete teh session if JOIN failure occurred.
1772 if(resultCode != eSIR_SME_SUCCESS)
1773 {
1774 if(NULL != psessionEntry)
1775 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001776 if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE,psessionEntry->bssId,
1777 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001778 PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 peDeleteSession(pMac,psessionEntry);
1780 psessionEntry = NULL;
1781 }
1782 }
1783 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, resultCode, protStatusCode,psessionEntry,
1784 smesessionId, smetransactionId);
1785} /*** end limHandleSmeJoinResult() ***/
1786
1787/**
Jeff Johnsone7245742012-09-05 17:12:55 -07001788 * limHandleSmeReaasocResult()
1789 *
1790 *FUNCTION:
1791 * This function is called to process reassoc failures
1792 * upon receiving REASSOC_CNF with a failure code or
1793 * MLM_REASSOC_CNF with a success code in case of STA role
1794 *
1795 *LOGIC:
1796 *
1797 *ASSUMPTIONS:
1798 *
1799 *NOTE:
1800 *
1801 * @param pMac Pointer to Global MAC structure
1802 * @param resultCode Failure code to be sent
1803 *
1804 *
1805 * @return None
1806 */
1807static void
1808limHandleSmeReaasocResult(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode, tpPESession psessionEntry)
1809{
1810 tpDphHashNode pStaDs = NULL;
1811 tANI_U8 smesessionId;
1812 tANI_U16 smetransactionId;
1813
1814 if(psessionEntry == NULL)
1815 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001816 PELOGE(limLog(pMac, LOGE,FL("psessionEntry is NULL "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001817 return;
1818 }
1819 smesessionId = psessionEntry->smeSessionId;
1820 smetransactionId = psessionEntry->transactionId;
1821 /* When associations is failed , delete the session created and pass NULL to limsendsmeJoinReassocRsp() */
1822 if(resultCode != eSIR_SME_SUCCESS)
1823 {
1824 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1825 if (pStaDs != NULL)
1826 {
1827 pStaDs->mlmStaContext.disassocReason = eSIR_MAC_UNSPEC_FAILURE_REASON;
1828 pStaDs->mlmStaContext.cleanupTrigger = eLIM_JOIN_FAILURE;
1829 pStaDs->mlmStaContext.resultCode = resultCode;
1830 pStaDs->mlmStaContext.protStatusCode = protStatusCode;
1831 limCleanupRxPath(pMac, pStaDs, psessionEntry);
1832 return;
1833 }
1834 }
1835
1836 //Delete teh session if REASSOC failure occurred.
1837 if(resultCode != eSIR_SME_SUCCESS)
1838 {
1839 if(NULL != psessionEntry)
1840 {
1841 peDeleteSession(pMac,psessionEntry);
1842 psessionEntry = NULL;
1843 }
1844 }
1845 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP, resultCode, protStatusCode,psessionEntry,
1846 smesessionId, smetransactionId);
1847} /*** end limHandleSmeReassocResult() ***/
1848
1849/**
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 * limProcessMlmAddStaRsp()
1851 *
1852 *FUNCTION:
1853 * This function is called to process a WDA_ADD_STA_RSP from HAL.
1854 * Upon receipt of this message from HAL, MLME -
1855 * > Determines the "state" in which this message was received
1856 * > Forwards it to the appropriate callback
1857 *
1858 *ASSUMPTIONS:
1859 *
1860 *NOTE:
1861 *
1862 * @param pMac Pointer to Global MAC structure
1863 * @param tSirMsgQ The MsgQ header, which contains the response buffer
1864 *
1865 * @return None
1866 */
1867void limProcessMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry )
1868{
1869 //we need to process the deferred message since the initiating req. there might be nested request.
1870 //in the case of nested request the new request initiated from the response will take care of resetting
1871 //the deffered flag.
1872 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 )
1876 {
1877 limProcessBtAmpApMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
1878 return;
1879 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 limProcessStaMlmAddStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001881}
1882void limProcessStaMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
1883{
1884 tLimMlmAssocCnf mlmAssocCnf;
1885 tpDphHashNode pStaDs;
1886 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
1887 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
1888
1889 if(NULL == pAddStaParams )
1890 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001891 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001892 return;
1893 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301894 if (true == psessionEntry->fDeauthReceived)
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 {
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301896 PELOGE(limLog(pMac, LOGE,
1897 FL("Received Deauth frame in ADD_STA_RESP state"));)
c_hpothua9dc89c2014-03-22 19:22:31 +05301898
1899 if (eHAL_STATUS_SUCCESS == pAddStaParams->status)
1900 {
1901 PELOGE(limLog(pMac, LOGE,
1902 FL("ADD_STA success, send update result code with"
1903 "eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA staIdx: %d"
1904 "limMlmState: %d"), pAddStaParams->staIdx,
1905 psessionEntry->limMlmState);)
1906 mlmAssocCnf.resultCode =
1907 (tSirResultCodes) eSIR_SME_JOIN_DEAUTH_FROM_AP_DURING_ADD_STA;
1908 psessionEntry->staId = pAddStaParams->staIdx;
1909 goto end;
1910 }
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301911 }
1912
1913 if ( eHAL_STATUS_SUCCESS == pAddStaParams->status )
1914 {
1915 if ( eLIM_MLM_WT_ADD_STA_RSP_STATE != psessionEntry->limMlmState)
Jeff Johnson295189b2012-06-20 16:38:30 -07001916 {
1917 //TODO: any response to be sent out here ?
1918 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001919 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 psessionEntry->limMlmState);
1921 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1922 goto end;
1923 }
1924 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1925 mesgType = LIM_MLM_REASSOC_CNF;
1926 //
1927 // Update the DPH Hash Entry for this STA
1928 // with proper state info
1929 //
1930 pStaDs = dphGetHashEntry( pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
1931 if( NULL != pStaDs)
1932 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
1933 else
1934 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001935 FL( "Unable to get the DPH Hash Entry for AID - %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 DPH_STA_HASH_INDEX_PEER);
1937 psessionEntry->limMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001938 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 /*
1940 * Storing the self StaIndex(Generated by HAL) in session context,
1941 * instead of storing it in DPH Hash entry for Self STA.
1942 * DPH entry for the self STA stores the sta index for the BSS entry
1943 * to which the STA is associated.
1944 */
1945 psessionEntry->staId = pAddStaParams->staIdx;
1946 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
Yathish9f22e662012-12-10 14:21:35 -08001947#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1948 if(!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1949#endif
1950 {
1951 limReactivateHeartBeatTimer(pMac, psessionEntry);
1952 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001953 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_KEEPALIVE_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07001954
1955 //assign the sessionId to the timer Object
1956 pMac->lim.limTimers.gLimKeepaliveTimer.sessionId = psessionEntry->peSessionId;
1957 if (tx_timer_activate(&pMac->lim.limTimers.gLimKeepaliveTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001958 limLog(pMac, LOGP, FL("Cannot activate keepalive timer."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001959#ifdef WLAN_DEBUG
1960 pMac->lim.gLimNumLinkEsts++;
1961#endif
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07001962#ifdef FEATURE_WLAN_TDLS
1963 /* initialize TDLS peer related data */
1964 limInitTdlsData(pMac,psessionEntry);
1965#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 // Return Assoc confirm to SME with success
1967 // FIXME_GEN4 - Need the correct ASSOC RSP code to
1968 // be passed in here....
1969 //mlmAssocCnf.resultCode = (tSirResultCodes) assoc.statusCode;
1970 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_SUCCESS;
1971 }
1972 else
1973 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05301974 limLog( pMac, LOGE, FL( "ADD_STA failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
1976 }
1977end:
1978 if( 0 != limMsgQ->bodyptr )
1979 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301980 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001981 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 }
1983 /* Updating PE session Id*/
1984 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
1985 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
Madan Mohan Koyyalamudi58c87792013-08-30 02:51:14 +05301986 if (true == psessionEntry->fDeauthReceived)
1987 {
1988 psessionEntry->fDeauthReceived = false;
1989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 return;
1991}
1992void limProcessMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
1993{
1994 //we need to process the deferred message since the initiating req. there might be nested request.
1995 //in the case of nested request the new request initiated from the response will take care of resetting
1996 //the deffered flag.
1997 // tpPESession psessionEntry;
1998 // tpDeleteBssParams pDeleteBssParams =( tpDeleteBssParams)limMsgQ->bodyptr;
1999 // if((psessionEntry = peFindSessionBySessionId(pMac,pDeleteBssParams->sessionId)) == NULL)
2000 // {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002001 // limLog( pMac, LOGE, FL( "Session deos not exist with given sessionId" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 // return;
2003 // }
2004 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
2006 if (((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
2007 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 ) &&
2010 (psessionEntry->statypeForBss == STA_ENTRY_SELF))
2011 {
2012 limProcessBtAmpApMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
2013 return;
2014 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 limProcessStaMlmDelBssRsp(pMac, limMsgQ,psessionEntry);
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08002016
2017 if(!limIsInMCC(pMac))
2018 {
2019 WDA_TrafficStatsTimerActivate(FALSE);
2020 }
Chet Lanctot186b5732013-03-18 10:26:30 -07002021
2022#ifdef WLAN_FEATURE_11W
2023 if (psessionEntry->limRmfEnabled)
2024 {
2025 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, TRUE, psessionEntry) )
2026 {
2027 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002028 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07002029 }
2030 }
2031#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002032}
2033
2034void limProcessStaMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2035{
2036 tpDeleteBssParams pDelBssParams = (tpDeleteBssParams) limMsgQ->bodyptr;
2037 tpDphHashNode pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2038 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302039
2040 if (NULL == pDelBssParams)
2041 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002042 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302043 goto end;
2044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 if( eHAL_STATUS_SUCCESS == pDelBssParams->status )
2046 {
2047 PELOGW(limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002048 FL( "STA received the DEL_BSS_RSP for BSSID: %X."),pDelBssParams->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId,
2050 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
2051
2052 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002053 PELOGE(limLog( pMac, LOGE, FL( "Failure in setting link state to IDLE"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 statusCode = eSIR_SME_REFUSED;
2055 goto end;
2056 }
2057 if(pStaDs == NULL)
2058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002059 limLog( pMac, LOGE, FL( "DPH Entry for STA 1 missing."));
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 statusCode = eSIR_SME_REFUSED;
2061 goto end;
2062 }
2063 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2064 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002065 PELOGE(limLog( pMac, LOGE, FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 pStaDs->mlmStaContext.mlmState);)
2067 statusCode = eSIR_SME_REFUSED;
2068 goto end;
2069 }
2070 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2071 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
2072 }
2073 else
2074 {
Gopichand Nakkalad786fa32013-03-20 23:48:19 +05302075 limLog( pMac, LOGE, FL( "DEL BSS failed!" ) );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302076 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002077 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 return;
2079 }
2080 end:
2081 if( 0 != limMsgQ->bodyptr )
2082 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302083 vos_mem_free(pDelBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002084 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 }
2086 if(pStaDs == NULL)
2087 return;
2088 if ( ((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2089 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE &&
2090 psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE) &&
2091 pStaDs->mlmStaContext.cleanupTrigger != eLIM_JOIN_FAILURE)
2092 {
2093 /** The Case where the DelBss is invoked from
2094 * context of other than normal DisAssoc / Deauth OR
2095 * as part of Join Failure.
2096 */
2097 limHandleDelBssInReAssocContext(pMac, pStaDs,psessionEntry);
2098 return;
2099 }
2100 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2101 return;
2102}
2103
Jeff Johnson295189b2012-06-20 16:38:30 -07002104void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2105{
2106 tSirResultCodes rc = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002107 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 tpDeleteBssParams pDelBss = (tpDeleteBssParams) limMsgQ->bodyptr;
2109 tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
2110
2111 if(psessionEntry == NULL)
2112 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002113 limLog(pMac, LOGE,FL("Session entry passed is NULL"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002114 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002115 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302116 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002117 limMsgQ->bodyptr = NULL;
2118 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 return;
2120 }
2121
2122 if (pDelBss == NULL)
2123 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002124 PELOGE(limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP with no body!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 rc = eSIR_SME_REFUSED;
2126 goto end;
2127 }
2128 pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002129 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState));
2130
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 if( eLIM_MLM_WT_DEL_BSS_RSP_STATE != psessionEntry->limMlmState)
2132 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002133 limLog( pMac, LOGE,
Jeff Johnson43971f52012-07-17 12:26:56 -07002134 FL( "Received unexpected WDA_DEL_BSS_RSP in state %X" ),
2135 psessionEntry->limMlmState);
Jeff Johnsone7245742012-09-05 17:12:55 -07002136 rc = eSIR_SME_REFUSED;
2137 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 }
2139 if (pDelBss->status != eHAL_STATUS_SUCCESS)
2140 {
2141 limLog(pMac, LOGE, FL("BSS: DEL_BSS_RSP error (%x) Bss %d "),
2142 pDelBss->status, pDelBss->bssIdx);
2143 rc = eSIR_SME_STOP_BSS_FAILURE;
2144 goto end;
2145 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002146 status = limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 psessionEntry->selfMacAddr, NULL, NULL);
Jeff Johnson43971f52012-07-17 12:26:56 -07002148 if (status != eSIR_SUCCESS)
2149 {
2150 rc = eSIR_SME_REFUSED;
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 goto end;
Jeff Johnson43971f52012-07-17 12:26:56 -07002152 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 /** Softmac may send all the buffered packets right after resuming the transmission hence
2154 * to occupy the medium during non channel occupancy period. So resume the transmission after
2155 * HAL gives back the response.
2156 */
Jeff Johnsone7245742012-09-05 17:12:55 -07002157#if 0 //TODO: How to handle this per session
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 if (LIM_IS_RADAR_DETECTED(pMac))
2159 {
2160 limFrameTransmissionControl(pMac, eLIM_TX_BSS_BUT_BEACON, eLIM_RESUME_TX);
2161 LIM_SET_RADAR_DETECTED(pMac, eANI_BOOLEAN_FALSE);
2162 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002163#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);//TBD-RAJESH is it needed ?
2165 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 //Initialize number of associated stations during cleanup
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002167 psessionEntry->gLimNumOfCurrentSTAs = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 end:
2169 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, rc, psessionEntry->smeSessionId, psessionEntry->transactionId);
2170 peDeleteSession(pMac, psessionEntry);
2171
2172 if(pDelBss != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002173 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302174 vos_mem_free(pDelBss);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002175 limMsgQ->bodyptr = NULL;
2176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002177}
2178
2179void limProcessMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
2180{
2181 //we need to process the deferred message since the initiating req. there might be nested request.
2182 //in the case of nested request the new request initiated from the response will take care of resetting
2183 //the deffered flag.
2184
2185 tpPESession psessionEntry;
2186 tpDeleteStaParams pDeleteStaParams;
2187 pDeleteStaParams = (tpDeleteStaParams)limMsgQ->bodyptr;
2188 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302189
2190 if(NULL == pDeleteStaParams ||
2191 NULL == (psessionEntry = peFindSessionBySessionId(pMac, pDeleteStaParams->sessionId)))
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002193 limLog(pMac, LOGP,FL("Session Does not exist or invalid body pointer in message"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002194 if(pDeleteStaParams != NULL)
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002195 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302196 vos_mem_free(pDeleteStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002197 limMsgQ->bodyptr = NULL;
2198 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 return;
2200 }
2201
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 )
2205 {
2206 limProcessBtAmpApMlmDelStaRsp(pMac,limMsgQ,psessionEntry);
2207 return;
2208 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 limProcessStaMlmDelStaRsp(pMac, limMsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002210}
2211
Jeff Johnson295189b2012-06-20 16:38:30 -07002212void limProcessBtAmpApMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2213{
2214 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2215 tpDphHashNode pStaDs;
2216 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2217 if(limMsgQ->bodyptr == NULL)
2218 {
2219 return;
2220 }
2221
2222 pStaDs = dphGetHashEntry(pMac, pDelStaParams->assocId, &psessionEntry->dph.dphHashTable);
2223 if(pStaDs == NULL)
2224 {
2225 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002226 FL( "DPH Entry for STA %X missing."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 statusCode = eSIR_SME_REFUSED;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302228 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002229 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002230
2231 return;
2232 }
2233 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2234 {
2235 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002236 FL( "AP received the DEL_STA_RSP for assocID: %X."), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002237
2238 if(( eLIM_MLM_WT_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState) &&
2239 ( eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState))
2240 {
2241 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002242 FL( "Received unexpected WDA_DEL_STA_RSP in state %s for staId %d assocId %d " ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 limMlmStateStr(pStaDs->mlmStaContext.mlmState), pStaDs->staIndex, pStaDs->assocId);
2244 statusCode = eSIR_SME_REFUSED;
2245 goto end;
2246 }
2247
2248 limLog( pMac, LOG1,
2249 FL("Deleted STA AssocID %d staId %d MAC "),
2250 pStaDs->assocId, pStaDs->staIndex);
2251 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2252 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE == pStaDs->mlmStaContext.mlmState)
2253 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302254 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002255 limMsgQ->bodyptr = NULL;
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002256 if (limAddSta(pMac, pStaDs, false, psessionEntry) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 {
2258 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002259 FL("could not Add STA with assocId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 pStaDs->assocId);)
2261 // delete the TS if it has already been added.
2262 // send the response with error status.
2263 if(pStaDs->qos.addtsPresent)
2264 {
2265 tpLimTspecInfo pTspecInfo;
2266 if(eSIR_SUCCESS == limTspecFindByAssocId(pMac, pStaDs->assocId,
2267 &pStaDs->qos.addts.tspec, &pMac->lim.tspecInfo[0], &pTspecInfo))
2268 {
2269 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo,
2270 NULL, &pTspecInfo->idx);
2271 }
2272 }
2273 limRejectAssociation(pMac,
2274 pStaDs->staAddr,
2275 pStaDs->mlmStaContext.subType,
2276 true, pStaDs->mlmStaContext.authType,
2277 pStaDs->assocId, true,
2278 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2279 psessionEntry);
2280 }
2281 return;
2282 }
2283 }
2284 else
2285 {
2286 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002287 FL( "DEL STA failed!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 statusCode = eSIR_SME_REFUSED;
2289 }
2290 end:
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302291 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002292 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 if(eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2294 {
2295 limPrepareAndSendDelStaCnf(pMac, pStaDs, statusCode,psessionEntry);
2296 }
2297 return;
2298}
2299
2300void limProcessStaMlmDelStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2301{
2302 tSirResultCodes statusCode = eSIR_SME_SUCCESS;
2303 tpDeleteStaParams pDelStaParams = (tpDeleteStaParams) limMsgQ->bodyptr;
2304 tpDphHashNode pStaDs = NULL;
2305 if(NULL == pDelStaParams )
2306 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002307 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 goto end;
2309 }
2310 if( eHAL_STATUS_SUCCESS == pDelStaParams->status )
2311 {
2312 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
2313 if (pStaDs == NULL)
2314 {
2315 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002316 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 pDelStaParams->assocId);
2318 statusCode = eSIR_SME_REFUSED;
2319 goto end;
2320 }
2321 if( eLIM_MLM_WT_DEL_STA_RSP_STATE != psessionEntry->limMlmState)
2322 {
2323 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002324 limLog( pMac, LOGE, FL( "Received unexpected WDA_DELETE_STA_RSP in state %s" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 limMlmStateStr(psessionEntry->limMlmState));
2326 statusCode = eSIR_SME_REFUSED;
2327 goto end;
2328 }
2329 PELOG1(limLog( pMac, LOG1, FL("STA AssocID %d MAC "), pStaDs->assocId );
2330 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002331 limLog( pMac, LOGW, FL( "DEL_STA_RSP received for assocID: %X"), pDelStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 //we must complete all cleanup related to delSta before calling limDelBSS.
2333 if( 0 != limMsgQ->bodyptr )
2334 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302335 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002336 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 }
2338 statusCode = (tSirResultCodes) limDelBss(pMac, pStaDs, 0,psessionEntry);
2339 return;
2340 }
2341 else
2342 {
Gopichand Nakkalacc8cf8e2013-04-25 06:03:10 -07002343 limLog( pMac, LOGE, FL( "DEL_STA failed for sta Id %d" ), pDelStaParams->staIdx);
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 statusCode = eSIR_SME_REFUSED;
2345 }
2346end:
2347 if( 0 != limMsgQ->bodyptr )
2348 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302349 vos_mem_free(pDelStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002350 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 }
2352 return;
2353}
2354
Jeff Johnson295189b2012-06-20 16:38:30 -07002355void limProcessBtAmpApMlmAddStaRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
2356{
2357 tpAddStaParams pAddStaParams = (tpAddStaParams) limMsgQ->bodyptr;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302358 tpDphHashNode pStaDs = NULL;
2359
2360 if (NULL == pAddStaParams)
2361 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002362 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302363 goto end;
2364 }
2365
2366 pStaDs = dphGetHashEntry(pMac, pAddStaParams->assocId, &psessionEntry->dph.dphHashTable);
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 if(pStaDs == NULL)
2368 {
2369 //TODO: any response to be sent out here ?
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002370 limLog( pMac, LOGE, FL( "DPH Entry for STA %X missing."), pAddStaParams->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 goto end;
2372 }
2373 //
2374 // TODO & FIXME_GEN4
2375 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
2376 //
2377 //TODO: any check for pMac->lim.gLimMlmState ?
2378 if( eLIM_MLM_WT_ADD_STA_RSP_STATE != pStaDs->mlmStaContext.mlmState)
2379 {
2380 //TODO: any response to be sent out here ?
2381 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002382 FL( "Received unexpected WDA_ADD_STA_RSP in state %X" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 pStaDs->mlmStaContext.mlmState);
2384 goto end;
2385 }
2386 if(eHAL_STATUS_SUCCESS != pAddStaParams->status)
2387 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002388 PELOGE(limLog(pMac, LOGE, FL("Error! rcvd delSta rsp from HAL with status %d"),pAddStaParams->status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002389 limRejectAssociation(pMac, pStaDs->staAddr,
2390 pStaDs->mlmStaContext.subType,
2391 true, pStaDs->mlmStaContext.authType,
2392 pStaDs->assocId, true,
2393 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
2394 psessionEntry);
2395 goto end;
2396 }
2397 pStaDs->bssId = pAddStaParams->bssIdx;
2398 pStaDs->staIndex = pAddStaParams->staIdx;
2399 //if the AssocRsp frame is not acknowledged, then keep alive timer will take care of the state
2400 pStaDs->valid = 1;
2401 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_CNF_STATE;
2402 limLog( pMac, LOG1,
2403 FL("STA AssocID %d staId %d MAC "),
2404 pStaDs->assocId,
2405 pStaDs->staIndex);
2406 limPrintMacAddr(pMac, pStaDs->staAddr, LOG1);
2407
2408 /* For BTAMP-AP, the flow sequence shall be:
2409 * 1) PE sends eWNI_SME_ASSOC_IND to SME
2410 * 2) PE receives eWNI_SME_ASSOC_CNF from SME
2411 * 3) BTAMP-AP sends Re/Association Response to BTAMP-STA
2412 */
2413 limSendMlmAssocInd(pMac, pStaDs, psessionEntry);
2414 // fall though to reclaim the original Add STA Response message
2415end:
2416 if( 0 != limMsgQ->bodyptr )
2417 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302418 vos_mem_free(pAddStaParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002419 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002420 }
2421 return;
2422}
2423
2424/**
2425 * limProcessApMlmAddBssRsp()
2426 *
2427 *FUNCTION:
2428 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2429 * Upon receipt of this message from HAL, MLME -
2430 * > Validates the result of WDA_ADD_BSS_REQ
2431 * > Init other remaining LIM variables
2432 * > Init the AID pool, for that BSSID
2433 * > Init the Pre-AUTH list, for that BSSID
2434 * > Create LIM timers, specific to that BSSID
2435 * > Init DPH related parameters that are specific to that BSSID
2436 * > TODO - When do we do the actual change channel?
2437 *
2438 *LOGIC:
2439 * SME sends eWNI_SME_START_BSS_REQ to LIM
2440 * LIM sends LIM_MLM_START_REQ to MLME
2441 * MLME sends WDA_ADD_BSS_REQ to HAL
2442 * HAL responds with WDA_ADD_BSS_RSP to MLME
2443 * MLME responds with LIM_MLM_START_CNF to LIM
2444 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2445 *
2446 *ASSUMPTIONS:
2447 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2448 * tSirMsgQ.body will now be freed by this routine
2449 *
2450 *NOTE:
2451 *
2452 * @param pMac Pointer to Global MAC structure
2453 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2454 *
2455 * @return None
2456 */
2457static void
2458limProcessApMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ)
2459{
2460 tLimMlmStartCnf mlmStartCnf;
2461 tANI_U32 val;
2462 tpPESession psessionEntry;
2463// tANI_U8 sessionId;
2464 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2465 if(NULL == pAddBssParams )
2466 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002467 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 goto end;
2469 }
2470 //TBD: free the memory before returning, do it for all places where lookup fails.
2471 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2472 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002473 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002474 if( NULL != pAddBssParams )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002475 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302476 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002477 limMsgQ->bodyptr = NULL;
2478 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 return;
2480 }
2481 /* Update PE session Id*/
2482 mlmStartCnf.sessionId = pAddBssParams->sessionId;
2483 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2484 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002485 PELOG2(limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 if (limSetLinkState(pMac, eSIR_LINK_AP_STATE,psessionEntry->bssId,
2487 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2488 goto end;
2489 // Set MLME state
2490 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002491 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 if( eSIR_IBSS_MODE == pAddBssParams->bssType )
2493 {
2494 /** IBSS is 'active' when we receive
2495 * Beacon frames from other STAs that are part of same IBSS.
2496 * Mark internal state as inactive until then.
2497 */
2498 psessionEntry->limIbssActive = false;
2499 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know session created for self/peer
2500 limResetHBPktCount( psessionEntry );
2501 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002502 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002503 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002504 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 }
2506 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2507
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002509
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 if ( eSIR_INFRA_AP_MODE == pAddBssParams->bssType )
2511 psessionEntry->limSystemRole = eLIM_AP_ROLE;
2512 else
2513 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 schEdcaProfileUpdate(pMac, psessionEntry);
2515 limInitPreAuthList(pMac);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08002516 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 // Create timers used by LIM
2518 if (!pMac->lim.gLimTimersCreated)
2519 limCreateTimers(pMac);
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002520
2521 // Start OLBC timer
2522 if (tx_timer_activate(&pMac->lim.limTimers.gLimUpdateOlbcCacheTimer) != TX_SUCCESS)
2523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002524 limLog(pMac, LOGE, FL("tx_timer_activate failed"));
Madan Mohan Koyyalamudi788b4ee2012-09-25 10:42:09 -07002525 }
2526
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2528 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002529 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2531 // Apply previously set configuration at HW
2532 limApplyConfiguration(pMac,psessionEntry);
2533 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2534 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2535 }
2536 else
2537 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002538 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2540 }
2541 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2542 end:
2543 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002544 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302545 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002546 limMsgQ->bodyptr = NULL;
2547 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002548}
2549
2550
2551/**
2552 * limProcessIbssMlmAddBssRsp()
2553 *
2554 *FUNCTION:
2555 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2556 * Upon receipt of this message from HAL, MLME -
2557 * > Validates the result of WDA_ADD_BSS_REQ
2558 * > Init other remaining LIM variables
2559 * > Init the AID pool, for that BSSID
2560 * > Init the Pre-AUTH list, for that BSSID
2561 * > Create LIM timers, specific to that BSSID
2562 * > Init DPH related parameters that are specific to that BSSID
2563 * > TODO - When do we do the actual change channel?
2564 *
2565 *LOGIC:
2566 * SME sends eWNI_SME_START_BSS_REQ to LIM
2567 * LIM sends LIM_MLM_START_REQ to MLME
2568 * MLME sends WDA_ADD_BSS_REQ to HAL
2569 * HAL responds with WDA_ADD_BSS_RSP to MLME
2570 * MLME responds with LIM_MLM_START_CNF to LIM
2571 * LIM responds with eWNI_SME_START_BSS_RSP to SME
2572 *
2573 *ASSUMPTIONS:
2574 * tSirMsgQ.body is allocated by MLME during limProcessMlmStartReq
2575 * tSirMsgQ.body will now be freed by this routine
2576 *
2577 *NOTE:
2578 *
2579 * @param pMac Pointer to Global MAC structure
2580 * @param tSirMsgQ The MsgQ header, which contains the response buffer
2581 *
2582 * @return None
2583 */
2584static void
2585limProcessIbssMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
2586{
2587 tLimMlmStartCnf mlmStartCnf;
2588 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2589 tANI_U32 val;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302590
2591 if (NULL == pAddBssParams)
2592 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002593 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302594 goto end;
2595 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2597 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002598 PELOG1(limLog(pMac, LOG1, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 if (limSetLinkState(pMac, eSIR_LINK_IBSS_STATE,psessionEntry->bssId,
2600 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
2601 goto end;
2602 // Set MLME state
2603 psessionEntry->limMlmState = eLIM_MLM_BSS_STARTED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002604 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 /** IBSS is 'active' when we receive
2606 * Beacon frames from other STAs that are part of same IBSS.
2607 * Mark internal state as inactive until then.
2608 */
2609 psessionEntry->limIbssActive = false;
2610 limResetHBPktCount( psessionEntry );
2611 /* Timer related functions are not modified for BT-AMP : To be Done */
2612 limHeartBeatDeactivateAndChangeTimer(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002613 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_HEART_BEAT_TIMER));
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002614 if (limActivateHearBeatTimer(pMac, psessionEntry) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002615 limLog(pMac, LOGP, FL("could not activate Heartbeat timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2617 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
2618 psessionEntry->statypeForBss = STA_ENTRY_SELF;
2619 schEdcaProfileUpdate(pMac, psessionEntry);
2620 //TBD-RAJESH limInitPreauthList should re removed for IBSS also ?????
2621 //limInitPreAuthList(pMac);
Shailender Karmuchia734f332013-04-19 14:02:48 -07002622 if (0 == psessionEntry->freePeerIdxHead)
2623 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 // Create timers used by LIM
2625#ifdef FIXME_GEN6 //following code may not be required, as limCreateTimers is now invoked from limInitialize (peStart)
2626 if (!pMac->lim.gLimTimersCreated)
2627 limCreateTimers(pMac);
2628#endif
2629 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
2630 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002631 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
2633 // Apply previously set configuration at HW
2634 limApplyConfiguration(pMac,psessionEntry);
2635 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2636 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
2637 //If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM
2638 if(true == pMac->lim.gLimIbssCoalescingHappened)
2639 {
2640 limIbssAddBssRspWhenCoalescing(pMac, limMsgQ->bodyptr, psessionEntry);
2641 goto end;
2642 }
2643 }
2644 else
2645 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002646 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 pAddBssParams->status );
2648 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
2649 }
2650 //Send this message to SME, when ADD_BSS is initiated by SME
2651 //If ADD_BSS is done as part of coalescing, this won't happen.
2652 /* Update PE session Id*/
2653 mlmStartCnf.sessionId =psessionEntry->peSessionId;
2654 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
2655 end:
2656 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002657 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302658 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002659 limMsgQ->bodyptr = NULL;
2660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002661}
2662
2663static void
2664limProcessStaMlmAddBssRspPreAssoc( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry )
2665{
2666 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
2667 tAniAuthType cfgAuthType, authMode;
2668 tLimMlmAuthReq *pMlmAuthReq;
2669 tpDphHashNode pStaDs = NULL;
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302670
2671 if (NULL == pAddBssParams)
2672 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002673 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05302674 goto joinFailure;
2675 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
2677 {
2678 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->staContext.staMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
2679 {
2680 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002681 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2683 goto joinFailure;
2684 }
2685 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2686 //Success, handle below
2687 pStaDs->bssId = pAddBssParams->bssIdx;
2688 //STA Index(genr by HAL) for the BSS entry is stored here
2689 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2690 // Trigger Authentication with AP
2691 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATION_TYPE,
2692 (tANI_U32 *) &cfgAuthType) != eSIR_SUCCESS)
2693 {
2694 /**
2695 * Could not get AuthType from CFG.
2696 * Log error.
2697 */
2698 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002699 FL("could not retrieve AuthType"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 }
2701 if (cfgAuthType == eSIR_AUTO_SWITCH)
2702 authMode = eSIR_OPEN_SYSTEM; // Try Open Authentication first
2703 else
2704 authMode = cfgAuthType;
2705
2706 // Trigger MAC based Authentication
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302707 pMlmAuthReq = vos_mem_malloc(sizeof(tLimMlmAuthReq));
2708 if ( NULL == pMlmAuthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 {
2710 // Log error
2711 limLog(pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302712 FL("call to AllocateMemory failed for mlmAuthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 return;
2714 }
2715 #if 0
2716 val = sizeof(tSirMacAddr);
2717 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID,
2718 pMlmAuthReq->peerMacAddr,
2719 &val) != eSIR_SUCCESS)
2720 {
2721 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002722 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 }
2724 #endif //TO SUPPORT BT-AMP
2725 sirCopyMacAddr(pMlmAuthReq->peerMacAddr,psessionEntry->bssId);
2726
2727 pMlmAuthReq->authType = authMode;
2728 if (wlan_cfgGetInt(pMac, WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT,
2729 (tANI_U32 *) &pMlmAuthReq->authFailureTimeout)
2730 != eSIR_SUCCESS)
2731 {
2732 /**
2733 * Could not get AuthFailureTimeout
2734 * value from CFG. Log error.
2735 */
2736 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002737 FL("could not retrieve AuthFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 }
2739 // SUNIT_FIX_ME: Set BOTH? Assume not. Please verify here and below.
2740 //pMac->lim.gLimMlmState = eLIM_MLM_JOINED_STATE;
2741 psessionEntry->limMlmState = eLIM_MLM_JOINED_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002742 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_JOINED_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 pMlmAuthReq->sessionId = psessionEntry->peSessionId;
2744 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2745 psessionEntry->limSmeState = eLIM_SME_WT_AUTH_STATE;
2746 // remember staId in case of assoc timeout/failure handling
2747 psessionEntry->staId = pAddBssParams->staContext.staIdx;
2748
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302749 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE,
2750 psessionEntry->peSessionId, psessionEntry->limSmeState));
2751 limLog(pMac,LOG1,"SessionId:%d limPostMlmMessage LIM_MLM_AUTH_REQ"
2752 "with limSmeState:%d",psessionEntry->peSessionId,
2753 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 limPostMlmMessage(pMac,
2755 LIM_MLM_AUTH_REQ,
2756 (tANI_U32 *) pMlmAuthReq);
2757 return;
2758 }
2759
2760joinFailure:
2761 {
2762 psessionEntry->limSmeState = eLIM_SME_JOIN_FAILURE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002763 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002764
2765 /// Send Join response to Host
2766 limHandleSmeJoinResult(pMac, eSIR_SME_REFUSED, eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
2767
2768 }
2769
2770}
2771
2772#ifdef WLAN_FEATURE_VOWIFI_11R
2773/*------------------------------------------------------------------------------------------
2774 *
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002775 * Function to handle WDA_ADD_BSS_RSP, in FT reassoc state.
2776 * Function to Send ReAssociation Request.
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 *
2778 *
2779 *------------------------------------------------------------------------------------------
2780 */
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002781static inline void
2782limProcessStaMlmAddBssRspFT(tpAniSirGlobal pMac, tpSirMsgQ limMsgQ, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002783{
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 tLimMlmReassocCnf mlmReassocCnf; // keep sme
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002785 tpDphHashNode pStaDs = NULL;
2786 tpAddStaParams pAddStaParams = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002787 tANI_U32 listenInterval = WNI_CFG_LISTEN_INTERVAL_STADEF;
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002788 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002789 tANI_U32 selfStaDot11Mode = 0;
2790
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002791 /* Sanity Checks */
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002792
2793 if (pAddBssParams == NULL)
2794 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002795 PELOGE(limLog(pMac, LOGE, FL("Invalid parameters"));)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002796 goto end;
2797 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002798 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
2799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002800 limLog( pMac, LOGE, FL( "Session Does not exist for given sessionId" ));
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002801 goto end;
2802 }
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002803 if ( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE != psessionEntry->limMlmState )
2804 {
2805 goto end;
2806 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002807
2808 if ((pStaDs = dphAddHashEntry(pMac, pAddBssParams->bssId, DPH_STA_HASH_INDEX_PEER,
2809 &psessionEntry->dph.dphHashTable)) == NULL)
2810 {
2811 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002812 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 limPrintMacAddr(pMac, pAddBssParams->staContext.staMac, LOGE);
2814 goto end;
2815 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 // Prepare and send Reassociation request frame
2817 // start reassoc timer.
2818 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
2819 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07002820 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
2822 != TX_SUCCESS)
2823 {
2824 /// Could not start reassoc failure timer.
2825 // Log error
2826 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002827 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002828 // Return Reassoc confirm with
2829 // Resources Unavailable
2830 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2831 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
2832 goto end;
2833 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002834#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002835 pMac->lim.pSessionEntry = psessionEntry;
2836 if(NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq)
2837 {
2838 /* Take a copy of reassoc request for retrying */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302839 pMac->lim.pSessionEntry->pLimMlmReassocRetryReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2840 if ( NULL == pMac->lim.pSessionEntry->pLimMlmReassocRetryReq ) goto end;
2841 vos_mem_set(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq, sizeof(tLimMlmReassocReq), 0);
2842 vos_mem_copy(pMac->lim.pSessionEntry->pLimMlmReassocRetryReq,
2843 psessionEntry->pLimMlmReassocReq,
2844 sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002845 }
2846 pMac->lim.reAssocRetryAttempt = 0;
2847#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002848 limSendReassocReqWithFTIEsMgmtFrame(pMac, psessionEntry->pLimMlmReassocReq, psessionEntry);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07002849
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 psessionEntry->limPrevMlmState = psessionEntry->limMlmState;
2851 psessionEntry->limMlmState = eLIM_MLM_WT_FT_REASSOC_RSP_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002852 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, eLIM_MLM_WT_FT_REASSOC_RSP_STATE));
Hoonki Lee1090c6a2013-01-16 17:40:54 -08002853 PELOGE(limLog(pMac, LOG1, FL("Set the mlm state to %d session=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 psessionEntry->limMlmState, psessionEntry->peSessionId);)
2855
2856 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
2857
2858 //Success, handle below
2859 pStaDs->bssId = pAddBssParams->bssIdx;
2860 //STA Index(genr by HAL) for the BSS entry is stored here
2861 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
2862 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
2863 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
2864
Jeff Johnson295189b2012-06-20 16:38:30 -07002865#if defined WLAN_FEATURE_VOWIFI
2866 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
2867#endif
2868
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302869 pAddStaParams = vos_mem_malloc(sizeof( tAddStaParams ));
2870 if ( NULL == pAddStaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302872 limLog( pMac, LOGP, FL( "Unable to allocate memory during ADD_STA" ));
Jeff Johnson19ba8882013-04-03 17:02:37 -07002873 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002874 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302875 vos_mem_set((tANI_U8 *) pAddStaParams, sizeof(tAddStaParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002876
2877 /// Add STA context at MAC HW (BMU, RHP & TFP)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302878 vos_mem_copy((tANI_U8 *) pAddStaParams->staMac,
2879 (tANI_U8 *) psessionEntry->selfMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002880
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302881 vos_mem_copy((tANI_U8 *) pAddStaParams->bssId,
2882 psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002883
2884 // Update this when we get reassoc rsp , with success.
2885 // pAddStaParams->assocId = psessionEntry->limAID;
2886
2887 pAddStaParams->staType = STA_ENTRY_SELF;
2888 pAddStaParams->status = eHAL_STATUS_SUCCESS;
2889 pAddStaParams->respReqd = 1;
2890
2891 /* Update PE session ID */
2892 pAddStaParams->sessionId = psessionEntry->peSessionId;
2893
2894 // This will indicate HAL to "allocate" a new STA index
2895 pAddStaParams->staIdx = HAL_STA_INVALID_IDX;
2896 pAddStaParams->updateSta = FALSE;
2897
2898 pAddStaParams->shortPreambleSupported = (tANI_U8)psessionEntry->beaconParams.fShortPreamble;
Jeff Johnsone7245742012-09-05 17:12:55 -07002899#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002900 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry, NULL);
Jeff Johnsone7245742012-09-05 17:12:55 -07002901#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -07002902 limPopulatePeerRateSet(pMac, &pAddStaParams->supportedRates, NULL, false,psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002903#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002904
Jeff Johnsone7245742012-09-05 17:12:55 -07002905 if( psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002907 pAddStaParams->htCapable = psessionEntry->htCapability;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002908#ifdef WLAN_FEATURE_11AC
2909 pAddStaParams->vhtCapable = psessionEntry->vhtCapability;
2910 pAddStaParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet;
2911#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002912#ifdef DISABLE_GF_FOR_INTEROP
2913 /*
2914 * To resolve the interop problem with Broadcom AP,
2915 * where TQ STA could not pass traffic with GF enabled,
2916 * TQ STA will do Greenfield only with TQ AP, for
2917 * everybody else it will be turned off.
Jeff Johnsone7245742012-09-05 17:12:55 -07002918 */
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2920 {
2921 limLog( pMac, LOGE, FL(" Turning off Greenfield, when adding self entry"));
2922 pAddStaParams->greenFieldCapable = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
2923 }
2924 else
2925#endif
2926
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 pAddStaParams->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry);
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002928 if (psessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
2929 {
2930 pAddStaParams->txChannelWidthSet =
2931 pMac->roam.configParam.channelBondingMode24GHz;
2932 }
2933 else
2934 {
2935 pAddStaParams->txChannelWidthSet =
2936 pMac->roam.configParam.channelBondingMode5GHz;
2937 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 pAddStaParams->mimoPS = limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry );
2939 pAddStaParams->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry );
2940 pAddStaParams->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry );
2941 pAddStaParams->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry );
2942 pAddStaParams->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry );
2943 pAddStaParams->maxAmpduSize = limGetHTCapability(pMac, eHT_MAX_RX_AMPDU_FACTOR, psessionEntry);
2944 pAddStaParams->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry );
2945 pAddStaParams->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry);
2946 pAddStaParams->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry);
2947 pAddStaParams->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 }
2949
2950 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &listenInterval) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002951 limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002952 pAddStaParams->listenInterval = (tANI_U16)listenInterval;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002953 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfStaDot11Mode);
2954 pAddStaParams->supportedRates.opRateMode = limGetStaRateMode((tANI_U8)selfStaDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002955 // Lets save this for when we receive the Reassoc Rsp
2956 pMac->ft.ftPEContext.pAddStaReq = pAddStaParams;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002957
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002958 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002959 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002960 vos_mem_free(pAddBssParams);
2961 pAddBssParams = NULL;
2962 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002963 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002964 return;
2965
2966end:
2967 // Free up buffer allocated for reassocReq
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002968 if (psessionEntry != NULL)
2969 if (psessionEntry->pLimMlmReassocReq != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002971 vos_mem_free(psessionEntry->pLimMlmReassocReq);
2972 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 }
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002974
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002975 if (pAddBssParams != NULL)
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002976 {
Varun Reddy Yeturucf589342013-08-09 09:31:50 -07002977 vos_mem_free(pAddBssParams);
2978 pAddBssParams = NULL;
2979 limMsgQ->bodyptr = NULL;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002980 }
2981
2982 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
2983 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Gopichand Nakkala94273ab2013-03-25 14:47:39 +05302984 /* Update PE session Id*/
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07002985 if (psessionEntry != NULL)
2986 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
Jeff Johnson19ba8882013-04-03 17:02:37 -07002987 else
2988 mlmReassocCnf.sessionId = 0;
Dhanashri Atre4a6e3ea2012-12-12 14:10:33 -08002989
2990 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
2991}
Jeff Johnson295189b2012-06-20 16:38:30 -07002992#endif /* WLAN_FEATURE_VOWIFI_11R */
Jeff Johnson295189b2012-06-20 16:38:30 -07002993/**
2994 * limProcessStaMlmAddBssRsp()
2995 *
2996 *FUNCTION:
2997 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
2998 * Upon receipt of this message from HAL, MLME -
2999 * > Validates the result of WDA_ADD_BSS_REQ
3000 * > Now, send an ADD_STA to HAL and ADD the "local" STA itself
3001 *
3002 *LOGIC:
3003 * MLME had sent WDA_ADD_BSS_REQ to HAL
3004 * HAL responded with WDA_ADD_BSS_RSP to MLME
3005 * MLME now sends WDA_ADD_STA_REQ to HAL
3006 *
3007 *ASSUMPTIONS:
3008 * tSirMsgQ.body is allocated by MLME during limProcessMlmJoinReq
3009 * tSirMsgQ.body will now be freed by this routine
3010 *
3011 *NOTE:
3012 *
3013 * @param pMac Pointer to Global MAC structure
3014 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3015 *
3016 * @return None
3017 */
3018static void
3019limProcessStaMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry)
3020{
3021 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
3022 tLimMlmAssocCnf mlmAssocCnf;
3023 tANI_U32 mesgType = LIM_MLM_ASSOC_CNF;
3024 tANI_U32 subType = LIM_ASSOC;
3025 tpDphHashNode pStaDs = NULL;
3026 tANI_U16 staIdx = HAL_STA_INVALID_IDX;
3027 tANI_U8 updateSta = false;
3028 mlmAssocCnf.resultCode = eSIR_SME_SUCCESS;
3029
3030 if(eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE == psessionEntry->limMlmState)
3031 {
3032 //Done: 7-28-2009. JIM_FIX_ME: sessionize the following function
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303033 limLog(pMac,LOG1,"SessionId:%d limProcessStaMlmAddBssRspPreAssoc",
3034 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003035 limProcessStaMlmAddBssRspPreAssoc(pMac, limMsgQ, psessionEntry);
3036 goto end;
3037 }
3038 if( eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == psessionEntry->limMlmState )
3039 {
3040 mesgType = LIM_MLM_REASSOC_CNF;
3041 subType = LIM_REASSOC;
3042 //If Reassoc is happening for the same BSS, then use the existing StaId and indicate to HAL
3043 //to update the existing STA entry.
3044 //If Reassoc is happening for the new BSS, then old BSS and STA entry would have been already deleted
3045 //before PE tries to add BSS for the new BSS, so set the updateSta to false and pass INVALID STA Index.
3046 if (sirCompareMacAddr( psessionEntry->bssId, psessionEntry->limReAssocbssId))
3047 {
3048 staIdx = psessionEntry->staId;
3049 updateSta = true;
3050 }
3051 }
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003052
Madan Mohan Koyyalamudi830ed802012-11-29 11:38:12 -08003053 if(pAddBssParams == 0)
Madan Mohan Koyyalamudi0b78e152012-11-28 15:46:51 -08003054 goto end;
3055
Jeff Johnson295189b2012-06-20 16:38:30 -07003056 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
3057 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003058#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 if( eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == psessionEntry->limMlmState )
3060 {
3061#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Hoonki Lee1090c6a2013-01-16 17:40:54 -08003062 PELOGE(limLog(pMac, LOG1, FL("Mlm=%d %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 psessionEntry->limMlmState,
3064 eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE);)
3065#endif
3066 limProcessStaMlmAddBssRspFT( pMac, limMsgQ, psessionEntry);
3067 goto end;
3068 }
3069#endif /* WLAN_FEATURE_VOWIFI_11R */
3070
3071 // Set MLME state
3072 psessionEntry->limMlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003073 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 psessionEntry->statypeForBss = STA_ENTRY_PEER; //to know the session started for self or for peer oct6th
3075 // Now, send WDA_ADD_STA_REQ
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303076 limLog( pMac, LOGW, FL( "SessionId:%d On STA: ADD_BSS was successful" ),
3077 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3079 if (pStaDs == NULL)
3080 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303081 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3082 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3084 }
3085 else
3086 {
3087 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
3088 //Success, handle below
3089 pStaDs->bssId = pAddBssParams->bssIdx;
3090 //STA Index(genr by HAL) for the BSS entry is stored here
3091 pStaDs->staIndex = pAddBssParams->staContext.staIdx;
3092 pStaDs->ucUcastSig = pAddBssParams->staContext.ucUcastSig;
3093 pStaDs->ucBcastSig = pAddBssParams->staContext.ucBcastSig;
3094 // Downgrade the EDCA parameters if needed
3095 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3096 // Send the active EDCA parameters to HAL
3097 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) {
3098 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3099 } else {
3100 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3101 }
3102#if defined WLAN_FEATURE_VOWIFI
3103 rrmCacheMgmtTxPower( pMac, pAddBssParams->txMgmtPower, psessionEntry );
3104#endif
3105
3106 if (subType == LIM_REASSOC)
3107 limDeactivateAndChangeTimer(pMac, eLIM_KEEPALIVE_TIMER);
3108 if (limAddStaSelf(pMac,staIdx, updateSta, psessionEntry) != eSIR_SUCCESS)
3109 {
3110 // Add STA context at HW
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303111 PELOGE(limLog(pMac, LOGE, FL("SessionId:%d could not Add Self"
3112 "Entry for the station"),psessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003113 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3114 }
3115 }
3116 }
3117 else
3118 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303119 limLog( pMac, LOGP, FL( "SessionId:%d ADD_BSS failed!" ),
3120 psessionEntry->peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 // Return Assoc confirm to SME with failure
3122 mlmAssocCnf.resultCode = (tSirResultCodes) eSIR_SME_REFUSED;
3123 }
3124
3125 if(mlmAssocCnf.resultCode != eSIR_SME_SUCCESS)
3126 {
3127 /* Update PE session Id*/
3128 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
3129 limPostSmeMessage( pMac, mesgType, (tANI_U32 *) &mlmAssocCnf );
3130 }
3131 end:
3132 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003133 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303134 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003135 limMsgQ->bodyptr = NULL;
3136 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003137}
3138
3139
3140
3141/**
3142 * limProcessMlmAddBssRsp()
3143 *
3144 *FUNCTION:
3145 * This function is called to process a WDA_ADD_BSS_RSP from HAL.
3146 * Upon receipt of this message from HAL, MLME -
3147 * > Determines the "state" in which this message was received
3148 * > Forwards it to the appropriate callback
3149 *
3150 *LOGIC:
3151 * WDA_ADD_BSS_RSP can be received by MLME while the LIM is
3152 * in the following two states:
3153 * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE
3154 * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE
3155 * Based on these two states, this API will determine where to
3156 * route the message to
3157 *
3158 *ASSUMPTIONS:
3159 *
3160 *NOTE:
3161 *
3162 * @param pMac Pointer to Global MAC structure
3163 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3164 *
3165 * @return None
3166 */
3167void limProcessMlmAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3168{
3169 tLimMlmStartCnf mlmStartCnf;
3170 tpPESession psessionEntry;
3171 tpAddBssParams pAddBssParams = (tpAddBssParams) (limMsgQ->bodyptr);
3172
3173 if(NULL == pAddBssParams )
3174 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003175 limLog( pMac, LOGE, FL( "Encountered NULL Pointer" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 return;
3177 }
3178
3179 //
3180 // TODO & FIXME_GEN4
3181 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3182 //
3183 //we need to process the deferred message since the initiating req. there might be nested request.
3184 //in the case of nested request the new request initiated from the response will take care of resetting
3185 //the deffered flag.
3186 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3187 // Validate SME/LIM state
3188 // Validate MLME state
3189 if((psessionEntry = peFindSessionBySessionId(pMac,pAddBssParams->sessionId))== NULL)
3190 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303191 limLog( pMac, LOGE, FL( "SessionId:%d Session Does not exist" ),
3192 pAddBssParams->sessionId);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003193 if( NULL != pAddBssParams )
3194 {
3195 vos_mem_free(pAddBssParams);
3196 limMsgQ->bodyptr = NULL;
3197 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 return;
3199 }
3200 /* update PE session Id*/
3201 mlmStartCnf.sessionId = psessionEntry->peSessionId;
3202 if( eSIR_IBSS_MODE == psessionEntry->bssType )
3203 limProcessIbssMlmAddBssRsp( pMac, limMsgQ, psessionEntry );
3204 else
3205 {
3206 if( eLIM_SME_WT_START_BSS_STATE == psessionEntry->limSmeState )
3207 {
3208 if( eLIM_MLM_WT_ADD_BSS_RSP_STATE != psessionEntry->limMlmState )
3209 {
3210 // Mesg received from HAL in Invalid state!
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05303211 limLog( pMac, LOGE,FL( "SessionId:%d Received unexpected"
3212 "WDA_ADD_BSS_RSP in state %X" ),
3213 psessionEntry->peSessionId,psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
3215 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003216 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303217 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003218 limMsgQ->bodyptr = NULL;
3219 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
3221 }
3222 else if ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE)||(psessionEntry->bssType == eSIR_BTAMP_STA_MODE))
3223 {
3224 limProcessBtampAddBssRsp(pMac,limMsgQ,psessionEntry);
3225 }
3226 else
3227 limProcessApMlmAddBssRsp( pMac,limMsgQ);
3228 }
3229 else
3230 /* Called while processing assoc response */
3231 limProcessStaMlmAddBssRsp( pMac, limMsgQ,psessionEntry);
3232 }
Madan Mohan Koyyalamudi01cba042013-01-10 21:56:05 -08003233
3234 if(limIsInMCC(pMac))
3235 {
3236 WDA_TrafficStatsTimerActivate(TRUE);
3237 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003238
3239#ifdef WLAN_FEATURE_11W
3240 if (psessionEntry->limRmfEnabled)
3241 {
3242 if ( eSIR_SUCCESS != limSendExcludeUnencryptInd(pMac, FALSE, psessionEntry) )
3243 {
3244 limLog( pMac, LOGE,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003245 FL( "Could not send down Exclude Unencrypted Indication!" ) );
Chet Lanctot186b5732013-03-18 10:26:30 -07003246 }
3247 }
3248#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003249}
3250/**
3251 * limProcessMlmSetKeyRsp()
3252 *
3253 *FUNCTION:
3254 * This function is called to process the following two
3255 * messages from HAL:
3256 * 1) WDA_SET_BSSKEY_RSP
3257 * 2) WDA_SET_STAKEY_RSP
3258 * 3) WDA_SET_STA_BCASTKEY_RSP
3259 * Upon receipt of this message from HAL,
3260 * MLME -
3261 * > Determines the "state" in which this message was received
3262 * > Forwards it to the appropriate callback
3263 *
3264 *LOGIC:
3265 * WDA_SET_BSSKEY_RSP/WDA_SET_STAKEY_RSP can be
3266 * received by MLME while in the following state:
3267 * MLME state = eLIM_MLM_WT_SET_BSS_KEY_STATE --OR--
3268 * MLME state = eLIM_MLM_WT_SET_STA_KEY_STATE --OR--
3269 * MLME state = eLIM_MLM_WT_SET_STA_BCASTKEY_STATE
3270 * Based on this state, this API will determine where to
3271 * route the message to
3272 *
3273 *ASSUMPTIONS:
3274 * ONLY the MLME state is being taken into account for now.
3275 * This is because, it appears that the handling of the
3276 * SETKEYS REQ is handled symmetrically on both the AP & STA
3277 *
3278 *NOTE:
3279 *
3280 * @param pMac Pointer to Global MAC structure
3281 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3282 *
3283 * @return None
3284 */
3285void limProcessMlmSetStaKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3286{
Jeff Johnsone7245742012-09-05 17:12:55 -07003287 tANI_U8 respReqd = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 tLimMlmSetKeysCnf mlmSetKeysCnf;
3289 tANI_U8 sessionId = 0;
3290 tpPESession psessionEntry;
3291 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303292 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003294 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003296 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 return;
3298 }
3299 sessionId = ((tpSetStaKeyParams) limMsgQ->bodyptr)->sessionId;
3300 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3301 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003302 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303303 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003304 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 return;
3306 }
3307 if( eLIM_MLM_WT_SET_STA_KEY_STATE != psessionEntry->limMlmState )
3308 {
3309 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003310 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 // There's not much that MLME can do at this stage...
3312 respReqd = 0;
3313 }
3314 else
3315 mlmSetKeysCnf.resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status);
3316
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303317 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003318 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003321 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 if( respReqd )
3323 {
3324 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3325 // Prepare and Send LIM_MLM_SETKEYS_CNF
3326 if( NULL != lpLimMlmSetKeysReq )
3327 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303328 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3329 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3330 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303332 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 pMac->lim.gpLimMlmSetKeysReq = NULL;
3334 }
3335 mlmSetKeysCnf.sessionId = sessionId;
Jeff Johnsone7245742012-09-05 17:12:55 -07003336 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 }
3338}
3339void limProcessMlmSetBssKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3340{
3341 tANI_U8 respReqd = 1;
3342 tLimMlmSetKeysCnf mlmSetKeysCnf;
Jeff Johnsone7245742012-09-05 17:12:55 -07003343 tANI_U16 resultCode;
3344 tANI_U8 sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 tpPESession psessionEntry;
3346 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303347 vos_mem_set((void *)&mlmSetKeysCnf, sizeof( tLimMlmSetKeysCnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 //BTAMP
Jeff Johnsone7245742012-09-05 17:12:55 -07003349 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003351 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is null"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 return;
3353 }
3354 sessionId = ((tpSetBssKeyParams) limMsgQ->bodyptr)->sessionId;
3355 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
3356 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003357 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303358 vos_mem_free( limMsgQ->bodyptr );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003359 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 return;
3361 }
3362 if( eLIM_MLM_WT_SET_BSS_KEY_STATE == psessionEntry->limMlmState )
3363 resultCode = (tANI_U16) (((tpSetBssKeyParams) limMsgQ->bodyptr)->status);
3364 else
3365 resultCode = (tANI_U16) (((tpSetStaKeyParams) limMsgQ->bodyptr)->status); //BCAST key also uses tpSetStaKeyParams. Done this way for readabilty.
3366
Jeff Johnsone7245742012-09-05 17:12:55 -07003367 //
3368 // TODO & FIXME_GEN4
3369 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3370 //
Jeff Johnson295189b2012-06-20 16:38:30 -07003371 // Validate SME/LIM state - Read the above "ASSUMPTIONS"
3372 //if( eLIM_SME_LINK_EST_STATE == pMac->lim.gLimSmeState )
3373 //{
3374 // Validate MLME state
3375 if( eLIM_MLM_WT_SET_BSS_KEY_STATE != psessionEntry->limMlmState &&
3376 eLIM_MLM_WT_SET_STA_BCASTKEY_STATE != psessionEntry->limMlmState )
3377 {
3378 // Mesg received from HAL in Invalid state!
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003379 limLog( pMac, LOGW, FL( "Received unexpected [Mesg Id - %d] in state %X" ), limMsgQ->type, psessionEntry->limMlmState );
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 // There's not much that MLME can do at this stage...
3381 respReqd = 0;
3382 }
3383 else
3384 mlmSetKeysCnf.resultCode = resultCode;
3385
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303386 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003387 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 // Restore MLME state
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3390
Jeff Johnsone7245742012-09-05 17:12:55 -07003391 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 if( respReqd )
3393 {
3394 tpLimMlmSetKeysReq lpLimMlmSetKeysReq = (tpLimMlmSetKeysReq) pMac->lim.gpLimMlmSetKeysReq;
3395 mlmSetKeysCnf.sessionId = sessionId;
3396
3397 // Prepare and Send LIM_MLM_SETKEYS_CNF
3398 if( NULL != lpLimMlmSetKeysReq )
3399 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303400 vos_mem_copy((tANI_U8 *) &mlmSetKeysCnf.peerMacAddr,
3401 (tANI_U8 *) lpLimMlmSetKeysReq->peerMacAddr,
3402 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 // Free the buffer cached for the global pMac->lim.gpLimMlmSetKeysReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303404 vos_mem_free(pMac->lim.gpLimMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003405 pMac->lim.gpLimMlmSetKeysReq = NULL;
3406 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003407 limPostSmeMessage(pMac, LIM_MLM_SETKEYS_CNF, (tANI_U32 *) &mlmSetKeysCnf);
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 }
3409}
3410/**
3411 * limProcessMlmRemoveKeyRsp()
3412 *
3413 *FUNCTION:
3414 *
3415 *LOGIC:
3416 *
3417 *ASSUMPTIONS:
3418 *
3419 *NOTE:
3420 *
3421 * @param pMac Pointer to Global MAC structure
3422 * @param tSirMsgQ The MsgQ header, which contains the response buffer
3423 *
3424 * @return None
3425 */
3426void limProcessMlmRemoveKeyRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ )
3427{
Jeff Johnsone7245742012-09-05 17:12:55 -07003428 tANI_U8 respReqd = 1;
3429 tLimMlmRemoveKeyCnf mlmRemoveCnf;
3430 tANI_U16 resultCode;
3431 tANI_U8 sessionId = 0;
3432 tpPESession psessionEntry;
3433 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303434 vos_mem_set((void *) &mlmRemoveCnf, sizeof( tLimMlmRemoveKeyCnf ), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07003435
3436 if( NULL == limMsgQ->bodyptr )
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003438 PELOGE(limLog(pMac, LOGE,FL("limMsgQ bodyptr is NULL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003439 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 }
3441
Jeff Johnsone7245742012-09-05 17:12:55 -07003442 if (limMsgQ->type == WDA_REMOVE_STAKEY_RSP)
3443 sessionId = ((tpRemoveStaKeyParams) limMsgQ->bodyptr)->sessionId;
3444 else if (limMsgQ->type == WDA_REMOVE_BSSKEY_RSP)
3445 sessionId = ((tpRemoveBssKeyParams) limMsgQ->bodyptr)->sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003446
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003449 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07003450 return;
3451 }
3452
3453 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE == psessionEntry->limMlmState )
3454 resultCode = (tANI_U16) (((tpRemoveBssKeyParams) limMsgQ->bodyptr)->status);
3455 else
3456 resultCode = (tANI_U16) (((tpRemoveStaKeyParams) limMsgQ->bodyptr)->status);
3457
3458 // Validate MLME state
3459 if( eLIM_MLM_WT_REMOVE_BSS_KEY_STATE != psessionEntry->limMlmState &&
3460 eLIM_MLM_WT_REMOVE_STA_KEY_STATE != psessionEntry->limMlmState )
3461 {
3462 // Mesg received from HAL in Invalid state!
3463 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003464 FL("Received unexpected [Mesg Id - %d] in state %X"),
Jeff Johnsone7245742012-09-05 17:12:55 -07003465 limMsgQ->type,
3466 psessionEntry->limMlmState );
3467 respReqd = 0;
3468 }
3469 else
3470 mlmRemoveCnf.resultCode = resultCode;
3471
3472 //
3473 // TODO & FIXME_GEN4
3474 // Need to inspect tSirMsgQ.reserved for a valid Dialog token!
3475 //
3476
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303477 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003478 limMsgQ->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07003479
3480 // Restore MLME state
3481 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3482 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
3483
3484 if( respReqd )
3485 {
3486 tpLimMlmRemoveKeyReq lpLimMlmRemoveKeyReq = (tpLimMlmRemoveKeyReq) pMac->lim.gpLimMlmRemoveKeyReq;
3487 mlmRemoveCnf.sessionId = sessionId;
3488
3489 // Prepare and Send LIM_MLM_REMOVEKEY_CNF
3490 if( NULL != lpLimMlmRemoveKeyReq )
3491 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303492 vos_mem_copy((tANI_U8 *) &mlmRemoveCnf.peerMacAddr,
3493 (tANI_U8 *) lpLimMlmRemoveKeyReq->peerMacAddr,
3494 sizeof( tSirMacAddr ));
Jeff Johnsone7245742012-09-05 17:12:55 -07003495 // Free the buffer cached for the global pMac->lim.gpLimMlmRemoveKeyReq
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303496 vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07003497 pMac->lim.gpLimMlmRemoveKeyReq = NULL;
3498 }
3499 limPostSmeMessage( pMac, LIM_MLM_REMOVEKEY_CNF, (tANI_U32 *) &mlmRemoveCnf );
3500 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003501}
3502
Jeff Johnson295189b2012-06-20 16:38:30 -07003503
3504/** ---------------------------------------------------------------------
3505\fn limProcessInitScanRsp
3506\brief This function is called when LIM receives WDA_INIT_SCAN_RSP
3507\ message from HAL. If status code is failure, then
3508\ update the gLimNumOfConsecutiveBkgndScanFailure count.
3509\param tpAniSirGlobal pMac
3510\param tANI_U32 body
3511\return none
3512\ ----------------------------------------------------------------------- */
3513void limProcessInitScanRsp(tpAniSirGlobal pMac, void *body)
3514{
3515 tpInitScanParams pInitScanParam;
3516 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3518 pInitScanParam = (tpInitScanParams) body;
3519 status = pInitScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303520 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003521
3522 //Only abort scan if the we are scanning.
3523 if( pMac->lim.abortScan &&
3524 (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
3525 {
krunal sonid3d60e12013-07-17 13:24:09 -07003526 limLog( pMac, LOGW, FL(" abort scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 pMac->lim.abortScan = 0;
3528 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3529 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3530 //Set the resume channel to Any valid channel (invalid).
3531 //This will instruct HAL to set it to any previous valid channel.
3532 peSetResumeChannel(pMac, 0, 0);
krunal sonid3d60e12013-07-17 13:24:09 -07003533 if (status != eHAL_STATUS_SUCCESS)
3534 {
3535 PELOGW(limLog(pMac, LOGW, FL("InitScnRsp failed status=%d"),status);)
3536 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3537 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3538 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3539 return;
3540 }
3541 else
3542 {
3543 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3544 }
3545
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 }
3547 switch(pMac->lim.gLimHalScanState)
3548 {
3549 case eLIM_HAL_INIT_SCAN_WAIT_STATE:
3550 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3551 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003552 PELOGW(limLog(pMac, LOGW, FL("InitScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
3554 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure += 1;
3555 /*
3556 * On Windows eSIR_SME_HAL_SCAN_INIT_FAILED message to CSR may trigger
3557 * another Scan request in the same context (happens when 11d is enabled
3558 * and first scan request with 11d channels fails for whatever reason, then CSR issues next init
3559 * scan in the same context but with bigger channel list), so the state needs to be
3560 * changed before this response message is sent.
3561 */
3562 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 return;
3564 }
3565 else if (status == eHAL_STATUS_SUCCESS)
3566 {
3567 /* since we have successfully triggered a background scan,
3568 * reset the "consecutive bkgnd scan failure" count to 0
3569 */
3570 pMac->lim.gLimNumOfConsecutiveBkgndScanFailure = 0;
3571 pMac->lim.gLimNumOfBackgroundScanSuccess += 1;
Praveen Kumar Sirisilla7ea8dc92013-12-22 16:35:05 -08003572 pMac->lim.probeCounter = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003573 }
3574 limContinueChannelScan(pMac);
3575 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003576//WLAN_SUSPEND_LINK Related
3577 case eLIM_HAL_SUSPEND_LINK_WAIT_STATE:
3578 if( pMac->lim.gpLimSuspendCallback )
3579 {
Abhishek Singh53bfb332013-12-12 18:03:29 +05303580 if( eHAL_STATUS_SUCCESS == status )
3581 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 pMac->lim.gLimHalScanState = eLIM_HAL_SUSPEND_LINK_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303583 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003584 else
Abhishek Singh53bfb332013-12-12 18:03:29 +05303585 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
Abhishek Singh53bfb332013-12-12 18:03:29 +05303587 pMac->lim.gLimSystemInScanLearnMode = 0;
3588 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003589
3590 pMac->lim.gpLimSuspendCallback( pMac, status, pMac->lim.gpLimSuspendData );
3591 pMac->lim.gpLimSuspendCallback = NULL;
3592 pMac->lim.gpLimSuspendData = NULL;
3593 }
3594 else
3595 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003596 limLog( pMac, LOGP, "No suspend link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07003597 return;
3598 }
3599 break;
3600//end WLAN_SUSPEND_LINK Related
3601 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003602 limLog(pMac, LOGW, FL("limProcessInitScanRsp: Rcvd InitScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 pMac->lim.gLimHalScanState);
3604 break;
3605 }
3606 return;
3607}
3608/**
3609 * limProcessSwitchChannelReAssocReq()
3610 *
3611 *FUNCTION:
3612 * This function is called to send the reassoc req mgmt frame after the
3613 * switchChannelRsp message is received from HAL.
3614 *
3615 *LOGIC:
3616 *
3617 *ASSUMPTIONS:
3618 * NA
3619 *
3620 *NOTE:
3621 * NA
3622 *
3623 * @param pMac - Pointer to Global MAC structure.
3624 * @param psessionEntry - session related information.
3625 * @param status - channel switch success/failure.
3626 *
3627 * @return None
3628 */
3629static void limProcessSwitchChannelReAssocReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3630{
3631 tLimMlmReassocCnf mlmReassocCnf;
3632 tLimMlmReassocReq *pMlmReassocReq;
3633 pMlmReassocReq = (tLimMlmReassocReq *)(psessionEntry->pLimMlmReassocReq);
3634 if(pMlmReassocReq == NULL)
3635 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003636 limLog(pMac, LOGP, FL("pLimMlmReassocReq does not exist for given switchChanSession"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3638 goto end;
3639 }
3640
3641 if(status != eHAL_STATUS_SUCCESS)
3642 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003643 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 mlmReassocCnf.resultCode = eSIR_SME_CHANNEL_SWITCH_FAIL;
3645 goto end;
3646 }
3647 /// Start reassociation failure timer
Jeff Johnsone7245742012-09-05 17:12:55 -07003648 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3650 != TX_SUCCESS)
3651 {
3652 /// Could not start reassoc failure timer.
3653 // Log error
3654 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003655 FL("could not start Reassociation failure timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003656 // Return Reassoc confirm with
3657 // Resources Unavailable
3658 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3659 goto end;
3660 }
3661 /// Prepare and send Reassociation request frame
3662 limSendReassocReqMgmtFrame(pMac, pMlmReassocReq, psessionEntry);
3663 return;
3664end:
3665 // Free up buffer allocated for reassocReq
3666 if(pMlmReassocReq != NULL)
3667 {
3668 /* Update PE session Id*/
3669 mlmReassocCnf.sessionId = pMlmReassocReq->sessionId;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303670 vos_mem_free(pMlmReassocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003671 psessionEntry->pLimMlmReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 }
3673 else
3674 {
3675 mlmReassocCnf.sessionId = 0;
3676 }
3677
3678 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3679 /* Update PE sessio Id*/
3680 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3681
3682 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3683}
3684/**
3685 * limProcessSwitchChannelJoinReq()
3686 *
3687 *FUNCTION:
3688 * This function is called to send the probe req mgmt frame after the
3689 * switchChannelRsp message is received from HAL.
3690 *
3691 *LOGIC:
3692 *
3693 *ASSUMPTIONS:
3694 * NA
3695 *
3696 *NOTE:
3697 * NA
3698 *
3699 * @param pMac - Pointer to Global MAC structure.
3700 * @param psessionEntry - session related information.
3701 * @param status - channel switch success/failure.
3702 *
3703 * @return None
3704 */
3705static void limProcessSwitchChannelJoinReq(tpAniSirGlobal pMac, tpPESession psessionEntry, eHalStatus status)
3706{
3707 tANI_U32 val;
3708 tSirMacSSid ssId;
3709 tLimMlmJoinCnf mlmJoinCnf;
3710 if(status != eHAL_STATUS_SUCCESS)
3711 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003712 PELOGE(limLog(pMac, LOGE, FL("Change channel failed!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 goto error;
3714 }
3715
3716 if ( (NULL == psessionEntry ) || (NULL == psessionEntry->pLimMlmJoinReq) )
3717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003718 PELOGE(limLog(pMac, LOGE, FL("invalid pointer!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 goto error;
3720 }
3721
Jeff Johnsone7245742012-09-05 17:12:55 -07003722
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 /* eSIR_BTAMP_AP_MODE stroed as bss type in session Table when join req is received, is to be veified */
3724 if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
3725 {
3726 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_PREASSOC_STATE, psessionEntry->bssId,
3727 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303728 {
3729 PELOGE(limLog(pMac, LOGE, FL("Sessionid: %d Set link state "
3730 "failed!! BSSID:"MAC_ADDRESS_STR),psessionEntry->peSessionId,
3731 MAC_ADDR_ARRAY(psessionEntry->bssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003732 goto error;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303733 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003735
3736 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
3737 if(wlan_cfgGetInt(pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003738 limLog(pMac, LOGP, FL("failed to get WNI_CFG_TRIG_STA_BK_SCAN cfg value!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
3740 // Apply previously set configuration at HW
3741 limApplyConfiguration(pMac, psessionEntry);
Abhishek Singhde51a412014-05-20 19:17:26 +05303742
3743 /* If sendDeauthBeforeCon is enabled, Send Deauth first to AP if last
3744 * disconnection was caused by HB failure.
3745 */
3746 if(pMac->roam.configParam.sendDeauthBeforeCon)
3747 {
3748 int apCount;
3749
3750 for(apCount = 0; apCount < 2; apCount++)
3751 {
3752
3753 if (vos_mem_compare(psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3754 pMac->lim.gLimHeartBeatApMac[apCount], sizeof(tSirMacAddr)))
3755 {
3756 limLog(pMac, LOGE, FL("Index %d Sessionid: %d Send deauth on "
3757 "channel %d to BSSID: "MAC_ADDRESS_STR ), apCount,
3758 psessionEntry->peSessionId, psessionEntry->currentOperChannel,
3759 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
3760
3761 limSendDeauthMgmtFrame( pMac, eSIR_MAC_UNSPEC_FAILURE_REASON,
3762 psessionEntry->pLimMlmJoinReq->bssDescription.bssId,
3763 psessionEntry, FALSE );
3764
3765 vos_mem_zero(pMac->lim.gLimHeartBeatApMac[apCount],
3766 sizeof(tSirMacAddr));
3767 break;
3768 }
3769 }
3770 }
3771
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 /// Wait for Beacon to announce join success
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303773 vos_mem_copy(ssId.ssId,
3774 psessionEntry->ssId.ssId,
3775 psessionEntry->ssId.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 ssId.length = psessionEntry->ssId.length;
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003777
3778 limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER);
3779
3780 //assign appropriate sessionId to the timer object
3781 pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId = psessionEntry->peSessionId;
Abhishek Singhde51a412014-05-20 19:17:26 +05303782 limLog(pMac, LOG1, FL("Sessionid: %d Send Probe req on channel %d ssid: %.*s "
3783 "BSSID: "MAC_ADDRESS_STR ), psessionEntry->peSessionId,
3784 psessionEntry->currentOperChannel, ssId.length, ssId.ssId,
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303785 MAC_ADDR_ARRAY(psessionEntry->pLimMlmJoinReq->bssDescription.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07003786 // include additional IE if there is
3787 limSendProbeReqMgmtFrame( pMac, &ssId,
3788 psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/,
3789 psessionEntry->selfMacAddr, psessionEntry->dot11mode,
3790 psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata);
Jeff Johnsone7245742012-09-05 17:12:55 -07003791
3792 // Sending mgmt frame is a blocking call activate Join failure timer now
3793 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_JOIN_FAIL_TIMER));
3794 if (tx_timer_activate(&pMac->lim.limTimers.gLimJoinFailureTimer) != TX_SUCCESS)
3795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003796 limLog(pMac, LOGP, FL("could not activate Join failure timer"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003797 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
3798 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, pMac->lim.gLimMlmState));
3799 //memory is freed up below.
3800 psessionEntry->pLimMlmJoinReq = NULL;
3801 goto error;
3802 }
3803
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003804 if( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE )
3805 {
Yathish9f22e662012-12-10 14:21:35 -08003806 // Activate Join Periodic Probe Req timer
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003807 if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS)
3808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003809 limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer"));
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003810 goto error;
3811 }
3812 }
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08003813
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 return;
3815error:
3816 if(NULL != psessionEntry)
3817 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303818 vos_mem_free(psessionEntry->pLimMlmJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 psessionEntry->pLimMlmJoinReq = NULL;
3820 mlmJoinCnf.sessionId = psessionEntry->peSessionId;
3821 }
3822 else
3823 {
3824 mlmJoinCnf.sessionId = 0;
3825 }
3826 mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3827 mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3828 limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf);
3829}
3830
3831/**
3832 * limProcessSwitchChannelRsp()
3833 *
3834 *FUNCTION:
3835 * This function is called to process switchChannelRsp message from HAL.
3836 *
3837 *LOGIC:
3838 *
3839 *ASSUMPTIONS:
3840 * NA
3841 *
3842 *NOTE:
3843 * NA
3844 *
3845 * @param pMac - Pointer to Global MAC structure
3846 * @param body - message body.
3847 *
3848 * @return None
3849 */
3850void limProcessSwitchChannelRsp(tpAniSirGlobal pMac, void *body)
3851{
3852 tpSwitchChannelParams pChnlParams = NULL;
3853 eHalStatus status;
3854 tANI_U16 channelChangeReasonCode;
3855 tANI_U8 peSessionId;
3856 tpPESession psessionEntry;
3857 //we need to process the deferred message since the initiating req. there might be nested request.
3858 //in the case of nested request the new request initiated from the response will take care of resetting
3859 //the deffered flag.
3860 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3861 pChnlParams = (tpSwitchChannelParams) body;
3862 status = pChnlParams->status;
3863 peSessionId = pChnlParams->peSessionId;
3864 if((psessionEntry = peFindSessionBySessionId(pMac, peSessionId))== NULL)
3865 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303866 vos_mem_free(body);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003867 limLog(pMac, LOGP, FL("session does not exist for given sessionId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003868 return;
3869 }
3870#if defined WLAN_FEATURE_VOWIFI
3871 //HAL fills in the tx power used for mgmt frames in this field.
3872 //Store this value to use in TPC report IE.
3873 rrmCacheMgmtTxPower( pMac, pChnlParams->txMgmtPower, psessionEntry );
3874#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303875 vos_mem_free(body);
Jeff Johnson295189b2012-06-20 16:38:30 -07003876 channelChangeReasonCode = psessionEntry->channelChangeReasonCode;
3877 // initialize it back to invalid id
3878 psessionEntry->channelChangeReasonCode = 0xBAD;
Abhishek Singhdcbd8272014-01-09 14:16:01 +05303879 limLog(pMac, LOG1, FL("channelChangeReasonCode %d"),channelChangeReasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 switch(channelChangeReasonCode)
3881 {
3882 case LIM_SWITCH_CHANNEL_REASSOC:
3883 limProcessSwitchChannelReAssocReq(pMac, psessionEntry, status);
3884 break;
3885 case LIM_SWITCH_CHANNEL_JOIN:
3886 limProcessSwitchChannelJoinReq(pMac, psessionEntry, status);
3887 break;
3888
3889 case LIM_SWITCH_CHANNEL_OPERATION:
3890 /*
3891 * The above code should also use the callback.
3892 * mechanism below, there is scope for cleanup here.
3893 * THat way all this response handler does is call the call back
3894 * We can get rid of the reason code here.
3895 */
3896 if (pMac->lim.gpchangeChannelCallback)
3897 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003898 PELOG1(limLog( pMac, LOG1, "Channel changed hence invoke registered call back");)
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08003899 if (eHAL_CHANNEL_SWITCH_SOURCE_CSA == pChnlParams->channelSwitchSrc )
3900 {
3901 if (IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
3902 {
3903 if ( psessionEntry && psessionEntry->limSmeState
3904 == eLIM_SME_LINK_EST_STATE )
3905 {
3906 peSetResumeChannel( pMac,
3907 psessionEntry->currentOperChannel,
3908 psessionEntry->htSecondaryChannelOffset);
3909 }
3910 else
3911 {
3912 peSetResumeChannel( pMac, 0, 0);
3913 }
3914 limResumeLink(pMac, limSwitchChannelResumeLinkRsp, NULL);
3915 }
3916 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 pMac->lim.gpchangeChannelCallback(pMac, status, pMac->lim.gpchangeChannelData, psessionEntry);
3918 }
3919 break;
3920 default:
3921 break;
3922 }
3923}
3924/**
3925 * limProcessStartScanRsp()
3926 *
3927 *FUNCTION:
3928 * This function is called to process startScanRsp message from HAL. If scan/learn was successful
3929 * then it will start scan/learn on the next channel.
3930 *
3931 *LOGIC:
3932 *
3933 *ASSUMPTIONS:
3934 * NA
3935 *
3936 *NOTE:
3937 * NA
3938 *
3939 * @param pMac - Pointer to Global MAC structure
3940 * @param body - message body.
3941 *
3942 * @return None
3943 */
3944
3945void limProcessStartScanRsp(tpAniSirGlobal pMac, void *body)
3946{
3947 tpStartScanParams pStartScanParam;
3948 eHalStatus status;
3949 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3950 pStartScanParam = (tpStartScanParams) body;
3951 status = pStartScanParam->status;
3952#if defined WLAN_FEATURE_VOWIFI
3953 //HAL fills in the tx power used for mgmt frames in this field.
3954 //Store this value to use in TPC report IE.
3955 rrmCacheMgmtTxPower( pMac, pStartScanParam->txMgmtPower, NULL );
3956 //Store start TSF of scan start. This will be stored in BSS params.
3957 rrmUpdateStartTSF( pMac, pStartScanParam->startTSF );
3958#endif
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05303959 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08003960 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 if( pMac->lim.abortScan )
3962 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003963 limLog( pMac, LOGW, FL(" finish scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 pMac->lim.abortScan = 0;
3965 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
3966 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
3967 //Set the resume channel to Any valid channel (invalid).
3968 //This will instruct HAL to set it to any previous valid channel.
3969 peSetResumeChannel(pMac, 0, 0);
3970 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
3971 }
3972 switch(pMac->lim.gLimHalScanState)
3973 {
3974 case eLIM_HAL_START_SCAN_WAIT_STATE:
3975 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
3976 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003977 PELOGW(limLog(pMac, LOGW, FL("StartScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 //
3979 // FIXME - With this, LIM will try and recover state, but
3980 // eWNI_SME_SCAN_CNF maybe reporting an incorrect
3981 // status back to the SME
3982 //
3983 //Set the resume channel to Any valid channel (invalid).
3984 //This will instruct HAL to set it to any previous valid channel.
3985 peSetResumeChannel(pMac, 0, 0);
3986 limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE );
3987 //limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
3988 }
3989 else
3990 {
3991 pMac->lim.gLimHalScanState = eLIM_HAL_SCANNING_STATE;
3992 limContinuePostChannelScan(pMac);
3993 }
3994 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003996 limLog(pMac, LOGW, FL("Rcvd StartScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 pMac->lim.gLimHalScanState);
3998 break;
3999 }
4000 return;
4001}
4002void limProcessEndScanRsp(tpAniSirGlobal pMac, void *body)
4003{
4004 tpEndScanParams pEndScanParam;
4005 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4007 pEndScanParam = (tpEndScanParams) body;
4008 status = pEndScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304009 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004010 body = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 switch(pMac->lim.gLimHalScanState)
4012 {
4013 case eLIM_HAL_END_SCAN_WAIT_STATE:
4014 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4015 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004016 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4018 limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED);
4019 }
4020 else
4021 {
Madan Mohan Koyyalamudic5992c92012-11-15 16:40:57 -08004022 pMac->lim.gLimCurrentScanChannelId++;
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 limContinueChannelScan(pMac);
4024 }
4025 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004027 limLog(pMac, LOGW, FL("Rcvd endScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 pMac->lim.gLimHalScanState);
4029 break;
4030 }
4031 return;
4032}
Jeff Johnsone7245742012-09-05 17:12:55 -07004033/**
4034 * limStopTxAndSwitch()
4035 *
4036 *FUNCTION:
4037 * Start channel switch on all sessions that is in channel switch state.
4038 *
4039 * @param pMac - pointer to global adapter context
4040 *
4041 * @return None
4042 *
4043 */
4044static void
4045limStopTxAndSwitch (tpAniSirGlobal pMac)
4046{
4047 tANI_U8 i;
4048
4049 for(i =0; i < pMac->lim.maxBssId; i++)
4050 {
4051 if(pMac->lim.gpSession[i].valid &&
4052 pMac->lim.gpSession[i].gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
4053 {
4054 limStopTxAndSwitchChannel(pMac, i);
4055 }
4056 }
4057 return;
4058}
4059/**
4060 * limStartQuietOnSession()
4061 *
4062 *FUNCTION:
4063 * This function is called to start quiet timer after finish scan if there is
4064 * qeuieting on any session.
4065 *
4066 *LOGIC:
4067 *
4068 *ASSUMPTIONS:
4069 * NA
4070 *
4071 *NOTE:
4072 * NA
4073 *
4074 * @param pMac - Pointer to Global MAC structure
4075 *
4076 * @return None
4077 */
4078static void
4079limStartQuietOnSession (tpAniSirGlobal pMac)
4080{
4081 tANI_U8 i;
4082
4083 for(i =0; i < pMac->lim.maxBssId; i++)
4084 {
4085 if(pMac->lim.gpSession[i].valid &&
4086 pMac->lim.gpSession[i].gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN)
4087 {
4088 limStartQuietTimer(pMac, i);
4089 }
4090 }
4091 return;
4092}
Jeff Johnson295189b2012-06-20 16:38:30 -07004093void limProcessFinishScanRsp(tpAniSirGlobal pMac, void *body)
4094{
4095 tpFinishScanParams pFinishScanParam;
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 eHalStatus status;
4097 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4098 pFinishScanParam = (tpFinishScanParams) body;
4099 status = pFinishScanParam->status;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304100 vos_mem_free(body);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004101 body = NULL;
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004102
Sushant Kaushik826de802014-05-08 18:04:11 +05304103 limLog(pMac, LOG1, FL("Rcvd FinishScanRsp in state %d channel %d "),
4104 pMac->lim.gLimHalScanState,
4105 pFinishScanParam->currentOperChannel);
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004106
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 switch(pMac->lim.gLimHalScanState)
4108 {
4109 case eLIM_HAL_FINISH_SCAN_WAIT_STATE:
4110 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4111 limCompleteMlmScan(pMac, eSIR_SME_SUCCESS);
Jeff Johnsone7245742012-09-05 17:12:55 -07004112 if (limIsChanSwitchRunning(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 {
4114 /** Right time to stop tx and start the timer for channel switch */
4115 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4116 * be any associated session id
4117 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004118 limStopTxAndSwitch(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004120 else if (limIsQuietBegin(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 {
4122 /** Start the quieting */
4123 /* Sending Session ID 0, may not be correct, since SCAN is global there should not
4124 * be any associated session id
4125 */
Jeff Johnsone7245742012-09-05 17:12:55 -07004126 limStartQuietOnSession(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004128 if (status != (tANI_U32) eHAL_STATUS_SUCCESS)
4129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004130 PELOGW(limLog(pMac, LOGW, FL("EndScanRsp with failed status= %d"), status);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 }
4132 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004133//WLAN_SUSPEND_LINK Related
4134 case eLIM_HAL_RESUME_LINK_WAIT_STATE:
4135 if( pMac->lim.gpLimResumeCallback )
4136 {
4137 pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE;
4138 pMac->lim.gpLimResumeCallback( pMac, status, pMac->lim.gpLimResumeData );
4139 pMac->lim.gpLimResumeCallback = NULL;
4140 pMac->lim.gpLimResumeData = NULL;
4141 pMac->lim.gLimSystemInScanLearnMode = 0;
4142 }
4143 else
4144 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004145 limLog( pMac, LOGP, "No Resume link callback set but station is in suspend state");
Jeff Johnson295189b2012-06-20 16:38:30 -07004146 return;
4147 }
4148 break;
4149//end WLAN_SUSPEND_LINK Related
4150
4151 default:
Praveen Kumar Sirisillaac600a82013-10-18 11:07:47 -07004152 limLog(pMac, LOGE, FL("Rcvd FinishScanRsp not in WAIT State, state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 pMac->lim.gLimHalScanState);
4154 break;
4155 }
4156 return;
4157}
4158/**
4159 * @function : limProcessMlmHalAddBARsp
4160 *
4161 * @brief: Process WDA_ADDBA_RSP coming from HAL
4162 *
4163 *
4164 * @param pMac The global tpAniSirGlobal object
4165 *
4166 * @param tSirMsgQ The MsgQ header containing the response buffer
4167 *
4168 * @return none
4169 */
4170void limProcessMlmHalAddBARsp( tpAniSirGlobal pMac,
4171 tpSirMsgQ limMsgQ )
4172{
4173 // Send LIM_MLM_ADDBA_CNF to LIM
4174 tpLimMlmAddBACnf pMlmAddBACnf;
lukez3c809222013-05-03 10:23:02 -07004175 tpPESession psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 tpAddBAParams pAddBAParams = (tpAddBAParams) limMsgQ->bodyptr;
lukez3c809222013-05-03 10:23:02 -07004177
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 //now LIM can process any defer message.
4179 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
4180 if (pAddBAParams == NULL) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004181 PELOGE(limLog(pMac, LOGE,FL("NULL ADD BA Response from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 return;
4183 }
4184 if((psessionEntry = peFindSessionBySessionId(pMac, pAddBAParams->sessionId))==NULL)
4185 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004186 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionID: %d"),pAddBAParams->sessionId );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304187 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004188 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 return;
4190 }
4191#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4192 limDiagEventReport(pMac, WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, psessionEntry, 0, 0);
4193#endif //FEATURE_WLAN_DIAG_SUPPORT
4194
4195 // Allocate for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304196 pMlmAddBACnf = vos_mem_malloc(sizeof(tLimMlmAddBACnf));
4197 if ( NULL == pMlmAddBACnf ) {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004198 limLog( pMac, LOGP, FL(" AllocateMemory failed for pMlmAddBACnf"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304199 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004200 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 return;
4202 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304203 vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 // Copy the peer MAC
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304205 vos_mem_copy(pMlmAddBACnf->peerMacAddr, pAddBAParams->peerMacAddr,
4206 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 // Copy other ADDBA Rsp parameters
4208 pMlmAddBACnf->baDialogToken = pAddBAParams->baDialogToken;
4209 pMlmAddBACnf->baTID = pAddBAParams->baTID;
4210 pMlmAddBACnf->baPolicy = pAddBAParams->baPolicy;
4211 pMlmAddBACnf->baBufferSize = pAddBAParams->baBufferSize;
4212 pMlmAddBACnf->baTimeout = pAddBAParams->baTimeout;
4213 pMlmAddBACnf->baDirection = pAddBAParams->baDirection;
4214 pMlmAddBACnf->sessionId = psessionEntry->peSessionId;
4215 if(eHAL_STATUS_SUCCESS == pAddBAParams->status)
4216 pMlmAddBACnf->addBAResultCode = eSIR_MAC_SUCCESS_STATUS;
4217 else
4218 pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304219 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004220 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 // Send ADDBA CNF to LIM
4222 limPostSmeMessage( pMac, LIM_MLM_ADDBA_CNF, (tANI_U32 *) pMlmAddBACnf );
4223}
4224/**
4225 * \brief Process LIM_MLM_ADDBA_CNF
4226 *
4227 * \sa limProcessMlmAddBACnf
4228 *
4229 * \param pMac The global tpAniSirGlobal object
4230 *
4231 * \param tSirMsgQ The MsgQ header containing the response buffer
4232 *
4233 * \return none
4234 */
4235void limProcessMlmAddBACnf( tpAniSirGlobal pMac,
4236 tANI_U32 *pMsgBuf )
4237{
4238tpLimMlmAddBACnf pMlmAddBACnf;
4239tpDphHashNode pSta;
4240tANI_U16 aid;
4241tLimBAState curBaState;
4242tpPESession psessionEntry = NULL;
4243if(pMsgBuf == NULL)
4244{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004245 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 return;
4247}
4248pMlmAddBACnf = (tpLimMlmAddBACnf) pMsgBuf;
4249 if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBACnf->sessionId))== NULL)
4250 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004251 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304252 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 return;
4254 }
4255 // First, extract the DPH entry
4256 pSta = dphLookupHashEntry( pMac, pMlmAddBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4257 if( NULL == pSta )
4258 {
4259 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004260 FL( "STA context not found - ignoring ADDBA CNF from HAL" ));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304261 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 return;
4263 }
4264 LIM_GET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, &curBaState);
4265 // Need to validate SME state
4266 if( eLIM_BA_STATE_WT_ADD_RSP != curBaState)
4267 {
4268 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004269 FL( "Received unexpected ADDBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 curBaState );)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304271 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004272 return;
4273 }
4274 // Restore STA BA state
4275 LIM_SET_STA_BA_STATE(pSta, pMlmAddBACnf->baTID, eLIM_BA_STATE_IDLE);
Jeff Johnson43971f52012-07-17 12:26:56 -07004276 if( eSIR_MAC_SUCCESS_STATUS == pMlmAddBACnf->addBAResultCode )
Jeff Johnson295189b2012-06-20 16:38:30 -07004277 {
4278 // Update LIM internal cache...
4279 if( eBA_RECIPIENT == pMlmAddBACnf->baDirection )
4280 {
4281 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBARx = 1;
4282 pSta->tcCfg[pMlmAddBACnf->baTID].fRxCompBA = 1;
4283 pSta->tcCfg[pMlmAddBACnf->baTID].fRxBApolicy = pMlmAddBACnf->baPolicy;
4284 pSta->tcCfg[pMlmAddBACnf->baTID].rxBufSize = pMlmAddBACnf->baBufferSize;
4285 pSta->tcCfg[pMlmAddBACnf->baTID].tuRxBAWaitTimeout = pMlmAddBACnf->baTimeout;
Shailender Karmuchi2a74d4c2013-03-24 23:25:27 -07004286 // Package LIM_MLM_ADDBA_RSP to MLME, with proper
4287 // status code. MLME will then send an ADDBA RSP
4288 // over the air to the peer MAC entity
4289 if( eSIR_SUCCESS != limPostMlmAddBARsp( pMac,
4290 pMlmAddBACnf->peerMacAddr,
4291 pMlmAddBACnf->addBAResultCode,
4292 pMlmAddBACnf->baDialogToken,
4293 (tANI_U8) pMlmAddBACnf->baTID,
4294 (tANI_U8) pMlmAddBACnf->baPolicy,
4295 pMlmAddBACnf->baBufferSize,
4296 pMlmAddBACnf->baTimeout,psessionEntry))
4297 {
4298 PELOGW(limLog( pMac, LOGW,
4299 FL( "Failed to post LIM_MLM_ADDBA_RSP to " ));
4300 limPrintMacAddr( pMac, pMlmAddBACnf->peerMacAddr, LOGW );)
4301 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 }
4303 else
4304 {
4305 pSta->tcCfg[pMlmAddBACnf->baTID].fUseBATx = 1;
4306 pSta->tcCfg[pMlmAddBACnf->baTID].fTxCompBA = 1;
4307 pSta->tcCfg[pMlmAddBACnf->baTID].fTxBApolicy = pMlmAddBACnf->baPolicy;
4308 pSta->tcCfg[pMlmAddBACnf->baTID].txBufSize = pMlmAddBACnf->baBufferSize;
4309 pSta->tcCfg[pMlmAddBACnf->baTID].tuTxBAWaitTimeout = pMlmAddBACnf->baTimeout;
4310 }
4311 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004312 // Free the memory allocated for LIM_MLM_ADDBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304313 vos_mem_free(pMsgBuf);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004314 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004315}
4316/**
4317 * \brief Process LIM_MLM_DELBA_CNF
4318 *
4319 * \sa limProcessMlmDelBACnf
4320 *
4321 * \param pMac The global tpAniSirGlobal object
4322 *
4323 * \param tSirMsgQ The MsgQ header containing the response buffer
4324 *
4325 * \return none
4326 */
4327void limProcessMlmDelBACnf( tpAniSirGlobal pMac,
4328 tANI_U32 *pMsgBuf )
4329{
4330 tpLimMlmDelBACnf pMlmDelBACnf;
4331 tpDphHashNode pSta;
4332 tANI_U16 aid;
4333// tANI_U8 sessionId;
4334 tLimBAState curBaState;
4335 tpPESession psessionEntry;
4336
4337 if(pMsgBuf == NULL)
4338 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004339 PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004340 return;
4341 }
4342 pMlmDelBACnf = (tpLimMlmDelBACnf) pMsgBuf;
4343 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDelBACnf->sessionId))== NULL)
4344 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05304345 limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"),
4346 pMlmDelBACnf->sessionId);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304347 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004348 return;
4349 }
4350 // First, extract the DPH entry
4351 pSta = dphLookupHashEntry( pMac, pMlmDelBACnf->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4352 if( NULL == pSta )
4353 {
4354 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004355 FL( "STA context not found - ignoring DELBA CNF from HAL" ));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304356 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 return;
4358 }
4359 if(NULL == pMlmDelBACnf)
4360 {
4361 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004362 FL( "pMlmDelBACnf is NULL - ignoring DELBA CNF from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004363 return;
4364 }
4365 // Need to validate baState
4366 LIM_GET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, &curBaState);
4367 if( eLIM_BA_STATE_WT_DEL_RSP != curBaState )
4368 {
4369 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004370 FL( "Received unexpected DELBA CNF when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004371 curBaState );
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304372 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004373 return;
4374 }
4375 // Restore STA BA state
4376 LIM_SET_STA_BA_STATE(pSta, pMlmDelBACnf->baTID, eLIM_BA_STATE_IDLE);
4377 // Free the memory allocated for LIM_MLM_DELBA_CNF
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304378 vos_mem_free(pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07004379}
4380/**
4381 * \brief Process SIR_LIM_DEL_BA_IND
4382 *
4383 * \sa limProcessMlmHalBADeleteInd
4384 *
4385 * \param pMac The global tpAniSirGlobal object
4386 *
4387 * \param tSirMsgQ The MsgQ header containing the indication buffer
4388 *
4389 * \return none
4390 */
4391void limProcessMlmHalBADeleteInd( tpAniSirGlobal pMac,
4392 tpSirMsgQ limMsgQ )
4393{
4394 tSirRetStatus status = eSIR_SUCCESS;
4395 tpBADeleteParams pBADeleteParams;
4396 tpDphHashNode pSta;
4397 tANI_U16 aid;
4398 tLimBAState curBaState;
4399 tpPESession psessionEntry;
4400 tANI_U8 sessionId;
4401
4402 pBADeleteParams = (tpBADeleteParams) limMsgQ->bodyptr;
4403
4404 if((psessionEntry = peFindSessionByBssid(pMac,pBADeleteParams->bssId,&sessionId))== NULL)
4405 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004406 PELOGE(limLog(pMac, LOGE,FL("session does not exist for given BSSId"));)
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304407 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004408 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004409 return;
4410 }
4411 // First, extract the DPH entry
4412 pSta = dphLookupHashEntry( pMac, pBADeleteParams->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable );
4413 if( NULL == pSta )
4414 {
4415 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004416 FL( "STA context not found - ignoring BA Delete IND from HAL" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004417 goto returnAfterCleanup;
4418 }
4419
4420 // Need to validate BA state
4421 LIM_GET_STA_BA_STATE(pSta, pBADeleteParams->baTID, &curBaState);
4422 if( eLIM_BA_STATE_IDLE != curBaState )
4423 {
4424 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004425 FL( "Received unexpected BA Delete IND when STA BA state is %d" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 curBaState );
4427 goto returnAfterCleanup;
4428 }
4429
4430 // Validate if a BA is active for the requested TID
4431 // AND in that desired direction
4432 if( eBA_INITIATOR == pBADeleteParams->baDirection )
4433 {
4434 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBATx )
4435 status = eSIR_FAILURE;
4436 }
4437 else
4438 {
4439 if( 0 == pSta->tcCfg[pBADeleteParams->baTID].fUseBARx )
4440 status = eSIR_FAILURE;
4441 }
4442 if( eSIR_FAILURE == status )
4443 {
4444 limLog( pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004445 FL("Received an INVALID DELBA Delete Ind for TID %d..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 pBADeleteParams->baTID );
4447 }
4448 else
4449 {
4450 // Post DELBA REQ to MLME...
4451 if( eSIR_SUCCESS !=
4452 (status = limPostMlmDelBAReq( pMac,
4453 pSta,
4454 pBADeleteParams->baDirection,
4455 pBADeleteParams->baTID,
4456 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry )))
4457 {
4458 limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004459 FL( "Attempt to post LIM_MLM_DELBA_REQ failed with status %d" ), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07004460 }
4461 else
4462 {
4463 limLog( pMac, LOGE,
4464 FL( "BA Delete - Reason 0x%08x. Attempting to delete BA session for TID %d with peer STA " ),
4465 pBADeleteParams->reasonCode, pBADeleteParams->baTID );
4466 limPrintMacAddr( pMac, pSta->staAddr, LOGE );
4467 }
4468 }
4469returnAfterCleanup:
4470 // Free the memory allocated for SIR_LIM_DEL_BA_IND
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304471 vos_mem_free(limMsgQ->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004472 limMsgQ->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004473}
4474/**
4475 * @function : limProcessSetMimoRsp()
4476 *
4477 * @brief : This function is called upon receiving the WDA_SET_MIMOPS_RSP from the HAL
4478 * after Processing the Req from the SME (PMC)
4479 *
4480 * LOGIC:
4481 *
4482 * ASSUMPTIONS:
4483 * NA
4484 *
4485 * NOTE:
4486 * NA
4487 *
4488 * @param pMac - Pointer to Global MAC structure
4489 * @param limMsg - Lim Message structure object with the MimoPSparam in body
4490 * @return None
4491 */
4492
4493void
4494limProcessSetMimoRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
4495{
4496#if 0
4497 tSirRetStatus retStatus;
4498 tpSetMIMOPS pMIMO_PSParams;
4499
4500
4501 do {
4502
4503 pMIMO_PSParams = (tpSetMIMOPS)limMsg->bodyptr;
4504 if( NULL == pMIMO_PSParams ) {
4505 PELOGE(limLog(pMac, LOGE, "Received the WDA_SET_MIMOPS_RSP with NULL as the PS param");)
4506 return;
4507 }
4508
4509 /** If Updation of the HAL Fail's*/
4510 if (pMIMO_PSParams->status != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004511 limLog(pMac, LOGP, FL("Update HAL / SW Mac for MIMO State has Failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 break;
4513 }
4514
4515 if ((pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) ||
4516 (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) )
4517 break;
4518
4519 pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState;
4520 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState));
4521
4522 /** In the Case of Exiting out of the Powersave (changing from Dynamic/Static mode to SM Enabled)
4523 * send the action Frame to Peer to update the PS State of the STA , for the case of Entering PowerSave
4524 * the Action Frame is being sent at first before setting the internal structures
4525 */
4526 if (!isEnteringMimoPS(pMac->lim.gHTMIMOPSState, pMIMO_PSParams->htMIMOPSState)) {
4527 tSirMacAddr macAddr;
4528
4529 /** Obtain the AP's Mac Address */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304530 vos_mem_copy((tANI_U8 *)macAddr, pMac->lim.gLimBssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004531
4532 /** Send Action Frame with the corresponding mode */
4533 retStatus = limSendSMPowerStateFrame(pMac, macAddr, pMIMO_PSParams->htMIMOPSState);
4534 if (retStatus != eSIR_SUCCESS) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004535 PELOGE(limLog(pMac, LOGE, FL("Sending Action Frame has failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 break;
4537 }
4538 }
4539 PELOG1(limLog(pMac, LOG1, FL("The Setting up of LimGlobals is successful for MIMOPS"));)
4540 }while(0);
4541
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304542 vos_mem_free((void *) pMIMO_PSParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004543#endif
4544}
4545/**
4546 * @function : limHandleDelBssInReAssocContext
4547 * @brief : While Processing the ReAssociation Response Frame in STA,
4548 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4549 * being issued and the end of DelBSS the new BSS is being added.
4550 *
4551 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4552 * change, We need to update CSR with ReAssocCNF Response with the
4553 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4554 * context only
4555 *
4556 * @param : pMac - tpAniSirGlobal
4557 * pStaDs - Station Descriptor
4558 *
4559 * @return : none
4560 */
4561static void
4562limHandleDelBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
4563{
4564 tLimMlmReassocCnf mlmReassocCnf;
4565 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4566 /** Set the MlmState to IDLE*/
4567 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 /* Update PE session Id*/
4569 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
4570 switch (psessionEntry->limMlmState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 case eLIM_SME_WT_REASSOC_STATE :
4572 {
4573 tpSirAssocRsp assocRsp;
4574 tpDphHashNode pStaDs;
4575 tSirRetStatus retStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 tSchBeaconStruct beaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 /** Delete the older STA Table entry */
4578 limDeleteDphHashEntry(pMac, psessionEntry->bssId, DPH_STA_HASH_INDEX_PEER, psessionEntry);
4579 /**
4580 * Add an entry for AP to hash table
4581 * maintained by DPH module
4582 */
4583 if ((pStaDs = dphAddHashEntry(pMac, psessionEntry->limReAssocbssId, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) == NULL)
4584 {
4585 // Could not add hash table entry
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004586 PELOGE(limLog(pMac, LOGE, FL("could not add hash entry at DPH for "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004587 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
4588 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4589 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
4590 goto Error;
4591 }
4592 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4593 * is being stored to be used here for sending ADDBSS
4594 */
4595 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4596 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp,psessionEntry);
4597 limUpdateReAssocGlobals(pMac, assocRsp,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 limExtractApCapabilities( pMac,
4599 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4600 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
4601 &beaconStruct );
4602 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
4603 limDecideStaProtectionOnAssoc(pMac, &beaconStruct, psessionEntry);
4604 if(beaconStruct.erpPresent) {
4605 if (beaconStruct.erpIEInfo.barkerPreambleMode)
4606 psessionEntry->beaconParams.fShortPreamble = 0;
4607 else
4608 psessionEntry->beaconParams.fShortPreamble = 1;
4609 }
4610 //updateBss flag is false, as in this case, PE is first deleting the existing BSS and then adding a new one.
4611 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, &beaconStruct,
4612 &psessionEntry->pLimReAssocReq->bssDescription, false, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004613 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 retStatus = eSIR_FAILURE;
4615 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 if (retStatus != eSIR_SUCCESS)
4617 {
4618 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4619 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304620 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 pMac->lim.gLimAssocResponseData = NULL;
4622 goto Error;
4623 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304624 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 psessionEntry->limAssocResponseData = NULL;
4626 }
4627 break;
4628 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE:
4629 {
4630 /** Case wherein the DisAssoc / Deauth
4631 * being sent as response to ReAssoc Req*/
4632 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4633 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4634 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4635 /** Set the SME State back to WT_Reassoc State*/
4636 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004637 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId,psessionEntry);
4638 if((psessionEntry->limSystemRole == eLIM_STA_ROLE)||
4639 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
4640 {
4641 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 }
4643 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4644 }
4645 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004647 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004648 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4649 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4650 goto Error;
4651 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004652 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07004653Error:
4654 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4655}
4656
4657/* Added For BT -AMP Support */
4658static void
4659limProcessBtampAddBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ ,tpPESession psessionEntry)
4660{
4661 tLimMlmStartCnf mlmStartCnf;
4662 tANI_U32 val;
4663 tpAddBssParams pAddBssParams = (tpAddBssParams) limMsgQ->bodyptr;
4664
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304665 if (NULL == pAddBssParams)
4666 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004667 limLog( pMac, LOGE, FL( "Invalid body pointer in message"));
Pratik Bhalgataa1ae392012-11-22 17:44:33 +05304668 goto end;
4669 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 if( eHAL_STATUS_SUCCESS == pAddBssParams->status )
4671 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004672 limLog(pMac, LOG2, FL("WDA_ADD_BSS_RSP returned with eHAL_STATUS_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
4674 {
4675 if (limSetLinkState(pMac, eSIR_LINK_BTAMP_AP_STATE, psessionEntry->bssId,
4676 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4677 goto end;
4678 } else if (psessionEntry->bssType == eSIR_BTAMP_STA_MODE) {
4679 if (limSetLinkState(pMac, eSIR_LINK_SCAN_STATE, psessionEntry->bssId,
4680 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS )
4681 goto end;
4682 }
4683
4684 // Set MLME state
4685 psessionEntry->limMlmState= eLIM_MLM_BSS_STARTED_STATE;
4686 psessionEntry->statypeForBss = STA_ENTRY_SELF; // to know session started for peer or for self
4687 psessionEntry->bssIdx = (tANI_U8) pAddBssParams->bssIdx;
4688 schEdcaProfileUpdate(pMac, psessionEntry);
Gopichand Nakkala777e6032012-12-31 16:39:21 -08004689 limInitPeerIdxpool(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004690 // Create timers used by LIM
4691 if (!pMac->lim.gLimTimersCreated)
4692 limCreateTimers(pMac);
4693 /* Update the lim global gLimTriggerBackgroundScanDuringQuietBss */
4694 if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_TRIG_STA_BK_SCAN, &val ))
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004695 limLog( pMac, LOGP, FL("Failed to get WNI_CFG_TRIG_STA_BK_SCAN!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 pMac->lim.gLimTriggerBackgroundScanDuringQuietBss = (val) ? 1 : 0;
4697 // Apply previously set configuration at HW
4698 limApplyConfiguration(pMac,psessionEntry);
4699 psessionEntry->staId = pAddBssParams->staContext.staIdx;
4700 mlmStartCnf.resultCode = eSIR_SME_SUCCESS;
4701 }
4702 else
4703 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004704 limLog( pMac, LOGE, FL( "WDA_ADD_BSS_REQ failed with status %d" ),pAddBssParams->status );
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 mlmStartCnf.resultCode = eSIR_SME_HAL_SEND_MESSAGE_FAIL;
4706 }
4707 mlmStartCnf.sessionId = psessionEntry->peSessionId;
4708 limPostSmeMessage( pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf );
4709 end:
4710 if( 0 != limMsgQ->bodyptr )
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004711 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304712 vos_mem_free(pAddBssParams);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004713 limMsgQ->bodyptr = NULL;
4714 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004715}
4716
4717/**
4718 * @function : limHandleAddBssInReAssocContext
4719 * @brief : While Processing the ReAssociation Response Frame in STA,
4720 * a. immediately after receiving the Reassoc Response the RxCleanUp is
4721 * being issued and the end of DelBSS the new BSS is being added.
4722 *
4723 * b .If an AP rejects the ReAssociation (Disassoc / Deauth) with some context
4724 * change, We need to update CSR with ReAssocCNF Response with the
4725 * ReAssoc Fail and the reason Code, that is also being handled in the DELBSS
4726 * context only
4727 *
4728 * @param : pMac - tpAniSirGlobal
4729 * pStaDs - Station Descriptor
4730 *
4731 * @return : none
4732 */
4733void
4734limHandleAddBssInReAssocContext(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
4735{
4736 tLimMlmReassocCnf mlmReassocCnf;
4737 /** Skipped the DeleteDPH Hash Entry as we need it for the new BSS*/
4738 /** Set the MlmState to IDLE*/
Jeff Johnsone7245742012-09-05 17:12:55 -07004739 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
4740 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004741 switch (psessionEntry->limSmeState) {
Jeff Johnson295189b2012-06-20 16:38:30 -07004742 case eLIM_SME_WT_REASSOC_STATE : {
4743 tpSirAssocRsp assocRsp;
4744 tpDphHashNode pStaDs;
4745 tSirRetStatus retStatus = eSIR_SUCCESS;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004746 tSchBeaconStruct *pBeaconStruct;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304747 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
4748 if ( NULL == pBeaconStruct )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004749 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304750 limLog(pMac, LOGE, FL("Unable to allocate memory in limHandleAddBssInReAssocContext") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004751 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4752 mlmReassocCnf.protStatusCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4753 goto Error;
4754 }
4755
Jeff Johnson295189b2012-06-20 16:38:30 -07004756 // Get the AP entry from DPH hash table
4757 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4758 if (pStaDs == NULL )
4759 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004760 PELOGE(limLog(pMac, LOGE, FL("Fail to get STA PEER entry from hash"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004761 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4762 mlmReassocCnf.protStatusCode = eSIR_SME_SUCCESS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304763 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004764 goto Error;
4765 }
4766 /** While Processing the ReAssoc Response Frame the ReAssocRsp Frame
4767 * is being stored to be used here for sending ADDBSS
4768 */
4769 assocRsp = (tpSirAssocRsp)psessionEntry->limAssocResponseData;
4770 limUpdateAssocStaDatas(pMac, pStaDs, assocRsp, psessionEntry);
4771 limUpdateReAssocGlobals(pMac, assocRsp, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 limExtractApCapabilities( pMac,
4773 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
4774 limGetIElenFromBssDescription( &psessionEntry->pLimReAssocReq->bssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004775 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004777 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, psessionEntry);
4778
4779 if(pBeaconStruct->erpPresent)
4780 {
4781 if (pBeaconStruct->erpIEInfo.barkerPreambleMode)
Jeff Johnson295189b2012-06-20 16:38:30 -07004782 psessionEntry->beaconParams.fShortPreamble = 0;
4783 else
4784 psessionEntry->beaconParams.fShortPreamble = 1;
4785 }
4786
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07004787 if (eSIR_SUCCESS != limStaSendAddBss( pMac, assocRsp, pBeaconStruct,
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 &psessionEntry->pLimReAssocReq->bssDescription, true, psessionEntry)) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004789 limLog( pMac, LOGE, FL( "Posting ADDBSS in the ReAssocContext has Failed "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004790 retStatus = eSIR_FAILURE;
4791 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004792 if (retStatus != eSIR_SUCCESS)
4793 {
4794 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
4795 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304796 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 pMac->lim.gLimAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304798 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 goto Error;
4800 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304801 vos_mem_free(assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 psessionEntry->limAssocResponseData = NULL;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304803 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 }
4805 break;
4806 case eLIM_SME_WT_REASSOC_LINK_FAIL_STATE: { /** Case wherein the DisAssoc / Deauth
4807 * being sent as response to ReAssoc Req*/
4808 /** Send the Reason code as the same received in Disassoc / Deauth Frame*/
4809 mlmReassocCnf.resultCode = pStaDs->mlmStaContext.disassocReason;
4810 mlmReassocCnf.protStatusCode = pStaDs->mlmStaContext.cleanupTrigger;
4811 /** Set the SME State back to WT_Reassoc State*/
4812 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
4813 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry);
4814 if(psessionEntry->limSystemRole == eLIM_STA_ROLE)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004815 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004817 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
4818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004819
4820 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4821 }
4822 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004824 PELOGE(limLog(pMac, LOGE, FL("DelBss is being invoked in the wrong system Role /unhandled SME State"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 mlmReassocCnf.resultCode = eSIR_SME_REFUSED;
4826 mlmReassocCnf.protStatusCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
4827 goto Error;
4828 }
4829return;
4830Error:
4831 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
4832}
4833
4834#if 0
4835 static void
4836limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
4837{
4838 tSirSmeAssocCnf assocCnf;
4839 tpDphHashNode pStaDs;
4840 tpPESession psessionEntry;
4841 tANI_U8 sessionId;
4842
4843 if(pMsgBuf == NULL)
4844 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004845 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004846 goto end;
4847 }
4848 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
4849 !__limIsSmeAssocCnfValid(&assocCnf))
4850 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004851 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 goto end;
4853 }
4854 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
4855 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004856 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 goto end;
4858 }
4859 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
4860 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4861 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004862 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004863 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
4864 goto end;
4865 }
4866 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
4867 if (pStaDs == NULL)
4868 {
4869 limLog(pMac, LOG1,
4870 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
4871 msgType, assocCnf.aid);
4872 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4873 /*
4874 ** send a DISASSOC_IND message to WSM to make sure
4875 ** the state in WSM and LIM is the same
4876 **/
4877 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
4878 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
4879 goto end;
4880 }
4881 if ((pStaDs &&
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304882 (( !vos_mem_compare((tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004883 (tANI_U8 *) assocCnf.peerMacAddr,
4884 sizeof(tSirMacAddr)) ) ||
4885 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4886 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4887 (msgType != eWNI_SME_ASSOC_CNF)) ||
4888 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
4889 (msgType != eWNI_SME_REASSOC_CNF)))))
4890 {
4891 limLog(pMac, LOG1,
4892 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
4893 msgType, assocCnf.aid);
4894 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4895 goto end;
4896 }
4897 /*
4898 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4899 ** has been received
4900 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004901 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4903 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4904 {
4905 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4906 * when it had received Assoc Request frame. Now, PE just needs to send
4907 * Association Response frame to the requesting BTAMP-STA.
4908 */
4909 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004910 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4912 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4913 goto end;
4914 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4915 else
4916 {
4917 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4918 limRejectAssociation(pMac, pStaDs->staAddr,
4919 pStaDs->mlmStaContext.subType,
4920 true, pStaDs->mlmStaContext.authType,
4921 pStaDs->assocId, true,
4922 assocCnf.statusCode, psessionEntry);
4923 return;
4924 }
4925end:
4926 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4927 {
4928 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4929 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304930 vos_mem_free(((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4932 }
4933
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304934 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4936 }
4937} /*** end __limProcessSmeAssocCnfNew() ***/
4938#endif
4939
Jeff Johnson295189b2012-06-20 16:38:30 -07004940void
4941limSendBeaconInd(tpAniSirGlobal pMac, tpPESession psessionEntry){
4942 tBeaconGenParams *pBeaconGenParams = NULL;
4943 tSirMsgQ limMsg;
4944 /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/
4945 if(psessionEntry == NULL ){
4946 PELOGE( limLog( pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004947 FL( "Error:Unable to get the PESessionEntry" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 return;
4949 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304950 pBeaconGenParams = vos_mem_malloc(sizeof(*pBeaconGenParams));
4951 if ( NULL == pBeaconGenParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004952 {
4953 PELOGE( limLog( pMac, LOGP,
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304954 FL( "Unable to allocate memory during sending beaconPreMessage" ));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 return;
4956 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05304957 vos_mem_set(pBeaconGenParams, sizeof(*pBeaconGenParams), 0);
4958 vos_mem_copy((void *) pBeaconGenParams->bssId,
4959 (void *)psessionEntry->bssId,
4960 SIR_MAC_ADDR_LENGTH );
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 limMsg.bodyptr = pBeaconGenParams;
4962 schProcessPreBeaconInd(pMac, &limMsg);
4963 return;
4964}
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304965
4966void limSendScanOffloadComplete(tpAniSirGlobal pMac,
4967 tSirResultCodes reasonCode)
4968{
4969 tANI_U16 scanRspLen = 0;
4970
4971 pMac->lim.gLimSmeScanResultLength +=
4972 pMac->lim.gLimMlmScanResultLength;
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304973 pMac->lim.gLimRspReqd = false;
4974 if ((reasonCode == eSIR_SME_SUCCESS) ||
4975 pMac->lim.gLimSmeScanResultLength) {
4976 scanRspLen = sizeof(tSirSmeScanRsp) +
4977 pMac->lim.gLimSmeScanResultLength -
4978 sizeof(tSirBssDescription);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304979 }
Madan Mohan Koyyalamudicfe89a52013-07-05 20:49:50 +05304980 else
4981 scanRspLen = sizeof(tSirSmeScanRsp);
4982
4983 limSendSmeScanRsp(pMac, scanRspLen, reasonCode,
4984 pMac->lim.gSmeSessionId,
4985 pMac->lim.gTransactionId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304986}
4987
4988
4989void limProcessRxScanEvent(tpAniSirGlobal pMac, void *buf)
4990{
4991 tSirScanOffloadEvent *pScanEvent = (tSirScanOffloadEvent *) buf;
4992
4993 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004994 "scan_id = %u", pScanEvent->scanId);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05304995
4996 switch (pScanEvent->event)
4997 {
4998 case SCAN_EVENT_STARTED:
4999 break;
5000 case SCAN_EVENT_START_FAILED:
5001 case SCAN_EVENT_COMPLETED:
5002 limSendScanOffloadComplete(pMac, pScanEvent->reasonCode);
5003 break;
5004 case SCAN_EVENT_BSS_CHANNEL:
5005 case SCAN_EVENT_FOREIGN_CHANNEL:
5006 case SCAN_EVENT_DEQUEUED:
5007 case SCAN_EVENT_PREEMPTED:
5008 default:
5009 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005010 "Received unhandled scan event %u", pScanEvent->event);
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05305011 }
5012}
Kalikinkar dhara085c02f2014-02-28 15:32:12 -08005013
5014void limSwitchChannelResumeLinkRsp(tpAniSirGlobal pMac,
5015 eHalStatus status,
5016 tANI_U32* mlmAddBssRsp)
5017{
5018 if (status != eHAL_STATUS_SUCCESS)
5019 {
5020 limLog(pMac, LOGE,
5021 FL(" CSA failed to get the response for resume link"));
5022 }
5023 return;
5024}