blob: f749a8c0be1fb9a6398153ff5312af1dc1f9e30e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Agrawal Ashish01c66342017-01-27 12:52:25 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limProcessSmeReqMessages.cc contains the code
33 * for processing SME request messages.
34 * Author: Chandra Modumudi
35 * Date: 02/11/02
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41
42#include "palTypes.h"
43#include "wniApi.h"
Satyanarayana Dash6f438272015-03-03 18:01:06 +053044#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "cfgApi.h"
46#include "sirApi.h"
47#include "schApi.h"
48#include "utilsApi.h"
49#include "limTypes.h"
50#include "limUtils.h"
51#include "limAssocUtils.h"
52#include "limSecurityUtils.h"
53#include "limSerDesUtils.h"
54#include "limSmeReqUtils.h"
55#include "limIbssPeerMgmt.h"
56#include "limAdmitControl.h"
57#include "dphHashTable.h"
58#include "limSendMessages.h"
59#include "limApi.h"
60#include "wmmApsd.h"
61
Abhishek Singh00b71972016-01-07 10:51:04 +053062#ifdef WLAN_FEATURE_RMC
63#include "limRMC.h"
64#endif
65
Jeff Johnson295189b2012-06-20 16:38:30 -070066#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070067
68#if defined WLAN_FEATURE_VOWIFI
69#include "rrmApi.h"
70#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080071#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
72#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#endif
74
75#if defined WLAN_FEATURE_VOWIFI_11R
76#include <limFT.h>
77#endif
78
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +053079#ifdef WLAN_FEATURE_LFR_MBB
80#include "lim_mbb.h"
81#endif
82
Jeff Johnson295189b2012-06-20 16:38:30 -070083
Sushant Kaushike3ca61c2015-03-19 18:33:25 +053084#define JOIN_FAILURE_TIMEOUT 1000 // in msecs
Viral Modid86bde22012-12-10 13:09:21 -080085/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
86 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
Sunil Ravi24fd3aa2013-01-21 22:12:06 -080087 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
88 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080089 */
Viral Modid440e682013-03-06 02:25:31 -080090#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
91#define JOIN_NOA_DURATION 2000 // in msecs
92#define OEM_DATA_NOA_DURATION 60 // in msecs
93#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070094
Gopichand Nakkala096a1052012-12-21 07:05:34 -080095#define CONV_MS_TO_US 1024 //conversion factor from ms to us
96
Jeff Johnson295189b2012-06-20 16:38:30 -070097// SME REQ processing function templates
98static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
99static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
100static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -0800101static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700102static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
105static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
106static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
107static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
108static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
109
Jeff Johnson295189b2012-06-20 16:38:30 -0700110void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
111
Jeff Johnson295189b2012-06-20 16:38:30 -0700112extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700113
Jeff Johnson295189b2012-06-20 16:38:30 -0700114
Jeff Johnson295189b2012-06-20 16:38:30 -0700115#ifdef BACKGROUND_SCAN_ENABLED
116
117// start the background scan timers if it hasn't already started
118static void
119__limBackgroundScanInitiate(tpAniSirGlobal pMac)
120{
121 if (pMac->lim.gLimBackgroundScanStarted)
122 return;
123
124 //make sure timer is created first
125 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
126 {
127 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700128 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700130 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700131 pMac->lim.gLimBackgroundScanStarted = true;
132 pMac->lim.gLimBackgroundScanChannelId = 0;
133 }
134}
135
136#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700137
138// determine if a fresh scan request must be issued or not
139/*
140* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
141* If one of the sessions is not in one of the above states, then PE does not do fresh scan
142* If no session exists (scanning very first time), then PE will always do fresh scan if SME
143* asks it to do that.
144*/
145static tANI_U8
146__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
147{
148
149 tANI_U8 validState = TRUE;
150 int i;
151
152 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
153 {
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530154 limLog(pMac, LOG1, FL("setting fresh scan as false. sme state is %d"),
155 pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700156 return FALSE;
157 }
158 for(i =0; i < pMac->lim.maxBssId; i++)
159 {
160
161 if(pMac->lim.gpSession[i].valid == TRUE)
162 {
163 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
164 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
165 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
166
167 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
168 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
169 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
170 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
172 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
173 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
174 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700175 ))
176 {
177 validState = FALSE;
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530178 limLog(pMac, LOG1, FL("setting fresh scan as false."
179 "bssType is %d system role is %d, smestate is %d"),
180 pMac->lim.gpSession[i].bssType,
181 pMac->lim.gpSession[i].limSystemRole,
182 pMac->lim.gpSession[i].limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 break;
184 }
185
186 }
187 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530188 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700189
190 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
191 return TRUE;
192
193 return FALSE;
194}
195
Jeff Johnson295189b2012-06-20 16:38:30 -0700196
197
198/**
199 * __limIsSmeAssocCnfValid()
200 *
201 *FUNCTION:
202 * This function is called by limProcessLmmMessages() upon
203 * receiving SME_ASSOC_CNF.
204 *
205 *LOGIC:
206 * Message validity checks are performed in this function
207 *
208 *ASSUMPTIONS:
209 *
210 *NOTE:
211 *
212 * @param pMeasReq Pointer to Received ASSOC_CNF message
213 * @return true When received SME_ASSOC_CNF is formatted
214 * correctly
215 * false otherwise
216 */
217
218inline static tANI_U8
219__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
220{
221 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
222 return false;
223 else
224 return true;
225} /*** end __limIsSmeAssocCnfValid() ***/
226
227
228/**
229 * __limGetSmeJoinReqSizeForAlloc()
230 *
231 *FUNCTION:
232 * This function is called in various places to get IE length
233 * from tSirBssDescription structure
234 * number being scanned.
235 *
236 *PARAMS:
237 *
238 *LOGIC:
239 *
240 *ASSUMPTIONS:
241 * NA
242 *
243 *NOTE:
244 * NA
245 *
246 * @param pBssDescr
247 * @return Total IE length
248 */
249
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +0530250tANI_U16
Jeff Johnson295189b2012-06-20 16:38:30 -0700251__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
252{
253 tANI_U16 len = 0;
254
255 if (!pBuf)
256 return len;
257
258 pBuf += sizeof(tANI_U16);
259 len = limGetU16( pBuf );
260 return (len + sizeof( tANI_U16 ));
261} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
262
263
264/**----------------------------------------------------------------
265\fn __limIsDeferedMsgForLearn
266
267\brief Has role only if 11h is enabled. Not used on STA side.
268 Defers the message if SME is in learn state and brings
269 the LIM back to normal mode.
270
271\param pMac
272\param pMsg - Pointer to message posted from SME to LIM.
273\return TRUE - If defered
274 FALSE - Otherwise
275------------------------------------------------------------------*/
276static tANI_BOOLEAN
277__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
278{
279 if (limIsSystemInScanState(pMac))
280 {
281 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
282 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700283 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700284 return eANI_BOOLEAN_FALSE;
285 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700286 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 pMsg->type);)
288
289 /** Send finish scan req to HAL only if LIM is not waiting for any response
290 * from HAL like init scan rsp, start scan rsp etc.
291 */
292 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
293 {
294 //Set the resume channel to Any valid channel (invalid).
295 //This will instruct HAL to set it to any previous valid channel.
296 peSetResumeChannel(pMac, 0, 0);
297 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
298 }
299
300 return eANI_BOOLEAN_TRUE;
301 }
302 return eANI_BOOLEAN_FALSE;
303}
304
305/**----------------------------------------------------------------
306\fn __limIsDeferedMsgForRadar
307
308\brief Has role only if 11h is enabled. Not used on STA side.
309 Defers the message if radar is detected.
310
311\param pMac
312\param pMsg - Pointer to message posted from SME to LIM.
313\return TRUE - If defered
314 FALSE - Otherwise
315------------------------------------------------------------------*/
316static tANI_BOOLEAN
317__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
318{
319 /** fRadarDetCurOperChan will be set only if we detect radar in current
320 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700321 //TODO: Need to take care radar detection.
322 //if (LIM_IS_RADAR_DETECTED(pMac))
323 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 {
325 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
326 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700327 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 return eANI_BOOLEAN_FALSE;
329 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700330 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 pMsg->type);)
332 return eANI_BOOLEAN_TRUE;
333 }
334 return eANI_BOOLEAN_FALSE;
335}
336
337
338/**
339 * __limProcessSmeStartReq()
340 *
341 *FUNCTION:
342 * This function is called to process SME_START_REQ message
343 * from HDD or upper layer application.
344 *
345 *LOGIC:
346 *
347 *ASSUMPTIONS:
348 *
349 *NOTE:
350 *
351 * @param pMac Pointer to Global MAC structure
352 * @param *pMsgBuf A pointer to the SME message buffer
353 * @return None
354 */
355
356static void
357__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
358{
359 tSirResultCodes retCode = eSIR_SME_SUCCESS;
360 tANI_U8 smesessionId;
361 tANI_U16 smetransactionId;
362
363
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530364 limLog(pMac, LOG1, FL("Received SME_START_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
367
368 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
369 {
370 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
371
Jeff Johnsone7245742012-09-05 17:12:55 -0700372 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700373
374 /// By default do not return after first scan match
375 pMac->lim.gLimReturnAfterFirstMatch = 0;
376
377 /// Initialize MLM state machine
378 limInitMlm(pMac);
379
380 /// By default return unique scan results
381 pMac->lim.gLimReturnUniqueResults = true;
382 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700383#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
384 pMac->lim.gLimSmeLfrScanResultLength = 0;
385#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700386
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
388 {
389 /*
390 * Need to indicate new BSSs found during background scanning to
391 * host. Update this parameter at CFG
392 */
393 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
394 != eSIR_SUCCESS)
395 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700396 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
398 }
399 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 }
401 else
402 {
403 /**
404 * Should not have received eWNI_SME_START_REQ in states
405 * other than OFFLINE. Return response to host and
406 * log error
407 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530408 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
410 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
411 }
412 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
413} /*** end __limProcessSmeStartReq() ***/
414
415
416/** -------------------------------------------------------------
417\fn __limProcessSmeSysReadyInd
418\brief handles the notification from HDD. PE just forwards this message to HAL.
419\param tpAniSirGlobal pMac
420\param tANI_U32* pMsgBuf
421\return TRUE-Posting to HAL failed, so PE will consume the buffer.
422\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
423 -------------------------------------------------------------*/
424static tANI_BOOLEAN
425__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
426{
427 tSirMsgQ msg;
428
429 msg.type = WDA_SYS_READY_IND;
430 msg.reserved = 0;
431 msg.bodyptr = pMsgBuf;
432 msg.bodyval = 0;
433
Jeff Johnson92751692013-03-06 16:00:33 -0800434 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 {
Jeff Johnson92751692013-03-06 16:00:33 -0800436 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700438 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700439 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
Jeff Johnson92751692013-03-06 16:00:33 -0800441 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700443 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 return eANI_BOOLEAN_TRUE;
445 }
446 return eANI_BOOLEAN_FALSE;
447}
448
Jeff Johnsone7245742012-09-05 17:12:55 -0700449#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
Jeff Johnsone7245742012-09-05 17:12:55 -0700451tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
452{
453 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
454 {
455 switch(secondaryChanOffset)
456 {
457 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
458 return primarychanNum;
459 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
460 return primarychanNum + 2;
461 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
462 return primarychanNum - 2;
463 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
464 return primarychanNum + 6;
465 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
466 return primarychanNum + 2;
467 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
468 return primarychanNum - 2;
469 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
470 return primarychanNum - 6;
471 default :
472 return eSIR_CFG_INVALID_ID;
473 }
474 }
475 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
476 {
477 switch(secondaryChanOffset)
478 {
479 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
480 return primarychanNum + 2;
481 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
482 return primarychanNum - 2;
483 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
484 return primarychanNum;
485 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
486 return primarychanNum + 2;
487 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
488 return primarychanNum - 2;
489 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
490 return primarychanNum + 2;
491 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
492 return primarychanNum - 2;
493 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
494 return primarychanNum + 2;
495 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
496 return primarychanNum - 2;
497 default :
498 return eSIR_CFG_INVALID_ID;
499 }
500 }
501 return primarychanNum;
502}
503
504#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700505/**
506 * __limHandleSmeStartBssRequest()
507 *
508 *FUNCTION:
509 * This function is called to process SME_START_BSS_REQ message
510 * from HDD or upper layer application.
511 *
512 *LOGIC:
513 *
514 *ASSUMPTIONS:
515 *
516 *NOTE:
517 *
518 * @param pMac Pointer to Global MAC structure
519 * @param *pMsgBuf A pointer to the SME message buffer
520 * @return None
521 */
522
523static void
524__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
525{
526 tANI_U16 size;
527 tANI_U32 val = 0;
528 tSirRetStatus retStatus;
529 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700530 tLimMlmStartReq *pMlmStartReq = NULL;
531 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 tSirResultCodes retCode = eSIR_SME_SUCCESS;
533 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 tANI_U8 sessionId;
535 tpPESession psessionEntry = NULL;
536 tANI_U8 smesessionId;
537 tANI_U16 smetransactionId;
538
539#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
540 //Since the session is not created yet, sending NULL. The response should have the correct state.
541 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
542#endif //FEATURE_WLAN_DIAG_SUPPORT
543
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530544 limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700545
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530546 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
548 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
549 {
550 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
551
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530552 pSmeStartBssReq = vos_mem_malloc(size);
553 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530555 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 /// Send failure response to host
557 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
558 goto end;
559 }
560
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530561 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700562
563 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
564 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
565 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700566 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 retCode = eSIR_SME_INVALID_PARAMETERS;
568 goto free;
569 }
570#if 0
571 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700572 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
574#endif
575
576 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530577 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700580 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
582 psessionEntry = NULL;
583 goto free;
584 }
585 else
586 {
587 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
588 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700589 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
591 goto free;
592 }
593
594 }
595
596 /* Store the session related parameters in newly created session */
597 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
598
599 /* Store PE sessionId in session Table */
600 psessionEntry->peSessionId = sessionId;
601
602 /* Store SME session Id in sessionTable */
603 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
604
605 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
606
607 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
608
609 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530610 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 (tANI_U8 *)&pSmeStartBssReq->ssId,
612 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530613
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530617
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
619
620 /* Store the channel number in session Table */
621 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
622
623 /*Store Persona */
624 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700625 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 psessionEntry->pePersona);
627
628 /*Update the phymode*/
629 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
630
631 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
632 psessionEntry->currentOperChannel );
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530633
634#ifdef WLAN_FEATURE_AP_HT40_24G
635 /*Store Overlapping BSS Scan Parameters IEs to session table */
636 if (pSmeStartBssReq->apHT40_24GEnabled)
637 {
638 limInitOBSSScanParams(pMac, psessionEntry);
639 }
640#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 /* Store the dot 11 mode in to the session Table*/
642
643 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700644 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
645#ifdef WLAN_FEATURE_11AC
646 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700647 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
648 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700649#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800650
651 psessionEntry->txLdpcIniFeatureEnabled =
652 pSmeStartBssReq->txLdpcIniFeatureEnabled;
653
Chet Lanctot8cecea22014-02-11 19:09:36 -0800654#ifdef WLAN_FEATURE_11W
655 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
656 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
657#endif
658
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530659 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 (void*)&pSmeStartBssReq->operationalRateSet,
661 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530662 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 (void*)&pSmeStartBssReq->extendedRateSet,
664 sizeof(tSirMacRateSet));
665
666 switch(pSmeStartBssReq->bssType)
667 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 case eSIR_INFRA_AP_MODE:
669 psessionEntry->limSystemRole = eLIM_AP_ROLE;
670 psessionEntry->privacy = pSmeStartBssReq->privacy;
671 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
672 psessionEntry->authType = pSmeStartBssReq->authType;
673 /* Store the DTIM period */
674 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
675 /*Enable/disable UAPSD*/
676 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
677 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
678 {
679 psessionEntry->proxyProbeRspEn = 0;
680 }
681 else
682 {
683 /* To detect PBC overlap in SAP WPS mode, Host handles
684 * Probe Requests.
685 */
686 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
687 {
688 psessionEntry->proxyProbeRspEn = 1;
689 }
690 else
691 {
692 psessionEntry->proxyProbeRspEn = 0;
693 }
694 }
695 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
696 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700697 limGetShortSlotFromPhyMode(pMac, psessionEntry,
698 psessionEntry->gLimPhyMode,
699 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 case eSIR_IBSS_MODE:
702 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700703 limGetShortSlotFromPhyMode(pMac, psessionEntry,
704 psessionEntry->gLimPhyMode,
705 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530706 /* In WPA-NONE case we wont get the privacy bit in ibss config
707 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
708 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
709 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
710 */
711 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
712 != eSIR_SUCCESS)
713 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
714 " failed"));
715 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800716 psessionEntry->isCoalesingInIBSSAllowed =
717 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 break;
719
720 case eSIR_BTAMP_AP_MODE:
721 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
722 break;
723
724 case eSIR_BTAMP_STA_MODE:
725 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
726 break;
727
728 /* There is one more mode called auto mode. which is used no where */
729
730 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
731
732
733 default:
734 //not used anywhere...used in scan function
735 break;
736 }
737
738 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
739 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700741 )
742 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530743 psessionEntry->parsedAssocReq = vos_mem_malloc(
744 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
745 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530747 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
749 goto free;
750 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530751 vos_mem_set(psessionEntry->parsedAssocReq,
752 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
753 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 }
755
756 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
757 if (pSmeStartBssReq->channelId)
758 {
759 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700760 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
761 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
762 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700763 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700764 FL("cbMode %u"), pSmeStartBssReq->cbMode);
765#ifdef WLAN_FEATURE_11AC
766 if(psessionEntry->vhtCapability)
767 {
768 tANI_U32 centerChan;
769 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700770
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
772 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700774 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700775 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700776 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530777
Abhishek Singh921926b2014-02-13 17:21:01 +0530778 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530779 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700780 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530781 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530782 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
783 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700785
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530786 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
787 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530788 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530789 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
790 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
791 != eSIR_SUCCESS)
792 {
793 limLog(pMac, LOGP, FL("could not set "
794 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
795 retCode = eSIR_LOGP_EXCEPTION;
796 goto free;
797 }
798 }
799 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
800 {
801 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
802 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
803 != eSIR_SUCCESS)
804 {
805 limLog(pMac, LOGP, FL("could not set "
806 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
807 retCode = eSIR_LOGP_EXCEPTION;
808 goto free;
809 }
810
811 centerChan = limGetCenterChannel( pMac, channelNumber,
812 pSmeStartBssReq->cbMode,
813 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700814 if(centerChan != eSIR_CFG_INVALID_ID)
815 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530816 limLog(pMac, LOGW, FL("***Center Channel for "
817 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700818 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530819 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530820 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
821 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700822 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530823 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530824 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700825 retCode = eSIR_LOGP_EXCEPTION;
826 goto free;
827 }
828 }
829 }
830
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530831 /* All the translation is done by now for gVhtChannelWidth
832 * from .ini file to the actual values as defined in spec.
833 * So, grabing the spec value which is
834 * updated in .dat file by the above logic */
835 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
836 &chanWidth) != eSIR_SUCCESS)
837 {
838 limLog(pMac, LOGP,
839 FL("Unable to retrieve Channel Width from CFG"));
840 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700841 /*For Sta+p2p-Go concurrency
842 vhtTxChannelWidthSet is used for storing p2p-GO channel width
843 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
844 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
845 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700846 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700847 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700848 }
849 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
850#endif
851 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 else
853 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700854 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 retCode = eSIR_SME_INVALID_PARAMETERS;
856 goto free;
857 }
858
859 // Delete pre-auth list if any
860 limDeletePreAuthList(pMac);
861
862 // Delete IBSS peer BSSdescription list if any
863 //limIbssDelete(pMac); sep 26 review
864
865
866
867#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
868 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 limInitMlm(pMac);
870#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700871
Jeff Johnsone7245742012-09-05 17:12:55 -0700872 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700873
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 /* keep the RSN/WPA IE information in PE Session Entry
875 * later will be using this to check when received (Re)Assoc req
876 * */
877 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
878
Jeff Johnson295189b2012-06-20 16:38:30 -0700879
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 //Taken care for only softAP case rest need to be done
881 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
882 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
883 /*each byte will have the following info
884 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
885 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530886 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700888 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
890 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700891
892 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530893 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
894 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530896 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
898 goto free;
899 }
900
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530901 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530904 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 (tANI_U8 *) &pSmeStartBssReq->ssId,
906 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
908 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700909
910
911 pMlmStartReq->bssType = psessionEntry->bssType;
912
913 /* Fill PE session Id from the session Table */
914 pMlmStartReq->sessionId = psessionEntry->peSessionId;
915
916 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 )
919 {
920 //len = sizeof(tSirMacAddr);
921 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
922 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700923 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700924
925 /* Copy the BSSId from sessionTable to mlmStartReq struct */
926 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
927 }
928
929 else // ibss mode
930 {
931 pMac->lim.gLimIbssCoalescingHappened = false;
932
933 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
934 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700935 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 retCode = eSIR_LOGP_EXCEPTION;
937 goto free;
938 }
939
940 if(!autoGenBssId)
941 {
942 // We're not auto generating BSSID. Instead, get it from session entry
943 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
944
945 if(pMlmStartReq->bssId[0] & 0x01)
946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700947 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 autoGenBssId = TRUE;
949 }
950 }
951
952 if( autoGenBssId )
953 { //if BSSID is not any uc id. then use locally generated BSSID.
954 //Autogenerate the BSSID
955 limGetRandomBssid( pMac, pMlmStartReq->bssId);
956 pMlmStartReq->bssId[0]= 0x02;
957
958 /* Copy randomly generated BSSID to the session Table */
959 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
960 }
961 }
962 /* store the channel num in mlmstart req structure */
963 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
964 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
965 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
966
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
968 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
969 pMlmStartReq->wps_state = psessionEntry->wps_state;
970
971 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 {
973 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700974 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 pMlmStartReq->dtimPeriod = (tANI_U8)val;
976 }
977
978 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700979 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
981
982 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700983 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
985
986 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530987 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 sizeof(tSirMacRateSet));
989
Jeff Johnson295189b2012-06-20 16:38:30 -0700990 // Now populate the 11n related parameters
991 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700992 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 //
994 // FIXME_GEN4 - Determine the appropriate defaults...
995 //
996 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
997 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700998 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700999
1000 /* sep26 review */
1001 psessionEntry->limRFBand = limGetRFBand(channelNumber);
1002
1003 // Initialize 11h Enable Flag
1004 psessionEntry->lim11hEnable = 0;
1005 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
1006 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
1007 {
1008 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001009 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 psessionEntry->lim11hEnable = val;
1011 }
1012
1013 if (!psessionEntry->lim11hEnable)
1014 {
1015 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001016 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 }
1018
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1020 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001021 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001022
1023 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1024 return;
1025 }
1026 else
1027 {
1028
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001029 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1031 goto end;
1032 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1033
1034free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001035 if ((psessionEntry != NULL) &&
1036 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1037 {
1038 psessionEntry->pLimStartBssReq = NULL;
1039 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301040 vos_mem_free( pSmeStartBssReq);
1041 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001042
1043end:
1044
1045 /* This routine should return the sme sessionId and SME transaction Id */
1046 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1047
1048 if(NULL != psessionEntry)
1049 {
1050 peDeleteSession(pMac,psessionEntry);
1051 psessionEntry = NULL;
1052 }
1053 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1054} /*** end __limHandleSmeStartBssRequest() ***/
1055
1056
1057/**--------------------------------------------------------------
1058\fn __limProcessSmeStartBssReq
1059
1060\brief Wrapper for the function __limHandleSmeStartBssRequest
1061 This message will be defered until softmac come out of
1062 scan mode or if we have detected radar on the current
1063 operating channel.
1064\param pMac
1065\param pMsg
1066
1067\return TRUE - If we consumed the buffer
1068 FALSE - If have defered the message.
1069 ---------------------------------------------------------------*/
1070static tANI_BOOLEAN
1071__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1072{
1073 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1074 __limIsDeferedMsgForRadar(pMac, pMsg))
1075 {
1076 /**
1077 * If message defered, buffer is not consumed yet.
1078 * So return false
1079 */
1080 return eANI_BOOLEAN_FALSE;
1081 }
1082
1083 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1084 return eANI_BOOLEAN_TRUE;
1085}
1086
1087
1088/**
1089 * limGetRandomBssid()
1090 *
1091 * FUNCTION:This function is called to process generate the random number for bssid
1092 * This function is called to process SME_SCAN_REQ message
1093 * from HDD or upper layer application.
1094 *
1095 * LOGIC:
1096 *
1097 * ASSUMPTIONS:
1098 *
1099 * NOTE:
1100 * 1. geneartes the unique random number for bssid in ibss
1101 *
1102 * @param pMac Pointer to Global MAC structure
1103 * @param *data Pointer to bssid buffer
1104 * @return None
1105 */
1106void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1107{
1108 tANI_U32 random[2] ;
1109 random[0] = tx_time_get();
1110 random[0] |= (random[0] << 15) ;
1111 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301112 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001113}
1114
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301115static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1116 tpSirSmeScanReq pScanReq)
1117{
1118 tSirScanOffloadReq *pScanOffloadReq;
1119 tANI_U8 *p;
1120 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301121 tANI_U16 i, len;
1122 tSirRetStatus rc = eSIR_SUCCESS;
1123
1124 /* The tSirScanOffloadReq will reserve the space for first channel,
1125 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1126 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1127 pScanReq->uIEFieldLen;
1128
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301129 pScanOffloadReq = vos_mem_malloc(len);
1130 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301131 {
1132 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301133 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301134 return eHAL_STATUS_FAILURE;
1135 }
1136
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301137 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301138
1139 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1140 msg.bodyptr = pScanOffloadReq;
1141 msg.bodyval = 0;
1142
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301143 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301144 (tANI_U8*) pScanReq->bssId,
1145 sizeof(tSirMacAddr));
1146
1147 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1148 {
1149 limLog(pMac, LOGE,
1150 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301151 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301152 return eHAL_STATUS_FAILURE;
1153 }
1154
1155 pScanOffloadReq->numSsid = pScanReq->numSsid;
1156 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1157 {
1158 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301159 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301160 (tANI_U8 *) pScanReq->ssId[i].ssId,
1161 pScanOffloadReq->ssId[i].length);
1162 }
1163
1164 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301165 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301166 (tANI_U8 *) pScanReq->selfMacAddr,
1167 sizeof(tSirMacAddr));
1168 pScanOffloadReq->bssType = pScanReq->bssType;
1169 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1170 pScanOffloadReq->scanType = pScanReq->scanType;
1171 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1172 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1173 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1174 pScanOffloadReq->sessionId = pScanReq->sessionId;
1175 pScanOffloadReq->channelList.numChannels =
1176 pScanReq->channelList.numChannels;
1177 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1178 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1179 p[i] = pScanReq->channelList.channelNumber[i];
1180
1181 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1182 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301183 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301184 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1185 pScanOffloadReq->uIEFieldLen);
1186
1187 rc = wdaPostCtrlMsg(pMac, &msg);
1188 if (rc != eSIR_SUCCESS)
1189 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001190 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301191 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301192 return eHAL_STATUS_FAILURE;
1193 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301194 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301195
1196 return eHAL_STATUS_SUCCESS;
1197}
Jeff Johnson295189b2012-06-20 16:38:30 -07001198
1199/**
1200 * __limProcessSmeScanReq()
1201 *
1202 *FUNCTION:
1203 * This function is called to process SME_SCAN_REQ message
1204 * from HDD or upper layer application.
1205 *
1206 *LOGIC:
1207 *
1208 *ASSUMPTIONS:
1209 *
1210 *NOTE:
1211 * 1. Periodic scanning should be requesting to return unique
1212 * scan results.
1213 *
1214 * @param pMac Pointer to Global MAC structure
1215 * @param *pMsgBuf A pointer to the SME message buffer
1216 * @return None
1217 */
1218
Viral Modid440e682013-03-06 02:25:31 -08001219static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001220__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1221{
1222 tANI_U32 len;
1223 tLimMlmScanReq *pMlmScanReq;
1224 tpSirSmeScanReq pScanReq;
1225 tANI_U8 i = 0;
1226
Sushant Kaushikb97a0082015-08-31 12:36:45 +05301227#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1229#endif //FEATURE_WLAN_DIAG_SUPPORT
1230
1231 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301232 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1233 "first %d fresh %d unique %d type %s (%d)"
1234 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001235 pScanReq->channelList.numChannels,
1236 pScanReq->minChannelTime,
1237 pScanReq->maxChannelTime,
1238 pScanReq->uIEFieldLen,
1239 pScanReq->returnAfterFirstMatch,
1240 pScanReq->returnFreshResults,
1241 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301242 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001243 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301244 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1245 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001246
1247 /* Since scan req always requires a response, we will overwrite response required here.
1248 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1249 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1250 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1251 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1252 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1253 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1254 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1255 * the global flag gLimRspReqd to TRUE here.
1256 */
1257 pMac->lim.gLimRspReqd = TRUE;
1258
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301259 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1261
Abhishek Singhdaf95742015-10-13 14:53:21 +05301262 /* Check if scan req is not valid or link is already suspended*/
1263 if (!limIsSmeScanReqValid(pMac, pScanReq) || limIsLinkSuspended(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 {
Abhishek Singhdaf95742015-10-13 14:53:21 +05301265 limLog(pMac, LOGE,
1266 FL("Received SME_SCAN_REQ with invalid params or link is suspended %d"),
1267 limIsLinkSuspended(pMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001268
1269 if (pMac->lim.gLimRspReqd)
1270 {
1271 pMac->lim.gLimRspReqd = false;
1272
1273 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1274
1275 } // if (pMac->lim.gLimRspReqd)
1276
1277 return;
1278 }
1279
1280 //if scan is disabled then return as invalid scan request.
1281 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1282 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1283 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301284 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1285 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001286 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 return;
1288 }
1289
1290
1291 /**
1292 * If scan request is received in idle, joinFailed
1293 * states or in link established state (in STA role)
1294 * or in normal state (in STA-in-IBSS/AP role) with
1295 * 'return fresh scan results' request from HDD or
1296 * it is periodic background scanning request,
1297 * trigger fresh scan request to MLM
1298 */
1299 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1300 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301301 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1302 {
1303 // Discard previously cached scan results
1304 limReInitScanResults(pMac);
1305 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001306
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301307 pMac->lim.gLim24Band11dScanDone = 0;
1308 pMac->lim.gLim50Band11dScanDone = 0;
1309 pMac->lim.gLimReturnAfterFirstMatch =
1310 pScanReq->returnAfterFirstMatch;
1311 pMac->lim.gLimBackgroundScanMode =
1312 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001313
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301314 pMac->lim.gLimReturnUniqueResults =
1315 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1316 /* De-activate Heartbeat timers for connected sessions while
1317 * scan is in progress if the system is in Active mode *
1318 * AND it is not a ROAMING ("background") scan */
1319 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1320 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1321 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1322 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1323 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 for(i=0;i<pMac->lim.maxBssId;i++)
1325 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301326 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1327 (pMac->lim.gpSession[i].valid == TRUE) &&
1328 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1329 {
1330 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1331 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301333 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001334
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301335 if (pMac->fScanOffload)
1336 {
1337 if (eHAL_STATUS_SUCCESS !=
1338 limSendHalStartScanOffloadReq(pMac, pScanReq))
1339 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301340 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301341 limSendSmeScanRsp(pMac,
1342 offsetof(tSirSmeScanRsp, bssDescription[0]),
1343 eSIR_SME_INVALID_PARAMETERS,
1344 pScanReq->sessionId,
1345 pScanReq->transactionId);
1346 return;
1347 }
1348 }
1349 else
1350 {
1351
1352 /*Change Global SME state */
1353 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301354 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301355 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1356 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1357 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1358
1359 if (pScanReq->channelList.numChannels == 0)
1360 {
1361 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301362
1363 limLog(pMac, LOG1,
1364 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301365 // Scan all channels
1366 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1368 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301369 pMlmScanReq = vos_mem_malloc(len);
1370 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301371 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301372 // Log error
1373 limLog(pMac, LOGP,
1374 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001375
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301376 if (pMac->lim.gLimRspReqd)
1377 {
1378 pMac->lim.gLimRspReqd = false;
1379
1380 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1381 eSIR_SME_RESOURCES_UNAVAILABLE,
1382 pScanReq->sessionId,
1383 pScanReq->transactionId);
1384 }
1385
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301386 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301387 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301389 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301390 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301392 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1393 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 pMlmScanReq->channelList.channelNumber,
1395 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301396 {
1397 /**
1398 * Could not get Valid channel list from CFG.
1399 * Log error.
1400 */
1401 limLog(pMac, LOGP,
1402 FL("could not retrieve Valid channel list"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301403
1404 if (pMac->lim.gLimRspReqd)
1405 {
1406 pMac->lim.gLimRspReqd = false;
1407
1408 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1409 eSIR_SME_INVALID_PARAMETERS,
1410 pScanReq->sessionId,
1411 pScanReq->transactionId);
1412 }
Abhishek Singh2b055852015-10-07 14:14:13 +05301413 vos_mem_free(pMlmScanReq);
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301414 return;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301415 }
1416 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301417
1418 //Ignore DFS channels if DFS scan is disabled
1419 if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
1420 {
1421 tANI_U8 numChan = 0;
1422 tANI_U8 channel_state;
1423 tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
1424
1425 limLog(pMac, LOG1,
1426 FL("Ignore DFS channels from valid channel list"));
1427
1428 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1429 pMlmScanReq->channelList.channelNumber,
1430 pMlmScanReq->channelList.numChannels);
1431
1432 //Filter DFS channels
1433 for (i = 0; i < cfg_len; i++)
1434 {
1435 channel_state =
1436 vos_nv_getChannelEnabledState(*(chan_ptr + i));
1437
1438 //Allow channel if not DFS
1439 if(channel_state != NV_CHANNEL_DFS)
1440 {
1441 *(chan_ptr + numChan) = *(chan_ptr + i);
1442 numChan++;
1443 }
1444 }
1445 pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
1446
1447 limLog(pMac, LOG1, FL("No of valid channels %d, No of"
1448 "channels after filtering %d"), cfg_len, numChan);
1449
1450 limLog(pMac, LOG1, FL("Channel list after filtering: "));
1451
1452 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1453 pMlmScanReq->channelList.channelNumber,
1454 pMlmScanReq->channelList.numChannels);
1455 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301456 }
1457 else
1458 {
1459 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1460 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1461 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001462
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301463 pMlmScanReq = vos_mem_malloc(len);
1464 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301465 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301466 // Log error
1467 limLog(pMac, LOGP,
1468 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001469
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301470 if (pMac->lim.gLimRspReqd)
1471 {
1472 pMac->lim.gLimRspReqd = false;
1473
1474 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1475 eSIR_SME_RESOURCES_UNAVAILABLE,
1476 pScanReq->sessionId,
1477 pScanReq->transactionId);
1478 }
1479
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301480 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301481 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001482
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301483 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301484 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301485 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301486 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001487
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301488 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1489 pScanReq->channelList.channelNumber,
1490 pScanReq->channelList.numChannels);
1491 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301493 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1494 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1495 if(pScanReq->uIEFieldLen)
1496 {
1497 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1498 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1499 pScanReq->uIEFieldLen);
1500 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001501
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301502 pMlmScanReq->bssType = pScanReq->bssType;
1503 vos_mem_copy( pMlmScanReq->bssId,
1504 pScanReq->bssId,
1505 sizeof(tSirMacAddr));
1506 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001507
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301508 i = 0;
1509 while (i < pMlmScanReq->numSsid)
1510 {
1511 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 (tANI_U8 *) &pScanReq->ssId[i],
1513 pScanReq->ssId[i].length + 1);
1514
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301515 i++;
1516 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001517
Jeff Johnson295189b2012-06-20 16:38:30 -07001518
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301519 pMlmScanReq->scanType = pScanReq->scanType;
1520 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301521 if (pMac->miracast_mode)
1522 {
1523 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1524 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1525 }
1526 else
1527 {
1528 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1529 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1530 }
1531
Abhishek Singh3a93ee42016-09-29 17:00:03 +05301532 pMlmScanReq->min_chntime_btc_esco =
1533 pScanReq->min_chntime_btc_esco;
1534 pMlmScanReq->max_chntime_btc_esco =
1535 pScanReq->max_chntime_btc_esco;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301536 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1537 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001538
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301539 //Store the smeSessionID and transaction ID for later use.
1540 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1541 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001542
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301543 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301544 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301545 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1546 }
1547 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001548
1549 else
1550 {
1551 /// In all other cases return 'cached' scan results
1552 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1553 {
1554 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1555
1556 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001557#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1558 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001560 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1561 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1562 {
1563 limSendSmeLfrScanRsp(pMac, scanRspLen,
1564 eSIR_SME_SUCCESS,
1565 pScanReq->sessionId,
1566 pScanReq->transactionId);
1567 }
1568 else
1569 {
1570 scanRspLen = sizeof(tSirSmeScanRsp) +
1571 pMac->lim.gLimSmeLfrScanResultLength -
1572 sizeof(tSirBssDescription);
1573 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1574 pScanReq->sessionId, pScanReq->transactionId);
1575 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 }
1577 else
1578 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001579#endif
1580 if (pMac->lim.gLimSmeScanResultLength == 0)
1581 {
1582 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1583 pScanReq->sessionId, pScanReq->transactionId);
1584 }
1585 else
1586 {
1587 scanRspLen = sizeof(tSirSmeScanRsp) +
1588 pMac->lim.gLimSmeScanResultLength -
1589 sizeof(tSirBssDescription);
1590 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1591 pScanReq->sessionId, pScanReq->transactionId);
1592 }
1593#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001595#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301596 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001597
1598 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1599 {
1600 // Discard previously cached scan results
1601 limReInitScanResults(pMac);
1602 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001603#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1604 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1605 {
1606 // Discard previously cached scan results
1607 limReInitLfrScanResults(pMac);
1608 }
1609#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001610
1611 } // if (pMac->lim.gLimRspReqd)
1612 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1613
Jeff Johnson295189b2012-06-20 16:38:30 -07001614#ifdef BACKGROUND_SCAN_ENABLED
1615 // start background scans if needed
1616 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1617 __limBackgroundScanInitiate(pMac);
1618#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001619
1620} /*** end __limProcessSmeScanReq() ***/
1621
Jeff Johnsone7245742012-09-05 17:12:55 -07001622#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001623
Jeff Johnsone7245742012-09-05 17:12:55 -07001624static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1625{
1626 tpSirOemDataReq pOemDataReq;
1627 tLimMlmOemDataReq* pMlmOemDataReq;
1628
1629 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1630
1631 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301632 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1633 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001634 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301635 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001636 return;
1637 }
1638
1639 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301640 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001641
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301642 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1643 sizeof(tSirMacAddr));
1644 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1645 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001646
1647 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1648 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1649
1650 return;
1651
1652} /*** end __limProcessSmeOemDataReq() ***/
1653
1654#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001655
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301656/**
1657 * __limProcessClearDfsChannelList()
1658 *
1659 *FUNCTION:
1660 *Clear DFS channel list when country is changed/aquired.
1661.*This message is sent from SME.
1662 *
1663 *LOGIC:
1664 *
1665 *ASSUMPTIONS:
1666 *
1667 *NOTE:
1668 *
1669 * @param pMac Pointer to Global MAC structure
1670 * @param *pMsgBuf A pointer to the SME message buffer
1671 * @return None
1672 */
1673static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1674 tpSirMsgQ pMsg)
1675{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301676 vos_mem_set( &pMac->lim.dfschannelList,
1677 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301678}
Jeff Johnson295189b2012-06-20 16:38:30 -07001679
1680/**
1681 * __limProcessSmeJoinReq()
1682 *
1683 *FUNCTION:
1684 * This function is called to process SME_JOIN_REQ message
1685 * from HDD or upper layer application.
1686 *
1687 *LOGIC:
1688 *
1689 *ASSUMPTIONS:
1690 *
1691 *NOTE:
1692 *
1693 * @param pMac Pointer to Global MAC structure
1694 * @param *pMsgBuf A pointer to the SME message buffer
1695 * @return None
1696 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001697static void
1698__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1699{
1700 // tANI_U8 *pBuf;
1701 //tANI_U32 len;
1702// tSirMacAddr currentBssId;
1703 tpSirSmeJoinReq pSmeJoinReq = NULL;
1704 tLimMlmJoinReq *pMlmJoinReq;
1705 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1706 tANI_U32 val = 0;
1707 tANI_U16 nSize;
1708 tANI_U8 sessionId;
1709 tpPESession psessionEntry = NULL;
Nitesh Shah54046ee2016-07-19 15:23:51 +05301710 tANI_U8 smesessionId = 0;
1711 tANI_U16 smetransactionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301713 tANI_U16 ieLen;
1714 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001715
1716#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1717 //Not sending any session, since it is not created yet. The response whould have correct state.
1718 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1719#endif //FEATURE_WLAN_DIAG_SUPPORT
1720
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301721 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001722
1723#ifdef WLAN_FEATURE_VOWIFI
1724 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1725 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1726 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1727 * like not honoring power constraint on 1st association after driver loading. */
1728 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001729 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1731 val = 0;
1732#endif /* WLAN_FEATURE_VOWIFI */
1733
1734 /**
1735 * Expect Join request in idle state.
1736 * Reassociate request is expected in link established state.
1737 */
1738
1739 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1740 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1741 {
1742 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301743
1744 pSmeJoinReq = vos_mem_malloc(nSize);
1745 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301747 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1748 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1750 goto end;
1751 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301752 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001753
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1755 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1756 {
1757 /// Received invalid eWNI_SME_JOIN_REQ
1758 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301759 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1760 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 retCode = eSIR_SME_INVALID_PARAMETERS;
1762 goto end;
1763 }
1764
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301765 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001766
1767 /* check for the existence of start BSS session */
1768#ifdef FIXME_GEN6
1769 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1770 {
1771 if(peValidateBtJoinRequest(pMac)!= TRUE)
1772 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301773 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1774 "not present::SME_JOIN_REQ in unexpected state"),
1775 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1777 psessionEntry = NULL;
1778 goto end;
1779 }
1780 }
1781
1782#endif
1783
1784
1785 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1786 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301787 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301788 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301789 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1790 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001791
1792 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1793 {
1794 // Received eWNI_SME_JOIN_REQ for same
1795 // BSS as currently associated.
1796 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301797 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1798 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301800 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1801 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 goto end;
1803 }
1804 else
1805 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301806 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1807 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 retCode = eSIR_SME_REFUSED;
1809 psessionEntry = NULL;
1810 goto end;
1811 }
1812 }
1813 else /* Session Entry does not exist for given BSSId */
1814 {
1815 /* Try to Create a new session */
1816 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1817 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001818 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1820 goto end;
1821 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301822 else
1823 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1824 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301825 }
1826
1827 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1828 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1829 psessionEntry->is11Gonly = true;
1830 }
1831 }
1832
krunal soni5afa96c2013-09-06 22:19:02 -07001833 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001834
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 /* Store Session related parameters */
1836 /* Store PE session Id in session Table */
1837 psessionEntry->peSessionId = sessionId;
1838
1839 /* store the smejoin req handle in session table */
1840 psessionEntry->pLimJoinReq = pSmeJoinReq;
1841
1842 /* Store SME session Id in sessionTable */
1843 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1844
1845 /* Store SME transaction Id in session Table */
1846 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1847
1848 /* Store beaconInterval */
1849 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1850
1851 /* Copying of bssId is already done, while creating session */
1852 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1853 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1854 psessionEntry->bssType = pSmeJoinReq->bsstype;
1855
1856 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301857 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1858 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301859 psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
Abhishek Singheef5c992016-01-27 13:41:54 +05301860 psessionEntry->bWPSAssociation = pSmeJoinReq->bWPSAssociation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001861
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301862 /* Store vendor specfic IE for CISCO AP */
Abhishek Singhbad2b322016-10-21 11:22:33 +05301863 ieLen = GET_IE_LEN_IN_BSS(pSmeJoinReq->bssDescription.length);
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301864
1865 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1866 SIR_MAC_CISCO_OUI_SIZE,
1867 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1868
1869 if ( NULL != vendorIE )
1870 {
1871 limLog(pMac, LOGE,
1872 FL("DUT is trying to connect to Cisco AP"));
1873 psessionEntry->isCiscoVendorAP = TRUE;
1874 }
1875 else
1876 {
1877 psessionEntry->isCiscoVendorAP = FALSE;
1878 }
1879
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 /* Copy the dot 11 mode in to the session table */
1881
1882 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1883 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001884#ifdef WLAN_FEATURE_11AC
1885 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001886 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001887 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001888 if (psessionEntry->vhtCapability )
1889 {
1890 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1891
1892 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001893 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001894 psessionEntry->txBFIniFeatureEnabled);
1895
Selvaraj, Sridhar716d30f2016-07-28 18:54:03 +05301896 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
1897 psessionEntry->txBFIniFeatureEnabled) != eSIR_SUCCESS)
1898 {
1899 limLog(pMac, LOGP, FL("could not set "
1900 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
1901 retCode = eSIR_LOGP_EXCEPTION;
1902 goto end;
1903 }
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001904 if( psessionEntry->txBFIniFeatureEnabled )
1905 {
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001906 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301907 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1908 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001909
1910 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001911 != eSIR_SUCCESS)
1912 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301913 limLog(pMac, LOGP, FL("could not set "
1914 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001915 retCode = eSIR_LOGP_EXCEPTION;
1916 goto end;
1917 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301918
1919 if ( FALSE == pMac->isMuBfsessionexist )
1920 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001921 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301922
1923 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1924 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1925 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1926
1927 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1928 != eSIR_SUCCESS)
1929 {
1930 limLog(pMac, LOGE, FL("could not set "
1931 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1932 retCode = eSIR_LOGP_EXCEPTION;
1933 goto end;
1934 }
1935
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001936 }
1937
Jeff Johnsone7245742012-09-05 17:12:55 -07001938#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001939
1940 /*Phy mode*/
1941 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1942
Abhishek Singhca6ec5d2015-06-24 13:13:27 +05301943 handleHTCapabilityandHTInfo(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 /* Copy The channel Id to the session Table */
1945 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001946 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1947 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1948 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001949
Chet Lanctot186b5732013-03-18 10:26:30 -07001950 /* Record if management frames need to be protected */
1951#ifdef WLAN_FEATURE_11W
1952 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1953 {
1954 psessionEntry->limRmfEnabled = 1;
1955 }
1956 else
1957 {
1958 psessionEntry->limRmfEnabled = 0;
1959 }
1960#endif
1961
krunal soni8d13b092013-07-19 13:23:29 -07001962#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1963 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1964#endif
1965
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 /*Store Persona */
1967 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1968 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301969 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1970 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001971
1972 /* Copy the SSID from smejoinreq to session entry */
1973 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301974 vos_mem_copy( psessionEntry->ssId.ssId,
1975 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1976
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001977 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301978 // which inturn is dependent on the profile the user wants to connect
1979 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001980#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301981 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001982#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001983#ifdef FEATURE_WLAN_ESE
1984 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001985#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001986#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301987 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001988#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301989
Jeff Johnson43971f52012-07-17 12:26:56 -07001990#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301991 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001992#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301993 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001994
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301995 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301997 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1998 }
1999 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
2000 {
2001 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
2002 }
2003 else
2004 {
2005 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05302006 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
2007 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302008 retCode = eSIR_SME_INVALID_PARAMETERS;
2009 goto end;
2010 }
2011
2012 if (pSmeJoinReq->addIEScan.length)
2013 {
2014 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
2016 }
2017
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302018 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302020 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
2022 }
2023
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302025 pMlmJoinReq = vos_mem_malloc(val);
2026 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302028 limLog(pMac, LOGP, FL("call to AllocateMemory "
2029 "failed for mlmJoinReq"));
Nitesh Shah54046ee2016-07-19 15:23:51 +05302030 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2031 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07002032 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302033 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002034
2035 /* PE SessionId is stored as a part of JoinReq*/
2036 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
2037
2038 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
2039 != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302040 {
2041 limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
2042 "setting it to default value"));
2043 pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
2044 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002045
2046 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302047 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302049 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 sizeof(tSirMacRateSet));
2051 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302052 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 sizeof(tSirMacRateSet));
2054
2055 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
2056
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
2058
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302059 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
2061 psessionEntry->pLimJoinReq->bssDescription.length + 2);
2062
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07002064 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002065
Jeff Johnsone7245742012-09-05 17:12:55 -07002066 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302067 localPowerConstraint = regMax;
Abhishek Singhbad2b322016-10-21 11:22:33 +05302068 limExtractApCapability(pMac,
2069 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
2070 GET_IE_LEN_IN_BSS(psessionEntry->pLimJoinReq->bssDescription.length),
2071 &psessionEntry->limCurrentBssQosCaps,
2072 &psessionEntry->limCurrentBssPropCap,
2073 &pMac->lim.gLimCurrentBssUapsd,
2074 &localPowerConstraint,
2075 psessionEntry);
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302076
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002077#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002078 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07002079#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302080 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002081#endif
Sushant Kaushikece4b562015-04-09 18:27:33 +05302082 if (!psessionEntry->maxTxPower)
2083 {
2084 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
2085 "is zero. Setting it to default value %d"),
2086 TX_POWER_DEFAULT);
2087 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2088 }
2089
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302090 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2091 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302092 " max tx = %d", regMax, localPowerConstraint,
2093 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002094
Agrawal Ashish0a4edfb2017-02-24 14:37:09 +05302095 if (pSmeJoinReq->powerCap.maxTxPower > psessionEntry->maxTxPower)
2096 {
2097 pSmeJoinReq->powerCap.maxTxPower = psessionEntry->maxTxPower;
2098 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2099 "Update MaxTxPower in join Req to %d",
2100 pSmeJoinReq->powerCap.maxTxPower);
2101 }
2102
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 if (pMac->lim.gLimCurrentBssUapsd)
2104 {
2105 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302106 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2107 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002108
2109 // resetting the dynamic uapsd mask
2110 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2111 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2112 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002113
2114 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2115
2116 // Initialize 11h Enable Flag
2117 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2118 {
2119 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302120 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002121 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302122 psessionEntry->lim11hEnable = 1;
2123 }
2124 else
2125 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 }
2127 else
2128 psessionEntry->lim11hEnable = 0;
2129
2130 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2131 pMac->lim.gLimIbssCoalescingHappened = false;
2132
Jeff Johnsone7245742012-09-05 17:12:55 -07002133 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2134 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2135 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002136
Abhishek Singh57aebef2014-02-03 18:47:44 +05302137 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2138 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2139 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2140 psessionEntry->currentOperChannel,
2141 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002142
2143 /* Indicate whether spectrum management is enabled*/
2144 psessionEntry->spectrumMgtEnabled =
2145 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302146
2147 /* Enable the spectrum management if this is a DFS channel */
2148 if (psessionEntry->countryInfoPresent &&
2149 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2150 {
2151 psessionEntry->spectrumMgtEnabled = TRUE;
2152 }
2153
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302154 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2155 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 /* Issue LIM_MLM_JOIN_REQ to MLM */
2157 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2158 return;
2159
2160 }
2161 else
2162 {
2163 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302164 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302165 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2167 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2168 psessionEntry = NULL;
2169 goto end;
2170
2171 }
2172
2173end:
2174 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2175
2176 if(pSmeJoinReq)
2177 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302178 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 pSmeJoinReq = NULL;
2180 if (NULL != psessionEntry)
2181 {
2182 psessionEntry->pLimJoinReq = NULL;
2183 }
2184 }
2185
2186 if(retCode != eSIR_SME_SUCCESS)
2187 {
2188 if(NULL != psessionEntry)
2189 {
2190 peDeleteSession(pMac,psessionEntry);
2191 psessionEntry = NULL;
2192 }
2193 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302194 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2195 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2197} /*** end __limProcessSmeJoinReq() ***/
2198
2199
Agrawal Ashish01c66342017-01-27 12:52:25 +05302200#if defined FEATURE_WLAN_ESE || defined WLAN_FEATURE_VOWIFI
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002201tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002202{
2203 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302204 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002205 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2207 maxTxPower = txPower;
2208 else if (txPower < MIN_TX_PWR_CAP)
2209 maxTxPower = MIN_TX_PWR_CAP;
2210 else
2211 maxTxPower = MAX_TX_PWR_CAP;
2212
2213 return (maxTxPower);
2214}
2215#endif
2216
Jeff Johnson295189b2012-06-20 16:38:30 -07002217/**
2218 * __limProcessSmeReassocReq()
2219 *
2220 *FUNCTION:
2221 * This function is called to process SME_REASSOC_REQ message
2222 * from HDD or upper layer application.
2223 *
2224 *LOGIC:
2225 *
2226 *ASSUMPTIONS:
2227 *
2228 *NOTE:
2229 *
2230 * @param pMac Pointer to Global MAC structure
2231 * @param *pMsgBuf A pointer to the SME message buffer
2232 * @return None
2233 */
2234
2235static void
2236__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2237{
2238 tANI_U16 caps;
2239 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002240 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 tLimMlmReassocReq *pMlmReassocReq;
2242 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2243 tpPESession psessionEntry = NULL;
2244 tANI_U8 sessionId;
2245 tANI_U8 smeSessionId;
2246 tANI_U16 transactionId;
2247 tPowerdBm localPowerConstraint = 0, regMax = 0;
2248 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002249 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002250
2251
Abhishek Singh127a8442014-12-15 17:31:27 +05302252 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002254 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302255 pReassocReq = vos_mem_malloc(nSize);
2256 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 {
2258 // Log error
2259 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302260 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002261
2262 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2263 goto end;
2264 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302265 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2267 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2268 (!limIsSmeJoinReqValid(pMac,
2269 (tpSirSmeJoinReq) pReassocReq)))
2270 {
2271 /// Received invalid eWNI_SME_REASSOC_REQ
2272 // Log the event
2273 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002274 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002275
2276 retCode = eSIR_SME_INVALID_PARAMETERS;
2277 goto end;
2278 }
2279
2280 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2281 {
2282 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002283 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 retCode = eSIR_SME_INVALID_PARAMETERS;
2285 goto end;
2286 }
2287
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302288#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05302289 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry,
2290 eSIR_SUCCESS, eSIR_SUCCESS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002291#endif //FEATURE_WLAN_DIAG_SUPPORT
2292 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2293
2294 /* Store the reassoc handle in the session Table.. 23rd sep review */
2295 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302296 psessionEntry->dot11mode = pReassocReq->dot11mode;
2297 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002298
2299 /**
2300 * Reassociate request is expected
2301 * in link established state only.
2302 */
2303
2304 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2305 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002306#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2308 {
2309 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002310 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 psessionEntry->peSessionId);
2312
2313 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302314 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2316 {
2317 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2318 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002319 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 retCode = eSIR_SME_INVALID_PARAMETERS;
2321 goto end;
2322 }
2323
2324 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2325 return;
2326 }
2327#endif
2328 /// Should not have received eWNI_SME_REASSOC_REQ
2329 // Log the event
2330 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302331 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 psessionEntry->limSmeState);
2333 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2334
2335 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2336 goto end;
2337 }
2338
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302339 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2341 sizeof(tSirMacAddr));
2342
2343 psessionEntry->limReassocChannelId =
2344 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2345
Jeff Johnsone7245742012-09-05 17:12:55 -07002346 psessionEntry->reAssocHtSupportedChannelWidthSet =
2347 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2348 psessionEntry->reAssocHtRecommendedTxWidthSet =
2349 psessionEntry->reAssocHtSupportedChannelWidthSet;
2350 psessionEntry->reAssocHtSecondaryChannelOffset =
2351 psessionEntry->pLimReAssocReq->cbMode;
2352
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 psessionEntry->limReassocBssCaps =
2354 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2356 localPowerConstraint = regMax;
Abhishek Singhbad2b322016-10-21 11:22:33 +05302357 limExtractApCapability(pMac,
2358 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2359 GET_IE_LEN_IN_BSS(
2360 psessionEntry->pLimReAssocReq->bssDescription.length),
2361 &psessionEntry->limReassocBssQosCaps,
2362 &psessionEntry->limReassocBssPropCap,
2363 &pMac->lim.gLimCurrentBssUapsd,
2364 &localPowerConstraint,
2365 psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002366
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302367 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Sushant Kaushikece4b562015-04-09 18:27:33 +05302368 if (!psessionEntry->maxTxPower)
2369 {
2370 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
2371 "is zero. Setting it to default value %d"),
2372 TX_POWER_DEFAULT);
2373 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2374 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002375#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302376 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2377 "= %d, max tx = %d", regMax, localPowerConstraint,
2378 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002379#endif
2380 {
2381 #if 0
2382 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2383 &cfgLen) != eSIR_SUCCESS)
2384 {
2385 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002386 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 }
2388 #endif//TO SUPPORT BT-AMP
2389
2390 /* Copy the SSID from sessio entry to local variable */
2391 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302392 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 psessionEntry->ssId.ssId,
2394 psessionEntry->ssId.length);
2395 #endif
2396 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302397 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2399
2400 }
2401
2402 if (pMac->lim.gLimCurrentBssUapsd)
2403 {
2404 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302405 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2406 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 }
2408
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302409 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2410 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002411 {
2412 // Log error
2413 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302414 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002415
2416 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2417 goto end;
2418 }
2419
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302420 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 psessionEntry->limReAssocbssId,
2422 sizeof(tSirMacAddr));
2423
2424 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2425 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2426 != eSIR_SUCCESS)
2427 {
2428 /**
2429 * Could not get ReassocFailureTimeout value
2430 * from CFG. Log error.
2431 */
2432 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002433 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435
2436 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2437 {
2438 /**
2439 * Could not get Capabilities value
2440 * from CFG. Log error.
2441 */
2442 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002443 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05302445
2446 lim_update_caps_info_for_bss(pMac, &caps,
2447 pReassocReq->bssDescription.capabilityInfo);
2448
2449 limLog(pMac, LOG1, FL("Capabilities info Reassoc: 0x%X"), caps);
2450
Jeff Johnson295189b2012-06-20 16:38:30 -07002451 pMlmReassocReq->capabilityInfo = caps;
2452
2453 /* Update PE sessionId*/
2454 pMlmReassocReq->sessionId = sessionId;
2455
2456 /* If telescopic beaconing is enabled, set listen interval to
2457 WNI_CFG_TELE_BCN_MAX_LI */
2458 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2459 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002460 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002461
2462 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2463
2464 if(teleBcnEn)
2465 {
2466 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2467 eSIR_SUCCESS)
2468 {
2469 /**
2470 * Could not get ListenInterval value
2471 * from CFG. Log error.
2472 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002473 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 }
2475 }
2476 else
2477 {
2478 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2479 {
2480 /**
2481 * Could not get ListenInterval value
2482 * from CFG. Log error.
2483 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002484 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 }
2486 }
2487
2488 /* Delete all BA sessions before Re-Assoc.
2489 * BA frames are class 3 frames and the session
2490 * is lost upon disassociation and reassociation.
2491 */
2492
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302493 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2494 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002495
2496 pMlmReassocReq->listenInterval = (tANI_U16) val;
2497
2498 /* Indicate whether spectrum management is enabled*/
2499 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2500
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302501 /* Enable the spectrum management if this is a DFS channel */
2502 if (psessionEntry->countryInfoPresent &&
2503 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2504 {
2505 psessionEntry->spectrumMgtEnabled = TRUE;
2506 }
2507
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2509 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2510
Jeff Johnsone7245742012-09-05 17:12:55 -07002511 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002512
2513 limPostMlmMessage(pMac,
2514 LIM_MLM_REASSOC_REQ,
2515 (tANI_U32 *) pMlmReassocReq);
2516 return;
2517
2518end:
2519 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302520 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002521
2522 if (psessionEntry)
2523 {
2524 // error occurred after we determined the session so extract
2525 // session and transaction info from there
2526 smeSessionId = psessionEntry->smeSessionId;
2527 transactionId = psessionEntry->transactionId;
2528 }
2529 else
2530 {
2531 // error occurred before or during the time we determined the session
2532 // so extract the session and transaction info from the message
2533 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2534 }
2535
2536 /// Send Reassoc failure response to host
2537 /// (note psessionEntry may be NULL, but that's OK)
2538 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2539 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2540 psessionEntry, smeSessionId, transactionId);
2541
2542} /*** end __limProcessSmeReassocReq() ***/
2543
2544
2545tANI_BOOLEAN sendDisassocFrame = 1;
2546/**
2547 * __limProcessSmeDisassocReq()
2548 *
2549 *FUNCTION:
2550 * This function is called to process SME_DISASSOC_REQ message
2551 * from HDD or upper layer application.
2552 *
2553 *LOGIC:
2554 *
2555 *ASSUMPTIONS:
2556 *
2557 *NOTE:
2558 *
2559 * @param pMac Pointer to Global MAC structure
2560 * @param *pMsgBuf A pointer to the SME message buffer
2561 * @return None
2562 */
2563
2564static void
2565__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2566{
2567 tANI_U16 disassocTrigger, reasonCode;
2568 tLimMlmDisassocReq *pMlmDisassocReq;
2569 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002570 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 tSirSmeDisassocReq smeDisassocReq;
2572 tpPESession psessionEntry = NULL;
2573 tANI_U8 sessionId;
2574 tANI_U8 smesessionId;
2575 tANI_U16 smetransactionId;
2576
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
Jeff Johnson43971f52012-07-17 12:26:56 -07002578 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002580 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 return;
2582 }
2583
Jeff Johnson43971f52012-07-17 12:26:56 -07002584 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002585
Jeff Johnson43971f52012-07-17 12:26:56 -07002586 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002587
Jeff Johnson43971f52012-07-17 12:26:56 -07002588 if ( (eSIR_FAILURE == status) ||
2589 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 {
2591 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002592 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002593
2594 if (pMac->lim.gLimRspReqd)
2595 {
2596 pMac->lim.gLimRspReqd = false;
2597
2598 retCode = eSIR_SME_INVALID_PARAMETERS;
2599 disassocTrigger = eLIM_HOST_DISASSOC;
2600 goto sendDisassoc;
2601 }
2602
2603 return;
2604 }
2605
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2607 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302608 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2609 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 retCode = eSIR_SME_INVALID_PARAMETERS;
2611 disassocTrigger = eLIM_HOST_DISASSOC;
2612 goto sendDisassoc;
2613
2614 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302615 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2616 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2617 smesessionId,psessionEntry->limSystemRole,
2618 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2619 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002620
2621#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2622 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2623#endif //FEATURE_WLAN_DIAG_SUPPORT
2624
2625 /* Update SME session Id and SME transaction ID*/
2626
2627 psessionEntry->smeSessionId = smesessionId;
2628 psessionEntry->transactionId = smetransactionId;
2629
2630 switch (psessionEntry->limSystemRole)
2631 {
2632 case eLIM_STA_ROLE:
2633 case eLIM_BT_AMP_STA_ROLE:
2634 switch (psessionEntry->limSmeState)
2635 {
2636 case eLIM_SME_ASSOCIATED_STATE:
2637 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302638 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2639 "limSmeState: %d "),psessionEntry->limSmeState);
2640
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2642 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002643#ifdef FEATURE_WLAN_TDLS
2644 /* Delete all TDLS peers connected before leaving BSS*/
2645 limDeleteTDLSPeers(pMac, psessionEntry);
2646#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002647 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 break;
2649
2650 case eLIM_SME_WT_DEAUTH_STATE:
2651 /* PE shall still process the DISASSOC_REQ and proceed with
2652 * link tear down even if it had already sent a DEAUTH_IND to
2653 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2654 * its been set when PE entered WT_DEAUTH_STATE.
2655 */
2656 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002657 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302658 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2659 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 break;
2661
2662 case eLIM_SME_WT_DISASSOC_STATE:
2663 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2664 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2665 * PE can continue processing DISASSOC_REQ and send the response instead
2666 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2667 * for disassoc frame.
2668 *
2669 * It will send a disassoc, which is ok. However, we can use the global flag
2670 * sendDisassoc to not send disassoc frame.
2671 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302672 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2673 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 break;
2675
2676 case eLIM_SME_JOIN_FAILURE_STATE: {
2677 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302678 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2679 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 if (pMac->lim.gLimRspReqd) {
2681 retCode = eSIR_SME_SUCCESS;
2682 disassocTrigger = eLIM_HOST_DISASSOC;
2683 goto sendDisassoc;
2684 }
2685 }break;
2686 default:
2687 /**
2688 * STA is not currently associated.
2689 * Log error and send response to host
2690 */
2691 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302692 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 psessionEntry->limSmeState);
2694 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2695
2696 if (pMac->lim.gLimRspReqd)
2697 {
2698 if (psessionEntry->limSmeState !=
2699 eLIM_SME_WT_ASSOC_STATE)
2700 pMac->lim.gLimRspReqd = false;
2701
2702 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2703 disassocTrigger = eLIM_HOST_DISASSOC;
2704 goto sendDisassoc;
2705 }
2706
2707 return;
2708 }
2709
2710 break;
2711
2712 case eLIM_AP_ROLE:
2713 case eLIM_BT_AMP_AP_ROLE:
2714 // Fall through
2715 break;
2716
2717 case eLIM_STA_IN_IBSS_ROLE:
2718 default: // eLIM_UNKNOWN_ROLE
2719 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002720 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 psessionEntry->limSystemRole);
2722
2723 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2724 disassocTrigger = eLIM_HOST_DISASSOC;
2725 goto sendDisassoc;
2726 } // end switch (pMac->lim.gLimSystemRole)
2727
Edhar, Mahesh Kumar03cf7ff2015-11-26 17:59:29 +05302728 disassocTrigger = eLIM_HOST_DISASSOC;
2729 reasonCode = smeDisassocReq.reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002730
2731 if (smeDisassocReq.doNotSendOverTheAir)
2732 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302733 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 sendDisassocFrame = 0;
2735 }
2736 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302737 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2738 " : %d, reasonCode : %d"),
2739 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302740 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2741 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 {
2743 // Log error
2744 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302745 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002746
2747 return;
2748 }
2749
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302750 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2752 sizeof(tSirMacAddr));
2753
2754 pMlmDisassocReq->reasonCode = reasonCode;
2755 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2756
2757 /* Update PE session ID*/
2758 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002759
2760 limPostMlmMessage(pMac,
2761 LIM_MLM_DISASSOC_REQ,
2762 (tANI_U32 *) pMlmDisassocReq);
2763 return;
2764
2765sendDisassoc:
2766 if (psessionEntry)
2767 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2768 retCode,
2769 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 else
2772 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2773 retCode,
2774 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002775 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002776
2777
2778} /*** end __limProcessSmeDisassocReq() ***/
2779
2780
2781/** -----------------------------------------------------------------
2782 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2783
2784 This function is called to process SME_DISASSOC_CNF message
2785 from HDD or upper layer application.
2786
2787 \param pMac - global mac structure
2788 \param pStaDs - station dph hash node
2789 \return none
2790 \sa
2791 ----------------------------------------------------------------- */
2792static void
2793__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2794{
2795 tSirSmeDisassocCnf smeDisassocCnf;
2796 tANI_U16 aid;
2797 tpDphHashNode pStaDs;
2798 tSirRetStatus status = eSIR_SUCCESS;
2799 tpPESession psessionEntry;
2800 tANI_U8 sessionId;
2801
2802
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302803 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002804
2805 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2806
2807 if (status == eSIR_FAILURE)
2808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002809 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 return;
2811 }
2812
2813 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2814 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002815 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002816 return;
2817 }
2818
2819 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2820 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302821 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 return;
2823 }
2824
2825#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2826 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2827 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2828 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2829 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2830#endif //FEATURE_WLAN_DIAG_SUPPORT
2831
2832 switch (psessionEntry->limSystemRole)
2833 {
2834 case eLIM_STA_ROLE:
2835 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2836 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2837 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2838 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2839 {
2840 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302841 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 psessionEntry->limSmeState);
2843 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2844 return;
2845 }
2846 break;
2847
2848 case eLIM_AP_ROLE:
2849 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002851
2852 case eLIM_STA_IN_IBSS_ROLE:
2853 default: // eLIM_UNKNOWN_ROLE
2854 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002855 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 psessionEntry->limSystemRole);
2857
2858 return;
2859 }
2860
2861
2862 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2863 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 )
2866 {
2867 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2868 if (pStaDs == NULL)
2869 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302870 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2871 "does not have context, addr= "MAC_ADDRESS_STR),
2872 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 return;
2874 }
Wu Gao742b7352015-10-16 19:10:40 +08002875
2876 if(aid != smeDisassocCnf.assocId)
2877 {
2878 PELOGE(limLog(pMac, LOGE, FL("same peerMacAddr but assocId is different "
2879 "aid=%d, assocId=%d, addr= "MAC_ADDRESS_STR),
2880 aid, smeDisassocCnf.assocId, MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
2881 return;
2882 }
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05302883 /*
2884 * If MlM state is either of del_sta or del_bss state, then no need to
2885 * go ahead and clean up further as there must be some cleanup in
2886 * progress from upper layer disassoc/deauth request.
2887 */
2888 if((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
2889 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
2890 {
2891 limLog(pMac, LOGE, FL("No need to cleanup for addr:"MAC_ADDRESS_STR
2892 "as Mlm state is %d"),
2893 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr),
2894 pStaDs->mlmStaContext.mlmState);
2895 return;
2896 }
2897
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002898 /* Delete FT session if there exists one */
2899 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002901
2902 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 }
2904
2905 return;
2906}
2907
2908
2909/**
2910 * __limProcessSmeDeauthReq()
2911 *
2912 *FUNCTION:
2913 * This function is called to process SME_DEAUTH_REQ message
2914 * from HDD or upper layer application.
2915 *
2916 *LOGIC:
2917 *
2918 *ASSUMPTIONS:
2919 *
2920 *NOTE:
2921 *
2922 * @param pMac Pointer to Global MAC structure
2923 * @param *pMsgBuf A pointer to the SME message buffer
2924 * @return None
2925 */
2926
2927static void
2928__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2929{
2930 tANI_U16 deauthTrigger, reasonCode;
2931 tLimMlmDeauthReq *pMlmDeauthReq;
2932 tSirSmeDeauthReq smeDeauthReq;
2933 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2934 tSirRetStatus status = eSIR_SUCCESS;
2935 tpPESession psessionEntry;
2936 tANI_U8 sessionId; //PE sessionId
2937 tANI_U8 smesessionId;
2938 tANI_U16 smetransactionId;
2939
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
2941 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2943
2944 //We need to get a session first but we don't even know if the message is correct.
2945 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002947 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 retCode = eSIR_SME_INVALID_PARAMETERS;
2949 deauthTrigger = eLIM_HOST_DEAUTH;
2950 goto sendDeauth;
2951
2952 }
2953
2954 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2955 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302956 PELOGE(limLog(pMac, LOGE,FL
2957 ("received invalid SME_DEAUTH_REQ message"));)
2958 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002959
Sachin Ahuja42354142015-01-06 19:48:35 +05302960 retCode = eSIR_SME_INVALID_PARAMETERS;
2961 deauthTrigger = eLIM_HOST_DEAUTH;
2962 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302964 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2965 "Systemrole %d with reasoncode %u in limSmestate %d from "
2966 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2967 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2968 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002969#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2970 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2971#endif //FEATURE_WLAN_DIAG_SUPPORT
2972
2973 /* Update SME session ID and Transaction ID */
2974 psessionEntry->smeSessionId = smesessionId;
2975 psessionEntry->transactionId = smetransactionId;
2976
2977
2978 switch (psessionEntry->limSystemRole)
2979 {
2980 case eLIM_STA_ROLE:
2981 case eLIM_BT_AMP_STA_ROLE:
2982
2983 switch (psessionEntry->limSmeState)
2984 {
2985 case eLIM_SME_ASSOCIATED_STATE:
2986 case eLIM_SME_LINK_EST_STATE:
2987 case eLIM_SME_WT_ASSOC_STATE:
2988 case eLIM_SME_JOIN_FAILURE_STATE:
2989 case eLIM_SME_IDLE_STATE:
2990 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2991 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002992 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
2994 // Send Deauthentication request to MLM below
2995
2996 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302997 case eLIM_SME_WT_DEAUTH_STATE:
2998 /*
2999 * PE Recieved a Deauth frame. Normally it gets
3000 * DEAUTH_CNF but it received DEAUTH_REQ. Which
3001 * means host is also trying to disconnect.
3002 * PE can continue processing DEAUTH_REQ and send
3003 * the response instead of failing the request.
3004 * SME will anyway ignore DEAUTH_IND that was sent
3005 * for deauth frame.
3006 */
3007 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
3008 "SME_WT_DEAUTH_STATE. "));
3009 break;
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05303010 case eLIM_SME_WT_DISASSOC_STATE:
3011 /*
3012 * PE Recieved a Disassoc frame. Normally it gets
3013 * DISASSOC_CNF but it received DEAUTH_REQ. This means
3014 * host is also trying to disconnect.
3015 */
3016 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
3017 "SME_WT_DISASSOC_STATE. "));
3018 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 default:
3020 /**
3021 * STA is not in a state to deauthenticate with
3022 * peer. Log error and send response to host.
3023 */
3024 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303025 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303026 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3028
3029 if (pMac->lim.gLimRspReqd)
3030 {
3031 pMac->lim.gLimRspReqd = false;
3032
3033 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
3034 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08003035 /**
3036 *here we received deauth request from AP so sme state is
3037 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
3038 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
3039 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
3040 so the below condition captures the state where delSta
3041 not done and firmware still in connected state.
3042 */
3043 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
3044 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
3045 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
3046 {
3047 retCode = eSIR_SME_DEAUTH_STATUS;
3048 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 goto sendDeauth;
3050 }
3051
3052 return;
3053 }
3054
3055 break;
3056
3057 case eLIM_STA_IN_IBSS_ROLE:
Abhishek Singh92fbac22015-03-24 17:57:36 +05303058 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
3059 if (pMac->lim.gLimRspReqd)
3060 {
3061 pMac->lim.gLimRspReqd = false;
3062 retCode = eSIR_SME_INVALID_PARAMETERS;
3063 deauthTrigger = eLIM_HOST_DEAUTH;
3064 goto sendDeauth;
3065 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 return;
3067
3068 case eLIM_AP_ROLE:
3069 // Fall through
3070
3071 break;
3072
3073 default:
3074 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303075 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303076 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303077 if (pMac->lim.gLimRspReqd)
3078 {
3079 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003080
Abhishek Singh92fbac22015-03-24 17:57:36 +05303081 retCode = eSIR_SME_INVALID_PARAMETERS;
3082 deauthTrigger = eLIM_HOST_DEAUTH;
3083 goto sendDeauth;
3084 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303086
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 } // end switch (pMac->lim.gLimSystemRole)
3088
3089 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3090 {
3091 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303092 limLog(pMac, LOG1,
3093 FL("Deauthentication is triggered by Link Monitoring"));
3094 limLog(pMac, LOG1,
3095 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3096 limLog(pMac, LOG1,
3097 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003098 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3099 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3100 }
3101 else
3102 {
3103 deauthTrigger = eLIM_HOST_DEAUTH;
3104 reasonCode = smeDeauthReq.reasonCode;
3105 }
3106
3107 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303108 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3109 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003110 {
3111 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303112 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303113 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303114 if (pMac->lim.gLimRspReqd)
3115 {
3116 pMac->lim.gLimRspReqd = false;
3117 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3118 deauthTrigger = eLIM_HOST_DEAUTH;
3119 goto sendDeauth;
3120 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 return;
3122 }
3123
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303124 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3126 sizeof(tSirMacAddr));
3127
3128 pMlmDeauthReq->reasonCode = reasonCode;
3129 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003130
3131 /* Update PE session Id*/
3132 pMlmDeauthReq->sessionId = sessionId;
3133
3134 limPostMlmMessage(pMac,
3135 LIM_MLM_DEAUTH_REQ,
3136 (tANI_U32 *) pMlmDeauthReq);
3137 return;
3138
3139sendDeauth:
3140 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3141 retCode,
3142 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003144 smesessionId, smetransactionId);
3145} /*** end __limProcessSmeDeauthReq() ***/
3146
3147
3148
3149/**
3150 * __limProcessSmeSetContextReq()
3151 *
3152 *FUNCTION:
3153 * This function is called to process SME_SETCONTEXT_REQ message
3154 * from HDD or upper layer application.
3155 *
3156 *LOGIC:
3157 *
3158 *ASSUMPTIONS:
3159 *
3160 *NOTE:
3161 *
3162 * @param pMac Pointer to Global MAC structure
3163 * @param *pMsgBuf A pointer to the SME message buffer
3164 * @return None
3165 */
3166
3167static void
3168__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3169{
3170 tpSirSmeSetContextReq pSetContextReq;
3171 tLimMlmSetKeysReq *pMlmSetKeysReq;
3172 tpPESession psessionEntry;
3173 tANI_U8 sessionId; //PE sessionID
3174 tANI_U8 smesessionId;
3175 tANI_U16 smetransactionId;
3176
3177
3178 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003179 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003180
3181
3182 if(pMsgBuf == NULL)
3183 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003184 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 return;
3186 }
3187
3188 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303189
3190 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3191 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303193 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003194 return;
3195 }
3196
3197 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3198 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3199 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003200 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 goto end;
3202 }
3203
3204 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3205 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003206 PELOGE(limLog(pMac, LOGE, FL("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS"), pSetContextReq->keyMaterial.numKeys);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 limSendSmeSetContextRsp(pMac,
3208 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 eSIR_SME_INVALID_PARAMETERS,NULL,
3211 smesessionId,smetransactionId);
3212
3213 goto end;
3214 }
3215
3216
3217 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3218 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003219 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 limSendSmeSetContextRsp(pMac,
3221 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003222 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003223 eSIR_SME_INVALID_PARAMETERS,NULL,
3224 smesessionId,smetransactionId);
3225
3226 goto end;
3227 }
3228
3229#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3230 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3231#endif //FEATURE_WLAN_DIAG_SUPPORT
3232
3233
3234 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3235 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3236 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3237 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3238 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3239 {
3240 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303241 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3242 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 {
3244 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303245 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 goto end;
3247 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05303248 vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3250 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3251 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3252 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003253 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 goto end;
3255 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303256 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3258 sizeof(tSirMacAddr));
3259
Jeff Johnson295189b2012-06-20 16:38:30 -07003260
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303261 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3263 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3264
3265 pMlmSetKeysReq->sessionId = sessionId;
3266#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3267 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003268 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003269#endif
3270
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3272 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3273 {
3274 if(pSetContextReq->keyMaterial.key[0].keyLength)
3275 {
3276 tANI_U8 keyId;
3277 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303278 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003279 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3280 }
3281 else {
3282 tANI_U32 i;
3283 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3284 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303285 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3287 }
3288 }
3289 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003290
3291 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 }
3293 else
3294 {
3295 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303296 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 psessionEntry->limSystemRole,
3298 psessionEntry->limSmeState);
3299 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3300
3301 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3304 smesessionId,
3305 smetransactionId);
3306 }
3307
3308end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303309 vos_mem_zero(pSetContextReq,
3310 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303311 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 return;
3313} /*** end __limProcessSmeSetContextReq() ***/
3314
3315/**
3316 * __limProcessSmeRemoveKeyReq()
3317 *
3318 *FUNCTION:
3319 * This function is called to process SME_REMOVEKEY_REQ message
3320 * from HDD or upper layer application.
3321 *
3322 *LOGIC:
3323 *
3324 *ASSUMPTIONS:
3325 *
3326 *NOTE:
3327 *
3328 * @param pMac Pointer to Global MAC structure
3329 * @param *pMsgBuf A pointer to the SME message buffer
3330 * @return None
3331 */
3332
3333static void
3334__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3335{
3336 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3337 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3338 tpPESession psessionEntry;
3339 tANI_U8 sessionId; //PE sessionID
3340 tANI_U8 smesessionId;
3341 tANI_U16 smetransactionId;
3342
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303343 limLog(pMac, LOG1,
3344 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003345
3346 if(pMsgBuf == NULL)
3347 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003348 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 return;
3350 }
3351
3352
3353 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3354
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303355 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3356 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003357 {
3358 //Log error
3359 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303360 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003361
3362 return;
3363 }
3364
3365 if ((limRemoveKeyReqSerDes(pMac,
3366 pRemoveKeyReq,
3367 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3368 {
3369 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003370 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003371
3372 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3373
3374 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3375 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003376 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 //goto end;
3378 }
3379
3380 limSendSmeRemoveKeyRsp(pMac,
3381 pRemoveKeyReq->peerMacAddr,
3382 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3383 smesessionId,smetransactionId);
3384
3385 goto end;
3386 }
3387
3388 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3389 {
3390 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003391 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 limSendSmeRemoveKeyRsp(pMac,
3393 pRemoveKeyReq->peerMacAddr,
3394 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3395 smesessionId, smetransactionId);
3396 goto end;
3397 }
3398
3399
3400 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3401 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3402 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3403 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3404 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3405 {
3406 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303407 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3408 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 {
3410 // Log error
3411 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303412 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003413
3414 goto end;
3415 }
3416
3417 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3418 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3419 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3420 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3421
3422 /* Update PE session Id */
3423 pMlmRemoveKeyReq->sessionId = sessionId;
3424
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303425 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3427 sizeof(tSirMacAddr));
3428
3429
3430 limPostMlmMessage(pMac,
3431 LIM_MLM_REMOVEKEY_REQ,
3432 (tANI_U32 *) pMlmRemoveKeyReq);
3433 }
3434 else
3435 {
3436 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303437 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 psessionEntry->limSystemRole,
3439 psessionEntry->limSmeState);
3440 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3441
3442 limSendSmeRemoveKeyRsp(pMac,
3443 pRemoveKeyReq->peerMacAddr,
3444 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3445 smesessionId,smetransactionId);
3446 }
3447
3448end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303449 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003450} /*** end __limProcessSmeRemoveKeyReq() ***/
3451
Jeff Johnson295189b2012-06-20 16:38:30 -07003452void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3453{
3454 tSirMsgQ mmhMsg;
3455 tpSmeGetScanChnRsp pSirSmeRsp;
3456 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303457 tANI_U8 sessionId;
3458 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003459
3460 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003462 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 pMac->lim.scanChnInfo.numChnInfo);
3464 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3465 }
3466
Abhishek Singh525045c2014-12-15 17:18:45 +05303467 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003468 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303469 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003470
3471 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303472 pSirSmeRsp = vos_mem_malloc(len);
3473 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 {
3475 /// Buffer not available. Log error
3476 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303477 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003478
3479 return;
3480 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303481 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003482
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3484 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303485
3486 if (pMac->fScanOffload)
3487 {
3488 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3489 pSirSmeRsp->sessionId = sessionId;
3490 }
3491 else
3492 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003493
3494 if(pMac->lim.scanChnInfo.numChnInfo)
3495 {
3496 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303497 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3498 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 }
3500 //Clear the list
3501 limRessetScanChannelInfo(pMac);
3502
3503 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3504 mmhMsg.bodyptr = pSirSmeRsp;
3505 mmhMsg.bodyval = 0;
3506
3507 pMac->lim.gLimRspReqd = false;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303508 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3510}
3511
3512
Jeff Johnson295189b2012-06-20 16:38:30 -07003513void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3514{
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05303515 tSirSmeGetAssocSTAsReq getAssocSTAsReq = {0};
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 tpDphHashNode pStaDs = NULL;
3517 tpPESession psessionEntry = NULL;
3518 tSap_Event sapEvent;
3519 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3520 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3521 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3522 tANI_U8 assocId = 0;
3523 tANI_U8 staCount = 0;
3524
3525 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3526 {
3527 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003528 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303529 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 }
3531
3532 switch (getAssocSTAsReq.modId)
3533 {
3534/**
3535 case VOS_MODULE_ID_HAL:
3536 wdaPostCtrlMsg( pMac, &msgQ );
3537 return;
3538
3539 case VOS_MODULE_ID_TL:
3540 Post msg TL
3541 return;
3542*/
3543 case VOS_MODULE_ID_PE:
3544 default:
3545 break;
3546 }
3547
Jeff Johnson1250df42012-12-10 14:31:52 -08003548 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003549 // Find PE session Entry
3550 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3551 {
3552 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003553 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 goto limAssocStaEnd;
3555 }
3556
3557 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3558 {
3559 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303560 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303561 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 goto limAssocStaEnd;
3563 }
3564
3565 // Retrieve values obtained in the request message
3566 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3567 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3568
3569 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3570 {
3571 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3572
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303573 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 continue;
3575
3576 if (pStaDs->valid)
3577 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303578 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3579 (tANI_U8 *)&pStaDs->staAddr,
3580 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3582 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3583
Kiet Lamb1233192013-11-28 13:38:20 +05303584 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003585 (tANI_U8 *)&pStaDs->supportedRates,
3586 sizeof(tSirSupportedRates));
3587 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3588 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3589 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3590
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003592 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3593 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003594 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3595 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3596
3597 pAssocStasTemp++;
3598 staCount++;
3599 }
3600 }
3601
3602limAssocStaEnd:
3603 // Call hdd callback with sap event to send the list of associated stations from PE
3604 if (pSapEventCallback != NULL)
3605 {
3606 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3607 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3608 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3609 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3610 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3611 }
3612}
3613
3614
3615/**
3616 * limProcessSmeGetWPSPBCSessions
3617 *
3618 *FUNCTION:
3619 * This function is called when query the WPS PBC overlap message is received
3620 *
3621 *LOGIC:
3622 * This function parses get WPS PBC overlap information message and call callback to pass
3623 * WPS PBC overlap information back to hdd.
3624 *ASSUMPTIONS:
3625 *
3626 *
3627 *NOTE:
3628 *
3629 * @param pMac Pointer to Global MAC structure
3630 * @param pMsgBuf A pointer to WPS PBC overlap query message
3631*
3632 * @return None
3633 */
3634void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3635{
3636 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3637 tpPESession psessionEntry = NULL;
3638 tSap_Event sapEvent;
3639 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3640 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3641 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3642
3643 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3644
3645 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3646 {
3647 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003648 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303649 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 }
3651
Jeff Johnson1250df42012-12-10 14:31:52 -08003652 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003653 // Find PE session Entry
3654 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3655 {
3656 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003657 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 goto limGetWPSPBCSessionsEnd;
3659 }
3660
3661 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3662 {
3663 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303664 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 psessionEntry->limSystemRole);
3666 goto limGetWPSPBCSessionsEnd;
3667 }
3668
Jeff Johnson1250df42012-12-10 14:31:52 -08003669 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3671 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3672
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303673 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 { //This is GetWpsSession call
3675
3676 limGetWPSPBCSessions(pMac,
3677 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3678 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3679 }
3680 else
3681 {
3682 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3683 /* don't have to inform the HDD/Host */
3684 return;
3685 }
3686
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003687 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3689
3690 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3691
3692limGetWPSPBCSessionsEnd:
3693 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303694
3695 if (NULL != pSapEventCallback)
3696 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003697}
3698
Jeff Johnson295189b2012-06-20 16:38:30 -07003699
3700
3701/**
3702 * __limCounterMeasures()
3703 *
3704 * FUNCTION:
3705 * This function is called to "implement" MIC counter measure
3706 * and is *temporary* only
3707 *
3708 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3709 * we don't do the proper STA disassoc sequence since the
3710 * BSS will be stoped anyway
3711 *
3712 *ASSUMPTIONS:
3713 *
3714 *NOTE:
3715 *
3716 * @param pMac Pointer to Global MAC structure
3717 * @return None
3718 */
3719
3720static void
3721__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3722{
3723 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303724 /* If PMF is enabled then don't send broadcast disassociation */
3725 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3726 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3727 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3728#ifdef WLAN_FEATURE_11W
3729 && !psessionEntry->limRmfEnabled
3730#endif
3731 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003732 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003733
Jeff Johnson295189b2012-06-20 16:38:30 -07003734};
3735
3736
Jeff Johnson295189b2012-06-20 16:38:30 -07003737void
3738limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3739{
3740 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3741 tpPESession psessionEntry;
3742 tANI_U8 sessionId; //PE sessionId
3743
3744 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3745 {
3746 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003747 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 return;
3749 }
3750
3751 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3752 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003753 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 return;
3755 }
3756
3757 if ( tkipCntrMeasReq.bEnable )
3758 {
3759 __limCounterMeasures( pMac, psessionEntry );
3760 }
3761
3762 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3763}
Jeff Johnson295189b2012-06-20 16:38:30 -07003764
3765
3766static void
3767__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3768{
3769 tSirSmeStopBssReq stopBssReq;
3770 tSirRetStatus status;
3771 tLimSmeStates prevState;
3772 tANI_U8 sessionId; //PE sessionId
3773 tpPESession psessionEntry;
3774 tANI_U8 smesessionId;
3775 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303776 tANI_U8 i = 0;
3777 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003778
3779 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3780
3781
3782
3783 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3784 !limIsSmeStopBssReqValid(pMsgBuf))
3785 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003786 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 /// Send Stop BSS response to host
3788 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3789 return;
3790 }
3791
3792
3793 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3794 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003795 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3797 return;
3798 }
3799
3800#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3801 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3802#endif //FEATURE_WLAN_DIAG_SUPPORT
3803
3804
3805 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3806 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3807 {
3808 /**
3809 * Should not have received STOP_BSS_REQ in states
3810 * other than 'normal' state or on STA in Infrastructure
3811 * mode. Log error and return response to host.
3812 */
3813 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303814 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3816 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3817 /// Send Stop BSS response to host
3818 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3819 return;
3820 }
3821
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3823 {
3824 limWPSPBCClose(pMac, psessionEntry);
3825 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003826 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003827
3828 prevState = psessionEntry->limSmeState;
3829
3830 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003831 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003832
3833 /* Update SME session Id and Transaction Id */
3834 psessionEntry->smeSessionId = smesessionId;
3835 psessionEntry->transactionId = smetransactionId;
3836
Abhishek Singh8944b222014-09-17 16:13:17 +05303837 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3838 * If PMF is enabled then don't send broadcast disassociation */
3839 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3840 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3841#ifdef WLAN_FEATURE_11W
3842 && !psessionEntry->limRmfEnabled
3843#endif
3844 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003845 {
3846 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3847 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3848 // Send disassoc all stations associated thru TKIP
3849 __limCounterMeasures(pMac,psessionEntry);
3850 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303851 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003852 }
3853
3854 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3855 pMac->lim.gLimIbssCoalescingHappened = false;
3856
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303857 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3858 {
3859 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3860 if (NULL == pStaDs)
3861 continue;
3862 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3863 if(eSIR_SUCCESS == status)
3864 {
3865 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3866 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3867 }
3868 else
3869 {
3870 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3871 VOS_ASSERT(0) ;
3872 }
3873 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 /* send a delBss to HAL and wait for a response */
3875 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3876
3877 if (status != eSIR_SUCCESS)
3878 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003879 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 psessionEntry->limSmeState= prevState;
3881
Jeff Johnsone7245742012-09-05 17:12:55 -07003882 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003883
3884 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3885 }
3886}
3887
3888
3889/**--------------------------------------------------------------
3890\fn __limProcessSmeStopBssReq
3891
3892\brief Wrapper for the function __limHandleSmeStopBssRequest
3893 This message will be defered until softmac come out of
3894 scan mode. Message should be handled even if we have
3895 detected radar in the current operating channel.
3896\param pMac
3897\param pMsg
3898
3899\return TRUE - If we consumed the buffer
3900 FALSE - If have defered the message.
3901 ---------------------------------------------------------------*/
3902static tANI_BOOLEAN
3903__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3904{
3905 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3906 {
3907 /**
3908 * If message defered, buffer is not consumed yet.
3909 * So return false
3910 */
3911 return eANI_BOOLEAN_FALSE;
3912 }
3913 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3914 return eANI_BOOLEAN_TRUE;
3915} /*** end __limProcessSmeStopBssReq() ***/
3916
3917
3918void limProcessSmeDelBssRsp(
3919 tpAniSirGlobal pMac,
3920 tANI_U32 body,tpPESession psessionEntry)
3921{
3922
3923 (void) body;
3924 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3925 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003926 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003927 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3928 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003929 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3930 return;
3931}
3932
3933
Jeff Johnson295189b2012-06-20 16:38:30 -07003934/**---------------------------------------------------------------
3935\fn __limProcessSmeAssocCnfNew
3936\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3937\ in BTAMP AP.
3938\
3939\param pMac
3940\param msgType - message type
3941\param pMsgBuf - a pointer to the SME message buffer
3942\return None
3943------------------------------------------------------------------*/
3944
3945 void
3946__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3947{
3948 tSirSmeAssocCnf assocCnf;
3949 tpDphHashNode pStaDs = NULL;
3950 tpPESession psessionEntry= NULL;
3951 tANI_U8 sessionId;
3952
3953
3954 if(pMsgBuf == NULL)
3955 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003956 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 goto end;
3958 }
3959
3960 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3961 !__limIsSmeAssocCnfValid(&assocCnf))
3962 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003963 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 goto end;
3965 }
3966
3967 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3968 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003969 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003970 goto end;
3971 }
3972
3973 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3974 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3975 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303976 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303977 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 goto end;
3979 }
3980
3981 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3982
3983 if (pStaDs == NULL)
3984 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303985 limLog(pMac, LOGE,
3986 FL("Received invalid message %X due to no STA context, "
3987 "for aid %d, peer "),
3988 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3990
3991 /*
3992 ** send a DISASSOC_IND message to WSM to make sure
3993 ** the state in WSM and LIM is the same
3994 **/
3995 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3996 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3997 goto end;
3998 }
3999 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304000 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 (tANI_U8 *) assocCnf.peerMacAddr,
4002 sizeof(tSirMacAddr)) ) ||
4003 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
4004 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
4005 (msgType != eWNI_SME_ASSOC_CNF)) ||
4006 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07004008 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304009 limLog(pMac, LOGE,
4010 FL("Received invalid message %X due to peerMacAddr mismatched "
4011 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
4012 "StaD mlmState : %d"),
4013 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4015 goto end;
4016 }
4017
4018 /*
4019 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4020 ** has been received
4021 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004022 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4024
4025 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4026 {
4027 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4028 * when it had received Assoc Request frame. Now, PE just needs to send
4029 * Association Response frame to the requesting BTAMP-STA.
4030 */
4031 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004032 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4034 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4035 goto end;
4036 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4037 else
4038 {
4039 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4040 /*Since the HAL sta entry is created for denied STA we need to remove this HAL entry.So to do that set updateContext to 1*/
4041 if(!pStaDs->mlmStaContext.updateContext)
4042 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304043 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
4044 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 limRejectAssociation(pMac, pStaDs->staAddr,
4046 pStaDs->mlmStaContext.subType,
4047 true, pStaDs->mlmStaContext.authType,
4048 pStaDs->assocId, true,
4049 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004050 }
4051
4052end:
4053 if((psessionEntry != NULL) && (pStaDs != NULL))
4054 {
4055 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4056 {
4057 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4058 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304059 vos_mem_free(((tpSirAssocReq)
4060 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4062 }
4063
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304064 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004065 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4066 }
4067 }
4068
4069} /*** end __limProcessSmeAssocCnfNew() ***/
4070
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05304071#ifdef SAP_AUTH_OFFLOAD
4072/**
4073 * __lim_process_sme_assoc_offload_cnf() station connection confirmation
4074 * message from SME.
4075 * @pMac: SirGlobal handler
4076 * @msgType: message type
4077 * @pMsgBuf: message body
4078 *
4079 * This function handles the station connect confirm of
4080 * Software AP authentication offload feature
4081 *
4082 * Return: None
4083 */
4084 static void
4085__lim_process_sme_assoc_offload_cnf(tpAniSirGlobal pmac,
4086 tANI_U32 msg_type,
4087 tANI_U32 *pmsg_buf)
4088{
4089 tSirSmeAssocCnf assoc_cnf;
4090 tpDphHashNode sta_ds = NULL;
4091 tpPESession psession_entry= NULL;
4092 tANI_U8 session_id;
4093 tANI_U16 aid=0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004094
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05304095 if (pmsg_buf == NULL)
4096 {
4097 limLog(pmac, LOGE, FL("pmsg_buf is NULL "));
4098 return;
4099 }
4100
4101 if ((limAssocCnfSerDes(pmac, &assoc_cnf, (tANI_U8 *) pmsg_buf) ==
4102 eSIR_FAILURE) || !__limIsSmeAssocCnfValid(&assoc_cnf))
4103 {
4104 limLog(pmac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
4105 return;
4106 }
4107
4108 if((psession_entry =
4109 peFindSessionByBssid(pmac, assoc_cnf.bssId, &session_id))== NULL)
4110 {
4111 limLog(pmac, LOGE, FL("session does not exist for given bssId"));
4112 goto end;
4113 }
4114
4115 if ((!LIM_IS_AP_ROLE(psession_entry)) ||
4116 ((psession_entry->limSmeState != eLIM_SME_NORMAL_STATE) &&
4117 (psession_entry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
4118 {
4119 limLog(pmac, LOGE,
4120 FL("Received unexpected message %X in state %X, in role %X"),
4121 msg_type, psession_entry->limSmeState,
4122 GET_LIM_SYSTEM_ROLE(psession_entry));
4123 goto end;
4124 }
4125 sta_ds = dphGetHashEntry(pmac,
4126 assoc_cnf.aid,
4127 &psession_entry->dph.dphHashTable);
4128 if (sta_ds != NULL)
4129 {
4130 aid = sta_ds->assocId;
4131 /* Deactivate/delete CNF_WAIT timer since ASSOC_CNF
4132 * has been received */
4133 limDeactivateAndChangePerStaIdTimer(pmac,
4134 eLIM_CNF_WAIT_TIMER,
4135 aid);
4136 }
Agrawal Ashish25d9ef12017-01-10 20:27:50 +05304137 if (assoc_cnf.statusCode == eSIR_SME_SUCCESS)
4138 {
4139 sta_ds->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
4140 limLog(pmac, LOG1, FL("Set mlmState to eLIM_MLM_LINK_ESTABLISHED_STATE"));
4141 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05304142
4143end:
4144 if((psession_entry != NULL) && (sta_ds != NULL))
4145 {
4146 if ( psession_entry->parsedAssocReq[aid] != NULL )
4147 {
4148 if ( ((tpSirAssocReq)
4149 (psession_entry->parsedAssocReq[aid]))->assocReqFrame)
4150 {
4151 vos_mem_free(((tpSirAssocReq)
4152 (psession_entry->parsedAssocReq[aid]))->assocReqFrame);
4153 ((tpSirAssocReq)
4154 (psession_entry->parsedAssocReq[aid]))->assocReqFrame =
4155 NULL;
4156 }
4157 vos_mem_free(psession_entry->parsedAssocReq[aid]);
4158 psession_entry->parsedAssocReq[aid] = NULL;
4159 }
4160 }
4161
4162} /*** end __lim_process_sme_assoc_offload_cnf() ***/
4163#endif /* SAP_AUTH_OFFLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004164
4165
4166static void
4167__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4168{
4169 tpDphHashNode pStaDs;
4170 tSirMacAddr peerMac;
4171 tpSirAddtsReq pSirAddts;
4172 tANI_U32 timeout;
4173 tpPESession psessionEntry;
4174 tANI_U8 sessionId; //PE sessionId
4175 tANI_U8 smesessionId;
4176 tANI_U16 smetransactionId;
4177
4178
4179 if(pMsgBuf == NULL)
4180 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004181 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 return;
4183 }
4184
4185 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4186
4187 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4188
4189 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4190 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004191 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 return;
4193 }
4194#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4195 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4196#endif //FEATURE_WLAN_DIAG_SUPPORT
4197
4198
4199
4200 /* if sta
4201 * - verify assoc state
4202 * - send addts request to ap
4203 * - wait for addts response from ap
4204 * if ap, just ignore with error log
4205 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304206 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004207 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304209 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004210
4211 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4212 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004213 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4215 smesessionId,smetransactionId);
4216 return;
4217 }
4218
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4220
4221 if(pStaDs == NULL)
4222 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004223 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4225 smesessionId,smetransactionId);
4226 return;
4227 }
4228
4229 if ((! pStaDs->valid) ||
4230 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4231 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004232 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4234 smesessionId,smetransactionId);
4235 return;
4236 }
4237
4238 pSirAddts->req.wsmTspecPresent = 0;
4239 pSirAddts->req.wmeTspecPresent = 0;
4240 pSirAddts->req.lleTspecPresent = 0;
4241
4242 if ((pStaDs->wsmEnabled) &&
4243 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4244 pSirAddts->req.wsmTspecPresent = 1;
4245 else if (pStaDs->wmeEnabled)
4246 pSirAddts->req.wmeTspecPresent = 1;
4247 else if (pStaDs->lleEnabled)
4248 pSirAddts->req.lleTspecPresent = 1;
4249 else
4250 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004251 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4253 smesessionId,smetransactionId);
4254 return;
4255 }
4256
4257 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4258 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4259 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004260 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 psessionEntry->limSmeState);
4262 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4263 smesessionId,smetransactionId);
4264 return;
4265 }
4266
4267 if (pMac->lim.gLimAddtsSent)
4268 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004269 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 pMac->lim.gLimAddtsReq.req.dialogToken,
4271 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4272 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4273 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4274 smesessionId,smetransactionId);
4275 return;
4276 }
4277
4278 #if 0
4279 val = sizeof(tSirMacAddr);
4280 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4281 {
4282 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004283 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 return;
4285 }
4286 #endif
4287 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4288
4289 // save the addts request
4290 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304291 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004292
4293 // ship out the message now
4294 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4295 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304296 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004297
4298 // start a timer to wait for the response
4299 if (pSirAddts->timeout)
4300 timeout = pSirAddts->timeout;
4301 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4302 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004303 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 WNI_CFG_ADDTS_RSP_TIMEOUT);
4305 return;
4306 }
4307
4308 timeout = SYS_MS_TO_TICKS(timeout);
4309 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4310 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004311 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004312 return;
4313 }
4314 pMac->lim.gLimAddtsRspTimerCount++;
4315 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4316 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4317 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004318 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 return;
4320 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004321 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004322
4323 //add the sessionId to the timer object
4324 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4325 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4326 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004327 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 return;
4329 }
4330 return;
4331}
4332
4333
4334static void
4335__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4336{
4337 tSirMacAddr peerMacAddr;
4338 tANI_U8 ac;
4339 tSirMacTSInfo *pTsinfo;
4340 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4341 tpDphHashNode pStaDs = NULL;
4342 tpPESession psessionEntry;
4343 tANI_U8 sessionId;
4344 tANI_U32 status = eSIR_SUCCESS;
4345 tANI_U8 smesessionId;
4346 tANI_U16 smetransactionId;
4347
4348 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4349
4350 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4351 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004352 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004353 status = eSIR_FAILURE;
4354 goto end;
4355 }
4356#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4357 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4358#endif //FEATURE_WLAN_DIAG_SUPPORT
4359
4360
4361 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4362 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004363 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 status = eSIR_FAILURE;
4365 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4366 return;
4367 }
4368
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304369 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4370 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4371 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004372
4373 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4374 psessionEntry);
4375
4376 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4377
4378 /* We've successfully send DELTS frame to AP. Update the
4379 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4380 * is no longer trigger enabled or delivery enabled
4381 */
4382 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4383
4384 /* We're deleting the TSPEC, so this particular AC is no longer
4385 * admitted. PE needs to downgrade the EDCA
4386 * parameters(for the AC for which TS is being deleted) to the
4387 * next best AC for which ACM is not enabled, and send the
4388 * updated values to HAL.
4389 */
4390 ac = upToAc(pTsinfo->traffic.userPrio);
4391
4392 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4393 {
4394 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4395 }
4396 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4397 {
4398 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4399 }
4400 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4401 {
4402 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4403 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4404 }
4405
4406 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4407
4408 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4409 if (pStaDs != NULL)
4410 {
4411 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4412 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4413 else
4414 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4415 status = eSIR_SUCCESS;
4416 }
4417 else
4418 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004419 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 status = eSIR_FAILURE;
4421 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004422#ifdef FEATURE_WLAN_ESE
4423#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004424 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4425#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004426 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004427#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004428#endif
4429
4430 // send an sme response back
4431 end:
4432 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4433}
4434
4435
4436void
4437limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4438{
4439 //fetch the sessionEntry based on the sessionId
4440 tpPESession psessionEntry;
4441 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4442 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004443 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004444 return;
4445 }
4446
4447 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4448 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004449 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004450 pMac->lim.gLimAddtsSent = false;
4451 return;
4452 }
4453
4454 if (! pMac->lim.gLimAddtsSent)
4455 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004456 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 return;
4458 }
4459
4460 if (param != pMac->lim.gLimAddtsRspTimerCount)
4461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004462 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 param, pMac->lim.gLimAddtsRspTimerCount);
4464 return;
4465 }
4466
4467 // this a real response timeout
4468 pMac->lim.gLimAddtsSent = false;
4469 pMac->lim.gLimAddtsRspTimerCount++;
4470
4471 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4472 psessionEntry->smeSessionId, psessionEntry->transactionId);
4473}
4474
4475
4476/**
4477 * __limProcessSmeStatsRequest()
4478 *
4479 *FUNCTION:
4480 *
4481 *
4482 *NOTE:
4483 *
4484 * @param pMac Pointer to Global MAC structure
4485 * @param *pMsgBuf A pointer to the SME message buffer
4486 * @return None
4487 */
4488static void
4489__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4490{
4491 tpAniGetStatsReq pStatsReq;
4492 tSirMsgQ msgQ;
4493 tpPESession psessionEntry;
4494 tANI_U8 sessionId;
4495
4496
4497 if(pMsgBuf == NULL)
4498 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004499 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 return;
4501 }
4502
4503 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4504
4505 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4506 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004507 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304508 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004509 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 return;
4511 }
4512
4513
4514
4515 switch(pStatsReq->msgType)
4516 {
4517 //Add Lim stats here. and send reqsponse.
4518
4519 //HAL maintained Stats.
4520 case eWNI_SME_STA_STAT_REQ:
4521 msgQ.type = WDA_STA_STAT_REQ;
4522 break;
4523 case eWNI_SME_AGGR_STAT_REQ:
4524 msgQ.type = WDA_AGGR_STAT_REQ;
4525 break;
4526 case eWNI_SME_GLOBAL_STAT_REQ:
4527 msgQ.type = WDA_GLOBAL_STAT_REQ;
4528 break;
4529 case eWNI_SME_STAT_SUMM_REQ:
4530 msgQ.type = WDA_STAT_SUMM_REQ;
4531 break;
4532 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004533 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304534 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004535 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004536 return;
4537 }
4538
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 msgQ.reserved = 0;
4540 msgQ.bodyptr = pMsgBuf;
4541 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004542 if(NULL == psessionEntry)
4543 {
4544 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4545 }
4546 else
4547 {
4548 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4549 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004551 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304552 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004553 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 return;
4555 }
4556
4557 return;
4558}
4559
4560
4561/**
4562 * __limProcessSmeGetStatisticsRequest()
4563 *
4564 *FUNCTION:
4565 *
4566 *
4567 *NOTE:
4568 *
4569 * @param pMac Pointer to Global MAC structure
4570 * @param *pMsgBuf A pointer to the SME message buffer
4571 * @return None
4572 */
4573static void
4574__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4575{
4576 tpAniGetPEStatsReq pPEStatsReq;
4577 tSirMsgQ msgQ;
4578
4579 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4580
4581 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4582
4583 msgQ.type = WDA_GET_STATISTICS_REQ;
4584
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 msgQ.reserved = 0;
4586 msgQ.bodyptr = pMsgBuf;
4587 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004588 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004589
4590 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304591 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004592 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004593 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 return;
4595 }
4596
4597 return;
4598}
4599
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004600#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004601/**
4602 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4603 *
4604 *NOTE:
4605 *
4606 * @param pMac Pointer to Global MAC structure
4607 * @param *pMsgBuf A pointer to the SME message buffer
4608 * @return None
4609 */
4610static void
4611__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4612{
4613 tSirMsgQ msgQ;
4614
4615 msgQ.type = WDA_TSM_STATS_REQ;
4616 msgQ.reserved = 0;
4617 msgQ.bodyptr = pMsgBuf;
4618 msgQ.bodyval = 0;
4619 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4620
4621 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4622 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004623 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004624 limLog(pMac, LOGP, "Unable to forward request");
4625 return;
4626 }
4627}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004628#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004629
4630
Jeff Johnson295189b2012-06-20 16:38:30 -07004631
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004632#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004633/**
4634 * __limProcessSmeGetRoamRssiRequest()
4635 *
4636 *FUNCTION:
4637 *
4638 *
4639 *NOTE:
4640 *
4641 * @param pMac Pointer to Global MAC structure
4642 * @param *pMsgBuf A pointer to the SME message buffer
4643 * @return None
4644 */
4645static void
4646__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4647{
4648 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4649 tSirMsgQ msgQ;
4650
4651 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4652 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4653
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004654 msgQ.reserved = 0;
4655 msgQ.bodyptr = pMsgBuf;
4656 msgQ.bodyval = 0;
4657 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4658
4659 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304660 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004661 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004662 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004663 return;
4664 }
4665
4666 return;
4667}
4668#endif
4669
4670
Jeff Johnson295189b2012-06-20 16:38:30 -07004671static void
4672__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4673{
4674 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4675 tpPESession psessionEntry;
4676 tANI_U8 sessionId; //PE sessionID
4677
4678 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004679 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004680
4681 if(pMsgBuf == NULL)
4682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004683 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 return;
4685 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004686
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304687 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4688 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304690 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 return;
4692 }
4693
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004694 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004696 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004697 goto end;
4698 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004699
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4701 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004702 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 goto end;
4704 }
4705
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304706 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004707
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004709 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004710
4711end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304712 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004713 return;
4714} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4715
4716static void
4717__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4718{
4719 tpSirUpdateParams pUpdateParams;
4720 tpPESession psessionEntry;
4721
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304722 limLog(pMac, LOG1,
4723 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004724
4725 if(pMsgBuf == NULL)
4726 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004727 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004728 return;
4729 }
4730
4731 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4732
4733 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4734 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004735 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004736 pUpdateParams->sessionId);
4737 return;
4738 }
4739
4740 /* Update the session entry */
4741 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4742
4743 /* Update beacon */
4744 schSetFixedBeaconFields(pMac, psessionEntry);
4745 limSendBeaconInd(pMac, psessionEntry);
4746
4747 return;
4748} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4749
4750static void
4751__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4752{
4753 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4754 tpPESession psessionEntry;
4755 tANI_U8 sessionId; //PE sessionID
4756
4757 if(pMsgBuf == NULL)
4758 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004759 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004760 return;
4761 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304762
4763 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4764 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004765 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304766 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 return;
4768 }
4769
4770 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4771 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004772 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 goto end;
4774 }
4775
4776 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4777 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004778 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 goto end;
4780 }
4781
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304782 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4783 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004784
4785 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4786
4787 psessionEntry->pLimStartBssReq->privacy = 1;
4788 psessionEntry->privacy = 1;
4789
4790 schSetFixedBeaconFields(pMac, psessionEntry);
4791 limSendBeaconInd(pMac, psessionEntry);
4792
4793end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304794 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004795 return;
4796} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4797
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004798/*
4799Update the beacon Interval dynamically if beaconInterval is different in MCC
4800*/
4801static void
4802__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4803{
4804 tpSirChangeBIParams pChangeBIParams;
4805 tpPESession psessionEntry;
4806 tANI_U8 sessionId = 0;
4807 tUpdateBeaconParams beaconParams;
4808
4809 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004810 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004811
4812 if(pMsgBuf == NULL)
4813 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004814 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004815 return;
4816 }
4817
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304818 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004819 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4820
4821 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4822 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004823 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004824 return;
4825 }
4826
4827 /*Update sessionEntry Beacon Interval*/
4828 if(psessionEntry->beaconParams.beaconInterval !=
4829 pChangeBIParams->beaconInterval )
4830 {
4831 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4832 }
4833
4834 /*Update sch beaconInterval*/
4835 if(pMac->sch.schObject.gSchBeaconInterval !=
4836 pChangeBIParams->beaconInterval )
4837 {
4838 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4839
4840 PELOG1(limLog(pMac, LOG1,
4841 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4842
4843 /* Update beacon */
4844 schSetFixedBeaconFields(pMac, psessionEntry);
4845
Sunil Ravib96f7b52013-05-22 21:40:05 -07004846 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004847 //Set change in beacon Interval
4848 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004849 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004850 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4851 }
4852
4853 return;
4854} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4855
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304856/** -------------------------------------------------------------
4857\fn
4858\brief handles indication message from HDD to update HT mode
4859\param tpAniSirGlobal pMac
4860\param tANI_U32 pMsgBuf
4861\return None
4862-------------------------------------------------------------*/
4863#ifdef WLAN_FEATURE_AP_HT40_24G
4864static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4865{
4866 tpSirSetHT2040Mode pSetHT2040Mode;
4867 tpPESession psessionEntry;
4868 tANI_U8 sessionId = 0;
4869 tUpdateVHTOpMode *pHtOpMode = NULL;
4870 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004871
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304872 PELOG1(limLog(pMac, LOGRW,
4873 FL("received Set HT 20/40 mode message")););
4874
4875 if(pMsgBuf == NULL)
4876 {
4877 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4878 return;
4879 }
4880
4881 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4882
4883 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4884 &sessionId)) == NULL)
4885 {
4886 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4887 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4888 return;
4889 }
4890
4891 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4892 pSetHT2040Mode->cbMode);
4893
4894 /*Update sessionEntry HT related fields*/
4895 switch(pSetHT2040Mode->cbMode)
4896 {
4897 case PHY_SINGLE_CHANNEL_CENTERED:
4898 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4899 psessionEntry->htRecommendedTxWidthSet = 0;
4900 break;
4901 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4902 psessionEntry->htSecondaryChannelOffset =
4903 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4904 psessionEntry->htRecommendedTxWidthSet = 1;
4905 break;
4906 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4907 psessionEntry->htSecondaryChannelOffset =
4908 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4909 psessionEntry->htRecommendedTxWidthSet = 1;
4910 break;
4911 default:
4912 limLog(pMac, LOGE,FL("Invalid cbMode"));
4913 return;
4914 }
4915
4916 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4917 " htSecondaryChannelOffset: %d"
4918 " htRecommendedTxWidthSet :%d"),
4919 pSetHT2040Mode->cbMode,
4920 psessionEntry->htSecondaryChannelOffset,
4921 psessionEntry->htRecommendedTxWidthSet);
4922
4923 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4924
4925 /* Update beacon */
4926 schSetFixedBeaconFields(pMac, psessionEntry);
4927 limSendBeaconInd(pMac, psessionEntry);
4928
4929 /* Update OP Mode */
4930 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4931 if ( NULL == pHtOpMode )
4932 {
4933 limLog(pMac, LOGE,
4934 FL("Not able to allocate memory for setting OP mode"));
4935 return;
4936 }
4937
4938 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4939 PHY_SINGLE_CHANNEL_CENTERED)?
4940 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4941
4942 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4943 * operating mode for all connected STA.
4944 */
4945
4946 pHtOpMode->staId = psessionEntry->staId;
4947
4948 msg.type = WDA_UPDATE_OP_MODE;
4949 msg.reserved = 0;
4950 msg.bodyptr = pHtOpMode;
4951
4952 if (!VOS_IS_STATUS_SUCCESS(
4953 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4954 {
4955 limLog(pMac, LOGE,
4956 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4957 vos_mem_free(pHtOpMode);
4958 return;
4959 }
4960
4961 limLog(pMac, LOGW,
4962 FL("Notifed FW about OP mode: %d for staId=%d"),
4963 pHtOpMode->opMode, pHtOpMode->staId);
4964
4965 return;
4966}
4967#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004968
4969/** -------------------------------------------------------------
4970\fn limProcessSmeDelBaPeerInd
4971\brief handles indication message from HDD to send delete BA request
4972\param tpAniSirGlobal pMac
4973\param tANI_U32 pMsgBuf
4974\return None
4975-------------------------------------------------------------*/
4976void
4977limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4978{
4979 tANI_U16 assocId =0;
4980 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4981 tpDphHashNode pSta;
4982 tpPESession psessionEntry;
4983 tANI_U8 sessionId;
4984
4985
4986
4987 if(NULL == pSmeDelBAPeerInd)
4988 return;
4989
4990 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4991 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004992 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004993 return;
4994 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004995 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004996 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4997
4998 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4999 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
5000 pSta,
5001 pSmeDelBAPeerInd->baDirection,
5002 pSmeDelBAPeerInd->baTID,
5003 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
5004 {
5005 limLog( pMac, LOGW,
5006 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
5007 if (pSta)
5008 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
5009 }
5010}
5011
5012// --------------------------------------------------------------------
5013/**
5014 * __limProcessReportMessage
5015 *
5016 * FUNCTION: Processes the next received Radio Resource Management message
5017 *
5018 * LOGIC:
5019 *
5020 * ASSUMPTIONS:
5021 *
5022 * NOTE:
5023 *
5024 * @param None
5025 * @return None
5026 */
5027
5028void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5029{
5030#ifdef WLAN_FEATURE_VOWIFI
5031 switch (pMsg->type)
5032 {
5033 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5034 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
5035 break;
5036 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5037 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005038#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005039 tpSirBeaconReportXmitInd pBcnReport=NULL;
5040 tpPESession psessionEntry=NULL;
5041 tANI_U8 sessionId;
Padma, Santhosh Kumar20d45a12016-04-05 13:11:00 +05305042 tpEsePEContext pEseContext = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005043
5044 if(pMsg->bodyptr == NULL)
5045 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005046 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 return;
5048 }
5049 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
5050 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
5051 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005052 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 return;
5054 }
Padma, Santhosh Kumar20d45a12016-04-05 13:11:00 +05305055
5056 pEseContext = &psessionEntry->eseContext;
5057
5058 if (psessionEntry->isESEconnection && pEseContext->curMeasReq.isValid)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005059 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 else
5061#endif
5062 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
5063 }
5064 break;
5065 }
5066#endif
5067}
5068
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005069#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07005070// --------------------------------------------------------------------
5071/**
5072 * limSendSetMaxTxPowerReq
5073 *
5074 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
5075 *
5076 * LOGIC:
5077 *
5078 * ASSUMPTIONS:
5079 *
5080 * NOTE:
5081 *
5082 * @param txPower txPower to be set.
5083 * @param pSessionEntry session entry.
5084 * @return None
5085 */
5086tSirRetStatus
5087limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
5088{
5089 tpMaxTxPowerParams pMaxTxParams = NULL;
5090 tSirRetStatus retCode = eSIR_SUCCESS;
5091 tSirMsgQ msgQ;
5092
5093 if( pSessionEntry == NULL )
5094 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005095 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 return eSIR_FAILURE;
5097 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305098
5099 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
5100 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005101 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005102 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 return eSIR_MEM_ALLOC_FAILED;
5104
5105 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005106#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305107 limLog( pMac, LOG1,
5108 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005109#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005110 if( pMaxTxParams == NULL )
5111 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305112 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005113 return eSIR_FAILURE;
5114 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305116 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
5117 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005118
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005119 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
5120 msgQ.bodyptr = pMaxTxParams;
5121 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305122 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005123 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
5124 retCode = wdaPostCtrlMsg(pMac, &msgQ);
5125 if (eSIR_SUCCESS != retCode)
5126 {
5127 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305128 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005129 }
5130 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005131}
5132#endif
5133
5134/**
5135 * __limProcessSmeAddStaSelfReq()
5136 *
5137 *FUNCTION:
5138 * This function is called to process SME_ADD_STA_SELF_REQ message
5139 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
5140 *
5141 *LOGIC:
5142 *
5143 *ASSUMPTIONS:
5144 *
5145 *NOTE:
5146 *
5147 * @param pMac Pointer to Global MAC structure
5148 * @param *pMsgBuf A pointer to the SME message buffer
5149 * @return None
5150 */
5151
5152static void
5153__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5154{
5155 tSirMsgQ msg;
5156 tpAddStaSelfParams pAddStaSelfParams;
5157 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5158
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305159 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5160 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 {
5162 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5163 return;
5164 }
5165
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305166 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005167 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005168 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5169 msg.reserved = 0;
5170 msg.bodyptr = pAddStaSelfParams;
5171 msg.bodyval = 0;
5172
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005173 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005174 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005175
5176 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5177 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005178 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005179 }
5180 return;
5181} /*** end __limProcessAddStaSelfReq() ***/
5182
5183
5184/**
5185 * __limProcessSmeDelStaSelfReq()
5186 *
5187 *FUNCTION:
5188 * This function is called to process SME_DEL_STA_SELF_REQ message
5189 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5190 *
5191 *LOGIC:
5192 *
5193 *ASSUMPTIONS:
5194 *
5195 *NOTE:
5196 *
5197 * @param pMac Pointer to Global MAC structure
5198 * @param *pMsgBuf A pointer to the SME message buffer
5199 * @return None
5200 */
5201
5202static void
5203__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5204{
5205 tSirMsgQ msg;
5206 tpDelStaSelfParams pDelStaSelfParams;
5207 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5208
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305209 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5210 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005211 {
5212 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5213 return;
5214 }
5215
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305216 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005217
5218 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5219 msg.reserved = 0;
5220 msg.bodyptr = pDelStaSelfParams;
5221 msg.bodyval = 0;
5222
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05305223 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005224 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005225
5226 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5227 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005228 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 }
5230 return;
5231} /*** end __limProcessSmeDelStaSelfReq() ***/
5232
5233
Jeff Johnson295189b2012-06-20 16:38:30 -07005234/**
5235 * __limProcessSmeRegisterMgmtFrameReq()
5236 *
5237 *FUNCTION:
5238 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5239 * from SME. It Register this information within PE.
5240 *
5241 *LOGIC:
5242 *
5243 *ASSUMPTIONS:
5244 *
5245 *NOTE:
5246 *
5247 * @param pMac Pointer to Global MAC structure
5248 * @param *pMsgBuf A pointer to the SME message buffer
5249 * @return None
5250 */
5251static void
5252__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5253{
5254 VOS_STATUS vosStatus;
5255 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5256 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005257 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305258 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005259 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305260 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005261
Jeff Johnsond13512a2012-07-17 11:42:19 -07005262 /* First check whether entry exists already*/
5263
5264 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5265 (vos_list_node_t**)&pLimMgmtRegistration);
5266
5267 while(pLimMgmtRegistration != NULL)
5268 {
5269 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5270 {
5271 if(pSmeReq->matchLen)
5272 {
5273 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5274 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305275 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005276 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5277 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005278 /* found match! */
5279 match = VOS_TRUE;
5280 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005281 }
5282 }
5283 }
5284 else
5285 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005286 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005287 match = VOS_TRUE;
5288 break;
5289 }
5290 }
5291 vosStatus = vos_list_peek_next (
5292 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5293 (vos_list_node_t*) pLimMgmtRegistration,
5294 (vos_list_node_t**) &pNext );
5295
5296 pLimMgmtRegistration = pNext;
5297 pNext = NULL;
5298
5299 }
5300
5301 if (match)
5302 {
5303 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5304 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305305 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005306 }
5307
Jeff Johnson295189b2012-06-20 16:38:30 -07005308 if(pSmeReq->registerFrame)
5309 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305310 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5311 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005312 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305313 vos_mem_set((void*)pLimMgmtRegistration,
5314 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005315 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5316 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5317 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5318 if(pSmeReq->matchLen)
5319 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305320 vos_mem_copy(pLimMgmtRegistration->matchData,
5321 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005322 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005323 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5324 &pLimMgmtRegistration->node);
5325 }
5326 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005327
5328 return;
5329} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005330
5331static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005332__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005333{
5334 tpP2pPsParams pMsgNoA;
5335 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005336
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305337 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5338 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005339 {
5340 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005341 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005342 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005343 }
5344
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305345 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005346 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5347 pMsgNoA->opp_ps = 0;
5348 pMsgNoA->ctWindow = 0;
5349 pMsgNoA->duration = 0;
5350 pMsgNoA->interval = 0;
5351 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005352
Vinay Malekal62757362012-12-17 12:15:51 -08005353 /* Below params used for Single Shot NOA - so assign proper values */
5354 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005355 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005356
Viral Modid86bde22012-12-10 13:09:21 -08005357 /* Start Insert NOA timer
5358 * If insert NOA req fails or NOA rsp fails or start NOA indication doesn't come from FW due to GO session deletion
Viral Modid440e682013-03-06 02:25:31 -08005359 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5360 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005361 */
5362 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5363 == TX_TIMER_ERROR)
5364 {
5365 /// Could not activate Insert NOA timer.
5366 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005367 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005368
5369 // send the scan response back with status failure and do not even call insert NOA
5370 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305371 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005372 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005373 }
5374
Viral Modid440e682013-03-06 02:25:31 -08005375 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5376
Viral Modid86bde22012-12-10 13:09:21 -08005377 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5378 msg.reserved = 0;
5379 msg.bodyptr = pMsgNoA;
5380 msg.bodyval = 0;
5381
5382 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5383 {
5384 /* In this failure case, timer is already started, so its expiration will take care of sending scan response */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005385 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005386 /* Deactivate the NOA timer in failure case */
5387 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5388 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005389 }
Viral Modid440e682013-03-06 02:25:31 -08005390 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005391
Viral Modid440e682013-03-06 02:25:31 -08005392error:
5393 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5394 * worrying about the NOA
5395 */
5396 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5397 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005398 return FALSE;
5399
5400}
5401
Viral Modid440e682013-03-06 02:25:31 -08005402static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5403{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005404 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005405 pMac->lim.gDeferMsgTypeForNOA = msgType;
5406 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5407}
5408
5409static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5410{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005411 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005412 pMac->lim.gDeferMsgTypeForNOA = 0;
5413 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5414 {
5415 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305416 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005417 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5418 }
5419}
5420
5421static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305422tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5423 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005424{
5425 tANI_U32 noaDuration = 0;
5426
5427 switch (msgType)
5428 {
5429 case eWNI_SME_SCAN_REQ:
5430 {
5431 tANI_U32 val;
5432 tANI_U8 i;
5433 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5434 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5435 {
5436 /*
5437 * Could not get max channel value
5438 * from CFG. Log error.
5439 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005440 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005441
5442 /* use a default value of 110ms */
5443 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5444 }
5445
5446 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5447 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5448
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305449 if (pMac->miracast_mode) {
5450 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5451 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5452 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005453 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5454 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5455 */
5456 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305457 } else {
5458 /* Use min + max channel time to calculate the total duration of scan */
5459 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005460 }
5461 }
5462
5463 /* Adding an overhead of 20ms to account for the scan messaging delays */
5464 noaDuration += SCAN_MESSAGING_OVERHEAD;
5465 noaDuration *= CONV_MS_TO_US;
5466
5467 break;
5468 }
5469
5470 case eWNI_SME_OEM_DATA_REQ:
5471 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5472 break;
5473
5474 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5475 {
5476 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5477 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5478 break;
5479 }
5480
5481 case eWNI_SME_JOIN_REQ:
5482 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5483 break;
5484
5485 default:
5486 noaDuration = 0;
5487 break;
5488
5489 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005490 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005491 return noaDuration;
5492}
5493
5494void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5495{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305496 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005497
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005498 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005499 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5500 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5501 {
5502 switch (pMac->lim.gDeferMsgTypeForNOA)
5503 {
5504 case eWNI_SME_SCAN_REQ:
5505 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5506 break;
5507 case eWNI_SME_OEM_DATA_REQ:
5508 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5509 break;
5510 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305511 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5512 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5513 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5514 */
5515 if (FALSE == bufConsumed)
5516 {
5517 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5518 }
Viral Modid440e682013-03-06 02:25:31 -08005519 break;
5520 case eWNI_SME_JOIN_REQ:
5521 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5522 break;
5523 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005524 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005525 break;
5526 }
5527 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5528 }
5529 else
5530 {
5531 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005532 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005533 }
5534}
Jeff Johnson295189b2012-06-20 16:38:30 -07005535
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305536static void
5537__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5538{
5539 tpSirResetAPCapsChange pResetCapsChange;
5540 tpPESession psessionEntry;
5541 tANI_U8 sessionId = 0;
5542 if (pMsgBuf == NULL)
5543 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005544 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305545 return;
5546 }
5547
5548 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5549 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5550 if (psessionEntry == NULL)
5551 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005552 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305553 return;
5554 }
5555
5556 psessionEntry->limSentCapsChangeNtf = false;
5557 return;
5558}
5559
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305560static void
5561__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5562{
5563 tSirMsgQ msg;
5564 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5565 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5566
5567 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5568 if ( NULL == pSpoofMacAddrParams )
5569 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305570 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305571 return;
5572 }
5573
5574 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5575
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305576 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5577
5578 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5579 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5580
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305581 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5582 msg.reserved = 0;
5583 msg.bodyptr = pSpoofMacAddrParams;
5584 msg.bodyval = 0;
5585
5586 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5587 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5588
5589 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5590 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305591 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305592 vos_mem_free(pSpoofMacAddrParams);
5593 }
5594 return;
5595}
5596
Jeff Johnson295189b2012-06-20 16:38:30 -07005597/**
Abhishek Singh7d624e12015-11-30 14:29:27 +05305598 * lim_register_mgmt_frame_ind_cb() - Save the Management frame
5599 * indication callback in PE.
5600 * @pMac: Mac pointer
5601 * @pMsgBuf: Msg pointer containing the callback
5602 *
5603 * This function is used save the Management frame
5604 * indication callback in PE.
5605 *
5606 * Return: None
5607 */
5608static void lim_register_mgmt_frame_ind_cb(tpAniSirGlobal pMac,
5609 tANI_U32 *msg_buf)
5610{
5611 struct sir_sme_mgmt_frame_cb_req *sme_req =
5612 (struct sir_sme_mgmt_frame_cb_req *)msg_buf;
5613
5614 if (NULL == msg_buf)
5615 {
5616 limLog(pMac, LOGE, FL("msg_buf is null"));
5617 return;
5618 }
5619 if (sme_req->callback)
5620 pMac->mgmt_frame_ind_cb =
5621 (sir_mgmt_frame_ind_callback)sme_req->callback;
5622 else
5623 limLog(pMac, LOGE, FL("sme_req->callback is null"));
5624}
5625
5626/**
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 * limProcessSmeReqMessages()
5628 *
5629 *FUNCTION:
5630 * This function is called by limProcessMessageQueue(). This
5631 * function processes SME request messages from HDD or upper layer
5632 * application.
5633 *
5634 *LOGIC:
5635 *
5636 *ASSUMPTIONS:
5637 *
5638 *NOTE:
5639 *
5640 * @param pMac Pointer to Global MAC structure
5641 * @param msgType Indicates the SME message type
5642 * @param *pMsgBuf A pointer to the SME message buffer
5643 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5644 * FALSE - if pMsgBuf is not to be freed.
5645 */
5646
5647tANI_BOOLEAN
5648limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5649{
5650 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5651 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005652 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305653 tANI_BOOLEAN isPassiveScan = FALSE;
5654
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005655 PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005656 limMsgStr(pMsg->type), pMsg->type,
5657 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5658 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5659
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005660 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005661 /* Special handling of some SME Req msgs where we have an existing GO session and
5662 * want to insert NOA before processing those msgs. These msgs will be processed later when
5663 * start event happens
5664 */
5665 switch (pMsg->type)
5666 {
5667 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305668 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5669 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005670 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005671
5672 /* If scan is disabled return from here
5673 */
5674 if (pMac->lim.fScanDisabled)
5675 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005676 if (pMsg->type == eWNI_SME_SCAN_REQ)
5677 {
5678 limSendSmeScanRsp(pMac,
5679 offsetof(tSirSmeScanRsp,bssDescription[0]),
5680 eSIR_SME_INVALID_PARAMETERS,
5681 pScanReq->sessionId,
5682 pScanReq->transactionId);
5683
5684 bufConsumed = TRUE;
5685 }
5686 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5687 {
5688 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5689 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5690 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5691
5692 /*
5693 * limRemainOnChnRsp will free the buffer this change is to
5694 * avoid "double free"
5695 */
5696 bufConsumed = FALSE;
5697 }
5698
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305699 limLog(pMac, LOGE,
5700 FL("Error: Scan Disabled."
5701 " Return with error status for SME Message %s(%d)"),
5702 limMsgStr(pMsg->type), pMsg->type);
5703
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005704 return bufConsumed;
5705 }
5706 /*
5707 * Do not add BREAK here
5708 */
5709 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005710 case eWNI_SME_JOIN_REQ:
5711 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5712 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5713 {
5714 tANI_U32 noaDuration;
5715 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305716 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005717 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5718 return bufConsumed;
5719 }
5720 }
5721 /* If no insert NOA required then execute the code below */
5722
Jeff Johnson295189b2012-06-20 16:38:30 -07005723 switch (pMsg->type)
5724 {
5725 case eWNI_SME_START_REQ:
5726 __limProcessSmeStartReq(pMac, pMsgBuf);
5727 break;
5728
5729 case eWNI_SME_SYS_READY_IND:
5730 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5731 break;
5732
Jeff Johnson295189b2012-06-20 16:38:30 -07005733 case eWNI_SME_START_BSS_REQ:
5734 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5735 break;
5736
5737 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005738 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005739 break;
5740
Jeff Johnsone7245742012-09-05 17:12:55 -07005741#ifdef FEATURE_OEM_DATA_SUPPORT
5742 case eWNI_SME_OEM_DATA_REQ:
5743 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005744 break;
5745#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005746 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5747 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5748 break;
5749
5750 case eWNI_SME_UPDATE_NOA:
5751 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5752 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305753 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5754 __limProcessClearDfsChannelList(pMac, pMsg);
5755 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005756 case eWNI_SME_JOIN_REQ:
5757 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005758 break;
5759
5760 case eWNI_SME_AUTH_REQ:
5761 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5762
5763 break;
5764
5765 case eWNI_SME_REASSOC_REQ:
5766 __limProcessSmeReassocReq(pMac, pMsgBuf);
5767
5768 break;
5769
5770 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5771 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5772
5773 break;
5774
5775 case eWNI_SME_DISASSOC_REQ:
5776 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5777
5778 break;
5779
5780 case eWNI_SME_DISASSOC_CNF:
5781 case eWNI_SME_DEAUTH_CNF:
5782 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5783
5784 break;
5785
5786 case eWNI_SME_DEAUTH_REQ:
5787 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5788
5789 break;
5790
Jeff Johnson295189b2012-06-20 16:38:30 -07005791
5792
5793 case eWNI_SME_SETCONTEXT_REQ:
5794 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5795
5796 break;
5797
5798 case eWNI_SME_REMOVEKEY_REQ:
5799 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5800
5801 break;
5802
5803 case eWNI_SME_STOP_BSS_REQ:
5804 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5805 break;
5806
5807 case eWNI_SME_ASSOC_CNF:
5808 case eWNI_SME_REASSOC_CNF:
5809 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305810 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005811 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305812 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305813#ifdef SAP_AUTH_OFFLOAD
5814 if (pMac->sap_auth_offload)
5815 __lim_process_sme_assoc_offload_cnf(pMac, pMsg->type, pMsgBuf);
5816 else
5817 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5818#else
Jeff Johnson295189b2012-06-20 16:38:30 -07005819 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305820#endif /* SAP_AUTH_OFFLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005821 break;
5822
5823 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305824 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5826 break;
5827
5828 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305829 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005830 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5831 break;
5832
5833 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305834 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005835 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5836 break;
5837
5838 case eWNI_SME_STA_STAT_REQ:
5839 case eWNI_SME_AGGR_STAT_REQ:
5840 case eWNI_SME_GLOBAL_STAT_REQ:
5841 case eWNI_SME_STAT_SUMM_REQ:
5842 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5843 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5844 bufConsumed = FALSE;
5845 break;
5846 case eWNI_SME_GET_STATISTICS_REQ:
5847 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5848 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5849 bufConsumed = FALSE;
5850 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005851#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005852 case eWNI_SME_GET_ROAM_RSSI_REQ:
5853 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5854 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5855 bufConsumed = FALSE;
5856 break;
5857#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005858#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005859 case eWNI_SME_GET_TSM_STATS_REQ:
5860 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5861 bufConsumed = FALSE;
5862 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005863#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005864 case eWNI_SME_DEL_BA_PEER_IND:
5865 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5866 break;
5867 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5868 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5869 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005870 case eWNI_SME_GET_ASSOC_STAS_REQ:
5871 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5872 break;
5873 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5874 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5875 break;
5876
5877 case eWNI_SME_HIDE_SSID_REQ:
5878 __limProcessSmeHideSSID(pMac, pMsgBuf);
5879 break;
5880 case eWNI_SME_UPDATE_APWPSIE_REQ:
5881 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5882 break;
5883 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5884 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5885 break;
5886
5887 case eWNI_SME_SET_APWPARSNIEs_REQ:
5888 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5889 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005890
5891 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5892 //Update the beaconInterval
5893 __limProcessSmeChangeBI(pMac, pMsgBuf );
5894 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305895
5896#ifdef WLAN_FEATURE_AP_HT40_24G
5897 case eWNI_SME_SET_HT_2040_MODE:
5898 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5899 break;
5900#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005901
5902#if defined WLAN_FEATURE_VOWIFI
5903 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5904 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5905 __limProcessReportMessage(pMac, pMsg);
5906 break;
5907#endif
5908
5909#if defined WLAN_FEATURE_VOWIFI_11R
5910 case eWNI_SME_FT_PRE_AUTH_REQ:
5911 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5912 break;
5913 case eWNI_SME_FT_UPDATE_KEY:
5914 limProcessFTUpdateKey(pMac, pMsgBuf);
5915 break;
5916
5917 case eWNI_SME_FT_AGGR_QOS_REQ:
5918 limProcessFTAggrQosReq(pMac, pMsgBuf);
5919 break;
5920#endif
5921
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05305922#ifdef WLAN_FEATURE_LFR_MBB
5923 case eWNI_SME_MBB_PRE_AUTH_REASSOC_REQ:
5924 lim_process_pre_auth_reassoc_req(pMac, pMsg);
5925 bufConsumed = FALSE;
5926 break;
5927#endif
5928
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005929#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5930 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005931 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5932 break;
5933#endif
5934 case eWNI_SME_ADD_STA_SELF_REQ:
5935 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5936 break;
5937 case eWNI_SME_DEL_STA_SELF_REQ:
5938 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5939 break;
5940
Jeff Johnson295189b2012-06-20 16:38:30 -07005941 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5942 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5943 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005944#ifdef FEATURE_WLAN_TDLS
5945 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5946 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5947 break;
5948 case eWNI_SME_TDLS_ADD_STA_REQ:
5949 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5950 break;
5951 case eWNI_SME_TDLS_DEL_STA_REQ:
5952 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5953 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305954 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5955 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5956 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305957// tdlsoffchan
5958 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5959 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5960 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005961#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305962 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5963 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5964 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005965
schang86c22c42013-03-13 18:41:24 -07005966 case eWNI_SME_SET_TX_POWER_REQ:
5967 limSendSetTxPowerReq(pMac, pMsgBuf);
5968 break ;
5969
Abhishek Singh00b71972016-01-07 10:51:04 +05305970#ifdef WLAN_FEATURE_RMC
5971 case eWNI_SME_ENABLE_RMC_REQ:
5972 limProcessRMCMessages(pMac, eLIM_RMC_ENABLE_REQ, pMsgBuf);
5973 break ;
5974
5975 case eWNI_SME_DISABLE_RMC_REQ:
5976 limProcessRMCMessages(pMac, eLIM_RMC_DISABLE_REQ, pMsgBuf);
5977 break ;
5978#endif /* WLAN_FEATURE_RMC */
5979
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305980 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5981 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5982 break ;
Abhishek Singh7d624e12015-11-30 14:29:27 +05305983 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
5984 lim_register_mgmt_frame_ind_cb(pMac, pMsgBuf);
5985 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005986 default:
5987 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5988 pMsg->bodyptr = NULL;
5989 break;
5990 } // switch (msgType)
5991
5992 return bufConsumed;
5993} /*** end limProcessSmeReqMessages() ***/