blob: 09b0baa2c2e95f3f69b90ac975efd2689e9cb789 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 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
Jeff Johnson295189b2012-06-20 16:38:30 -070062#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#if defined WLAN_FEATURE_VOWIFI
65#include "rrmApi.h"
66#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080067#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
68#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070069#endif
70
71#if defined WLAN_FEATURE_VOWIFI_11R
72#include <limFT.h>
73#endif
74
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080075#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070076/* These are the min/max tx power (non virtual rates) range
77 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053078#define MIN_TX_PWR_CAP 8
79#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070080
81#endif
82
Sushant Kaushike3ca61c2015-03-19 18:33:25 +053083#define JOIN_FAILURE_TIMEOUT 1000 // in msecs
Viral Modid86bde22012-12-10 13:09:21 -080084/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
85 * 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 -080086 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
87 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080088 */
Viral Modid440e682013-03-06 02:25:31 -080089#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
90#define JOIN_NOA_DURATION 2000 // in msecs
91#define OEM_DATA_NOA_DURATION 60 // in msecs
92#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070093
Gopichand Nakkala096a1052012-12-21 07:05:34 -080094#define CONV_MS_TO_US 1024 //conversion factor from ms to us
95
Jeff Johnson295189b2012-06-20 16:38:30 -070096// SME REQ processing function templates
97static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
98static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
99static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -0800100static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700101static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
102static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
105static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
106static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
107static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700112
Jeff Johnson295189b2012-06-20 16:38:30 -0700113
Jeff Johnson295189b2012-06-20 16:38:30 -0700114#ifdef BACKGROUND_SCAN_ENABLED
115
116// start the background scan timers if it hasn't already started
117static void
118__limBackgroundScanInitiate(tpAniSirGlobal pMac)
119{
120 if (pMac->lim.gLimBackgroundScanStarted)
121 return;
122
123 //make sure timer is created first
124 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
125 {
126 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700127 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700129 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 pMac->lim.gLimBackgroundScanStarted = true;
131 pMac->lim.gLimBackgroundScanChannelId = 0;
132 }
133}
134
135#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700136
137// determine if a fresh scan request must be issued or not
138/*
139* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
140* If one of the sessions is not in one of the above states, then PE does not do fresh scan
141* If no session exists (scanning very first time), then PE will always do fresh scan if SME
142* asks it to do that.
143*/
144static tANI_U8
145__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
146{
147
148 tANI_U8 validState = TRUE;
149 int i;
150
151 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
152 {
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530153 limLog(pMac, LOG1, FL("setting fresh scan as false. sme state is %d"),
154 pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 return FALSE;
156 }
157 for(i =0; i < pMac->lim.maxBssId; i++)
158 {
159
160 if(pMac->lim.gpSession[i].valid == TRUE)
161 {
162 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
163 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
164 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
165
166 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
167 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
168 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
169 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
171 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
172 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
173 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700174 ))
175 {
176 validState = FALSE;
Sushant Kaushik59e6f362015-08-11 15:41:00 +0530177 limLog(pMac, LOG1, FL("setting fresh scan as false."
178 "bssType is %d system role is %d, smestate is %d"),
179 pMac->lim.gpSession[i].bssType,
180 pMac->lim.gpSession[i].limSystemRole,
181 pMac->lim.gpSession[i].limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 break;
183 }
184
185 }
186 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530187 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700188
189 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
190 return TRUE;
191
192 return FALSE;
193}
194
Jeff Johnson295189b2012-06-20 16:38:30 -0700195
196
197/**
198 * __limIsSmeAssocCnfValid()
199 *
200 *FUNCTION:
201 * This function is called by limProcessLmmMessages() upon
202 * receiving SME_ASSOC_CNF.
203 *
204 *LOGIC:
205 * Message validity checks are performed in this function
206 *
207 *ASSUMPTIONS:
208 *
209 *NOTE:
210 *
211 * @param pMeasReq Pointer to Received ASSOC_CNF message
212 * @return true When received SME_ASSOC_CNF is formatted
213 * correctly
214 * false otherwise
215 */
216
217inline static tANI_U8
218__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
219{
220 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
221 return false;
222 else
223 return true;
224} /*** end __limIsSmeAssocCnfValid() ***/
225
226
227/**
228 * __limGetSmeJoinReqSizeForAlloc()
229 *
230 *FUNCTION:
231 * This function is called in various places to get IE length
232 * from tSirBssDescription structure
233 * number being scanned.
234 *
235 *PARAMS:
236 *
237 *LOGIC:
238 *
239 *ASSUMPTIONS:
240 * NA
241 *
242 *NOTE:
243 * NA
244 *
245 * @param pBssDescr
246 * @return Total IE length
247 */
248
249static tANI_U16
250__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
251{
252 tANI_U16 len = 0;
253
254 if (!pBuf)
255 return len;
256
257 pBuf += sizeof(tANI_U16);
258 len = limGetU16( pBuf );
259 return (len + sizeof( tANI_U16 ));
260} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
261
262
263/**----------------------------------------------------------------
264\fn __limIsDeferedMsgForLearn
265
266\brief Has role only if 11h is enabled. Not used on STA side.
267 Defers the message if SME is in learn state and brings
268 the LIM back to normal mode.
269
270\param pMac
271\param pMsg - Pointer to message posted from SME to LIM.
272\return TRUE - If defered
273 FALSE - Otherwise
274------------------------------------------------------------------*/
275static tANI_BOOLEAN
276__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
277{
278 if (limIsSystemInScanState(pMac))
279 {
280 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
281 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700282 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return eANI_BOOLEAN_FALSE;
284 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700285 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700286 pMsg->type);)
287
288 /** Send finish scan req to HAL only if LIM is not waiting for any response
289 * from HAL like init scan rsp, start scan rsp etc.
290 */
291 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
292 {
293 //Set the resume channel to Any valid channel (invalid).
294 //This will instruct HAL to set it to any previous valid channel.
295 peSetResumeChannel(pMac, 0, 0);
296 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
297 }
298
299 return eANI_BOOLEAN_TRUE;
300 }
301 return eANI_BOOLEAN_FALSE;
302}
303
304/**----------------------------------------------------------------
305\fn __limIsDeferedMsgForRadar
306
307\brief Has role only if 11h is enabled. Not used on STA side.
308 Defers the message if radar is detected.
309
310\param pMac
311\param pMsg - Pointer to message posted from SME to LIM.
312\return TRUE - If defered
313 FALSE - Otherwise
314------------------------------------------------------------------*/
315static tANI_BOOLEAN
316__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
317{
318 /** fRadarDetCurOperChan will be set only if we detect radar in current
319 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700320 //TODO: Need to take care radar detection.
321 //if (LIM_IS_RADAR_DETECTED(pMac))
322 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 {
324 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
325 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700326 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 return eANI_BOOLEAN_FALSE;
328 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700329 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 pMsg->type);)
331 return eANI_BOOLEAN_TRUE;
332 }
333 return eANI_BOOLEAN_FALSE;
334}
335
336
337/**
338 * __limProcessSmeStartReq()
339 *
340 *FUNCTION:
341 * This function is called to process SME_START_REQ message
342 * from HDD or upper layer application.
343 *
344 *LOGIC:
345 *
346 *ASSUMPTIONS:
347 *
348 *NOTE:
349 *
350 * @param pMac Pointer to Global MAC structure
351 * @param *pMsgBuf A pointer to the SME message buffer
352 * @return None
353 */
354
355static void
356__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
357{
358 tSirResultCodes retCode = eSIR_SME_SUCCESS;
359 tANI_U8 smesessionId;
360 tANI_U16 smetransactionId;
361
362
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530363 limLog(pMac, LOG1, FL("Received SME_START_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
366
367 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
368 {
369 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
370
Jeff Johnsone7245742012-09-05 17:12:55 -0700371 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700372
373 /// By default do not return after first scan match
374 pMac->lim.gLimReturnAfterFirstMatch = 0;
375
376 /// Initialize MLM state machine
377 limInitMlm(pMac);
378
379 /// By default return unique scan results
380 pMac->lim.gLimReturnUniqueResults = true;
381 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700382#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
383 pMac->lim.gLimSmeLfrScanResultLength = 0;
384#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700385
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
387 {
388 /*
389 * Need to indicate new BSSs found during background scanning to
390 * host. Update this parameter at CFG
391 */
392 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
393 != eSIR_SUCCESS)
394 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700395 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
397 }
398 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 }
400 else
401 {
402 /**
403 * Should not have received eWNI_SME_START_REQ in states
404 * other than OFFLINE. Return response to host and
405 * log error
406 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530407 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
409 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
410 }
411 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
412} /*** end __limProcessSmeStartReq() ***/
413
414
415/** -------------------------------------------------------------
416\fn __limProcessSmeSysReadyInd
417\brief handles the notification from HDD. PE just forwards this message to HAL.
418\param tpAniSirGlobal pMac
419\param tANI_U32* pMsgBuf
420\return TRUE-Posting to HAL failed, so PE will consume the buffer.
421\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
422 -------------------------------------------------------------*/
423static tANI_BOOLEAN
424__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
425{
426 tSirMsgQ msg;
427
428 msg.type = WDA_SYS_READY_IND;
429 msg.reserved = 0;
430 msg.bodyptr = pMsgBuf;
431 msg.bodyval = 0;
432
Jeff Johnson92751692013-03-06 16:00:33 -0800433 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 {
Jeff Johnson92751692013-03-06 16:00:33 -0800435 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700437 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700438 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
Jeff Johnson92751692013-03-06 16:00:33 -0800440 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700442 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 return eANI_BOOLEAN_TRUE;
444 }
445 return eANI_BOOLEAN_FALSE;
446}
447
Jeff Johnsone7245742012-09-05 17:12:55 -0700448#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
Jeff Johnsone7245742012-09-05 17:12:55 -0700450tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
451{
452 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
453 {
454 switch(secondaryChanOffset)
455 {
456 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
457 return primarychanNum;
458 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
459 return primarychanNum + 2;
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
461 return primarychanNum - 2;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
463 return primarychanNum + 6;
464 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
465 return primarychanNum + 2;
466 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
467 return primarychanNum - 2;
468 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
469 return primarychanNum - 6;
470 default :
471 return eSIR_CFG_INVALID_ID;
472 }
473 }
474 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
475 {
476 switch(secondaryChanOffset)
477 {
478 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
479 return primarychanNum + 2;
480 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
481 return primarychanNum - 2;
482 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
483 return primarychanNum;
484 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
485 return primarychanNum + 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
487 return primarychanNum - 2;
488 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
489 return primarychanNum + 2;
490 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
491 return primarychanNum - 2;
492 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
493 return primarychanNum + 2;
494 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
495 return primarychanNum - 2;
496 default :
497 return eSIR_CFG_INVALID_ID;
498 }
499 }
500 return primarychanNum;
501}
502
503#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700504/**
505 * __limHandleSmeStartBssRequest()
506 *
507 *FUNCTION:
508 * This function is called to process SME_START_BSS_REQ message
509 * from HDD or upper layer application.
510 *
511 *LOGIC:
512 *
513 *ASSUMPTIONS:
514 *
515 *NOTE:
516 *
517 * @param pMac Pointer to Global MAC structure
518 * @param *pMsgBuf A pointer to the SME message buffer
519 * @return None
520 */
521
522static void
523__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
524{
525 tANI_U16 size;
526 tANI_U32 val = 0;
527 tSirRetStatus retStatus;
528 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700529 tLimMlmStartReq *pMlmStartReq = NULL;
530 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 tSirResultCodes retCode = eSIR_SME_SUCCESS;
532 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 tANI_U8 sessionId;
534 tpPESession psessionEntry = NULL;
535 tANI_U8 smesessionId;
536 tANI_U16 smetransactionId;
537
538#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
539 //Since the session is not created yet, sending NULL. The response should have the correct state.
540 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
541#endif //FEATURE_WLAN_DIAG_SUPPORT
542
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530543 limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700544
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530545 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
547 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
548 {
549 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
550
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530551 pSmeStartBssReq = vos_mem_malloc(size);
552 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530554 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 /// Send failure response to host
556 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
557 goto end;
558 }
559
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530560 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700561
562 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
563 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
564 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700565 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 retCode = eSIR_SME_INVALID_PARAMETERS;
567 goto free;
568 }
569#if 0
570 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700571 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
573#endif
574
575 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530576 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
578 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700579 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
581 psessionEntry = NULL;
582 goto free;
583 }
584 else
585 {
586 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
587 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700588 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
590 goto free;
591 }
592
593 }
594
595 /* Store the session related parameters in newly created session */
596 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
597
598 /* Store PE sessionId in session Table */
599 psessionEntry->peSessionId = sessionId;
600
601 /* Store SME session Id in sessionTable */
602 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
603
604 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
605
606 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
607
608 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530609 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 (tANI_U8 *)&pSmeStartBssReq->ssId,
611 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530612
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530614
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530616
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
618
619 /* Store the channel number in session Table */
620 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
621
622 /*Store Persona */
623 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700624 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 psessionEntry->pePersona);
626
627 /*Update the phymode*/
628 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
629
630 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
631 psessionEntry->currentOperChannel );
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530632
633#ifdef WLAN_FEATURE_AP_HT40_24G
634 /*Store Overlapping BSS Scan Parameters IEs to session table */
635 if (pSmeStartBssReq->apHT40_24GEnabled)
636 {
637 limInitOBSSScanParams(pMac, psessionEntry);
638 }
639#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 /* Store the dot 11 mode in to the session Table*/
641
642 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
644#ifdef WLAN_FEATURE_11AC
645 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700646 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
647 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700648#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800649
650 psessionEntry->txLdpcIniFeatureEnabled =
651 pSmeStartBssReq->txLdpcIniFeatureEnabled;
652
Chet Lanctot8cecea22014-02-11 19:09:36 -0800653#ifdef WLAN_FEATURE_11W
654 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
655 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
656#endif
657
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530658 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 (void*)&pSmeStartBssReq->operationalRateSet,
660 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530661 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 (void*)&pSmeStartBssReq->extendedRateSet,
663 sizeof(tSirMacRateSet));
664
665 switch(pSmeStartBssReq->bssType)
666 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 case eSIR_INFRA_AP_MODE:
668 psessionEntry->limSystemRole = eLIM_AP_ROLE;
669 psessionEntry->privacy = pSmeStartBssReq->privacy;
670 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
671 psessionEntry->authType = pSmeStartBssReq->authType;
672 /* Store the DTIM period */
673 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
674 /*Enable/disable UAPSD*/
675 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
676 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
677 {
678 psessionEntry->proxyProbeRspEn = 0;
679 }
680 else
681 {
682 /* To detect PBC overlap in SAP WPS mode, Host handles
683 * Probe Requests.
684 */
685 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
686 {
687 psessionEntry->proxyProbeRspEn = 1;
688 }
689 else
690 {
691 psessionEntry->proxyProbeRspEn = 0;
692 }
693 }
694 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
695 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700696 limGetShortSlotFromPhyMode(pMac, psessionEntry,
697 psessionEntry->gLimPhyMode,
698 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 case eSIR_IBSS_MODE:
701 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700702 limGetShortSlotFromPhyMode(pMac, psessionEntry,
703 psessionEntry->gLimPhyMode,
704 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530705 /* In WPA-NONE case we wont get the privacy bit in ibss config
706 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
707 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
708 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
709 */
710 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
711 != eSIR_SUCCESS)
712 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
713 " failed"));
714 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800715 psessionEntry->isCoalesingInIBSSAllowed =
716 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 break;
718
719 case eSIR_BTAMP_AP_MODE:
720 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
721 break;
722
723 case eSIR_BTAMP_STA_MODE:
724 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
725 break;
726
727 /* There is one more mode called auto mode. which is used no where */
728
729 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
730
731
732 default:
733 //not used anywhere...used in scan function
734 break;
735 }
736
737 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
738 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 )
741 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530742 psessionEntry->parsedAssocReq = vos_mem_malloc(
743 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
744 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530746 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
748 goto free;
749 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530750 vos_mem_set(psessionEntry->parsedAssocReq,
751 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
752 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 }
754
755 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
756 if (pSmeStartBssReq->channelId)
757 {
758 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700759 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
760 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
761 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700762 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 FL("cbMode %u"), pSmeStartBssReq->cbMode);
764#ifdef WLAN_FEATURE_11AC
765 if(psessionEntry->vhtCapability)
766 {
767 tANI_U32 centerChan;
768 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700769
Jeff Johnsone7245742012-09-05 17:12:55 -0700770 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
771 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700773 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700774 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700775 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530776
Abhishek Singh921926b2014-02-13 17:21:01 +0530777 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530778 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700779 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530780 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530781 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
782 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700784
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530785 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
786 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530787 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530788 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
789 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
790 != eSIR_SUCCESS)
791 {
792 limLog(pMac, LOGP, FL("could not set "
793 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
794 retCode = eSIR_LOGP_EXCEPTION;
795 goto free;
796 }
797 }
798 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
799 {
800 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
801 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
802 != eSIR_SUCCESS)
803 {
804 limLog(pMac, LOGP, FL("could not set "
805 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
806 retCode = eSIR_LOGP_EXCEPTION;
807 goto free;
808 }
809
810 centerChan = limGetCenterChannel( pMac, channelNumber,
811 pSmeStartBssReq->cbMode,
812 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700813 if(centerChan != eSIR_CFG_INVALID_ID)
814 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530815 limLog(pMac, LOGW, FL("***Center Channel for "
816 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700817 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530818 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530819 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
820 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700821 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530822 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530823 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700824 retCode = eSIR_LOGP_EXCEPTION;
825 goto free;
826 }
827 }
828 }
829
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530830 /* All the translation is done by now for gVhtChannelWidth
831 * from .ini file to the actual values as defined in spec.
832 * So, grabing the spec value which is
833 * updated in .dat file by the above logic */
834 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
835 &chanWidth) != eSIR_SUCCESS)
836 {
837 limLog(pMac, LOGP,
838 FL("Unable to retrieve Channel Width from CFG"));
839 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700840 /*For Sta+p2p-Go concurrency
841 vhtTxChannelWidthSet is used for storing p2p-GO channel width
842 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
843 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
844 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700845 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700846 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700847 }
848 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
849#endif
850 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 else
852 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700853 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 retCode = eSIR_SME_INVALID_PARAMETERS;
855 goto free;
856 }
857
858 // Delete pre-auth list if any
859 limDeletePreAuthList(pMac);
860
861 // Delete IBSS peer BSSdescription list if any
862 //limIbssDelete(pMac); sep 26 review
863
864
865
866#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
867 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 limInitMlm(pMac);
869#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700870
Jeff Johnsone7245742012-09-05 17:12:55 -0700871 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700872
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 /* keep the RSN/WPA IE information in PE Session Entry
874 * later will be using this to check when received (Re)Assoc req
875 * */
876 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
877
Jeff Johnson295189b2012-06-20 16:38:30 -0700878
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 //Taken care for only softAP case rest need to be done
880 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
881 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
882 /*each byte will have the following info
883 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
884 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530885 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700887 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
889 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700890
891 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530892 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
893 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530895 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
897 goto free;
898 }
899
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530900 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700901
902 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530903 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 (tANI_U8 *) &pSmeStartBssReq->ssId,
905 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
907 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700908
909
910 pMlmStartReq->bssType = psessionEntry->bssType;
911
912 /* Fill PE session Id from the session Table */
913 pMlmStartReq->sessionId = psessionEntry->peSessionId;
914
915 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 )
918 {
919 //len = sizeof(tSirMacAddr);
920 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
921 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700922 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700923
924 /* Copy the BSSId from sessionTable to mlmStartReq struct */
925 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
926 }
927
928 else // ibss mode
929 {
930 pMac->lim.gLimIbssCoalescingHappened = false;
931
932 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700934 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 retCode = eSIR_LOGP_EXCEPTION;
936 goto free;
937 }
938
939 if(!autoGenBssId)
940 {
941 // We're not auto generating BSSID. Instead, get it from session entry
942 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
943
944 if(pMlmStartReq->bssId[0] & 0x01)
945 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700946 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 autoGenBssId = TRUE;
948 }
949 }
950
951 if( autoGenBssId )
952 { //if BSSID is not any uc id. then use locally generated BSSID.
953 //Autogenerate the BSSID
954 limGetRandomBssid( pMac, pMlmStartReq->bssId);
955 pMlmStartReq->bssId[0]= 0x02;
956
957 /* Copy randomly generated BSSID to the session Table */
958 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
959 }
960 }
961 /* store the channel num in mlmstart req structure */
962 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
963 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
964 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
965
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
967 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
968 pMlmStartReq->wps_state = psessionEntry->wps_state;
969
970 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 {
972 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700973 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 pMlmStartReq->dtimPeriod = (tANI_U8)val;
975 }
976
977 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700978 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
980
981 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700982 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700983 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
984
985 //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 +0530986 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 sizeof(tSirMacRateSet));
988
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 // Now populate the 11n related parameters
990 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700991 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 //
993 // FIXME_GEN4 - Determine the appropriate defaults...
994 //
995 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
996 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700997 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700998
999 /* sep26 review */
1000 psessionEntry->limRFBand = limGetRFBand(channelNumber);
1001
1002 // Initialize 11h Enable Flag
1003 psessionEntry->lim11hEnable = 0;
1004 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
1005 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
1006 {
1007 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001008 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 psessionEntry->lim11hEnable = val;
1010 }
1011
1012 if (!psessionEntry->lim11hEnable)
1013 {
1014 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001015 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 }
1017
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1019 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001020 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001021
1022 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1023 return;
1024 }
1025 else
1026 {
1027
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001028 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1030 goto end;
1031 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1032
1033free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001034 if ((psessionEntry != NULL) &&
1035 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1036 {
1037 psessionEntry->pLimStartBssReq = NULL;
1038 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301039 vos_mem_free( pSmeStartBssReq);
1040 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
1042end:
1043
1044 /* This routine should return the sme sessionId and SME transaction Id */
1045 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1046
1047 if(NULL != psessionEntry)
1048 {
1049 peDeleteSession(pMac,psessionEntry);
1050 psessionEntry = NULL;
1051 }
1052 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1053} /*** end __limHandleSmeStartBssRequest() ***/
1054
1055
1056/**--------------------------------------------------------------
1057\fn __limProcessSmeStartBssReq
1058
1059\brief Wrapper for the function __limHandleSmeStartBssRequest
1060 This message will be defered until softmac come out of
1061 scan mode or if we have detected radar on the current
1062 operating channel.
1063\param pMac
1064\param pMsg
1065
1066\return TRUE - If we consumed the buffer
1067 FALSE - If have defered the message.
1068 ---------------------------------------------------------------*/
1069static tANI_BOOLEAN
1070__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1071{
1072 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1073 __limIsDeferedMsgForRadar(pMac, pMsg))
1074 {
1075 /**
1076 * If message defered, buffer is not consumed yet.
1077 * So return false
1078 */
1079 return eANI_BOOLEAN_FALSE;
1080 }
1081
1082 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1083 return eANI_BOOLEAN_TRUE;
1084}
1085
1086
1087/**
1088 * limGetRandomBssid()
1089 *
1090 * FUNCTION:This function is called to process generate the random number for bssid
1091 * This function is called to process SME_SCAN_REQ message
1092 * from HDD or upper layer application.
1093 *
1094 * LOGIC:
1095 *
1096 * ASSUMPTIONS:
1097 *
1098 * NOTE:
1099 * 1. geneartes the unique random number for bssid in ibss
1100 *
1101 * @param pMac Pointer to Global MAC structure
1102 * @param *data Pointer to bssid buffer
1103 * @return None
1104 */
1105void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1106{
1107 tANI_U32 random[2] ;
1108 random[0] = tx_time_get();
1109 random[0] |= (random[0] << 15) ;
1110 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301111 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001112}
1113
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301114static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1115 tpSirSmeScanReq pScanReq)
1116{
1117 tSirScanOffloadReq *pScanOffloadReq;
1118 tANI_U8 *p;
1119 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301120 tANI_U16 i, len;
1121 tSirRetStatus rc = eSIR_SUCCESS;
1122
1123 /* The tSirScanOffloadReq will reserve the space for first channel,
1124 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1125 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1126 pScanReq->uIEFieldLen;
1127
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301128 pScanOffloadReq = vos_mem_malloc(len);
1129 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301130 {
1131 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301132 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301133 return eHAL_STATUS_FAILURE;
1134 }
1135
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301136 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301137
1138 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1139 msg.bodyptr = pScanOffloadReq;
1140 msg.bodyval = 0;
1141
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301142 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301143 (tANI_U8*) pScanReq->bssId,
1144 sizeof(tSirMacAddr));
1145
1146 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1147 {
1148 limLog(pMac, LOGE,
1149 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301150 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301151 return eHAL_STATUS_FAILURE;
1152 }
1153
1154 pScanOffloadReq->numSsid = pScanReq->numSsid;
1155 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1156 {
1157 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301158 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301159 (tANI_U8 *) pScanReq->ssId[i].ssId,
1160 pScanOffloadReq->ssId[i].length);
1161 }
1162
1163 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301164 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301165 (tANI_U8 *) pScanReq->selfMacAddr,
1166 sizeof(tSirMacAddr));
1167 pScanOffloadReq->bssType = pScanReq->bssType;
1168 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1169 pScanOffloadReq->scanType = pScanReq->scanType;
1170 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1171 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1172 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1173 pScanOffloadReq->sessionId = pScanReq->sessionId;
1174 pScanOffloadReq->channelList.numChannels =
1175 pScanReq->channelList.numChannels;
1176 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1177 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1178 p[i] = pScanReq->channelList.channelNumber[i];
1179
1180 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1181 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301182 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301183 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1184 pScanOffloadReq->uIEFieldLen);
1185
1186 rc = wdaPostCtrlMsg(pMac, &msg);
1187 if (rc != eSIR_SUCCESS)
1188 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001189 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301190 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301191 return eHAL_STATUS_FAILURE;
1192 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301193 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301194
1195 return eHAL_STATUS_SUCCESS;
1196}
Jeff Johnson295189b2012-06-20 16:38:30 -07001197
1198/**
1199 * __limProcessSmeScanReq()
1200 *
1201 *FUNCTION:
1202 * This function is called to process SME_SCAN_REQ message
1203 * from HDD or upper layer application.
1204 *
1205 *LOGIC:
1206 *
1207 *ASSUMPTIONS:
1208 *
1209 *NOTE:
1210 * 1. Periodic scanning should be requesting to return unique
1211 * scan results.
1212 *
1213 * @param pMac Pointer to Global MAC structure
1214 * @param *pMsgBuf A pointer to the SME message buffer
1215 * @return None
1216 */
1217
Viral Modid440e682013-03-06 02:25:31 -08001218static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001219__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1220{
1221 tANI_U32 len;
1222 tLimMlmScanReq *pMlmScanReq;
1223 tpSirSmeScanReq pScanReq;
1224 tANI_U8 i = 0;
1225
Sushant Kaushikb97a0082015-08-31 12:36:45 +05301226#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1228#endif //FEATURE_WLAN_DIAG_SUPPORT
1229
1230 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301231 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1232 "first %d fresh %d unique %d type %s (%d)"
1233 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 pScanReq->channelList.numChannels,
1235 pScanReq->minChannelTime,
1236 pScanReq->maxChannelTime,
1237 pScanReq->uIEFieldLen,
1238 pScanReq->returnAfterFirstMatch,
1239 pScanReq->returnFreshResults,
1240 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301241 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001242 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301243 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1244 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001245
1246 /* Since scan req always requires a response, we will overwrite response required here.
1247 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1248 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1249 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1250 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1251 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1252 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1253 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1254 * the global flag gLimRspReqd to TRUE here.
1255 */
1256 pMac->lim.gLimRspReqd = TRUE;
1257
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301258 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1260
1261 /* This routine should return the sme sessionId and SME transaction Id */
1262
1263 if (!limIsSmeScanReqValid(pMac, pScanReq))
1264 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301265 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001266
1267 if (pMac->lim.gLimRspReqd)
1268 {
1269 pMac->lim.gLimRspReqd = false;
1270
1271 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1272
1273 } // if (pMac->lim.gLimRspReqd)
1274
1275 return;
1276 }
1277
1278 //if scan is disabled then return as invalid scan request.
1279 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1280 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1281 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301282 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1283 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001284 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 return;
1286 }
1287
1288
1289 /**
1290 * If scan request is received in idle, joinFailed
1291 * states or in link established state (in STA role)
1292 * or in normal state (in STA-in-IBSS/AP role) with
1293 * 'return fresh scan results' request from HDD or
1294 * it is periodic background scanning request,
1295 * trigger fresh scan request to MLM
1296 */
1297 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1298 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301299 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1300 {
1301 // Discard previously cached scan results
1302 limReInitScanResults(pMac);
1303 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001304
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301305 pMac->lim.gLim24Band11dScanDone = 0;
1306 pMac->lim.gLim50Band11dScanDone = 0;
1307 pMac->lim.gLimReturnAfterFirstMatch =
1308 pScanReq->returnAfterFirstMatch;
1309 pMac->lim.gLimBackgroundScanMode =
1310 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001311
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301312 pMac->lim.gLimReturnUniqueResults =
1313 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1314 /* De-activate Heartbeat timers for connected sessions while
1315 * scan is in progress if the system is in Active mode *
1316 * AND it is not a ROAMING ("background") scan */
1317 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1318 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1319 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1320 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1321 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 for(i=0;i<pMac->lim.maxBssId;i++)
1323 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301324 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1325 (pMac->lim.gpSession[i].valid == TRUE) &&
1326 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1327 {
1328 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1329 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301331 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001332
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301333 if (pMac->fScanOffload)
1334 {
1335 if (eHAL_STATUS_SUCCESS !=
1336 limSendHalStartScanOffloadReq(pMac, pScanReq))
1337 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301338 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301339 limSendSmeScanRsp(pMac,
1340 offsetof(tSirSmeScanRsp, bssDescription[0]),
1341 eSIR_SME_INVALID_PARAMETERS,
1342 pScanReq->sessionId,
1343 pScanReq->transactionId);
1344 return;
1345 }
1346 }
1347 else
1348 {
1349
1350 /*Change Global SME state */
1351 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301352 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301353 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1354 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1355 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1356
1357 if (pScanReq->channelList.numChannels == 0)
1358 {
1359 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301360
1361 limLog(pMac, LOG1,
1362 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301363 // Scan all channels
1364 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1366 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301367 pMlmScanReq = vos_mem_malloc(len);
1368 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301369 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301370 // Log error
1371 limLog(pMac, LOGP,
1372 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001373
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301374 if (pMac->lim.gLimRspReqd)
1375 {
1376 pMac->lim.gLimRspReqd = false;
1377
1378 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1379 eSIR_SME_RESOURCES_UNAVAILABLE,
1380 pScanReq->sessionId,
1381 pScanReq->transactionId);
1382 }
1383
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301384 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301385 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001386
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301387 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301388 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001389
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301390 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1391 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 pMlmScanReq->channelList.channelNumber,
1393 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301394 {
1395 /**
1396 * Could not get Valid channel list from CFG.
1397 * Log error.
1398 */
1399 limLog(pMac, LOGP,
1400 FL("could not retrieve Valid channel list"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301401
1402 if (pMac->lim.gLimRspReqd)
1403 {
1404 pMac->lim.gLimRspReqd = false;
1405
1406 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1407 eSIR_SME_INVALID_PARAMETERS,
1408 pScanReq->sessionId,
1409 pScanReq->transactionId);
1410 }
1411 return;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301412 }
1413 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301414
1415 //Ignore DFS channels if DFS scan is disabled
1416 if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
1417 {
1418 tANI_U8 numChan = 0;
1419 tANI_U8 channel_state;
1420 tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
1421
1422 limLog(pMac, LOG1,
1423 FL("Ignore DFS channels from valid channel list"));
1424
1425 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1426 pMlmScanReq->channelList.channelNumber,
1427 pMlmScanReq->channelList.numChannels);
1428
1429 //Filter DFS channels
1430 for (i = 0; i < cfg_len; i++)
1431 {
1432 channel_state =
1433 vos_nv_getChannelEnabledState(*(chan_ptr + i));
1434
1435 //Allow channel if not DFS
1436 if(channel_state != NV_CHANNEL_DFS)
1437 {
1438 *(chan_ptr + numChan) = *(chan_ptr + i);
1439 numChan++;
1440 }
1441 }
1442 pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
1443
1444 limLog(pMac, LOG1, FL("No of valid channels %d, No of"
1445 "channels after filtering %d"), cfg_len, numChan);
1446
1447 limLog(pMac, LOG1, FL("Channel list after filtering: "));
1448
1449 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1450 pMlmScanReq->channelList.channelNumber,
1451 pMlmScanReq->channelList.numChannels);
1452 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301453 }
1454 else
1455 {
1456 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1457 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1458 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301460 pMlmScanReq = vos_mem_malloc(len);
1461 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301462 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301463 // Log error
1464 limLog(pMac, LOGP,
1465 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001466
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301467 if (pMac->lim.gLimRspReqd)
1468 {
1469 pMac->lim.gLimRspReqd = false;
1470
1471 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1472 eSIR_SME_RESOURCES_UNAVAILABLE,
1473 pScanReq->sessionId,
1474 pScanReq->transactionId);
1475 }
1476
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301477 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301478 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001479
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301480 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301481 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301482 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301483 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001484
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301485 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1486 pScanReq->channelList.channelNumber,
1487 pScanReq->channelList.numChannels);
1488 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001489
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301490 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1491 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1492 if(pScanReq->uIEFieldLen)
1493 {
1494 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1495 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1496 pScanReq->uIEFieldLen);
1497 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001498
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301499 pMlmScanReq->bssType = pScanReq->bssType;
1500 vos_mem_copy( pMlmScanReq->bssId,
1501 pScanReq->bssId,
1502 sizeof(tSirMacAddr));
1503 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301505 i = 0;
1506 while (i < pMlmScanReq->numSsid)
1507 {
1508 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001509 (tANI_U8 *) &pScanReq->ssId[i],
1510 pScanReq->ssId[i].length + 1);
1511
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301512 i++;
1513 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
Jeff Johnson295189b2012-06-20 16:38:30 -07001515
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301516 pMlmScanReq->scanType = pScanReq->scanType;
1517 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301518 if (pMac->miracast_mode)
1519 {
1520 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1521 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1522 }
1523 else
1524 {
1525 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1526 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1527 }
1528
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301529 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1530 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1531 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1532 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001533
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301534 //Store the smeSessionID and transaction ID for later use.
1535 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1536 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301538 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301539 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301540 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1541 }
1542 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
1544 else
1545 {
1546 /// In all other cases return 'cached' scan results
1547 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1548 {
1549 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1550
1551 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001552#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1553 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001555 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1556 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1557 {
1558 limSendSmeLfrScanRsp(pMac, scanRspLen,
1559 eSIR_SME_SUCCESS,
1560 pScanReq->sessionId,
1561 pScanReq->transactionId);
1562 }
1563 else
1564 {
1565 scanRspLen = sizeof(tSirSmeScanRsp) +
1566 pMac->lim.gLimSmeLfrScanResultLength -
1567 sizeof(tSirBssDescription);
1568 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1569 pScanReq->sessionId, pScanReq->transactionId);
1570 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 }
1572 else
1573 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001574#endif
1575 if (pMac->lim.gLimSmeScanResultLength == 0)
1576 {
1577 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1578 pScanReq->sessionId, pScanReq->transactionId);
1579 }
1580 else
1581 {
1582 scanRspLen = sizeof(tSirSmeScanRsp) +
1583 pMac->lim.gLimSmeScanResultLength -
1584 sizeof(tSirBssDescription);
1585 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1586 pScanReq->sessionId, pScanReq->transactionId);
1587 }
1588#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001590#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301591 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
1593 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1594 {
1595 // Discard previously cached scan results
1596 limReInitScanResults(pMac);
1597 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001598#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1599 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1600 {
1601 // Discard previously cached scan results
1602 limReInitLfrScanResults(pMac);
1603 }
1604#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001605
1606 } // if (pMac->lim.gLimRspReqd)
1607 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1608
Jeff Johnson295189b2012-06-20 16:38:30 -07001609#ifdef BACKGROUND_SCAN_ENABLED
1610 // start background scans if needed
1611 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1612 __limBackgroundScanInitiate(pMac);
1613#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001614
1615} /*** end __limProcessSmeScanReq() ***/
1616
Jeff Johnsone7245742012-09-05 17:12:55 -07001617#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001618
Jeff Johnsone7245742012-09-05 17:12:55 -07001619static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1620{
1621 tpSirOemDataReq pOemDataReq;
1622 tLimMlmOemDataReq* pMlmOemDataReq;
1623
1624 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1625
1626 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301627 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1628 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001629 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301630 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001631 return;
1632 }
1633
1634 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301635 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001636
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301637 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1638 sizeof(tSirMacAddr));
1639 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1640 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001641
1642 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1643 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1644
1645 return;
1646
1647} /*** end __limProcessSmeOemDataReq() ***/
1648
1649#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001650
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301651/**
1652 * __limProcessClearDfsChannelList()
1653 *
1654 *FUNCTION:
1655 *Clear DFS channel list when country is changed/aquired.
1656.*This message is sent from SME.
1657 *
1658 *LOGIC:
1659 *
1660 *ASSUMPTIONS:
1661 *
1662 *NOTE:
1663 *
1664 * @param pMac Pointer to Global MAC structure
1665 * @param *pMsgBuf A pointer to the SME message buffer
1666 * @return None
1667 */
1668static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1669 tpSirMsgQ pMsg)
1670{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301671 vos_mem_set( &pMac->lim.dfschannelList,
1672 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301673}
Jeff Johnson295189b2012-06-20 16:38:30 -07001674
1675/**
1676 * __limProcessSmeJoinReq()
1677 *
1678 *FUNCTION:
1679 * This function is called to process SME_JOIN_REQ message
1680 * from HDD or upper layer application.
1681 *
1682 *LOGIC:
1683 *
1684 *ASSUMPTIONS:
1685 *
1686 *NOTE:
1687 *
1688 * @param pMac Pointer to Global MAC structure
1689 * @param *pMsgBuf A pointer to the SME message buffer
1690 * @return None
1691 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001692static void
1693__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1694{
1695 // tANI_U8 *pBuf;
1696 //tANI_U32 len;
1697// tSirMacAddr currentBssId;
1698 tpSirSmeJoinReq pSmeJoinReq = NULL;
1699 tLimMlmJoinReq *pMlmJoinReq;
1700 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1701 tANI_U32 val = 0;
1702 tANI_U16 nSize;
1703 tANI_U8 sessionId;
1704 tpPESession psessionEntry = NULL;
1705 tANI_U8 smesessionId;
1706 tANI_U16 smetransactionId;
1707 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301708 tANI_U16 ieLen;
1709 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001710
1711#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1712 //Not sending any session, since it is not created yet. The response whould have correct state.
1713 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1714#endif //FEATURE_WLAN_DIAG_SUPPORT
1715
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301716 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001717
1718#ifdef WLAN_FEATURE_VOWIFI
1719 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1720 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1721 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1722 * like not honoring power constraint on 1st association after driver loading. */
1723 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001724 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1726 val = 0;
1727#endif /* WLAN_FEATURE_VOWIFI */
1728
1729 /**
1730 * Expect Join request in idle state.
1731 * Reassociate request is expected in link established state.
1732 */
1733
1734 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1735 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1736 {
1737 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301738
1739 pSmeJoinReq = vos_mem_malloc(nSize);
1740 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301742 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1743 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1745 goto end;
1746 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301747 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001748
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1750 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1751 {
1752 /// Received invalid eWNI_SME_JOIN_REQ
1753 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301754 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1755 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 retCode = eSIR_SME_INVALID_PARAMETERS;
1757 goto end;
1758 }
1759
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301760 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001761
1762 /* check for the existence of start BSS session */
1763#ifdef FIXME_GEN6
1764 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1765 {
1766 if(peValidateBtJoinRequest(pMac)!= TRUE)
1767 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301768 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1769 "not present::SME_JOIN_REQ in unexpected state"),
1770 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1772 psessionEntry = NULL;
1773 goto end;
1774 }
1775 }
1776
1777#endif
1778
1779
1780 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1781 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301782 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301783 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301784 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1785 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001786
1787 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1788 {
1789 // Received eWNI_SME_JOIN_REQ for same
1790 // BSS as currently associated.
1791 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301792 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1793 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001794 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301795 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1796 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001797 goto end;
1798 }
1799 else
1800 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301801 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1802 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 retCode = eSIR_SME_REFUSED;
1804 psessionEntry = NULL;
1805 goto end;
1806 }
1807 }
1808 else /* Session Entry does not exist for given BSSId */
1809 {
1810 /* Try to Create a new session */
1811 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1812 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001813 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1815 goto end;
1816 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301817 else
1818 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1819 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301820 }
1821
1822 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1823 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1824 psessionEntry->is11Gonly = true;
1825 }
1826 }
1827
krunal soni5afa96c2013-09-06 22:19:02 -07001828 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001829
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 /* Store Session related parameters */
1831 /* Store PE session Id in session Table */
1832 psessionEntry->peSessionId = sessionId;
1833
1834 /* store the smejoin req handle in session table */
1835 psessionEntry->pLimJoinReq = pSmeJoinReq;
1836
1837 /* Store SME session Id in sessionTable */
1838 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1839
1840 /* Store SME transaction Id in session Table */
1841 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1842
1843 /* Store beaconInterval */
1844 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1845
1846 /* Copying of bssId is already done, while creating session */
1847 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1848 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1849 psessionEntry->bssType = pSmeJoinReq->bsstype;
1850
1851 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301852 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1853 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301854 psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001855
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301856 /* Store vendor specfic IE for CISCO AP */
1857 ieLen = (pSmeJoinReq->bssDescription.length +
1858 sizeof( pSmeJoinReq->bssDescription.length ) -
1859 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1860
1861 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1862 SIR_MAC_CISCO_OUI_SIZE,
1863 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1864
1865 if ( NULL != vendorIE )
1866 {
1867 limLog(pMac, LOGE,
1868 FL("DUT is trying to connect to Cisco AP"));
1869 psessionEntry->isCiscoVendorAP = TRUE;
1870 }
1871 else
1872 {
1873 psessionEntry->isCiscoVendorAP = FALSE;
1874 }
1875
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 /* Copy the dot 11 mode in to the session table */
1877
1878 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1879 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001880#ifdef WLAN_FEATURE_11AC
1881 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001882 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001883 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001884 if (psessionEntry->vhtCapability )
1885 {
1886 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1887
1888 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001889 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001890 psessionEntry->txBFIniFeatureEnabled);
1891
1892 if( psessionEntry->txBFIniFeatureEnabled )
1893 {
1894 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1895 != eSIR_SUCCESS)
1896 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301897 limLog(pMac, LOGP, FL("could not set "
1898 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001899 retCode = eSIR_LOGP_EXCEPTION;
1900 goto end;
1901 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001902 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301903 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1904 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001905
1906 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001907 != eSIR_SUCCESS)
1908 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301909 limLog(pMac, LOGP, FL("could not set "
1910 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001911 retCode = eSIR_LOGP_EXCEPTION;
1912 goto end;
1913 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301914
1915 if ( FALSE == pMac->isMuBfsessionexist )
1916 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001917 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301918
1919 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1920 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1921 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1922
1923 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1924 != eSIR_SUCCESS)
1925 {
1926 limLog(pMac, LOGE, FL("could not set "
1927 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1928 retCode = eSIR_LOGP_EXCEPTION;
1929 goto end;
1930 }
1931
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001932 }
1933
Jeff Johnsone7245742012-09-05 17:12:55 -07001934#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
1936 /*Phy mode*/
1937 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1938
Abhishek Singhca6ec5d2015-06-24 13:13:27 +05301939 handleHTCapabilityandHTInfo(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 /* Copy The channel Id to the session Table */
1941 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001942 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1943 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1944 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001945
Chet Lanctot186b5732013-03-18 10:26:30 -07001946 /* Record if management frames need to be protected */
1947#ifdef WLAN_FEATURE_11W
1948 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1949 {
1950 psessionEntry->limRmfEnabled = 1;
1951 }
1952 else
1953 {
1954 psessionEntry->limRmfEnabled = 0;
1955 }
1956#endif
1957
krunal soni8d13b092013-07-19 13:23:29 -07001958#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1959 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1960#endif
1961
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 /*Store Persona */
1963 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1964 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301965 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1966 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001967
1968 /* Copy the SSID from smejoinreq to session entry */
1969 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301970 vos_mem_copy( psessionEntry->ssId.ssId,
1971 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1972
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001973 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301974 // which inturn is dependent on the profile the user wants to connect
1975 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001976#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301977 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001978#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001979#ifdef FEATURE_WLAN_ESE
1980 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001981#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001982#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301983 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001984#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301985
Jeff Johnson43971f52012-07-17 12:26:56 -07001986#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301987 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001988#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301989 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001990
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301991 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301993 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1994 }
1995 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1996 {
1997 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1998 }
1999 else
2000 {
2001 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05302002 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
2003 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302004 retCode = eSIR_SME_INVALID_PARAMETERS;
2005 goto end;
2006 }
2007
2008 if (pSmeJoinReq->addIEScan.length)
2009 {
2010 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
2012 }
2013
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302014 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302016 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
2018 }
2019
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302021 pMlmJoinReq = vos_mem_malloc(val);
2022 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302024 limLog(pMac, LOGP, FL("call to AllocateMemory "
2025 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002026 return;
2027 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302028 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002029
2030 /* PE SessionId is stored as a part of JoinReq*/
2031 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
2032
2033 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
2034 != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302035 {
2036 limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
2037 "setting it to default value"));
2038 pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
2039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002040
2041 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302042 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302044 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 sizeof(tSirMacRateSet));
2046 //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 +05302047 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 sizeof(tSirMacRateSet));
2049
2050 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
2051
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
2053
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302054 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
2056 psessionEntry->pLimJoinReq->bssDescription.length + 2);
2057
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07002059 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002060
Jeff Johnsone7245742012-09-05 17:12:55 -07002061 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302062 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07002063 limExtractApCapability( pMac,
2064 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
2065 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
2066 &psessionEntry->limCurrentBssQosCaps,
2067 &psessionEntry->limCurrentBssPropCap,
2068 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002069 , &localPowerConstraint,
2070 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302071 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302072
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002073#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002074 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07002075#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302076 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002077#endif
Sushant Kaushikece4b562015-04-09 18:27:33 +05302078 if (!psessionEntry->maxTxPower)
2079 {
2080 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
2081 "is zero. Setting it to default value %d"),
2082 TX_POWER_DEFAULT);
2083 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2084 }
2085
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302086 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2087 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302088 " max tx = %d", regMax, localPowerConstraint,
2089 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002090
2091 if (pMac->lim.gLimCurrentBssUapsd)
2092 {
2093 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302094 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2095 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002096
2097 // resetting the dynamic uapsd mask
2098 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2099 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2100 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002101
2102 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2103
2104 // Initialize 11h Enable Flag
2105 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2106 {
2107 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302108 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002109 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302110 psessionEntry->lim11hEnable = 1;
2111 }
2112 else
2113 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 }
2115 else
2116 psessionEntry->lim11hEnable = 0;
2117
2118 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2119 pMac->lim.gLimIbssCoalescingHappened = false;
2120
Jeff Johnsone7245742012-09-05 17:12:55 -07002121 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2122 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2123 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002124
Abhishek Singh57aebef2014-02-03 18:47:44 +05302125 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2126 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2127 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2128 psessionEntry->currentOperChannel,
2129 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002130
2131 /* Indicate whether spectrum management is enabled*/
2132 psessionEntry->spectrumMgtEnabled =
2133 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302134
2135 /* Enable the spectrum management if this is a DFS channel */
2136 if (psessionEntry->countryInfoPresent &&
2137 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2138 {
2139 psessionEntry->spectrumMgtEnabled = TRUE;
2140 }
2141
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302142 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2143 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 /* Issue LIM_MLM_JOIN_REQ to MLM */
2145 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2146 return;
2147
2148 }
2149 else
2150 {
2151 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302152 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302153 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2155 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2156 psessionEntry = NULL;
2157 goto end;
2158
2159 }
2160
2161end:
2162 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2163
2164 if(pSmeJoinReq)
2165 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302166 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 pSmeJoinReq = NULL;
2168 if (NULL != psessionEntry)
2169 {
2170 psessionEntry->pLimJoinReq = NULL;
2171 }
2172 }
2173
2174 if(retCode != eSIR_SME_SUCCESS)
2175 {
2176 if(NULL != psessionEntry)
2177 {
2178 peDeleteSession(pMac,psessionEntry);
2179 psessionEntry = NULL;
2180 }
2181 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302182 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2183 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2185} /*** end __limProcessSmeJoinReq() ***/
2186
2187
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002188#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002189tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002190{
2191 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302192 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002193 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2195 maxTxPower = txPower;
2196 else if (txPower < MIN_TX_PWR_CAP)
2197 maxTxPower = MIN_TX_PWR_CAP;
2198 else
2199 maxTxPower = MAX_TX_PWR_CAP;
2200
2201 return (maxTxPower);
2202}
2203#endif
2204
Jeff Johnson295189b2012-06-20 16:38:30 -07002205/**
2206 * __limProcessSmeReassocReq()
2207 *
2208 *FUNCTION:
2209 * This function is called to process SME_REASSOC_REQ message
2210 * from HDD or upper layer application.
2211 *
2212 *LOGIC:
2213 *
2214 *ASSUMPTIONS:
2215 *
2216 *NOTE:
2217 *
2218 * @param pMac Pointer to Global MAC structure
2219 * @param *pMsgBuf A pointer to the SME message buffer
2220 * @return None
2221 */
2222
2223static void
2224__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2225{
2226 tANI_U16 caps;
2227 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002228 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 tLimMlmReassocReq *pMlmReassocReq;
2230 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2231 tpPESession psessionEntry = NULL;
2232 tANI_U8 sessionId;
2233 tANI_U8 smeSessionId;
2234 tANI_U16 transactionId;
2235 tPowerdBm localPowerConstraint = 0, regMax = 0;
2236 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002237 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002238
2239
Abhishek Singh127a8442014-12-15 17:31:27 +05302240 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002241
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002242 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302243 pReassocReq = vos_mem_malloc(nSize);
2244 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 {
2246 // Log error
2247 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302248 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249
2250 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2251 goto end;
2252 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302253 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2255 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2256 (!limIsSmeJoinReqValid(pMac,
2257 (tpSirSmeJoinReq) pReassocReq)))
2258 {
2259 /// Received invalid eWNI_SME_REASSOC_REQ
2260 // Log the event
2261 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002262 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002263
2264 retCode = eSIR_SME_INVALID_PARAMETERS;
2265 goto end;
2266 }
2267
2268 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2269 {
2270 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002271 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 retCode = eSIR_SME_INVALID_PARAMETERS;
2273 goto end;
2274 }
2275
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302276#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2278#endif //FEATURE_WLAN_DIAG_SUPPORT
2279 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2280
2281 /* Store the reassoc handle in the session Table.. 23rd sep review */
2282 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302283 psessionEntry->dot11mode = pReassocReq->dot11mode;
2284 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002285
2286 /**
2287 * Reassociate request is expected
2288 * in link established state only.
2289 */
2290
2291 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2292 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002293#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2295 {
2296 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002297 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 psessionEntry->peSessionId);
2299
2300 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302301 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2303 {
2304 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2305 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002306 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 retCode = eSIR_SME_INVALID_PARAMETERS;
2308 goto end;
2309 }
2310
2311 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2312 return;
2313 }
2314#endif
2315 /// Should not have received eWNI_SME_REASSOC_REQ
2316 // Log the event
2317 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302318 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 psessionEntry->limSmeState);
2320 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2321
2322 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2323 goto end;
2324 }
2325
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302326 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2328 sizeof(tSirMacAddr));
2329
2330 psessionEntry->limReassocChannelId =
2331 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2332
Jeff Johnsone7245742012-09-05 17:12:55 -07002333 psessionEntry->reAssocHtSupportedChannelWidthSet =
2334 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2335 psessionEntry->reAssocHtRecommendedTxWidthSet =
2336 psessionEntry->reAssocHtSupportedChannelWidthSet;
2337 psessionEntry->reAssocHtSecondaryChannelOffset =
2338 psessionEntry->pLimReAssocReq->cbMode;
2339
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 psessionEntry->limReassocBssCaps =
2341 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2343 localPowerConstraint = regMax;
2344 limExtractApCapability( pMac,
2345 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2346 limGetIElenFromBssDescription(
2347 &psessionEntry->pLimReAssocReq->bssDescription),
2348 &psessionEntry->limReassocBssQosCaps,
2349 &psessionEntry->limReassocBssPropCap,
2350 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002351 , &localPowerConstraint,
2352 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 );
2354
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302355 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Sushant Kaushikece4b562015-04-09 18:27:33 +05302356 if (!psessionEntry->maxTxPower)
2357 {
2358 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
2359 "is zero. Setting it to default value %d"),
2360 TX_POWER_DEFAULT);
2361 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2362 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002363#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302364 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2365 "= %d, max tx = %d", regMax, localPowerConstraint,
2366 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002367#endif
2368 {
2369 #if 0
2370 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2371 &cfgLen) != eSIR_SUCCESS)
2372 {
2373 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002374 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 }
2376 #endif//TO SUPPORT BT-AMP
2377
2378 /* Copy the SSID from sessio entry to local variable */
2379 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302380 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 psessionEntry->ssId.ssId,
2382 psessionEntry->ssId.length);
2383 #endif
2384 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302385 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2387
2388 }
2389
2390 if (pMac->lim.gLimCurrentBssUapsd)
2391 {
2392 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302393 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2394 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 }
2396
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302397 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2398 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 {
2400 // Log error
2401 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302402 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002403
2404 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2405 goto end;
2406 }
2407
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302408 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002409 psessionEntry->limReAssocbssId,
2410 sizeof(tSirMacAddr));
2411
2412 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2413 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2414 != eSIR_SUCCESS)
2415 {
2416 /**
2417 * Could not get ReassocFailureTimeout value
2418 * from CFG. Log error.
2419 */
2420 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002421 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002422 }
2423
2424 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2425 {
2426 /**
2427 * Could not get Capabilities value
2428 * from CFG. Log error.
2429 */
2430 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002431 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 }
2433 pMlmReassocReq->capabilityInfo = caps;
2434
2435 /* Update PE sessionId*/
2436 pMlmReassocReq->sessionId = sessionId;
2437
2438 /* If telescopic beaconing is enabled, set listen interval to
2439 WNI_CFG_TELE_BCN_MAX_LI */
2440 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2441 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002442 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002443
2444 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2445
2446 if(teleBcnEn)
2447 {
2448 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2449 eSIR_SUCCESS)
2450 {
2451 /**
2452 * Could not get ListenInterval value
2453 * from CFG. Log error.
2454 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002455 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 }
2457 }
2458 else
2459 {
2460 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2461 {
2462 /**
2463 * Could not get ListenInterval value
2464 * from CFG. Log error.
2465 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002466 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 }
2468 }
2469
2470 /* Delete all BA sessions before Re-Assoc.
2471 * BA frames are class 3 frames and the session
2472 * is lost upon disassociation and reassociation.
2473 */
2474
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302475 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2476 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002477
2478 pMlmReassocReq->listenInterval = (tANI_U16) val;
2479
2480 /* Indicate whether spectrum management is enabled*/
2481 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2482
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302483 /* Enable the spectrum management if this is a DFS channel */
2484 if (psessionEntry->countryInfoPresent &&
2485 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2486 {
2487 psessionEntry->spectrumMgtEnabled = TRUE;
2488 }
2489
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2491 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2492
Jeff Johnsone7245742012-09-05 17:12:55 -07002493 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002494
2495 limPostMlmMessage(pMac,
2496 LIM_MLM_REASSOC_REQ,
2497 (tANI_U32 *) pMlmReassocReq);
2498 return;
2499
2500end:
2501 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302502 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002503
2504 if (psessionEntry)
2505 {
2506 // error occurred after we determined the session so extract
2507 // session and transaction info from there
2508 smeSessionId = psessionEntry->smeSessionId;
2509 transactionId = psessionEntry->transactionId;
2510 }
2511 else
2512 {
2513 // error occurred before or during the time we determined the session
2514 // so extract the session and transaction info from the message
2515 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2516 }
2517
2518 /// Send Reassoc failure response to host
2519 /// (note psessionEntry may be NULL, but that's OK)
2520 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2521 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2522 psessionEntry, smeSessionId, transactionId);
2523
2524} /*** end __limProcessSmeReassocReq() ***/
2525
2526
2527tANI_BOOLEAN sendDisassocFrame = 1;
2528/**
2529 * __limProcessSmeDisassocReq()
2530 *
2531 *FUNCTION:
2532 * This function is called to process SME_DISASSOC_REQ message
2533 * from HDD or upper layer application.
2534 *
2535 *LOGIC:
2536 *
2537 *ASSUMPTIONS:
2538 *
2539 *NOTE:
2540 *
2541 * @param pMac Pointer to Global MAC structure
2542 * @param *pMsgBuf A pointer to the SME message buffer
2543 * @return None
2544 */
2545
2546static void
2547__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2548{
2549 tANI_U16 disassocTrigger, reasonCode;
2550 tLimMlmDisassocReq *pMlmDisassocReq;
2551 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002552 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 tSirSmeDisassocReq smeDisassocReq;
2554 tpPESession psessionEntry = NULL;
2555 tANI_U8 sessionId;
2556 tANI_U8 smesessionId;
2557 tANI_U16 smetransactionId;
2558
Jeff Johnson295189b2012-06-20 16:38:30 -07002559
Jeff Johnson43971f52012-07-17 12:26:56 -07002560 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002562 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 return;
2564 }
2565
Jeff Johnson43971f52012-07-17 12:26:56 -07002566 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002567
Jeff Johnson43971f52012-07-17 12:26:56 -07002568 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002569
Jeff Johnson43971f52012-07-17 12:26:56 -07002570 if ( (eSIR_FAILURE == status) ||
2571 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 {
2573 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002574 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002575
2576 if (pMac->lim.gLimRspReqd)
2577 {
2578 pMac->lim.gLimRspReqd = false;
2579
2580 retCode = eSIR_SME_INVALID_PARAMETERS;
2581 disassocTrigger = eLIM_HOST_DISASSOC;
2582 goto sendDisassoc;
2583 }
2584
2585 return;
2586 }
2587
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2589 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302590 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2591 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 retCode = eSIR_SME_INVALID_PARAMETERS;
2593 disassocTrigger = eLIM_HOST_DISASSOC;
2594 goto sendDisassoc;
2595
2596 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302597 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2598 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2599 smesessionId,psessionEntry->limSystemRole,
2600 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2601 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002602
2603#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2604 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2605#endif //FEATURE_WLAN_DIAG_SUPPORT
2606
2607 /* Update SME session Id and SME transaction ID*/
2608
2609 psessionEntry->smeSessionId = smesessionId;
2610 psessionEntry->transactionId = smetransactionId;
2611
2612 switch (psessionEntry->limSystemRole)
2613 {
2614 case eLIM_STA_ROLE:
2615 case eLIM_BT_AMP_STA_ROLE:
2616 switch (psessionEntry->limSmeState)
2617 {
2618 case eLIM_SME_ASSOCIATED_STATE:
2619 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302620 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2621 "limSmeState: %d "),psessionEntry->limSmeState);
2622
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2624 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002625#ifdef FEATURE_WLAN_TDLS
2626 /* Delete all TDLS peers connected before leaving BSS*/
2627 limDeleteTDLSPeers(pMac, psessionEntry);
2628#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002629 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 break;
2631
2632 case eLIM_SME_WT_DEAUTH_STATE:
2633 /* PE shall still process the DISASSOC_REQ and proceed with
2634 * link tear down even if it had already sent a DEAUTH_IND to
2635 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2636 * its been set when PE entered WT_DEAUTH_STATE.
2637 */
2638 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002639 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302640 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2641 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 break;
2643
2644 case eLIM_SME_WT_DISASSOC_STATE:
2645 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2646 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2647 * PE can continue processing DISASSOC_REQ and send the response instead
2648 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2649 * for disassoc frame.
2650 *
2651 * It will send a disassoc, which is ok. However, we can use the global flag
2652 * sendDisassoc to not send disassoc frame.
2653 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302654 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2655 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 break;
2657
2658 case eLIM_SME_JOIN_FAILURE_STATE: {
2659 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302660 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2661 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 if (pMac->lim.gLimRspReqd) {
2663 retCode = eSIR_SME_SUCCESS;
2664 disassocTrigger = eLIM_HOST_DISASSOC;
2665 goto sendDisassoc;
2666 }
2667 }break;
2668 default:
2669 /**
2670 * STA is not currently associated.
2671 * Log error and send response to host
2672 */
2673 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302674 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002675 psessionEntry->limSmeState);
2676 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2677
2678 if (pMac->lim.gLimRspReqd)
2679 {
2680 if (psessionEntry->limSmeState !=
2681 eLIM_SME_WT_ASSOC_STATE)
2682 pMac->lim.gLimRspReqd = false;
2683
2684 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2685 disassocTrigger = eLIM_HOST_DISASSOC;
2686 goto sendDisassoc;
2687 }
2688
2689 return;
2690 }
2691
2692 break;
2693
2694 case eLIM_AP_ROLE:
2695 case eLIM_BT_AMP_AP_ROLE:
2696 // Fall through
2697 break;
2698
2699 case eLIM_STA_IN_IBSS_ROLE:
2700 default: // eLIM_UNKNOWN_ROLE
2701 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002702 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 psessionEntry->limSystemRole);
2704
2705 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2706 disassocTrigger = eLIM_HOST_DISASSOC;
2707 goto sendDisassoc;
2708 } // end switch (pMac->lim.gLimSystemRole)
2709
Deepthi Gowri41716672015-07-27 17:18:13 +05302710 if (smeDisassocReq.reasonCode == eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON)
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 {
2712 /// Disassociation is triggered by Link Monitoring
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302713 limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 }
2716 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 disassocTrigger = eLIM_HOST_DISASSOC;
2718 reasonCode = smeDisassocReq.reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002719
2720 if (smeDisassocReq.doNotSendOverTheAir)
2721 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302722 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 sendDisassocFrame = 0;
2724 }
2725 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302726 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2727 " : %d, reasonCode : %d"),
2728 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302729 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2730 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 {
2732 // Log error
2733 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302734 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002735
2736 return;
2737 }
2738
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302739 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2741 sizeof(tSirMacAddr));
2742
2743 pMlmDisassocReq->reasonCode = reasonCode;
2744 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2745
2746 /* Update PE session ID*/
2747 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002748
2749 limPostMlmMessage(pMac,
2750 LIM_MLM_DISASSOC_REQ,
2751 (tANI_U32 *) pMlmDisassocReq);
2752 return;
2753
2754sendDisassoc:
2755 if (psessionEntry)
2756 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2757 retCode,
2758 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 else
2761 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2762 retCode,
2763 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002764 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002765
2766
2767} /*** end __limProcessSmeDisassocReq() ***/
2768
2769
2770/** -----------------------------------------------------------------
2771 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2772
2773 This function is called to process SME_DISASSOC_CNF message
2774 from HDD or upper layer application.
2775
2776 \param pMac - global mac structure
2777 \param pStaDs - station dph hash node
2778 \return none
2779 \sa
2780 ----------------------------------------------------------------- */
2781static void
2782__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2783{
2784 tSirSmeDisassocCnf smeDisassocCnf;
2785 tANI_U16 aid;
2786 tpDphHashNode pStaDs;
2787 tSirRetStatus status = eSIR_SUCCESS;
2788 tpPESession psessionEntry;
2789 tANI_U8 sessionId;
2790
2791
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302792 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002793
2794 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2795
2796 if (status == eSIR_FAILURE)
2797 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002798 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002799 return;
2800 }
2801
2802 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2803 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002804 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002805 return;
2806 }
2807
2808 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2809 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302810 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002811 return;
2812 }
2813
2814#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2815 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2816 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2817 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2818 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2819#endif //FEATURE_WLAN_DIAG_SUPPORT
2820
2821 switch (psessionEntry->limSystemRole)
2822 {
2823 case eLIM_STA_ROLE:
2824 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2825 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2826 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2827 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2828 {
2829 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302830 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002831 psessionEntry->limSmeState);
2832 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2833 return;
2834 }
2835 break;
2836
2837 case eLIM_AP_ROLE:
2838 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002839 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002840
2841 case eLIM_STA_IN_IBSS_ROLE:
2842 default: // eLIM_UNKNOWN_ROLE
2843 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002844 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002845 psessionEntry->limSystemRole);
2846
2847 return;
2848 }
2849
2850
2851 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2852 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 )
2855 {
2856 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2857 if (pStaDs == NULL)
2858 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302859 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2860 "does not have context, addr= "MAC_ADDRESS_STR),
2861 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 return;
2863 }
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05302864 /*
2865 * If MlM state is either of del_sta or del_bss state, then no need to
2866 * go ahead and clean up further as there must be some cleanup in
2867 * progress from upper layer disassoc/deauth request.
2868 */
2869 if((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
2870 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
2871 {
2872 limLog(pMac, LOGE, FL("No need to cleanup for addr:"MAC_ADDRESS_STR
2873 "as Mlm state is %d"),
2874 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr),
2875 pStaDs->mlmStaContext.mlmState);
2876 return;
2877 }
2878
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002879 /* Delete FT session if there exists one */
2880 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002882
2883 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 }
2885
2886 return;
2887}
2888
2889
2890/**
2891 * __limProcessSmeDeauthReq()
2892 *
2893 *FUNCTION:
2894 * This function is called to process SME_DEAUTH_REQ message
2895 * from HDD or upper layer application.
2896 *
2897 *LOGIC:
2898 *
2899 *ASSUMPTIONS:
2900 *
2901 *NOTE:
2902 *
2903 * @param pMac Pointer to Global MAC structure
2904 * @param *pMsgBuf A pointer to the SME message buffer
2905 * @return None
2906 */
2907
2908static void
2909__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2910{
2911 tANI_U16 deauthTrigger, reasonCode;
2912 tLimMlmDeauthReq *pMlmDeauthReq;
2913 tSirSmeDeauthReq smeDeauthReq;
2914 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2915 tSirRetStatus status = eSIR_SUCCESS;
2916 tpPESession psessionEntry;
2917 tANI_U8 sessionId; //PE sessionId
2918 tANI_U8 smesessionId;
2919 tANI_U16 smetransactionId;
2920
Jeff Johnson295189b2012-06-20 16:38:30 -07002921
2922 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2924
2925 //We need to get a session first but we don't even know if the message is correct.
2926 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2927 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002928 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 retCode = eSIR_SME_INVALID_PARAMETERS;
2930 deauthTrigger = eLIM_HOST_DEAUTH;
2931 goto sendDeauth;
2932
2933 }
2934
2935 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2936 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302937 PELOGE(limLog(pMac, LOGE,FL
2938 ("received invalid SME_DEAUTH_REQ message"));)
2939 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
Sachin Ahuja42354142015-01-06 19:48:35 +05302941 retCode = eSIR_SME_INVALID_PARAMETERS;
2942 deauthTrigger = eLIM_HOST_DEAUTH;
2943 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302945 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2946 "Systemrole %d with reasoncode %u in limSmestate %d from "
2947 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2948 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2949 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002950#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2951 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2952#endif //FEATURE_WLAN_DIAG_SUPPORT
2953
2954 /* Update SME session ID and Transaction ID */
2955 psessionEntry->smeSessionId = smesessionId;
2956 psessionEntry->transactionId = smetransactionId;
2957
2958
2959 switch (psessionEntry->limSystemRole)
2960 {
2961 case eLIM_STA_ROLE:
2962 case eLIM_BT_AMP_STA_ROLE:
2963
2964 switch (psessionEntry->limSmeState)
2965 {
2966 case eLIM_SME_ASSOCIATED_STATE:
2967 case eLIM_SME_LINK_EST_STATE:
2968 case eLIM_SME_WT_ASSOC_STATE:
2969 case eLIM_SME_JOIN_FAILURE_STATE:
2970 case eLIM_SME_IDLE_STATE:
2971 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2972 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002973 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002974
2975 // Send Deauthentication request to MLM below
2976
2977 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302978 case eLIM_SME_WT_DEAUTH_STATE:
2979 /*
2980 * PE Recieved a Deauth frame. Normally it gets
2981 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2982 * means host is also trying to disconnect.
2983 * PE can continue processing DEAUTH_REQ and send
2984 * the response instead of failing the request.
2985 * SME will anyway ignore DEAUTH_IND that was sent
2986 * for deauth frame.
2987 */
2988 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2989 "SME_WT_DEAUTH_STATE. "));
2990 break;
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05302991 case eLIM_SME_WT_DISASSOC_STATE:
2992 /*
2993 * PE Recieved a Disassoc frame. Normally it gets
2994 * DISASSOC_CNF but it received DEAUTH_REQ. This means
2995 * host is also trying to disconnect.
2996 */
2997 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2998 "SME_WT_DISASSOC_STATE. "));
2999 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 default:
3001 /**
3002 * STA is not in a state to deauthenticate with
3003 * peer. Log error and send response to host.
3004 */
3005 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303006 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303007 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3009
3010 if (pMac->lim.gLimRspReqd)
3011 {
3012 pMac->lim.gLimRspReqd = false;
3013
3014 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
3015 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08003016 /**
3017 *here we received deauth request from AP so sme state is
3018 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
3019 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
3020 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
3021 so the below condition captures the state where delSta
3022 not done and firmware still in connected state.
3023 */
3024 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
3025 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
3026 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
3027 {
3028 retCode = eSIR_SME_DEAUTH_STATUS;
3029 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 goto sendDeauth;
3031 }
3032
3033 return;
3034 }
3035
3036 break;
3037
3038 case eLIM_STA_IN_IBSS_ROLE:
Abhishek Singh92fbac22015-03-24 17:57:36 +05303039 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
3040 if (pMac->lim.gLimRspReqd)
3041 {
3042 pMac->lim.gLimRspReqd = false;
3043 retCode = eSIR_SME_INVALID_PARAMETERS;
3044 deauthTrigger = eLIM_HOST_DEAUTH;
3045 goto sendDeauth;
3046 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 return;
3048
3049 case eLIM_AP_ROLE:
3050 // Fall through
3051
3052 break;
3053
3054 default:
3055 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303056 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303057 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303058 if (pMac->lim.gLimRspReqd)
3059 {
3060 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003061
Abhishek Singh92fbac22015-03-24 17:57:36 +05303062 retCode = eSIR_SME_INVALID_PARAMETERS;
3063 deauthTrigger = eLIM_HOST_DEAUTH;
3064 goto sendDeauth;
3065 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303067
Jeff Johnson295189b2012-06-20 16:38:30 -07003068 } // end switch (pMac->lim.gLimSystemRole)
3069
3070 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3071 {
3072 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303073 limLog(pMac, LOG1,
3074 FL("Deauthentication is triggered by Link Monitoring"));
3075 limLog(pMac, LOG1,
3076 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3077 limLog(pMac, LOG1,
3078 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003079 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3080 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3081 }
3082 else
3083 {
3084 deauthTrigger = eLIM_HOST_DEAUTH;
3085 reasonCode = smeDeauthReq.reasonCode;
3086 }
3087
3088 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303089 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3090 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 {
3092 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303093 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303094 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303095 if (pMac->lim.gLimRspReqd)
3096 {
3097 pMac->lim.gLimRspReqd = false;
3098 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3099 deauthTrigger = eLIM_HOST_DEAUTH;
3100 goto sendDeauth;
3101 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 return;
3103 }
3104
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303105 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3107 sizeof(tSirMacAddr));
3108
3109 pMlmDeauthReq->reasonCode = reasonCode;
3110 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003111
3112 /* Update PE session Id*/
3113 pMlmDeauthReq->sessionId = sessionId;
3114
3115 limPostMlmMessage(pMac,
3116 LIM_MLM_DEAUTH_REQ,
3117 (tANI_U32 *) pMlmDeauthReq);
3118 return;
3119
3120sendDeauth:
3121 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3122 retCode,
3123 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003124 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 smesessionId, smetransactionId);
3126} /*** end __limProcessSmeDeauthReq() ***/
3127
3128
3129
3130/**
3131 * __limProcessSmeSetContextReq()
3132 *
3133 *FUNCTION:
3134 * This function is called to process SME_SETCONTEXT_REQ message
3135 * from HDD or upper layer application.
3136 *
3137 *LOGIC:
3138 *
3139 *ASSUMPTIONS:
3140 *
3141 *NOTE:
3142 *
3143 * @param pMac Pointer to Global MAC structure
3144 * @param *pMsgBuf A pointer to the SME message buffer
3145 * @return None
3146 */
3147
3148static void
3149__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3150{
3151 tpSirSmeSetContextReq pSetContextReq;
3152 tLimMlmSetKeysReq *pMlmSetKeysReq;
3153 tpPESession psessionEntry;
3154 tANI_U8 sessionId; //PE sessionID
3155 tANI_U8 smesessionId;
3156 tANI_U16 smetransactionId;
3157
3158
3159 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003160 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003161
3162
3163 if(pMsgBuf == NULL)
3164 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003165 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003166 return;
3167 }
3168
3169 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303170
3171 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3172 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303174 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003175 return;
3176 }
3177
3178 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3179 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3180 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003181 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003182 goto end;
3183 }
3184
3185 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3186 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003187 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 -07003188 limSendSmeSetContextRsp(pMac,
3189 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 eSIR_SME_INVALID_PARAMETERS,NULL,
3192 smesessionId,smetransactionId);
3193
3194 goto end;
3195 }
3196
3197
3198 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3199 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003200 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 limSendSmeSetContextRsp(pMac,
3202 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003203 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003204 eSIR_SME_INVALID_PARAMETERS,NULL,
3205 smesessionId,smetransactionId);
3206
3207 goto end;
3208 }
3209
3210#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3211 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3212#endif //FEATURE_WLAN_DIAG_SUPPORT
3213
3214
3215 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3216 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3217 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3218 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3219 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3220 {
3221 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303222 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3223 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 {
3225 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303226 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003227 goto end;
3228 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05303229 vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3231 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3232 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3233 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003234 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 goto end;
3236 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303237 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003238 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3239 sizeof(tSirMacAddr));
3240
Jeff Johnson295189b2012-06-20 16:38:30 -07003241
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303242 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003243 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3244 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3245
3246 pMlmSetKeysReq->sessionId = sessionId;
3247#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3248 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003249 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003250#endif
3251
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3253 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3254 {
3255 if(pSetContextReq->keyMaterial.key[0].keyLength)
3256 {
3257 tANI_U8 keyId;
3258 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303259 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3261 }
3262 else {
3263 tANI_U32 i;
3264 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3265 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303266 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3268 }
3269 }
3270 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003271
3272 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 }
3274 else
3275 {
3276 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303277 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 psessionEntry->limSystemRole,
3279 psessionEntry->limSmeState);
3280 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3281
3282 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3285 smesessionId,
3286 smetransactionId);
3287 }
3288
3289end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303290 vos_mem_zero(pSetContextReq,
3291 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303292 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 return;
3294} /*** end __limProcessSmeSetContextReq() ***/
3295
3296/**
3297 * __limProcessSmeRemoveKeyReq()
3298 *
3299 *FUNCTION:
3300 * This function is called to process SME_REMOVEKEY_REQ message
3301 * from HDD or upper layer application.
3302 *
3303 *LOGIC:
3304 *
3305 *ASSUMPTIONS:
3306 *
3307 *NOTE:
3308 *
3309 * @param pMac Pointer to Global MAC structure
3310 * @param *pMsgBuf A pointer to the SME message buffer
3311 * @return None
3312 */
3313
3314static void
3315__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3316{
3317 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3318 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3319 tpPESession psessionEntry;
3320 tANI_U8 sessionId; //PE sessionID
3321 tANI_U8 smesessionId;
3322 tANI_U16 smetransactionId;
3323
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303324 limLog(pMac, LOG1,
3325 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003326
3327 if(pMsgBuf == NULL)
3328 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003329 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 return;
3331 }
3332
3333
3334 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3335
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303336 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3337 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 {
3339 //Log error
3340 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303341 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003342
3343 return;
3344 }
3345
3346 if ((limRemoveKeyReqSerDes(pMac,
3347 pRemoveKeyReq,
3348 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3349 {
3350 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003351 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003352
3353 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3354
3355 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3356 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003357 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003358 //goto end;
3359 }
3360
3361 limSendSmeRemoveKeyRsp(pMac,
3362 pRemoveKeyReq->peerMacAddr,
3363 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3364 smesessionId,smetransactionId);
3365
3366 goto end;
3367 }
3368
3369 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3370 {
3371 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003372 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 limSendSmeRemoveKeyRsp(pMac,
3374 pRemoveKeyReq->peerMacAddr,
3375 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3376 smesessionId, smetransactionId);
3377 goto end;
3378 }
3379
3380
3381 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3382 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3383 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3384 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3385 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3386 {
3387 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303388 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3389 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 {
3391 // Log error
3392 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303393 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003394
3395 goto end;
3396 }
3397
3398 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3399 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3400 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3401 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3402
3403 /* Update PE session Id */
3404 pMlmRemoveKeyReq->sessionId = sessionId;
3405
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303406 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003407 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3408 sizeof(tSirMacAddr));
3409
3410
3411 limPostMlmMessage(pMac,
3412 LIM_MLM_REMOVEKEY_REQ,
3413 (tANI_U32 *) pMlmRemoveKeyReq);
3414 }
3415 else
3416 {
3417 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303418 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 psessionEntry->limSystemRole,
3420 psessionEntry->limSmeState);
3421 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3422
3423 limSendSmeRemoveKeyRsp(pMac,
3424 pRemoveKeyReq->peerMacAddr,
3425 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3426 smesessionId,smetransactionId);
3427 }
3428
3429end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303430 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003431} /*** end __limProcessSmeRemoveKeyReq() ***/
3432
Jeff Johnson295189b2012-06-20 16:38:30 -07003433void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3434{
3435 tSirMsgQ mmhMsg;
3436 tpSmeGetScanChnRsp pSirSmeRsp;
3437 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303438 tANI_U8 sessionId;
3439 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003440
3441 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3442 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003443 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003444 pMac->lim.scanChnInfo.numChnInfo);
3445 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3446 }
3447
Abhishek Singh525045c2014-12-15 17:18:45 +05303448 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003449 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303450 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003451
3452 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303453 pSirSmeRsp = vos_mem_malloc(len);
3454 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 {
3456 /// Buffer not available. Log error
3457 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303458 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003459
3460 return;
3461 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303462 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003463
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3465 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303466
3467 if (pMac->fScanOffload)
3468 {
3469 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3470 pSirSmeRsp->sessionId = sessionId;
3471 }
3472 else
3473 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003474
3475 if(pMac->lim.scanChnInfo.numChnInfo)
3476 {
3477 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303478 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3479 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 }
3481 //Clear the list
3482 limRessetScanChannelInfo(pMac);
3483
3484 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3485 mmhMsg.bodyptr = pSirSmeRsp;
3486 mmhMsg.bodyval = 0;
3487
3488 pMac->lim.gLimRspReqd = false;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303489 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3491}
3492
3493
Jeff Johnson295189b2012-06-20 16:38:30 -07003494void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3495{
3496 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3497 tpDphHashNode pStaDs = NULL;
3498 tpPESession psessionEntry = NULL;
3499 tSap_Event sapEvent;
3500 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3501 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3502 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3503 tANI_U8 assocId = 0;
3504 tANI_U8 staCount = 0;
3505
3506 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3507 {
3508 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003509 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303510 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003511 }
3512
3513 switch (getAssocSTAsReq.modId)
3514 {
3515/**
3516 case VOS_MODULE_ID_HAL:
3517 wdaPostCtrlMsg( pMac, &msgQ );
3518 return;
3519
3520 case VOS_MODULE_ID_TL:
3521 Post msg TL
3522 return;
3523*/
3524 case VOS_MODULE_ID_PE:
3525 default:
3526 break;
3527 }
3528
Jeff Johnson1250df42012-12-10 14:31:52 -08003529 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003530 // Find PE session Entry
3531 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3532 {
3533 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003534 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003535 goto limAssocStaEnd;
3536 }
3537
3538 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3539 {
3540 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303541 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303542 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003543 goto limAssocStaEnd;
3544 }
3545
3546 // Retrieve values obtained in the request message
3547 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3548 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3549
3550 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3551 {
3552 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3553
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303554 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003555 continue;
3556
3557 if (pStaDs->valid)
3558 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303559 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3560 (tANI_U8 *)&pStaDs->staAddr,
3561 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003562 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3563 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3564
Kiet Lamb1233192013-11-28 13:38:20 +05303565 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003566 (tANI_U8 *)&pStaDs->supportedRates,
3567 sizeof(tSirSupportedRates));
3568 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3569 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3570 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3571
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003573 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3574 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3576 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3577
3578 pAssocStasTemp++;
3579 staCount++;
3580 }
3581 }
3582
3583limAssocStaEnd:
3584 // Call hdd callback with sap event to send the list of associated stations from PE
3585 if (pSapEventCallback != NULL)
3586 {
3587 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3588 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3589 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3590 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3591 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3592 }
3593}
3594
3595
3596/**
3597 * limProcessSmeGetWPSPBCSessions
3598 *
3599 *FUNCTION:
3600 * This function is called when query the WPS PBC overlap message is received
3601 *
3602 *LOGIC:
3603 * This function parses get WPS PBC overlap information message and call callback to pass
3604 * WPS PBC overlap information back to hdd.
3605 *ASSUMPTIONS:
3606 *
3607 *
3608 *NOTE:
3609 *
3610 * @param pMac Pointer to Global MAC structure
3611 * @param pMsgBuf A pointer to WPS PBC overlap query message
3612*
3613 * @return None
3614 */
3615void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3616{
3617 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3618 tpPESession psessionEntry = NULL;
3619 tSap_Event sapEvent;
3620 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3621 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3622 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3623
3624 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3625
3626 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3627 {
3628 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003629 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303630 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003631 }
3632
Jeff Johnson1250df42012-12-10 14:31:52 -08003633 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 // Find PE session Entry
3635 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3636 {
3637 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003638 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003639 goto limGetWPSPBCSessionsEnd;
3640 }
3641
3642 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3643 {
3644 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303645 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 psessionEntry->limSystemRole);
3647 goto limGetWPSPBCSessionsEnd;
3648 }
3649
Jeff Johnson1250df42012-12-10 14:31:52 -08003650 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3652 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3653
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303654 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003655 { //This is GetWpsSession call
3656
3657 limGetWPSPBCSessions(pMac,
3658 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3659 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3660 }
3661 else
3662 {
3663 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3664 /* don't have to inform the HDD/Host */
3665 return;
3666 }
3667
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003668 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3670
3671 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3672
3673limGetWPSPBCSessionsEnd:
3674 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303675
3676 if (NULL != pSapEventCallback)
3677 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003678}
3679
Jeff Johnson295189b2012-06-20 16:38:30 -07003680
3681
3682/**
3683 * __limCounterMeasures()
3684 *
3685 * FUNCTION:
3686 * This function is called to "implement" MIC counter measure
3687 * and is *temporary* only
3688 *
3689 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3690 * we don't do the proper STA disassoc sequence since the
3691 * BSS will be stoped anyway
3692 *
3693 *ASSUMPTIONS:
3694 *
3695 *NOTE:
3696 *
3697 * @param pMac Pointer to Global MAC structure
3698 * @return None
3699 */
3700
3701static void
3702__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3703{
3704 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303705 /* If PMF is enabled then don't send broadcast disassociation */
3706 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3707 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3708 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3709#ifdef WLAN_FEATURE_11W
3710 && !psessionEntry->limRmfEnabled
3711#endif
3712 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003713 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003714
Jeff Johnson295189b2012-06-20 16:38:30 -07003715};
3716
3717
Jeff Johnson295189b2012-06-20 16:38:30 -07003718void
3719limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3720{
3721 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3722 tpPESession psessionEntry;
3723 tANI_U8 sessionId; //PE sessionId
3724
3725 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3726 {
3727 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003728 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003729 return;
3730 }
3731
3732 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3733 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003734 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003735 return;
3736 }
3737
3738 if ( tkipCntrMeasReq.bEnable )
3739 {
3740 __limCounterMeasures( pMac, psessionEntry );
3741 }
3742
3743 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3744}
Jeff Johnson295189b2012-06-20 16:38:30 -07003745
3746
3747static void
3748__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3749{
3750 tSirSmeStopBssReq stopBssReq;
3751 tSirRetStatus status;
3752 tLimSmeStates prevState;
3753 tANI_U8 sessionId; //PE sessionId
3754 tpPESession psessionEntry;
3755 tANI_U8 smesessionId;
3756 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303757 tANI_U8 i = 0;
3758 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003759
3760 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3761
3762
3763
3764 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3765 !limIsSmeStopBssReqValid(pMsgBuf))
3766 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003767 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 /// Send Stop BSS response to host
3769 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3770 return;
3771 }
3772
3773
3774 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3775 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003776 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003777 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3778 return;
3779 }
3780
3781#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3782 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3783#endif //FEATURE_WLAN_DIAG_SUPPORT
3784
3785
3786 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3787 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3788 {
3789 /**
3790 * Should not have received STOP_BSS_REQ in states
3791 * other than 'normal' state or on STA in Infrastructure
3792 * mode. Log error and return response to host.
3793 */
3794 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303795 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3797 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3798 /// Send Stop BSS response to host
3799 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3800 return;
3801 }
3802
Jeff Johnson295189b2012-06-20 16:38:30 -07003803 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3804 {
3805 limWPSPBCClose(pMac, psessionEntry);
3806 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003807 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003808
3809 prevState = psessionEntry->limSmeState;
3810
3811 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003812 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003813
3814 /* Update SME session Id and Transaction Id */
3815 psessionEntry->smeSessionId = smesessionId;
3816 psessionEntry->transactionId = smetransactionId;
3817
Abhishek Singh8944b222014-09-17 16:13:17 +05303818 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3819 * If PMF is enabled then don't send broadcast disassociation */
3820 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3821 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3822#ifdef WLAN_FEATURE_11W
3823 && !psessionEntry->limRmfEnabled
3824#endif
3825 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 {
3827 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3828 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3829 // Send disassoc all stations associated thru TKIP
3830 __limCounterMeasures(pMac,psessionEntry);
3831 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303832 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 }
3834
3835 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3836 pMac->lim.gLimIbssCoalescingHappened = false;
3837
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303838 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3839 {
3840 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3841 if (NULL == pStaDs)
3842 continue;
3843 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3844 if(eSIR_SUCCESS == status)
3845 {
3846 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3847 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3848 }
3849 else
3850 {
3851 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3852 VOS_ASSERT(0) ;
3853 }
3854 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 /* send a delBss to HAL and wait for a response */
3856 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3857
3858 if (status != eSIR_SUCCESS)
3859 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003860 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 psessionEntry->limSmeState= prevState;
3862
Jeff Johnsone7245742012-09-05 17:12:55 -07003863 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003864
3865 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3866 }
3867}
3868
3869
3870/**--------------------------------------------------------------
3871\fn __limProcessSmeStopBssReq
3872
3873\brief Wrapper for the function __limHandleSmeStopBssRequest
3874 This message will be defered until softmac come out of
3875 scan mode. Message should be handled even if we have
3876 detected radar in the current operating channel.
3877\param pMac
3878\param pMsg
3879
3880\return TRUE - If we consumed the buffer
3881 FALSE - If have defered the message.
3882 ---------------------------------------------------------------*/
3883static tANI_BOOLEAN
3884__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3885{
3886 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3887 {
3888 /**
3889 * If message defered, buffer is not consumed yet.
3890 * So return false
3891 */
3892 return eANI_BOOLEAN_FALSE;
3893 }
3894 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3895 return eANI_BOOLEAN_TRUE;
3896} /*** end __limProcessSmeStopBssReq() ***/
3897
3898
3899void limProcessSmeDelBssRsp(
3900 tpAniSirGlobal pMac,
3901 tANI_U32 body,tpPESession psessionEntry)
3902{
3903
3904 (void) body;
3905 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3906 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003907 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3909 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3911 return;
3912}
3913
3914
Jeff Johnson295189b2012-06-20 16:38:30 -07003915/**---------------------------------------------------------------
3916\fn __limProcessSmeAssocCnfNew
3917\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3918\ in BTAMP AP.
3919\
3920\param pMac
3921\param msgType - message type
3922\param pMsgBuf - a pointer to the SME message buffer
3923\return None
3924------------------------------------------------------------------*/
3925
3926 void
3927__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3928{
3929 tSirSmeAssocCnf assocCnf;
3930 tpDphHashNode pStaDs = NULL;
3931 tpPESession psessionEntry= NULL;
3932 tANI_U8 sessionId;
3933
3934
3935 if(pMsgBuf == NULL)
3936 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003937 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 goto end;
3939 }
3940
3941 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3942 !__limIsSmeAssocCnfValid(&assocCnf))
3943 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003944 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 goto end;
3946 }
3947
3948 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3949 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003950 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003951 goto end;
3952 }
3953
3954 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3955 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3956 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303957 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303958 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 goto end;
3960 }
3961
3962 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3963
3964 if (pStaDs == NULL)
3965 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303966 limLog(pMac, LOGE,
3967 FL("Received invalid message %X due to no STA context, "
3968 "for aid %d, peer "),
3969 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003970 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3971
3972 /*
3973 ** send a DISASSOC_IND message to WSM to make sure
3974 ** the state in WSM and LIM is the same
3975 **/
3976 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3977 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3978 goto end;
3979 }
3980 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303981 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 (tANI_U8 *) assocCnf.peerMacAddr,
3983 sizeof(tSirMacAddr)) ) ||
3984 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3985 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3986 (msgType != eWNI_SME_ASSOC_CNF)) ||
3987 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303990 limLog(pMac, LOGE,
3991 FL("Received invalid message %X due to peerMacAddr mismatched "
3992 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
3993 "StaD mlmState : %d"),
3994 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3996 goto end;
3997 }
3998
3999 /*
4000 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4001 ** has been received
4002 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004003 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004004 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4005
4006 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4007 {
4008 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4009 * when it had received Assoc Request frame. Now, PE just needs to send
4010 * Association Response frame to the requesting BTAMP-STA.
4011 */
4012 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004013 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4015 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4016 goto end;
4017 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4018 else
4019 {
4020 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4021 /*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*/
4022 if(!pStaDs->mlmStaContext.updateContext)
4023 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304024 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
4025 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 limRejectAssociation(pMac, pStaDs->staAddr,
4027 pStaDs->mlmStaContext.subType,
4028 true, pStaDs->mlmStaContext.authType,
4029 pStaDs->assocId, true,
4030 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 }
4032
4033end:
4034 if((psessionEntry != NULL) && (pStaDs != NULL))
4035 {
4036 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4037 {
4038 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4039 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304040 vos_mem_free(((tpSirAssocReq)
4041 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004042 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4043 }
4044
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304045 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4047 }
4048 }
4049
4050} /*** end __limProcessSmeAssocCnfNew() ***/
4051
4052
Jeff Johnson295189b2012-06-20 16:38:30 -07004053
4054
4055static void
4056__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4057{
4058 tpDphHashNode pStaDs;
4059 tSirMacAddr peerMac;
4060 tpSirAddtsReq pSirAddts;
4061 tANI_U32 timeout;
4062 tpPESession psessionEntry;
4063 tANI_U8 sessionId; //PE sessionId
4064 tANI_U8 smesessionId;
4065 tANI_U16 smetransactionId;
4066
4067
4068 if(pMsgBuf == NULL)
4069 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004070 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 return;
4072 }
4073
4074 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4075
4076 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4077
4078 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4079 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004080 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 return;
4082 }
4083#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4084 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4085#endif //FEATURE_WLAN_DIAG_SUPPORT
4086
4087
4088
4089 /* if sta
4090 * - verify assoc state
4091 * - send addts request to ap
4092 * - wait for addts response from ap
4093 * if ap, just ignore with error log
4094 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304095 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004096 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304098 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004099
4100 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4101 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004102 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004103 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4104 smesessionId,smetransactionId);
4105 return;
4106 }
4107
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4109
4110 if(pStaDs == NULL)
4111 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004112 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4114 smesessionId,smetransactionId);
4115 return;
4116 }
4117
4118 if ((! pStaDs->valid) ||
4119 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4120 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004121 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4123 smesessionId,smetransactionId);
4124 return;
4125 }
4126
4127 pSirAddts->req.wsmTspecPresent = 0;
4128 pSirAddts->req.wmeTspecPresent = 0;
4129 pSirAddts->req.lleTspecPresent = 0;
4130
4131 if ((pStaDs->wsmEnabled) &&
4132 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4133 pSirAddts->req.wsmTspecPresent = 1;
4134 else if (pStaDs->wmeEnabled)
4135 pSirAddts->req.wmeTspecPresent = 1;
4136 else if (pStaDs->lleEnabled)
4137 pSirAddts->req.lleTspecPresent = 1;
4138 else
4139 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004140 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4142 smesessionId,smetransactionId);
4143 return;
4144 }
4145
4146 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4147 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4148 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004149 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004150 psessionEntry->limSmeState);
4151 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4152 smesessionId,smetransactionId);
4153 return;
4154 }
4155
4156 if (pMac->lim.gLimAddtsSent)
4157 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004158 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 pMac->lim.gLimAddtsReq.req.dialogToken,
4160 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4161 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4162 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4163 smesessionId,smetransactionId);
4164 return;
4165 }
4166
4167 #if 0
4168 val = sizeof(tSirMacAddr);
4169 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4170 {
4171 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004172 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004173 return;
4174 }
4175 #endif
4176 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4177
4178 // save the addts request
4179 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304180 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004181
4182 // ship out the message now
4183 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4184 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304185 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004186
4187 // start a timer to wait for the response
4188 if (pSirAddts->timeout)
4189 timeout = pSirAddts->timeout;
4190 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4191 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004192 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 WNI_CFG_ADDTS_RSP_TIMEOUT);
4194 return;
4195 }
4196
4197 timeout = SYS_MS_TO_TICKS(timeout);
4198 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4199 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004200 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 return;
4202 }
4203 pMac->lim.gLimAddtsRspTimerCount++;
4204 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4205 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4206 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004207 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004208 return;
4209 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004210 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004211
4212 //add the sessionId to the timer object
4213 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4214 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4215 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004216 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 return;
4218 }
4219 return;
4220}
4221
4222
4223static void
4224__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4225{
4226 tSirMacAddr peerMacAddr;
4227 tANI_U8 ac;
4228 tSirMacTSInfo *pTsinfo;
4229 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4230 tpDphHashNode pStaDs = NULL;
4231 tpPESession psessionEntry;
4232 tANI_U8 sessionId;
4233 tANI_U32 status = eSIR_SUCCESS;
4234 tANI_U8 smesessionId;
4235 tANI_U16 smetransactionId;
4236
4237 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4238
4239 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4240 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004241 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 status = eSIR_FAILURE;
4243 goto end;
4244 }
4245#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4246 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4247#endif //FEATURE_WLAN_DIAG_SUPPORT
4248
4249
4250 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4251 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004252 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 status = eSIR_FAILURE;
4254 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4255 return;
4256 }
4257
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304258 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4259 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4260 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004261
4262 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4263 psessionEntry);
4264
4265 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4266
4267 /* We've successfully send DELTS frame to AP. Update the
4268 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4269 * is no longer trigger enabled or delivery enabled
4270 */
4271 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4272
4273 /* We're deleting the TSPEC, so this particular AC is no longer
4274 * admitted. PE needs to downgrade the EDCA
4275 * parameters(for the AC for which TS is being deleted) to the
4276 * next best AC for which ACM is not enabled, and send the
4277 * updated values to HAL.
4278 */
4279 ac = upToAc(pTsinfo->traffic.userPrio);
4280
4281 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4282 {
4283 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4284 }
4285 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4286 {
4287 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4288 }
4289 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4290 {
4291 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4292 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4293 }
4294
4295 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4296
4297 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4298 if (pStaDs != NULL)
4299 {
4300 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4301 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4302 else
4303 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4304 status = eSIR_SUCCESS;
4305 }
4306 else
4307 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004308 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 status = eSIR_FAILURE;
4310 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004311#ifdef FEATURE_WLAN_ESE
4312#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004313 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4314#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004316#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004317#endif
4318
4319 // send an sme response back
4320 end:
4321 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4322}
4323
4324
4325void
4326limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4327{
4328 //fetch the sessionEntry based on the sessionId
4329 tpPESession psessionEntry;
4330 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4331 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004332 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 return;
4334 }
4335
4336 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4337 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004338 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 pMac->lim.gLimAddtsSent = false;
4340 return;
4341 }
4342
4343 if (! pMac->lim.gLimAddtsSent)
4344 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004345 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 return;
4347 }
4348
4349 if (param != pMac->lim.gLimAddtsRspTimerCount)
4350 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004351 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 param, pMac->lim.gLimAddtsRspTimerCount);
4353 return;
4354 }
4355
4356 // this a real response timeout
4357 pMac->lim.gLimAddtsSent = false;
4358 pMac->lim.gLimAddtsRspTimerCount++;
4359
4360 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4361 psessionEntry->smeSessionId, psessionEntry->transactionId);
4362}
4363
4364
4365/**
4366 * __limProcessSmeStatsRequest()
4367 *
4368 *FUNCTION:
4369 *
4370 *
4371 *NOTE:
4372 *
4373 * @param pMac Pointer to Global MAC structure
4374 * @param *pMsgBuf A pointer to the SME message buffer
4375 * @return None
4376 */
4377static void
4378__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4379{
4380 tpAniGetStatsReq pStatsReq;
4381 tSirMsgQ msgQ;
4382 tpPESession psessionEntry;
4383 tANI_U8 sessionId;
4384
4385
4386 if(pMsgBuf == NULL)
4387 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004388 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 return;
4390 }
4391
4392 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4393
4394 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4395 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004396 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304397 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004398 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 return;
4400 }
4401
4402
4403
4404 switch(pStatsReq->msgType)
4405 {
4406 //Add Lim stats here. and send reqsponse.
4407
4408 //HAL maintained Stats.
4409 case eWNI_SME_STA_STAT_REQ:
4410 msgQ.type = WDA_STA_STAT_REQ;
4411 break;
4412 case eWNI_SME_AGGR_STAT_REQ:
4413 msgQ.type = WDA_AGGR_STAT_REQ;
4414 break;
4415 case eWNI_SME_GLOBAL_STAT_REQ:
4416 msgQ.type = WDA_GLOBAL_STAT_REQ;
4417 break;
4418 case eWNI_SME_STAT_SUMM_REQ:
4419 msgQ.type = WDA_STAT_SUMM_REQ;
4420 break;
4421 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004422 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304423 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004424 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 return;
4426 }
4427
Jeff Johnson295189b2012-06-20 16:38:30 -07004428 msgQ.reserved = 0;
4429 msgQ.bodyptr = pMsgBuf;
4430 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004431 if(NULL == psessionEntry)
4432 {
4433 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4434 }
4435 else
4436 {
4437 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4438 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004440 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304441 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004442 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004443 return;
4444 }
4445
4446 return;
4447}
4448
4449
4450/**
4451 * __limProcessSmeGetStatisticsRequest()
4452 *
4453 *FUNCTION:
4454 *
4455 *
4456 *NOTE:
4457 *
4458 * @param pMac Pointer to Global MAC structure
4459 * @param *pMsgBuf A pointer to the SME message buffer
4460 * @return None
4461 */
4462static void
4463__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4464{
4465 tpAniGetPEStatsReq pPEStatsReq;
4466 tSirMsgQ msgQ;
4467
4468 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4469
4470 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4471
4472 msgQ.type = WDA_GET_STATISTICS_REQ;
4473
Jeff Johnson295189b2012-06-20 16:38:30 -07004474 msgQ.reserved = 0;
4475 msgQ.bodyptr = pMsgBuf;
4476 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004477 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004478
4479 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304480 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004481 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004482 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 return;
4484 }
4485
4486 return;
4487}
4488
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004489#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004490/**
4491 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4492 *
4493 *NOTE:
4494 *
4495 * @param pMac Pointer to Global MAC structure
4496 * @param *pMsgBuf A pointer to the SME message buffer
4497 * @return None
4498 */
4499static void
4500__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4501{
4502 tSirMsgQ msgQ;
4503
4504 msgQ.type = WDA_TSM_STATS_REQ;
4505 msgQ.reserved = 0;
4506 msgQ.bodyptr = pMsgBuf;
4507 msgQ.bodyval = 0;
4508 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4509
4510 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4511 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004512 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004513 limLog(pMac, LOGP, "Unable to forward request");
4514 return;
4515 }
4516}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004517#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004518
4519
Jeff Johnson295189b2012-06-20 16:38:30 -07004520
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004521#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004522/**
4523 * __limProcessSmeGetRoamRssiRequest()
4524 *
4525 *FUNCTION:
4526 *
4527 *
4528 *NOTE:
4529 *
4530 * @param pMac Pointer to Global MAC structure
4531 * @param *pMsgBuf A pointer to the SME message buffer
4532 * @return None
4533 */
4534static void
4535__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4536{
4537 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4538 tSirMsgQ msgQ;
4539
4540 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4541 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4542
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004543 msgQ.reserved = 0;
4544 msgQ.bodyptr = pMsgBuf;
4545 msgQ.bodyval = 0;
4546 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4547
4548 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304549 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004550 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004551 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004552 return;
4553 }
4554
4555 return;
4556}
4557#endif
4558
4559
Jeff Johnson295189b2012-06-20 16:38:30 -07004560static void
4561__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4562{
4563 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4564 tpPESession psessionEntry;
4565 tANI_U8 sessionId; //PE sessionID
4566
4567 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004568 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004569
4570 if(pMsgBuf == NULL)
4571 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004572 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 return;
4574 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004575
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304576 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4577 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304579 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 return;
4581 }
4582
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004583 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004585 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004586 goto end;
4587 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004588
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4590 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004591 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 goto end;
4593 }
4594
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304595 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004596
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004598 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004599
4600end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304601 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 return;
4603} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4604
4605static void
4606__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4607{
4608 tpSirUpdateParams pUpdateParams;
4609 tpPESession psessionEntry;
4610
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304611 limLog(pMac, LOG1,
4612 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004613
4614 if(pMsgBuf == NULL)
4615 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004616 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004617 return;
4618 }
4619
4620 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4621
4622 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4623 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004624 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 pUpdateParams->sessionId);
4626 return;
4627 }
4628
4629 /* Update the session entry */
4630 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4631
4632 /* Update beacon */
4633 schSetFixedBeaconFields(pMac, psessionEntry);
4634 limSendBeaconInd(pMac, psessionEntry);
4635
4636 return;
4637} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4638
4639static void
4640__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4641{
4642 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4643 tpPESession psessionEntry;
4644 tANI_U8 sessionId; //PE sessionID
4645
4646 if(pMsgBuf == NULL)
4647 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004648 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 return;
4650 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304651
4652 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4653 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004654 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304655 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 return;
4657 }
4658
4659 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4660 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004661 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004662 goto end;
4663 }
4664
4665 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4666 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004667 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004668 goto end;
4669 }
4670
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304671 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4672 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004673
4674 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4675
4676 psessionEntry->pLimStartBssReq->privacy = 1;
4677 psessionEntry->privacy = 1;
4678
4679 schSetFixedBeaconFields(pMac, psessionEntry);
4680 limSendBeaconInd(pMac, psessionEntry);
4681
4682end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304683 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 return;
4685} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4686
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004687/*
4688Update the beacon Interval dynamically if beaconInterval is different in MCC
4689*/
4690static void
4691__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4692{
4693 tpSirChangeBIParams pChangeBIParams;
4694 tpPESession psessionEntry;
4695 tANI_U8 sessionId = 0;
4696 tUpdateBeaconParams beaconParams;
4697
4698 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004699 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004700
4701 if(pMsgBuf == NULL)
4702 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004703 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004704 return;
4705 }
4706
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304707 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004708 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4709
4710 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4711 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004712 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004713 return;
4714 }
4715
4716 /*Update sessionEntry Beacon Interval*/
4717 if(psessionEntry->beaconParams.beaconInterval !=
4718 pChangeBIParams->beaconInterval )
4719 {
4720 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4721 }
4722
4723 /*Update sch beaconInterval*/
4724 if(pMac->sch.schObject.gSchBeaconInterval !=
4725 pChangeBIParams->beaconInterval )
4726 {
4727 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4728
4729 PELOG1(limLog(pMac, LOG1,
4730 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4731
4732 /* Update beacon */
4733 schSetFixedBeaconFields(pMac, psessionEntry);
4734
Sunil Ravib96f7b52013-05-22 21:40:05 -07004735 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004736 //Set change in beacon Interval
4737 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004738 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004739 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4740 }
4741
4742 return;
4743} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4744
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304745/** -------------------------------------------------------------
4746\fn
4747\brief handles indication message from HDD to update HT mode
4748\param tpAniSirGlobal pMac
4749\param tANI_U32 pMsgBuf
4750\return None
4751-------------------------------------------------------------*/
4752#ifdef WLAN_FEATURE_AP_HT40_24G
4753static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4754{
4755 tpSirSetHT2040Mode pSetHT2040Mode;
4756 tpPESession psessionEntry;
4757 tANI_U8 sessionId = 0;
4758 tUpdateVHTOpMode *pHtOpMode = NULL;
4759 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004760
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304761 PELOG1(limLog(pMac, LOGRW,
4762 FL("received Set HT 20/40 mode message")););
4763
4764 if(pMsgBuf == NULL)
4765 {
4766 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4767 return;
4768 }
4769
4770 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4771
4772 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4773 &sessionId)) == NULL)
4774 {
4775 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4776 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4777 return;
4778 }
4779
4780 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4781 pSetHT2040Mode->cbMode);
4782
4783 /*Update sessionEntry HT related fields*/
4784 switch(pSetHT2040Mode->cbMode)
4785 {
4786 case PHY_SINGLE_CHANNEL_CENTERED:
4787 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4788 psessionEntry->htRecommendedTxWidthSet = 0;
4789 break;
4790 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4791 psessionEntry->htSecondaryChannelOffset =
4792 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4793 psessionEntry->htRecommendedTxWidthSet = 1;
4794 break;
4795 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4796 psessionEntry->htSecondaryChannelOffset =
4797 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4798 psessionEntry->htRecommendedTxWidthSet = 1;
4799 break;
4800 default:
4801 limLog(pMac, LOGE,FL("Invalid cbMode"));
4802 return;
4803 }
4804
4805 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4806 " htSecondaryChannelOffset: %d"
4807 " htRecommendedTxWidthSet :%d"),
4808 pSetHT2040Mode->cbMode,
4809 psessionEntry->htSecondaryChannelOffset,
4810 psessionEntry->htRecommendedTxWidthSet);
4811
4812 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4813
4814 /* Update beacon */
4815 schSetFixedBeaconFields(pMac, psessionEntry);
4816 limSendBeaconInd(pMac, psessionEntry);
4817
4818 /* Update OP Mode */
4819 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4820 if ( NULL == pHtOpMode )
4821 {
4822 limLog(pMac, LOGE,
4823 FL("Not able to allocate memory for setting OP mode"));
4824 return;
4825 }
4826
4827 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4828 PHY_SINGLE_CHANNEL_CENTERED)?
4829 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4830
4831 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4832 * operating mode for all connected STA.
4833 */
4834
4835 pHtOpMode->staId = psessionEntry->staId;
4836
4837 msg.type = WDA_UPDATE_OP_MODE;
4838 msg.reserved = 0;
4839 msg.bodyptr = pHtOpMode;
4840
4841 if (!VOS_IS_STATUS_SUCCESS(
4842 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4843 {
4844 limLog(pMac, LOGE,
4845 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4846 vos_mem_free(pHtOpMode);
4847 return;
4848 }
4849
4850 limLog(pMac, LOGW,
4851 FL("Notifed FW about OP mode: %d for staId=%d"),
4852 pHtOpMode->opMode, pHtOpMode->staId);
4853
4854 return;
4855}
4856#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004857
4858/** -------------------------------------------------------------
4859\fn limProcessSmeDelBaPeerInd
4860\brief handles indication message from HDD to send delete BA request
4861\param tpAniSirGlobal pMac
4862\param tANI_U32 pMsgBuf
4863\return None
4864-------------------------------------------------------------*/
4865void
4866limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4867{
4868 tANI_U16 assocId =0;
4869 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4870 tpDphHashNode pSta;
4871 tpPESession psessionEntry;
4872 tANI_U8 sessionId;
4873
4874
4875
4876 if(NULL == pSmeDelBAPeerInd)
4877 return;
4878
4879 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4880 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004881 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004882 return;
4883 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004884 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4886
4887 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4888 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4889 pSta,
4890 pSmeDelBAPeerInd->baDirection,
4891 pSmeDelBAPeerInd->baTID,
4892 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4893 {
4894 limLog( pMac, LOGW,
4895 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4896 if (pSta)
4897 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4898 }
4899}
4900
4901// --------------------------------------------------------------------
4902/**
4903 * __limProcessReportMessage
4904 *
4905 * FUNCTION: Processes the next received Radio Resource Management message
4906 *
4907 * LOGIC:
4908 *
4909 * ASSUMPTIONS:
4910 *
4911 * NOTE:
4912 *
4913 * @param None
4914 * @return None
4915 */
4916
4917void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4918{
4919#ifdef WLAN_FEATURE_VOWIFI
4920 switch (pMsg->type)
4921 {
4922 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4923 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4924 break;
4925 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4926 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004927#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004928 tpSirBeaconReportXmitInd pBcnReport=NULL;
4929 tpPESession psessionEntry=NULL;
4930 tANI_U8 sessionId;
4931
4932 if(pMsg->bodyptr == NULL)
4933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004934 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004935 return;
4936 }
4937 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4938 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4939 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004940 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 return;
4942 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004943 if (psessionEntry->isESEconnection)
4944 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 else
4946#endif
4947 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4948 }
4949 break;
4950 }
4951#endif
4952}
4953
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004954#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004955// --------------------------------------------------------------------
4956/**
4957 * limSendSetMaxTxPowerReq
4958 *
4959 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4960 *
4961 * LOGIC:
4962 *
4963 * ASSUMPTIONS:
4964 *
4965 * NOTE:
4966 *
4967 * @param txPower txPower to be set.
4968 * @param pSessionEntry session entry.
4969 * @return None
4970 */
4971tSirRetStatus
4972limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4973{
4974 tpMaxTxPowerParams pMaxTxParams = NULL;
4975 tSirRetStatus retCode = eSIR_SUCCESS;
4976 tSirMsgQ msgQ;
4977
4978 if( pSessionEntry == NULL )
4979 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004980 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004981 return eSIR_FAILURE;
4982 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304983
4984 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4985 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004987 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004988 return eSIR_MEM_ALLOC_FAILED;
4989
4990 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004991#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304992 limLog( pMac, LOG1,
4993 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004994#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004995 if( pMaxTxParams == NULL )
4996 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304997 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004998 return eSIR_FAILURE;
4999 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005000 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305001 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
5002 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005003
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005004 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
5005 msgQ.bodyptr = pMaxTxParams;
5006 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305007 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005008 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
5009 retCode = wdaPostCtrlMsg(pMac, &msgQ);
5010 if (eSIR_SUCCESS != retCode)
5011 {
5012 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305013 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005014 }
5015 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005016}
5017#endif
5018
5019/**
5020 * __limProcessSmeAddStaSelfReq()
5021 *
5022 *FUNCTION:
5023 * This function is called to process SME_ADD_STA_SELF_REQ message
5024 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
5025 *
5026 *LOGIC:
5027 *
5028 *ASSUMPTIONS:
5029 *
5030 *NOTE:
5031 *
5032 * @param pMac Pointer to Global MAC structure
5033 * @param *pMsgBuf A pointer to the SME message buffer
5034 * @return None
5035 */
5036
5037static void
5038__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5039{
5040 tSirMsgQ msg;
5041 tpAddStaSelfParams pAddStaSelfParams;
5042 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5043
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305044 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5045 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005046 {
5047 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5048 return;
5049 }
5050
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305051 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005052 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5054 msg.reserved = 0;
5055 msg.bodyptr = pAddStaSelfParams;
5056 msg.bodyval = 0;
5057
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005058 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005059 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005060
5061 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5062 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005063 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005064 }
5065 return;
5066} /*** end __limProcessAddStaSelfReq() ***/
5067
5068
5069/**
5070 * __limProcessSmeDelStaSelfReq()
5071 *
5072 *FUNCTION:
5073 * This function is called to process SME_DEL_STA_SELF_REQ message
5074 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5075 *
5076 *LOGIC:
5077 *
5078 *ASSUMPTIONS:
5079 *
5080 *NOTE:
5081 *
5082 * @param pMac Pointer to Global MAC structure
5083 * @param *pMsgBuf A pointer to the SME message buffer
5084 * @return None
5085 */
5086
5087static void
5088__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5089{
5090 tSirMsgQ msg;
5091 tpDelStaSelfParams pDelStaSelfParams;
5092 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5093
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305094 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5095 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005096 {
5097 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5098 return;
5099 }
5100
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305101 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005102
5103 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5104 msg.reserved = 0;
5105 msg.bodyptr = pDelStaSelfParams;
5106 msg.bodyval = 0;
5107
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05305108 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005109 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005110
5111 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5112 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005113 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005114 }
5115 return;
5116} /*** end __limProcessSmeDelStaSelfReq() ***/
5117
5118
Jeff Johnson295189b2012-06-20 16:38:30 -07005119/**
5120 * __limProcessSmeRegisterMgmtFrameReq()
5121 *
5122 *FUNCTION:
5123 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5124 * from SME. It Register this information within PE.
5125 *
5126 *LOGIC:
5127 *
5128 *ASSUMPTIONS:
5129 *
5130 *NOTE:
5131 *
5132 * @param pMac Pointer to Global MAC structure
5133 * @param *pMsgBuf A pointer to the SME message buffer
5134 * @return None
5135 */
5136static void
5137__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5138{
5139 VOS_STATUS vosStatus;
5140 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5141 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005142 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305143 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005144 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305145 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005146
Jeff Johnsond13512a2012-07-17 11:42:19 -07005147 /* First check whether entry exists already*/
5148
5149 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5150 (vos_list_node_t**)&pLimMgmtRegistration);
5151
5152 while(pLimMgmtRegistration != NULL)
5153 {
5154 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5155 {
5156 if(pSmeReq->matchLen)
5157 {
5158 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5159 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305160 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005161 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5162 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005163 /* found match! */
5164 match = VOS_TRUE;
5165 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005166 }
5167 }
5168 }
5169 else
5170 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005171 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005172 match = VOS_TRUE;
5173 break;
5174 }
5175 }
5176 vosStatus = vos_list_peek_next (
5177 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5178 (vos_list_node_t*) pLimMgmtRegistration,
5179 (vos_list_node_t**) &pNext );
5180
5181 pLimMgmtRegistration = pNext;
5182 pNext = NULL;
5183
5184 }
5185
5186 if (match)
5187 {
5188 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5189 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305190 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005191 }
5192
Jeff Johnson295189b2012-06-20 16:38:30 -07005193 if(pSmeReq->registerFrame)
5194 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305195 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5196 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005197 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305198 vos_mem_set((void*)pLimMgmtRegistration,
5199 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005200 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5201 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5202 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5203 if(pSmeReq->matchLen)
5204 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305205 vos_mem_copy(pLimMgmtRegistration->matchData,
5206 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005207 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005208 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5209 &pLimMgmtRegistration->node);
5210 }
5211 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005212
5213 return;
5214} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005215
5216static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005217__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005218{
5219 tpP2pPsParams pMsgNoA;
5220 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005221
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305222 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5223 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005224 {
5225 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005226 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005227 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005228 }
5229
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305230 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005231 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5232 pMsgNoA->opp_ps = 0;
5233 pMsgNoA->ctWindow = 0;
5234 pMsgNoA->duration = 0;
5235 pMsgNoA->interval = 0;
5236 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005237
Vinay Malekal62757362012-12-17 12:15:51 -08005238 /* Below params used for Single Shot NOA - so assign proper values */
5239 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005240 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005241
Viral Modid86bde22012-12-10 13:09:21 -08005242 /* Start Insert NOA timer
5243 * 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 -08005244 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5245 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005246 */
5247 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5248 == TX_TIMER_ERROR)
5249 {
5250 /// Could not activate Insert NOA timer.
5251 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005252 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005253
5254 // send the scan response back with status failure and do not even call insert NOA
5255 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305256 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005257 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005258 }
5259
Viral Modid440e682013-03-06 02:25:31 -08005260 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5261
Viral Modid86bde22012-12-10 13:09:21 -08005262 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5263 msg.reserved = 0;
5264 msg.bodyptr = pMsgNoA;
5265 msg.bodyval = 0;
5266
5267 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5268 {
5269 /* 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 -07005270 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005271 /* Deactivate the NOA timer in failure case */
5272 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5273 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005274 }
Viral Modid440e682013-03-06 02:25:31 -08005275 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005276
Viral Modid440e682013-03-06 02:25:31 -08005277error:
5278 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5279 * worrying about the NOA
5280 */
5281 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5282 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005283 return FALSE;
5284
5285}
5286
Viral Modid440e682013-03-06 02:25:31 -08005287static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5288{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005289 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005290 pMac->lim.gDeferMsgTypeForNOA = msgType;
5291 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5292}
5293
5294static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5295{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005296 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005297 pMac->lim.gDeferMsgTypeForNOA = 0;
5298 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5299 {
5300 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305301 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005302 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5303 }
5304}
5305
5306static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305307tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5308 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005309{
5310 tANI_U32 noaDuration = 0;
5311
5312 switch (msgType)
5313 {
5314 case eWNI_SME_SCAN_REQ:
5315 {
5316 tANI_U32 val;
5317 tANI_U8 i;
5318 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5319 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5320 {
5321 /*
5322 * Could not get max channel value
5323 * from CFG. Log error.
5324 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005325 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005326
5327 /* use a default value of 110ms */
5328 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5329 }
5330
5331 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5332 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5333
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305334 if (pMac->miracast_mode) {
5335 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5336 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5337 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005338 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5339 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5340 */
5341 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305342 } else {
5343 /* Use min + max channel time to calculate the total duration of scan */
5344 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005345 }
5346 }
5347
5348 /* Adding an overhead of 20ms to account for the scan messaging delays */
5349 noaDuration += SCAN_MESSAGING_OVERHEAD;
5350 noaDuration *= CONV_MS_TO_US;
5351
5352 break;
5353 }
5354
5355 case eWNI_SME_OEM_DATA_REQ:
5356 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5357 break;
5358
5359 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5360 {
5361 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5362 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5363 break;
5364 }
5365
5366 case eWNI_SME_JOIN_REQ:
5367 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5368 break;
5369
5370 default:
5371 noaDuration = 0;
5372 break;
5373
5374 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005375 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005376 return noaDuration;
5377}
5378
5379void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5380{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305381 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005382
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005383 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005384 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5385 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5386 {
5387 switch (pMac->lim.gDeferMsgTypeForNOA)
5388 {
5389 case eWNI_SME_SCAN_REQ:
5390 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5391 break;
5392 case eWNI_SME_OEM_DATA_REQ:
5393 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5394 break;
5395 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305396 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5397 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5398 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5399 */
5400 if (FALSE == bufConsumed)
5401 {
5402 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5403 }
Viral Modid440e682013-03-06 02:25:31 -08005404 break;
5405 case eWNI_SME_JOIN_REQ:
5406 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5407 break;
5408 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005409 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005410 break;
5411 }
5412 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5413 }
5414 else
5415 {
5416 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005417 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005418 }
5419}
Jeff Johnson295189b2012-06-20 16:38:30 -07005420
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305421static void
5422__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5423{
5424 tpSirResetAPCapsChange pResetCapsChange;
5425 tpPESession psessionEntry;
5426 tANI_U8 sessionId = 0;
5427 if (pMsgBuf == NULL)
5428 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005429 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305430 return;
5431 }
5432
5433 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5434 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5435 if (psessionEntry == NULL)
5436 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005437 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305438 return;
5439 }
5440
5441 psessionEntry->limSentCapsChangeNtf = false;
5442 return;
5443}
5444
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305445static void
5446__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5447{
5448 tSirMsgQ msg;
5449 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5450 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5451
5452 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5453 if ( NULL == pSpoofMacAddrParams )
5454 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305455 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305456 return;
5457 }
5458
5459 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5460
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305461 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5462
5463 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5464 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5465
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305466 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5467 msg.reserved = 0;
5468 msg.bodyptr = pSpoofMacAddrParams;
5469 msg.bodyval = 0;
5470
5471 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5472 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5473
5474 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5475 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305476 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305477 vos_mem_free(pSpoofMacAddrParams);
5478 }
5479 return;
5480}
5481
Jeff Johnson295189b2012-06-20 16:38:30 -07005482/**
5483 * limProcessSmeReqMessages()
5484 *
5485 *FUNCTION:
5486 * This function is called by limProcessMessageQueue(). This
5487 * function processes SME request messages from HDD or upper layer
5488 * application.
5489 *
5490 *LOGIC:
5491 *
5492 *ASSUMPTIONS:
5493 *
5494 *NOTE:
5495 *
5496 * @param pMac Pointer to Global MAC structure
5497 * @param msgType Indicates the SME message type
5498 * @param *pMsgBuf A pointer to the SME message buffer
5499 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5500 * FALSE - if pMsgBuf is not to be freed.
5501 */
5502
5503tANI_BOOLEAN
5504limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5505{
5506 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5507 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005508 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305509 tANI_BOOLEAN isPassiveScan = FALSE;
5510
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005511 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 -07005512 limMsgStr(pMsg->type), pMsg->type,
5513 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5514 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5515
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005516 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005517 /* Special handling of some SME Req msgs where we have an existing GO session and
5518 * want to insert NOA before processing those msgs. These msgs will be processed later when
5519 * start event happens
5520 */
5521 switch (pMsg->type)
5522 {
5523 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305524 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5525 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005526 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005527
5528 /* If scan is disabled return from here
5529 */
5530 if (pMac->lim.fScanDisabled)
5531 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005532 if (pMsg->type == eWNI_SME_SCAN_REQ)
5533 {
5534 limSendSmeScanRsp(pMac,
5535 offsetof(tSirSmeScanRsp,bssDescription[0]),
5536 eSIR_SME_INVALID_PARAMETERS,
5537 pScanReq->sessionId,
5538 pScanReq->transactionId);
5539
5540 bufConsumed = TRUE;
5541 }
5542 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5543 {
5544 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5545 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5546 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5547
5548 /*
5549 * limRemainOnChnRsp will free the buffer this change is to
5550 * avoid "double free"
5551 */
5552 bufConsumed = FALSE;
5553 }
5554
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305555 limLog(pMac, LOGE,
5556 FL("Error: Scan Disabled."
5557 " Return with error status for SME Message %s(%d)"),
5558 limMsgStr(pMsg->type), pMsg->type);
5559
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005560 return bufConsumed;
5561 }
5562 /*
5563 * Do not add BREAK here
5564 */
5565 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005566 case eWNI_SME_JOIN_REQ:
5567 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5568 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5569 {
5570 tANI_U32 noaDuration;
5571 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305572 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005573 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5574 return bufConsumed;
5575 }
5576 }
5577 /* If no insert NOA required then execute the code below */
5578
Jeff Johnson295189b2012-06-20 16:38:30 -07005579 switch (pMsg->type)
5580 {
5581 case eWNI_SME_START_REQ:
5582 __limProcessSmeStartReq(pMac, pMsgBuf);
5583 break;
5584
5585 case eWNI_SME_SYS_READY_IND:
5586 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5587 break;
5588
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 case eWNI_SME_START_BSS_REQ:
5590 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5591 break;
5592
5593 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005594 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005595 break;
5596
Jeff Johnsone7245742012-09-05 17:12:55 -07005597#ifdef FEATURE_OEM_DATA_SUPPORT
5598 case eWNI_SME_OEM_DATA_REQ:
5599 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005600 break;
5601#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005602 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5603 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5604 break;
5605
5606 case eWNI_SME_UPDATE_NOA:
5607 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5608 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305609 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5610 __limProcessClearDfsChannelList(pMac, pMsg);
5611 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005612 case eWNI_SME_JOIN_REQ:
5613 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005614 break;
5615
5616 case eWNI_SME_AUTH_REQ:
5617 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5618
5619 break;
5620
5621 case eWNI_SME_REASSOC_REQ:
5622 __limProcessSmeReassocReq(pMac, pMsgBuf);
5623
5624 break;
5625
5626 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5627 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5628
5629 break;
5630
5631 case eWNI_SME_DISASSOC_REQ:
5632 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5633
5634 break;
5635
5636 case eWNI_SME_DISASSOC_CNF:
5637 case eWNI_SME_DEAUTH_CNF:
5638 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5639
5640 break;
5641
5642 case eWNI_SME_DEAUTH_REQ:
5643 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5644
5645 break;
5646
Jeff Johnson295189b2012-06-20 16:38:30 -07005647
5648
5649 case eWNI_SME_SETCONTEXT_REQ:
5650 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5651
5652 break;
5653
5654 case eWNI_SME_REMOVEKEY_REQ:
5655 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5656
5657 break;
5658
5659 case eWNI_SME_STOP_BSS_REQ:
5660 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5661 break;
5662
5663 case eWNI_SME_ASSOC_CNF:
5664 case eWNI_SME_REASSOC_CNF:
5665 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305666 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005667 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305668 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005669 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5670 break;
5671
5672 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305673 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005674 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5675 break;
5676
5677 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305678 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005679 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5680 break;
5681
5682 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305683 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5685 break;
5686
5687 case eWNI_SME_STA_STAT_REQ:
5688 case eWNI_SME_AGGR_STAT_REQ:
5689 case eWNI_SME_GLOBAL_STAT_REQ:
5690 case eWNI_SME_STAT_SUMM_REQ:
5691 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5692 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5693 bufConsumed = FALSE;
5694 break;
5695 case eWNI_SME_GET_STATISTICS_REQ:
5696 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5697 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5698 bufConsumed = FALSE;
5699 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005700#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005701 case eWNI_SME_GET_ROAM_RSSI_REQ:
5702 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5703 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5704 bufConsumed = FALSE;
5705 break;
5706#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005707#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005708 case eWNI_SME_GET_TSM_STATS_REQ:
5709 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5710 bufConsumed = FALSE;
5711 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005712#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 case eWNI_SME_DEL_BA_PEER_IND:
5714 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5715 break;
5716 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5717 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5718 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005719 case eWNI_SME_GET_ASSOC_STAS_REQ:
5720 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5721 break;
5722 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5723 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5724 break;
5725
5726 case eWNI_SME_HIDE_SSID_REQ:
5727 __limProcessSmeHideSSID(pMac, pMsgBuf);
5728 break;
5729 case eWNI_SME_UPDATE_APWPSIE_REQ:
5730 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5731 break;
5732 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5733 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5734 break;
5735
5736 case eWNI_SME_SET_APWPARSNIEs_REQ:
5737 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5738 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005739
5740 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5741 //Update the beaconInterval
5742 __limProcessSmeChangeBI(pMac, pMsgBuf );
5743 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305744
5745#ifdef WLAN_FEATURE_AP_HT40_24G
5746 case eWNI_SME_SET_HT_2040_MODE:
5747 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5748 break;
5749#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005750
5751#if defined WLAN_FEATURE_VOWIFI
5752 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5753 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5754 __limProcessReportMessage(pMac, pMsg);
5755 break;
5756#endif
5757
5758#if defined WLAN_FEATURE_VOWIFI_11R
5759 case eWNI_SME_FT_PRE_AUTH_REQ:
5760 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5761 break;
5762 case eWNI_SME_FT_UPDATE_KEY:
5763 limProcessFTUpdateKey(pMac, pMsgBuf);
5764 break;
5765
5766 case eWNI_SME_FT_AGGR_QOS_REQ:
5767 limProcessFTAggrQosReq(pMac, pMsgBuf);
5768 break;
5769#endif
5770
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005771#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5772 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005773 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5774 break;
5775#endif
5776 case eWNI_SME_ADD_STA_SELF_REQ:
5777 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5778 break;
5779 case eWNI_SME_DEL_STA_SELF_REQ:
5780 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5781 break;
5782
Jeff Johnson295189b2012-06-20 16:38:30 -07005783 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5784 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5785 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005786#ifdef FEATURE_WLAN_TDLS
5787 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5788 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5789 break;
5790 case eWNI_SME_TDLS_ADD_STA_REQ:
5791 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5792 break;
5793 case eWNI_SME_TDLS_DEL_STA_REQ:
5794 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5795 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305796 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5797 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5798 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305799// tdlsoffchan
5800 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5801 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5802 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005803#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305804 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5805 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5806 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005807
schang86c22c42013-03-13 18:41:24 -07005808 case eWNI_SME_SET_TX_POWER_REQ:
5809 limSendSetTxPowerReq(pMac, pMsgBuf);
5810 break ;
5811
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305812 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5813 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5814 break ;
5815
Jeff Johnson295189b2012-06-20 16:38:30 -07005816 default:
5817 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5818 pMsg->bodyptr = NULL;
5819 break;
5820 } // switch (msgType)
5821
5822 return bufConsumed;
5823} /*** end limProcessSmeReqMessages() ***/