blob: deabb2469dff3b8bd674ac2f5e27bd0d762cba13 [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
Abhishek Singhdaf95742015-10-13 14:53:21 +05301261 /* Check if scan req is not valid or link is already suspended*/
1262 if (!limIsSmeScanReqValid(pMac, pScanReq) || limIsLinkSuspended(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 {
Abhishek Singhdaf95742015-10-13 14:53:21 +05301264 limLog(pMac, LOGE,
1265 FL("Received SME_SCAN_REQ with invalid params or link is suspended %d"),
1266 limIsLinkSuspended(pMac));
Jeff Johnson295189b2012-06-20 16:38:30 -07001267
1268 if (pMac->lim.gLimRspReqd)
1269 {
1270 pMac->lim.gLimRspReqd = false;
1271
1272 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1273
1274 } // if (pMac->lim.gLimRspReqd)
1275
1276 return;
1277 }
1278
1279 //if scan is disabled then return as invalid scan request.
1280 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1281 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1282 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301283 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1284 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001285 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 return;
1287 }
1288
1289
1290 /**
1291 * If scan request is received in idle, joinFailed
1292 * states or in link established state (in STA role)
1293 * or in normal state (in STA-in-IBSS/AP role) with
1294 * 'return fresh scan results' request from HDD or
1295 * it is periodic background scanning request,
1296 * trigger fresh scan request to MLM
1297 */
1298 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1299 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301300 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1301 {
1302 // Discard previously cached scan results
1303 limReInitScanResults(pMac);
1304 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001305
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301306 pMac->lim.gLim24Band11dScanDone = 0;
1307 pMac->lim.gLim50Band11dScanDone = 0;
1308 pMac->lim.gLimReturnAfterFirstMatch =
1309 pScanReq->returnAfterFirstMatch;
1310 pMac->lim.gLimBackgroundScanMode =
1311 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001312
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301313 pMac->lim.gLimReturnUniqueResults =
1314 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1315 /* De-activate Heartbeat timers for connected sessions while
1316 * scan is in progress if the system is in Active mode *
1317 * AND it is not a ROAMING ("background") scan */
1318 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1319 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1320 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1321 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1322 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 for(i=0;i<pMac->lim.maxBssId;i++)
1324 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301325 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1326 (pMac->lim.gpSession[i].valid == TRUE) &&
1327 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1328 {
1329 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1330 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301332 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001333
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301334 if (pMac->fScanOffload)
1335 {
1336 if (eHAL_STATUS_SUCCESS !=
1337 limSendHalStartScanOffloadReq(pMac, pScanReq))
1338 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301339 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301340 limSendSmeScanRsp(pMac,
1341 offsetof(tSirSmeScanRsp, bssDescription[0]),
1342 eSIR_SME_INVALID_PARAMETERS,
1343 pScanReq->sessionId,
1344 pScanReq->transactionId);
1345 return;
1346 }
1347 }
1348 else
1349 {
1350
1351 /*Change Global SME state */
1352 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301353 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301354 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1355 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1356 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1357
1358 if (pScanReq->channelList.numChannels == 0)
1359 {
1360 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301361
1362 limLog(pMac, LOG1,
1363 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301364 // Scan all channels
1365 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1367 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301368 pMlmScanReq = vos_mem_malloc(len);
1369 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301370 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301371 // Log error
1372 limLog(pMac, LOGP,
1373 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001374
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301375 if (pMac->lim.gLimRspReqd)
1376 {
1377 pMac->lim.gLimRspReqd = false;
1378
1379 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1380 eSIR_SME_RESOURCES_UNAVAILABLE,
1381 pScanReq->sessionId,
1382 pScanReq->transactionId);
1383 }
1384
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301385 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301386 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001387
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301388 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301389 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301391 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1392 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 pMlmScanReq->channelList.channelNumber,
1394 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301395 {
1396 /**
1397 * Could not get Valid channel list from CFG.
1398 * Log error.
1399 */
1400 limLog(pMac, LOGP,
1401 FL("could not retrieve Valid channel list"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301402
1403 if (pMac->lim.gLimRspReqd)
1404 {
1405 pMac->lim.gLimRspReqd = false;
1406
1407 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1408 eSIR_SME_INVALID_PARAMETERS,
1409 pScanReq->sessionId,
1410 pScanReq->transactionId);
1411 }
Abhishek Singh2b055852015-10-07 14:14:13 +05301412 vos_mem_free(pMlmScanReq);
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301413 return;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301414 }
1415 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301416
1417 //Ignore DFS channels if DFS scan is disabled
1418 if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
1419 {
1420 tANI_U8 numChan = 0;
1421 tANI_U8 channel_state;
1422 tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
1423
1424 limLog(pMac, LOG1,
1425 FL("Ignore DFS channels from valid channel list"));
1426
1427 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1428 pMlmScanReq->channelList.channelNumber,
1429 pMlmScanReq->channelList.numChannels);
1430
1431 //Filter DFS channels
1432 for (i = 0; i < cfg_len; i++)
1433 {
1434 channel_state =
1435 vos_nv_getChannelEnabledState(*(chan_ptr + i));
1436
1437 //Allow channel if not DFS
1438 if(channel_state != NV_CHANNEL_DFS)
1439 {
1440 *(chan_ptr + numChan) = *(chan_ptr + i);
1441 numChan++;
1442 }
1443 }
1444 pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
1445
1446 limLog(pMac, LOG1, FL("No of valid channels %d, No of"
1447 "channels after filtering %d"), cfg_len, numChan);
1448
1449 limLog(pMac, LOG1, FL("Channel list after filtering: "));
1450
1451 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1452 pMlmScanReq->channelList.channelNumber,
1453 pMlmScanReq->channelList.numChannels);
1454 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301455 }
1456 else
1457 {
1458 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1459 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1460 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001461
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301462 pMlmScanReq = vos_mem_malloc(len);
1463 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301464 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301465 // Log error
1466 limLog(pMac, LOGP,
1467 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001468
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301469 if (pMac->lim.gLimRspReqd)
1470 {
1471 pMac->lim.gLimRspReqd = false;
1472
1473 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1474 eSIR_SME_RESOURCES_UNAVAILABLE,
1475 pScanReq->sessionId,
1476 pScanReq->transactionId);
1477 }
1478
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301479 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301480 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001481
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301482 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301483 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301484 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301485 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001486
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301487 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1488 pScanReq->channelList.channelNumber,
1489 pScanReq->channelList.numChannels);
1490 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001491
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301492 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1493 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1494 if(pScanReq->uIEFieldLen)
1495 {
1496 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1497 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1498 pScanReq->uIEFieldLen);
1499 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001500
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301501 pMlmScanReq->bssType = pScanReq->bssType;
1502 vos_mem_copy( pMlmScanReq->bssId,
1503 pScanReq->bssId,
1504 sizeof(tSirMacAddr));
1505 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001506
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301507 i = 0;
1508 while (i < pMlmScanReq->numSsid)
1509 {
1510 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 (tANI_U8 *) &pScanReq->ssId[i],
1512 pScanReq->ssId[i].length + 1);
1513
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301514 i++;
1515 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
Jeff Johnson295189b2012-06-20 16:38:30 -07001517
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301518 pMlmScanReq->scanType = pScanReq->scanType;
1519 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301520 if (pMac->miracast_mode)
1521 {
1522 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1523 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1524 }
1525 else
1526 {
1527 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1528 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1529 }
1530
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301531 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1532 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1533 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1534 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301536 //Store the smeSessionID and transaction ID for later use.
1537 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1538 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001539
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301540 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301541 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301542 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1543 }
1544 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001545
1546 else
1547 {
1548 /// In all other cases return 'cached' scan results
1549 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1550 {
1551 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1552
1553 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001554#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1555 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001556 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001557 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1558 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1559 {
1560 limSendSmeLfrScanRsp(pMac, scanRspLen,
1561 eSIR_SME_SUCCESS,
1562 pScanReq->sessionId,
1563 pScanReq->transactionId);
1564 }
1565 else
1566 {
1567 scanRspLen = sizeof(tSirSmeScanRsp) +
1568 pMac->lim.gLimSmeLfrScanResultLength -
1569 sizeof(tSirBssDescription);
1570 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1571 pScanReq->sessionId, pScanReq->transactionId);
1572 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 }
1574 else
1575 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001576#endif
1577 if (pMac->lim.gLimSmeScanResultLength == 0)
1578 {
1579 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1580 pScanReq->sessionId, pScanReq->transactionId);
1581 }
1582 else
1583 {
1584 scanRspLen = sizeof(tSirSmeScanRsp) +
1585 pMac->lim.gLimSmeScanResultLength -
1586 sizeof(tSirBssDescription);
1587 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1588 pScanReq->sessionId, pScanReq->transactionId);
1589 }
1590#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001592#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301593 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001594
1595 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1596 {
1597 // Discard previously cached scan results
1598 limReInitScanResults(pMac);
1599 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001600#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1601 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1602 {
1603 // Discard previously cached scan results
1604 limReInitLfrScanResults(pMac);
1605 }
1606#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001607
1608 } // if (pMac->lim.gLimRspReqd)
1609 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1610
Jeff Johnson295189b2012-06-20 16:38:30 -07001611#ifdef BACKGROUND_SCAN_ENABLED
1612 // start background scans if needed
1613 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1614 __limBackgroundScanInitiate(pMac);
1615#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001616
1617} /*** end __limProcessSmeScanReq() ***/
1618
Jeff Johnsone7245742012-09-05 17:12:55 -07001619#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001620
Jeff Johnsone7245742012-09-05 17:12:55 -07001621static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1622{
1623 tpSirOemDataReq pOemDataReq;
1624 tLimMlmOemDataReq* pMlmOemDataReq;
1625
1626 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1627
1628 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301629 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1630 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001631 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301632 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001633 return;
1634 }
1635
1636 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301637 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001638
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301639 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1640 sizeof(tSirMacAddr));
1641 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1642 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001643
1644 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1645 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1646
1647 return;
1648
1649} /*** end __limProcessSmeOemDataReq() ***/
1650
1651#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301653/**
1654 * __limProcessClearDfsChannelList()
1655 *
1656 *FUNCTION:
1657 *Clear DFS channel list when country is changed/aquired.
1658.*This message is sent from SME.
1659 *
1660 *LOGIC:
1661 *
1662 *ASSUMPTIONS:
1663 *
1664 *NOTE:
1665 *
1666 * @param pMac Pointer to Global MAC structure
1667 * @param *pMsgBuf A pointer to the SME message buffer
1668 * @return None
1669 */
1670static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1671 tpSirMsgQ pMsg)
1672{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301673 vos_mem_set( &pMac->lim.dfschannelList,
1674 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301675}
Jeff Johnson295189b2012-06-20 16:38:30 -07001676
1677/**
1678 * __limProcessSmeJoinReq()
1679 *
1680 *FUNCTION:
1681 * This function is called to process SME_JOIN_REQ message
1682 * from HDD or upper layer application.
1683 *
1684 *LOGIC:
1685 *
1686 *ASSUMPTIONS:
1687 *
1688 *NOTE:
1689 *
1690 * @param pMac Pointer to Global MAC structure
1691 * @param *pMsgBuf A pointer to the SME message buffer
1692 * @return None
1693 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001694static void
1695__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1696{
1697 // tANI_U8 *pBuf;
1698 //tANI_U32 len;
1699// tSirMacAddr currentBssId;
1700 tpSirSmeJoinReq pSmeJoinReq = NULL;
1701 tLimMlmJoinReq *pMlmJoinReq;
1702 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1703 tANI_U32 val = 0;
1704 tANI_U16 nSize;
1705 tANI_U8 sessionId;
1706 tpPESession psessionEntry = NULL;
1707 tANI_U8 smesessionId;
1708 tANI_U16 smetransactionId;
1709 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301710 tANI_U16 ieLen;
1711 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001712
1713#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1714 //Not sending any session, since it is not created yet. The response whould have correct state.
1715 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1716#endif //FEATURE_WLAN_DIAG_SUPPORT
1717
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301718 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001719
1720#ifdef WLAN_FEATURE_VOWIFI
1721 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1722 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1723 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1724 * like not honoring power constraint on 1st association after driver loading. */
1725 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001726 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1728 val = 0;
1729#endif /* WLAN_FEATURE_VOWIFI */
1730
1731 /**
1732 * Expect Join request in idle state.
1733 * Reassociate request is expected in link established state.
1734 */
1735
1736 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1737 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1738 {
1739 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301740
1741 pSmeJoinReq = vos_mem_malloc(nSize);
1742 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301744 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1745 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1747 goto end;
1748 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301749 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001750
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1752 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1753 {
1754 /// Received invalid eWNI_SME_JOIN_REQ
1755 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301756 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1757 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 retCode = eSIR_SME_INVALID_PARAMETERS;
1759 goto end;
1760 }
1761
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301762 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001763
1764 /* check for the existence of start BSS session */
1765#ifdef FIXME_GEN6
1766 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1767 {
1768 if(peValidateBtJoinRequest(pMac)!= TRUE)
1769 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301770 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1771 "not present::SME_JOIN_REQ in unexpected state"),
1772 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1774 psessionEntry = NULL;
1775 goto end;
1776 }
1777 }
1778
1779#endif
1780
1781
1782 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1783 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301784 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301785 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301786 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1787 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001788
1789 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1790 {
1791 // Received eWNI_SME_JOIN_REQ for same
1792 // BSS as currently associated.
1793 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301794 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1795 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301797 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1798 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 goto end;
1800 }
1801 else
1802 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301803 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1804 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 retCode = eSIR_SME_REFUSED;
1806 psessionEntry = NULL;
1807 goto end;
1808 }
1809 }
1810 else /* Session Entry does not exist for given BSSId */
1811 {
1812 /* Try to Create a new session */
1813 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1814 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001815 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1817 goto end;
1818 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301819 else
1820 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1821 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301822 }
1823
1824 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1825 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1826 psessionEntry->is11Gonly = true;
1827 }
1828 }
1829
krunal soni5afa96c2013-09-06 22:19:02 -07001830 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001831
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 /* Store Session related parameters */
1833 /* Store PE session Id in session Table */
1834 psessionEntry->peSessionId = sessionId;
1835
1836 /* store the smejoin req handle in session table */
1837 psessionEntry->pLimJoinReq = pSmeJoinReq;
1838
1839 /* Store SME session Id in sessionTable */
1840 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1841
1842 /* Store SME transaction Id in session Table */
1843 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1844
1845 /* Store beaconInterval */
1846 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1847
1848 /* Copying of bssId is already done, while creating session */
1849 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1850 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1851 psessionEntry->bssType = pSmeJoinReq->bsstype;
1852
1853 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301854 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1855 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301856 psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001857
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301858 /* Store vendor specfic IE for CISCO AP */
1859 ieLen = (pSmeJoinReq->bssDescription.length +
1860 sizeof( pSmeJoinReq->bssDescription.length ) -
1861 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1862
1863 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1864 SIR_MAC_CISCO_OUI_SIZE,
1865 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1866
1867 if ( NULL != vendorIE )
1868 {
1869 limLog(pMac, LOGE,
1870 FL("DUT is trying to connect to Cisco AP"));
1871 psessionEntry->isCiscoVendorAP = TRUE;
1872 }
1873 else
1874 {
1875 psessionEntry->isCiscoVendorAP = FALSE;
1876 }
1877
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 /* Copy the dot 11 mode in to the session table */
1879
1880 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1881 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001882#ifdef WLAN_FEATURE_11AC
1883 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001884 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001885 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001886 if (psessionEntry->vhtCapability )
1887 {
1888 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1889
1890 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001891 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001892 psessionEntry->txBFIniFeatureEnabled);
1893
1894 if( psessionEntry->txBFIniFeatureEnabled )
1895 {
1896 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1897 != eSIR_SUCCESS)
1898 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301899 limLog(pMac, LOGP, FL("could not set "
1900 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001901 retCode = eSIR_LOGP_EXCEPTION;
1902 goto end;
1903 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001904 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301905 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1906 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001907
1908 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001909 != eSIR_SUCCESS)
1910 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301911 limLog(pMac, LOGP, FL("could not set "
1912 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001913 retCode = eSIR_LOGP_EXCEPTION;
1914 goto end;
1915 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301916
1917 if ( FALSE == pMac->isMuBfsessionexist )
1918 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001919 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301920
1921 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1922 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1923 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1924
1925 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1926 != eSIR_SUCCESS)
1927 {
1928 limLog(pMac, LOGE, FL("could not set "
1929 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1930 retCode = eSIR_LOGP_EXCEPTION;
1931 goto end;
1932 }
1933
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001934 }
1935
Jeff Johnsone7245742012-09-05 17:12:55 -07001936#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001937
1938 /*Phy mode*/
1939 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1940
Abhishek Singhca6ec5d2015-06-24 13:13:27 +05301941 handleHTCapabilityandHTInfo(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 /* Copy The channel Id to the session Table */
1943 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001944 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1945 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1946 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
Chet Lanctot186b5732013-03-18 10:26:30 -07001948 /* Record if management frames need to be protected */
1949#ifdef WLAN_FEATURE_11W
1950 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1951 {
1952 psessionEntry->limRmfEnabled = 1;
1953 }
1954 else
1955 {
1956 psessionEntry->limRmfEnabled = 0;
1957 }
1958#endif
1959
krunal soni8d13b092013-07-19 13:23:29 -07001960#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1961 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1962#endif
1963
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 /*Store Persona */
1965 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1966 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301967 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1968 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001969
1970 /* Copy the SSID from smejoinreq to session entry */
1971 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301972 vos_mem_copy( psessionEntry->ssId.ssId,
1973 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1974
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001975 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301976 // which inturn is dependent on the profile the user wants to connect
1977 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001978#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301979 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001980#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001981#ifdef FEATURE_WLAN_ESE
1982 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001983#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001984#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301985 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001986#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301987
Jeff Johnson43971f52012-07-17 12:26:56 -07001988#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301989 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001990#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301991 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001992
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301993 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301995 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1996 }
1997 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1998 {
1999 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
2000 }
2001 else
2002 {
2003 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05302004 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
2005 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302006 retCode = eSIR_SME_INVALID_PARAMETERS;
2007 goto end;
2008 }
2009
2010 if (pSmeJoinReq->addIEScan.length)
2011 {
2012 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
2014 }
2015
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302016 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302018 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
2020 }
2021
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302023 pMlmJoinReq = vos_mem_malloc(val);
2024 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302026 limLog(pMac, LOGP, FL("call to AllocateMemory "
2027 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 return;
2029 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302030 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002031
2032 /* PE SessionId is stored as a part of JoinReq*/
2033 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
2034
2035 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
2036 != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302037 {
2038 limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
2039 "setting it to default value"));
2040 pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
2041 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002042
2043 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302044 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302046 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 sizeof(tSirMacRateSet));
2048 //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 +05302049 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 sizeof(tSirMacRateSet));
2051
2052 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
2053
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
2055
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302056 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
2058 psessionEntry->pLimJoinReq->bssDescription.length + 2);
2059
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07002061 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002062
Jeff Johnsone7245742012-09-05 17:12:55 -07002063 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302064 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07002065 limExtractApCapability( pMac,
2066 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
2067 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
2068 &psessionEntry->limCurrentBssQosCaps,
2069 &psessionEntry->limCurrentBssPropCap,
2070 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002071 , &localPowerConstraint,
2072 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302073 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302074
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002075#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002076 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07002077#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302078 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002079#endif
Sushant Kaushikece4b562015-04-09 18:27:33 +05302080 if (!psessionEntry->maxTxPower)
2081 {
2082 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
2083 "is zero. Setting it to default value %d"),
2084 TX_POWER_DEFAULT);
2085 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2086 }
2087
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302088 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2089 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302090 " max tx = %d", regMax, localPowerConstraint,
2091 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002092
2093 if (pMac->lim.gLimCurrentBssUapsd)
2094 {
2095 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302096 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2097 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002098
2099 // resetting the dynamic uapsd mask
2100 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2101 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2102 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002103
2104 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2105
2106 // Initialize 11h Enable Flag
2107 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2108 {
2109 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302110 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002111 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302112 psessionEntry->lim11hEnable = 1;
2113 }
2114 else
2115 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 }
2117 else
2118 psessionEntry->lim11hEnable = 0;
2119
2120 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2121 pMac->lim.gLimIbssCoalescingHappened = false;
2122
Jeff Johnsone7245742012-09-05 17:12:55 -07002123 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2124 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2125 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002126
Abhishek Singh57aebef2014-02-03 18:47:44 +05302127 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2128 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2129 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2130 psessionEntry->currentOperChannel,
2131 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002132
2133 /* Indicate whether spectrum management is enabled*/
2134 psessionEntry->spectrumMgtEnabled =
2135 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302136
2137 /* Enable the spectrum management if this is a DFS channel */
2138 if (psessionEntry->countryInfoPresent &&
2139 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2140 {
2141 psessionEntry->spectrumMgtEnabled = TRUE;
2142 }
2143
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302144 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2145 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 /* Issue LIM_MLM_JOIN_REQ to MLM */
2147 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2148 return;
2149
2150 }
2151 else
2152 {
2153 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302154 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302155 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002156 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2157 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2158 psessionEntry = NULL;
2159 goto end;
2160
2161 }
2162
2163end:
2164 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2165
2166 if(pSmeJoinReq)
2167 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302168 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 pSmeJoinReq = NULL;
2170 if (NULL != psessionEntry)
2171 {
2172 psessionEntry->pLimJoinReq = NULL;
2173 }
2174 }
2175
2176 if(retCode != eSIR_SME_SUCCESS)
2177 {
2178 if(NULL != psessionEntry)
2179 {
2180 peDeleteSession(pMac,psessionEntry);
2181 psessionEntry = NULL;
2182 }
2183 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302184 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2185 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2187} /*** end __limProcessSmeJoinReq() ***/
2188
2189
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002190#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002191tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002192{
2193 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302194 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002195 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2197 maxTxPower = txPower;
2198 else if (txPower < MIN_TX_PWR_CAP)
2199 maxTxPower = MIN_TX_PWR_CAP;
2200 else
2201 maxTxPower = MAX_TX_PWR_CAP;
2202
2203 return (maxTxPower);
2204}
2205#endif
2206
Jeff Johnson295189b2012-06-20 16:38:30 -07002207/**
2208 * __limProcessSmeReassocReq()
2209 *
2210 *FUNCTION:
2211 * This function is called to process SME_REASSOC_REQ message
2212 * from HDD or upper layer application.
2213 *
2214 *LOGIC:
2215 *
2216 *ASSUMPTIONS:
2217 *
2218 *NOTE:
2219 *
2220 * @param pMac Pointer to Global MAC structure
2221 * @param *pMsgBuf A pointer to the SME message buffer
2222 * @return None
2223 */
2224
2225static void
2226__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2227{
2228 tANI_U16 caps;
2229 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002230 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 tLimMlmReassocReq *pMlmReassocReq;
2232 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2233 tpPESession psessionEntry = NULL;
2234 tANI_U8 sessionId;
2235 tANI_U8 smeSessionId;
2236 tANI_U16 transactionId;
2237 tPowerdBm localPowerConstraint = 0, regMax = 0;
2238 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002239 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002240
2241
Abhishek Singh127a8442014-12-15 17:31:27 +05302242 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002243
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002244 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302245 pReassocReq = vos_mem_malloc(nSize);
2246 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
2248 // Log error
2249 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302250 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002251
2252 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2253 goto end;
2254 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302255 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2257 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2258 (!limIsSmeJoinReqValid(pMac,
2259 (tpSirSmeJoinReq) pReassocReq)))
2260 {
2261 /// Received invalid eWNI_SME_REASSOC_REQ
2262 // Log the event
2263 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002264 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002265
2266 retCode = eSIR_SME_INVALID_PARAMETERS;
2267 goto end;
2268 }
2269
2270 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2271 {
2272 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002273 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 retCode = eSIR_SME_INVALID_PARAMETERS;
2275 goto end;
2276 }
2277
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302278#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2280#endif //FEATURE_WLAN_DIAG_SUPPORT
2281 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2282
2283 /* Store the reassoc handle in the session Table.. 23rd sep review */
2284 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302285 psessionEntry->dot11mode = pReassocReq->dot11mode;
2286 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002287
2288 /**
2289 * Reassociate request is expected
2290 * in link established state only.
2291 */
2292
2293 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2294 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002295#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2297 {
2298 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002299 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 psessionEntry->peSessionId);
2301
2302 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302303 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2305 {
2306 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2307 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002308 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 retCode = eSIR_SME_INVALID_PARAMETERS;
2310 goto end;
2311 }
2312
2313 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2314 return;
2315 }
2316#endif
2317 /// Should not have received eWNI_SME_REASSOC_REQ
2318 // Log the event
2319 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302320 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 psessionEntry->limSmeState);
2322 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2323
2324 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2325 goto end;
2326 }
2327
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302328 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2330 sizeof(tSirMacAddr));
2331
2332 psessionEntry->limReassocChannelId =
2333 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2334
Jeff Johnsone7245742012-09-05 17:12:55 -07002335 psessionEntry->reAssocHtSupportedChannelWidthSet =
2336 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2337 psessionEntry->reAssocHtRecommendedTxWidthSet =
2338 psessionEntry->reAssocHtSupportedChannelWidthSet;
2339 psessionEntry->reAssocHtSecondaryChannelOffset =
2340 psessionEntry->pLimReAssocReq->cbMode;
2341
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 psessionEntry->limReassocBssCaps =
2343 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2345 localPowerConstraint = regMax;
2346 limExtractApCapability( pMac,
2347 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2348 limGetIElenFromBssDescription(
2349 &psessionEntry->pLimReAssocReq->bssDescription),
2350 &psessionEntry->limReassocBssQosCaps,
2351 &psessionEntry->limReassocBssPropCap,
2352 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002353 , &localPowerConstraint,
2354 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 );
2356
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302357 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Sushant Kaushikece4b562015-04-09 18:27:33 +05302358 if (!psessionEntry->maxTxPower)
2359 {
2360 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
2361 "is zero. Setting it to default value %d"),
2362 TX_POWER_DEFAULT);
2363 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2364 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002365#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302366 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2367 "= %d, max tx = %d", regMax, localPowerConstraint,
2368 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002369#endif
2370 {
2371 #if 0
2372 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2373 &cfgLen) != eSIR_SUCCESS)
2374 {
2375 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002376 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 }
2378 #endif//TO SUPPORT BT-AMP
2379
2380 /* Copy the SSID from sessio entry to local variable */
2381 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302382 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 psessionEntry->ssId.ssId,
2384 psessionEntry->ssId.length);
2385 #endif
2386 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302387 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2389
2390 }
2391
2392 if (pMac->lim.gLimCurrentBssUapsd)
2393 {
2394 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302395 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2396 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 }
2398
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302399 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2400 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 {
2402 // Log error
2403 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302404 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002405
2406 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2407 goto end;
2408 }
2409
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302410 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002411 psessionEntry->limReAssocbssId,
2412 sizeof(tSirMacAddr));
2413
2414 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2415 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2416 != eSIR_SUCCESS)
2417 {
2418 /**
2419 * Could not get ReassocFailureTimeout value
2420 * from CFG. Log error.
2421 */
2422 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002423 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 }
2425
2426 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2427 {
2428 /**
2429 * Could not get Capabilities value
2430 * from CFG. Log error.
2431 */
2432 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002433 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435 pMlmReassocReq->capabilityInfo = caps;
2436
2437 /* Update PE sessionId*/
2438 pMlmReassocReq->sessionId = sessionId;
2439
2440 /* If telescopic beaconing is enabled, set listen interval to
2441 WNI_CFG_TELE_BCN_MAX_LI */
2442 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2443 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002444 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002445
2446 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2447
2448 if(teleBcnEn)
2449 {
2450 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2451 eSIR_SUCCESS)
2452 {
2453 /**
2454 * Could not get ListenInterval value
2455 * from CFG. Log error.
2456 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002457 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 }
2459 }
2460 else
2461 {
2462 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2463 {
2464 /**
2465 * Could not get ListenInterval value
2466 * from CFG. Log error.
2467 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002468 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 }
2470 }
2471
2472 /* Delete all BA sessions before Re-Assoc.
2473 * BA frames are class 3 frames and the session
2474 * is lost upon disassociation and reassociation.
2475 */
2476
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302477 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2478 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002479
2480 pMlmReassocReq->listenInterval = (tANI_U16) val;
2481
2482 /* Indicate whether spectrum management is enabled*/
2483 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2484
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302485 /* Enable the spectrum management if this is a DFS channel */
2486 if (psessionEntry->countryInfoPresent &&
2487 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2488 {
2489 psessionEntry->spectrumMgtEnabled = TRUE;
2490 }
2491
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2493 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2494
Jeff Johnsone7245742012-09-05 17:12:55 -07002495 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002496
2497 limPostMlmMessage(pMac,
2498 LIM_MLM_REASSOC_REQ,
2499 (tANI_U32 *) pMlmReassocReq);
2500 return;
2501
2502end:
2503 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302504 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002505
2506 if (psessionEntry)
2507 {
2508 // error occurred after we determined the session so extract
2509 // session and transaction info from there
2510 smeSessionId = psessionEntry->smeSessionId;
2511 transactionId = psessionEntry->transactionId;
2512 }
2513 else
2514 {
2515 // error occurred before or during the time we determined the session
2516 // so extract the session and transaction info from the message
2517 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2518 }
2519
2520 /// Send Reassoc failure response to host
2521 /// (note psessionEntry may be NULL, but that's OK)
2522 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2523 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2524 psessionEntry, smeSessionId, transactionId);
2525
2526} /*** end __limProcessSmeReassocReq() ***/
2527
2528
2529tANI_BOOLEAN sendDisassocFrame = 1;
2530/**
2531 * __limProcessSmeDisassocReq()
2532 *
2533 *FUNCTION:
2534 * This function is called to process SME_DISASSOC_REQ message
2535 * from HDD or upper layer application.
2536 *
2537 *LOGIC:
2538 *
2539 *ASSUMPTIONS:
2540 *
2541 *NOTE:
2542 *
2543 * @param pMac Pointer to Global MAC structure
2544 * @param *pMsgBuf A pointer to the SME message buffer
2545 * @return None
2546 */
2547
2548static void
2549__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2550{
2551 tANI_U16 disassocTrigger, reasonCode;
2552 tLimMlmDisassocReq *pMlmDisassocReq;
2553 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002554 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 tSirSmeDisassocReq smeDisassocReq;
2556 tpPESession psessionEntry = NULL;
2557 tANI_U8 sessionId;
2558 tANI_U8 smesessionId;
2559 tANI_U16 smetransactionId;
2560
Jeff Johnson295189b2012-06-20 16:38:30 -07002561
Jeff Johnson43971f52012-07-17 12:26:56 -07002562 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 return;
2566 }
2567
Jeff Johnson43971f52012-07-17 12:26:56 -07002568 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002569
Jeff Johnson43971f52012-07-17 12:26:56 -07002570 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002571
Jeff Johnson43971f52012-07-17 12:26:56 -07002572 if ( (eSIR_FAILURE == status) ||
2573 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 {
2575 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002576 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 if (pMac->lim.gLimRspReqd)
2579 {
2580 pMac->lim.gLimRspReqd = false;
2581
2582 retCode = eSIR_SME_INVALID_PARAMETERS;
2583 disassocTrigger = eLIM_HOST_DISASSOC;
2584 goto sendDisassoc;
2585 }
2586
2587 return;
2588 }
2589
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2591 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302592 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2593 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 retCode = eSIR_SME_INVALID_PARAMETERS;
2595 disassocTrigger = eLIM_HOST_DISASSOC;
2596 goto sendDisassoc;
2597
2598 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302599 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2600 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2601 smesessionId,psessionEntry->limSystemRole,
2602 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2603 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002604
2605#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2606 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2607#endif //FEATURE_WLAN_DIAG_SUPPORT
2608
2609 /* Update SME session Id and SME transaction ID*/
2610
2611 psessionEntry->smeSessionId = smesessionId;
2612 psessionEntry->transactionId = smetransactionId;
2613
2614 switch (psessionEntry->limSystemRole)
2615 {
2616 case eLIM_STA_ROLE:
2617 case eLIM_BT_AMP_STA_ROLE:
2618 switch (psessionEntry->limSmeState)
2619 {
2620 case eLIM_SME_ASSOCIATED_STATE:
2621 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302622 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2623 "limSmeState: %d "),psessionEntry->limSmeState);
2624
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2626 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002627#ifdef FEATURE_WLAN_TDLS
2628 /* Delete all TDLS peers connected before leaving BSS*/
2629 limDeleteTDLSPeers(pMac, psessionEntry);
2630#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002631 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 break;
2633
2634 case eLIM_SME_WT_DEAUTH_STATE:
2635 /* PE shall still process the DISASSOC_REQ and proceed with
2636 * link tear down even if it had already sent a DEAUTH_IND to
2637 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2638 * its been set when PE entered WT_DEAUTH_STATE.
2639 */
2640 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002641 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302642 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2643 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 break;
2645
2646 case eLIM_SME_WT_DISASSOC_STATE:
2647 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2648 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2649 * PE can continue processing DISASSOC_REQ and send the response instead
2650 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2651 * for disassoc frame.
2652 *
2653 * It will send a disassoc, which is ok. However, we can use the global flag
2654 * sendDisassoc to not send disassoc frame.
2655 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302656 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2657 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 break;
2659
2660 case eLIM_SME_JOIN_FAILURE_STATE: {
2661 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302662 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2663 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002664 if (pMac->lim.gLimRspReqd) {
2665 retCode = eSIR_SME_SUCCESS;
2666 disassocTrigger = eLIM_HOST_DISASSOC;
2667 goto sendDisassoc;
2668 }
2669 }break;
2670 default:
2671 /**
2672 * STA is not currently associated.
2673 * Log error and send response to host
2674 */
2675 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302676 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 psessionEntry->limSmeState);
2678 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2679
2680 if (pMac->lim.gLimRspReqd)
2681 {
2682 if (psessionEntry->limSmeState !=
2683 eLIM_SME_WT_ASSOC_STATE)
2684 pMac->lim.gLimRspReqd = false;
2685
2686 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2687 disassocTrigger = eLIM_HOST_DISASSOC;
2688 goto sendDisassoc;
2689 }
2690
2691 return;
2692 }
2693
2694 break;
2695
2696 case eLIM_AP_ROLE:
2697 case eLIM_BT_AMP_AP_ROLE:
2698 // Fall through
2699 break;
2700
2701 case eLIM_STA_IN_IBSS_ROLE:
2702 default: // eLIM_UNKNOWN_ROLE
2703 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002704 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 psessionEntry->limSystemRole);
2706
2707 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2708 disassocTrigger = eLIM_HOST_DISASSOC;
2709 goto sendDisassoc;
2710 } // end switch (pMac->lim.gLimSystemRole)
2711
Deepthi Gowri41716672015-07-27 17:18:13 +05302712 if (smeDisassocReq.reasonCode == eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON)
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 {
2714 /// Disassociation is triggered by Link Monitoring
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302715 limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 }
2718 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 disassocTrigger = eLIM_HOST_DISASSOC;
2720 reasonCode = smeDisassocReq.reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002721
2722 if (smeDisassocReq.doNotSendOverTheAir)
2723 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302724 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 sendDisassocFrame = 0;
2726 }
2727 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302728 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2729 " : %d, reasonCode : %d"),
2730 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302731 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2732 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 {
2734 // Log error
2735 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302736 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002737
2738 return;
2739 }
2740
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302741 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2743 sizeof(tSirMacAddr));
2744
2745 pMlmDisassocReq->reasonCode = reasonCode;
2746 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2747
2748 /* Update PE session ID*/
2749 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002750
2751 limPostMlmMessage(pMac,
2752 LIM_MLM_DISASSOC_REQ,
2753 (tANI_U32 *) pMlmDisassocReq);
2754 return;
2755
2756sendDisassoc:
2757 if (psessionEntry)
2758 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2759 retCode,
2760 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002761 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 else
2763 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2764 retCode,
2765 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002766 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002767
2768
2769} /*** end __limProcessSmeDisassocReq() ***/
2770
2771
2772/** -----------------------------------------------------------------
2773 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2774
2775 This function is called to process SME_DISASSOC_CNF message
2776 from HDD or upper layer application.
2777
2778 \param pMac - global mac structure
2779 \param pStaDs - station dph hash node
2780 \return none
2781 \sa
2782 ----------------------------------------------------------------- */
2783static void
2784__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2785{
2786 tSirSmeDisassocCnf smeDisassocCnf;
2787 tANI_U16 aid;
2788 tpDphHashNode pStaDs;
2789 tSirRetStatus status = eSIR_SUCCESS;
2790 tpPESession psessionEntry;
2791 tANI_U8 sessionId;
2792
2793
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302794 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002795
2796 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2797
2798 if (status == eSIR_FAILURE)
2799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002800 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 return;
2802 }
2803
2804 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2805 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002806 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 return;
2808 }
2809
2810 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2811 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302812 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 return;
2814 }
2815
2816#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2817 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2818 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2819 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2820 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2821#endif //FEATURE_WLAN_DIAG_SUPPORT
2822
2823 switch (psessionEntry->limSystemRole)
2824 {
2825 case eLIM_STA_ROLE:
2826 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2827 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2828 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2829 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2830 {
2831 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302832 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 psessionEntry->limSmeState);
2834 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2835 return;
2836 }
2837 break;
2838
2839 case eLIM_AP_ROLE:
2840 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002842
2843 case eLIM_STA_IN_IBSS_ROLE:
2844 default: // eLIM_UNKNOWN_ROLE
2845 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002846 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 psessionEntry->limSystemRole);
2848
2849 return;
2850 }
2851
2852
2853 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2854 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002855 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 )
2857 {
2858 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2859 if (pStaDs == NULL)
2860 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302861 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2862 "does not have context, addr= "MAC_ADDRESS_STR),
2863 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 return;
2865 }
Wu Gao742b7352015-10-16 19:10:40 +08002866
2867 if(aid != smeDisassocCnf.assocId)
2868 {
2869 PELOGE(limLog(pMac, LOGE, FL("same peerMacAddr but assocId is different "
2870 "aid=%d, assocId=%d, addr= "MAC_ADDRESS_STR),
2871 aid, smeDisassocCnf.assocId, MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
2872 return;
2873 }
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05302874 /*
2875 * If MlM state is either of del_sta or del_bss state, then no need to
2876 * go ahead and clean up further as there must be some cleanup in
2877 * progress from upper layer disassoc/deauth request.
2878 */
2879 if((pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_STA_RSP_STATE) ||
2880 (pStaDs->mlmStaContext.mlmState == eLIM_MLM_WT_DEL_BSS_RSP_STATE))
2881 {
2882 limLog(pMac, LOGE, FL("No need to cleanup for addr:"MAC_ADDRESS_STR
2883 "as Mlm state is %d"),
2884 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr),
2885 pStaDs->mlmStaContext.mlmState);
2886 return;
2887 }
2888
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002889 /* Delete FT session if there exists one */
2890 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002892
2893 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 }
2895
2896 return;
2897}
2898
2899
2900/**
2901 * __limProcessSmeDeauthReq()
2902 *
2903 *FUNCTION:
2904 * This function is called to process SME_DEAUTH_REQ message
2905 * from HDD or upper layer application.
2906 *
2907 *LOGIC:
2908 *
2909 *ASSUMPTIONS:
2910 *
2911 *NOTE:
2912 *
2913 * @param pMac Pointer to Global MAC structure
2914 * @param *pMsgBuf A pointer to the SME message buffer
2915 * @return None
2916 */
2917
2918static void
2919__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2920{
2921 tANI_U16 deauthTrigger, reasonCode;
2922 tLimMlmDeauthReq *pMlmDeauthReq;
2923 tSirSmeDeauthReq smeDeauthReq;
2924 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2925 tSirRetStatus status = eSIR_SUCCESS;
2926 tpPESession psessionEntry;
2927 tANI_U8 sessionId; //PE sessionId
2928 tANI_U8 smesessionId;
2929 tANI_U16 smetransactionId;
2930
Jeff Johnson295189b2012-06-20 16:38:30 -07002931
2932 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2934
2935 //We need to get a session first but we don't even know if the message is correct.
2936 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2937 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002938 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 retCode = eSIR_SME_INVALID_PARAMETERS;
2940 deauthTrigger = eLIM_HOST_DEAUTH;
2941 goto sendDeauth;
2942
2943 }
2944
2945 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2946 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302947 PELOGE(limLog(pMac, LOGE,FL
2948 ("received invalid SME_DEAUTH_REQ message"));)
2949 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002950
Sachin Ahuja42354142015-01-06 19:48:35 +05302951 retCode = eSIR_SME_INVALID_PARAMETERS;
2952 deauthTrigger = eLIM_HOST_DEAUTH;
2953 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302955 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2956 "Systemrole %d with reasoncode %u in limSmestate %d from "
2957 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2958 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2959 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002960#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2961 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2962#endif //FEATURE_WLAN_DIAG_SUPPORT
2963
2964 /* Update SME session ID and Transaction ID */
2965 psessionEntry->smeSessionId = smesessionId;
2966 psessionEntry->transactionId = smetransactionId;
2967
2968
2969 switch (psessionEntry->limSystemRole)
2970 {
2971 case eLIM_STA_ROLE:
2972 case eLIM_BT_AMP_STA_ROLE:
2973
2974 switch (psessionEntry->limSmeState)
2975 {
2976 case eLIM_SME_ASSOCIATED_STATE:
2977 case eLIM_SME_LINK_EST_STATE:
2978 case eLIM_SME_WT_ASSOC_STATE:
2979 case eLIM_SME_JOIN_FAILURE_STATE:
2980 case eLIM_SME_IDLE_STATE:
2981 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2982 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002983 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002984
2985 // Send Deauthentication request to MLM below
2986
2987 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302988 case eLIM_SME_WT_DEAUTH_STATE:
2989 /*
2990 * PE Recieved a Deauth frame. Normally it gets
2991 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2992 * means host is also trying to disconnect.
2993 * PE can continue processing DEAUTH_REQ and send
2994 * the response instead of failing the request.
2995 * SME will anyway ignore DEAUTH_IND that was sent
2996 * for deauth frame.
2997 */
2998 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2999 "SME_WT_DEAUTH_STATE. "));
3000 break;
Padma, Santhosh Kumar05600d32015-07-24 13:00:57 +05303001 case eLIM_SME_WT_DISASSOC_STATE:
3002 /*
3003 * PE Recieved a Disassoc frame. Normally it gets
3004 * DISASSOC_CNF but it received DEAUTH_REQ. This means
3005 * host is also trying to disconnect.
3006 */
3007 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
3008 "SME_WT_DISASSOC_STATE. "));
3009 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 default:
3011 /**
3012 * STA is not in a state to deauthenticate with
3013 * peer. Log error and send response to host.
3014 */
3015 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303016 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303017 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3019
3020 if (pMac->lim.gLimRspReqd)
3021 {
3022 pMac->lim.gLimRspReqd = false;
3023
3024 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
3025 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08003026 /**
3027 *here we received deauth request from AP so sme state is
3028 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
3029 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
3030 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
3031 so the below condition captures the state where delSta
3032 not done and firmware still in connected state.
3033 */
3034 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
3035 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
3036 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
3037 {
3038 retCode = eSIR_SME_DEAUTH_STATUS;
3039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 goto sendDeauth;
3041 }
3042
3043 return;
3044 }
3045
3046 break;
3047
3048 case eLIM_STA_IN_IBSS_ROLE:
Abhishek Singh92fbac22015-03-24 17:57:36 +05303049 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
3050 if (pMac->lim.gLimRspReqd)
3051 {
3052 pMac->lim.gLimRspReqd = false;
3053 retCode = eSIR_SME_INVALID_PARAMETERS;
3054 deauthTrigger = eLIM_HOST_DEAUTH;
3055 goto sendDeauth;
3056 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 return;
3058
3059 case eLIM_AP_ROLE:
3060 // Fall through
3061
3062 break;
3063
3064 default:
3065 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303066 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303067 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303068 if (pMac->lim.gLimRspReqd)
3069 {
3070 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003071
Abhishek Singh92fbac22015-03-24 17:57:36 +05303072 retCode = eSIR_SME_INVALID_PARAMETERS;
3073 deauthTrigger = eLIM_HOST_DEAUTH;
3074 goto sendDeauth;
3075 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303077
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 } // end switch (pMac->lim.gLimSystemRole)
3079
3080 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3081 {
3082 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303083 limLog(pMac, LOG1,
3084 FL("Deauthentication is triggered by Link Monitoring"));
3085 limLog(pMac, LOG1,
3086 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3087 limLog(pMac, LOG1,
3088 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3090 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3091 }
3092 else
3093 {
3094 deauthTrigger = eLIM_HOST_DEAUTH;
3095 reasonCode = smeDeauthReq.reasonCode;
3096 }
3097
3098 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303099 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3100 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 {
3102 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303103 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303104 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303105 if (pMac->lim.gLimRspReqd)
3106 {
3107 pMac->lim.gLimRspReqd = false;
3108 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3109 deauthTrigger = eLIM_HOST_DEAUTH;
3110 goto sendDeauth;
3111 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 return;
3113 }
3114
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303115 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003116 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3117 sizeof(tSirMacAddr));
3118
3119 pMlmDeauthReq->reasonCode = reasonCode;
3120 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003121
3122 /* Update PE session Id*/
3123 pMlmDeauthReq->sessionId = sessionId;
3124
3125 limPostMlmMessage(pMac,
3126 LIM_MLM_DEAUTH_REQ,
3127 (tANI_U32 *) pMlmDeauthReq);
3128 return;
3129
3130sendDeauth:
3131 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3132 retCode,
3133 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003134 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003135 smesessionId, smetransactionId);
3136} /*** end __limProcessSmeDeauthReq() ***/
3137
3138
3139
3140/**
3141 * __limProcessSmeSetContextReq()
3142 *
3143 *FUNCTION:
3144 * This function is called to process SME_SETCONTEXT_REQ message
3145 * from HDD or upper layer application.
3146 *
3147 *LOGIC:
3148 *
3149 *ASSUMPTIONS:
3150 *
3151 *NOTE:
3152 *
3153 * @param pMac Pointer to Global MAC structure
3154 * @param *pMsgBuf A pointer to the SME message buffer
3155 * @return None
3156 */
3157
3158static void
3159__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3160{
3161 tpSirSmeSetContextReq pSetContextReq;
3162 tLimMlmSetKeysReq *pMlmSetKeysReq;
3163 tpPESession psessionEntry;
3164 tANI_U8 sessionId; //PE sessionID
3165 tANI_U8 smesessionId;
3166 tANI_U16 smetransactionId;
3167
3168
3169 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003170 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003171
3172
3173 if(pMsgBuf == NULL)
3174 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003175 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 return;
3177 }
3178
3179 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303180
3181 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3182 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003183 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303184 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 return;
3186 }
3187
3188 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3189 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3190 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003191 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 goto end;
3193 }
3194
3195 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3196 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003197 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 -07003198 limSendSmeSetContextRsp(pMac,
3199 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003200 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 eSIR_SME_INVALID_PARAMETERS,NULL,
3202 smesessionId,smetransactionId);
3203
3204 goto end;
3205 }
3206
3207
3208 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3209 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003210 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003211 limSendSmeSetContextRsp(pMac,
3212 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003213 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 eSIR_SME_INVALID_PARAMETERS,NULL,
3215 smesessionId,smetransactionId);
3216
3217 goto end;
3218 }
3219
3220#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3221 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3222#endif //FEATURE_WLAN_DIAG_SUPPORT
3223
3224
3225 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3226 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3227 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3228 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3229 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3230 {
3231 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303232 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3233 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 {
3235 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303236 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 goto end;
3238 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05303239 vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3241 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3242 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3243 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003244 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 goto end;
3246 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303247 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3249 sizeof(tSirMacAddr));
3250
Jeff Johnson295189b2012-06-20 16:38:30 -07003251
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303252 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3254 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3255
3256 pMlmSetKeysReq->sessionId = sessionId;
3257#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3258 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003259 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003260#endif
3261
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3263 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3264 {
3265 if(pSetContextReq->keyMaterial.key[0].keyLength)
3266 {
3267 tANI_U8 keyId;
3268 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303269 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3271 }
3272 else {
3273 tANI_U32 i;
3274 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3275 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303276 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003277 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3278 }
3279 }
3280 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003281
3282 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 }
3284 else
3285 {
3286 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303287 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 psessionEntry->limSystemRole,
3289 psessionEntry->limSmeState);
3290 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3291
3292 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3295 smesessionId,
3296 smetransactionId);
3297 }
3298
3299end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303300 vos_mem_zero(pSetContextReq,
3301 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303302 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 return;
3304} /*** end __limProcessSmeSetContextReq() ***/
3305
3306/**
3307 * __limProcessSmeRemoveKeyReq()
3308 *
3309 *FUNCTION:
3310 * This function is called to process SME_REMOVEKEY_REQ message
3311 * from HDD or upper layer application.
3312 *
3313 *LOGIC:
3314 *
3315 *ASSUMPTIONS:
3316 *
3317 *NOTE:
3318 *
3319 * @param pMac Pointer to Global MAC structure
3320 * @param *pMsgBuf A pointer to the SME message buffer
3321 * @return None
3322 */
3323
3324static void
3325__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3326{
3327 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3328 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3329 tpPESession psessionEntry;
3330 tANI_U8 sessionId; //PE sessionID
3331 tANI_U8 smesessionId;
3332 tANI_U16 smetransactionId;
3333
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303334 limLog(pMac, LOG1,
3335 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336
3337 if(pMsgBuf == NULL)
3338 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003339 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 return;
3341 }
3342
3343
3344 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3345
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303346 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3347 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 {
3349 //Log error
3350 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303351 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003352
3353 return;
3354 }
3355
3356 if ((limRemoveKeyReqSerDes(pMac,
3357 pRemoveKeyReq,
3358 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3359 {
3360 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003361 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003362
3363 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3364
3365 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3366 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003367 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 //goto end;
3369 }
3370
3371 limSendSmeRemoveKeyRsp(pMac,
3372 pRemoveKeyReq->peerMacAddr,
3373 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3374 smesessionId,smetransactionId);
3375
3376 goto end;
3377 }
3378
3379 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3380 {
3381 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003382 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003383 limSendSmeRemoveKeyRsp(pMac,
3384 pRemoveKeyReq->peerMacAddr,
3385 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3386 smesessionId, smetransactionId);
3387 goto end;
3388 }
3389
3390
3391 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3392 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3393 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3394 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3395 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3396 {
3397 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303398 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3399 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 {
3401 // Log error
3402 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303403 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003404
3405 goto end;
3406 }
3407
3408 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3409 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3410 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3411 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3412
3413 /* Update PE session Id */
3414 pMlmRemoveKeyReq->sessionId = sessionId;
3415
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303416 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3418 sizeof(tSirMacAddr));
3419
3420
3421 limPostMlmMessage(pMac,
3422 LIM_MLM_REMOVEKEY_REQ,
3423 (tANI_U32 *) pMlmRemoveKeyReq);
3424 }
3425 else
3426 {
3427 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303428 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 psessionEntry->limSystemRole,
3430 psessionEntry->limSmeState);
3431 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3432
3433 limSendSmeRemoveKeyRsp(pMac,
3434 pRemoveKeyReq->peerMacAddr,
3435 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3436 smesessionId,smetransactionId);
3437 }
3438
3439end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303440 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003441} /*** end __limProcessSmeRemoveKeyReq() ***/
3442
Jeff Johnson295189b2012-06-20 16:38:30 -07003443void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3444{
3445 tSirMsgQ mmhMsg;
3446 tpSmeGetScanChnRsp pSirSmeRsp;
3447 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303448 tANI_U8 sessionId;
3449 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003450
3451 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3452 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003453 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003454 pMac->lim.scanChnInfo.numChnInfo);
3455 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3456 }
3457
Abhishek Singh525045c2014-12-15 17:18:45 +05303458 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003459 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303460 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003461
3462 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303463 pSirSmeRsp = vos_mem_malloc(len);
3464 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 {
3466 /// Buffer not available. Log error
3467 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303468 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003469
3470 return;
3471 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303472 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003473
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3475 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303476
3477 if (pMac->fScanOffload)
3478 {
3479 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3480 pSirSmeRsp->sessionId = sessionId;
3481 }
3482 else
3483 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003484
3485 if(pMac->lim.scanChnInfo.numChnInfo)
3486 {
3487 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303488 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3489 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 }
3491 //Clear the list
3492 limRessetScanChannelInfo(pMac);
3493
3494 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3495 mmhMsg.bodyptr = pSirSmeRsp;
3496 mmhMsg.bodyval = 0;
3497
3498 pMac->lim.gLimRspReqd = false;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05303499 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003500 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3501}
3502
3503
Jeff Johnson295189b2012-06-20 16:38:30 -07003504void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3505{
3506 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3507 tpDphHashNode pStaDs = NULL;
3508 tpPESession psessionEntry = NULL;
3509 tSap_Event sapEvent;
3510 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3511 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3512 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3513 tANI_U8 assocId = 0;
3514 tANI_U8 staCount = 0;
3515
3516 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3517 {
3518 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003519 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303520 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 }
3522
3523 switch (getAssocSTAsReq.modId)
3524 {
3525/**
3526 case VOS_MODULE_ID_HAL:
3527 wdaPostCtrlMsg( pMac, &msgQ );
3528 return;
3529
3530 case VOS_MODULE_ID_TL:
3531 Post msg TL
3532 return;
3533*/
3534 case VOS_MODULE_ID_PE:
3535 default:
3536 break;
3537 }
3538
Jeff Johnson1250df42012-12-10 14:31:52 -08003539 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 // Find PE session Entry
3541 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3542 {
3543 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003544 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003545 goto limAssocStaEnd;
3546 }
3547
3548 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3549 {
3550 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303551 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303552 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 goto limAssocStaEnd;
3554 }
3555
3556 // Retrieve values obtained in the request message
3557 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3558 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3559
3560 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3561 {
3562 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3563
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303564 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 continue;
3566
3567 if (pStaDs->valid)
3568 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303569 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3570 (tANI_U8 *)&pStaDs->staAddr,
3571 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3573 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3574
Kiet Lamb1233192013-11-28 13:38:20 +05303575 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003576 (tANI_U8 *)&pStaDs->supportedRates,
3577 sizeof(tSirSupportedRates));
3578 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3579 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3580 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3581
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003583 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3584 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003585 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3586 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3587
3588 pAssocStasTemp++;
3589 staCount++;
3590 }
3591 }
3592
3593limAssocStaEnd:
3594 // Call hdd callback with sap event to send the list of associated stations from PE
3595 if (pSapEventCallback != NULL)
3596 {
3597 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3598 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3599 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3600 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3601 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3602 }
3603}
3604
3605
3606/**
3607 * limProcessSmeGetWPSPBCSessions
3608 *
3609 *FUNCTION:
3610 * This function is called when query the WPS PBC overlap message is received
3611 *
3612 *LOGIC:
3613 * This function parses get WPS PBC overlap information message and call callback to pass
3614 * WPS PBC overlap information back to hdd.
3615 *ASSUMPTIONS:
3616 *
3617 *
3618 *NOTE:
3619 *
3620 * @param pMac Pointer to Global MAC structure
3621 * @param pMsgBuf A pointer to WPS PBC overlap query message
3622*
3623 * @return None
3624 */
3625void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3626{
3627 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3628 tpPESession psessionEntry = NULL;
3629 tSap_Event sapEvent;
3630 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3631 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3632 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3633
3634 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3635
3636 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3637 {
3638 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003639 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303640 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 }
3642
Jeff Johnson1250df42012-12-10 14:31:52 -08003643 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 // Find PE session Entry
3645 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3646 {
3647 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003648 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 goto limGetWPSPBCSessionsEnd;
3650 }
3651
3652 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3653 {
3654 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303655 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003656 psessionEntry->limSystemRole);
3657 goto limGetWPSPBCSessionsEnd;
3658 }
3659
Jeff Johnson1250df42012-12-10 14:31:52 -08003660 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3662 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3663
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303664 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 { //This is GetWpsSession call
3666
3667 limGetWPSPBCSessions(pMac,
3668 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3669 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3670 }
3671 else
3672 {
3673 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3674 /* don't have to inform the HDD/Host */
3675 return;
3676 }
3677
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003678 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003679 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3680
3681 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3682
3683limGetWPSPBCSessionsEnd:
3684 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303685
3686 if (NULL != pSapEventCallback)
3687 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003688}
3689
Jeff Johnson295189b2012-06-20 16:38:30 -07003690
3691
3692/**
3693 * __limCounterMeasures()
3694 *
3695 * FUNCTION:
3696 * This function is called to "implement" MIC counter measure
3697 * and is *temporary* only
3698 *
3699 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3700 * we don't do the proper STA disassoc sequence since the
3701 * BSS will be stoped anyway
3702 *
3703 *ASSUMPTIONS:
3704 *
3705 *NOTE:
3706 *
3707 * @param pMac Pointer to Global MAC structure
3708 * @return None
3709 */
3710
3711static void
3712__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3713{
3714 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303715 /* If PMF is enabled then don't send broadcast disassociation */
3716 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3717 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3718 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3719#ifdef WLAN_FEATURE_11W
3720 && !psessionEntry->limRmfEnabled
3721#endif
3722 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003723 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003724
Jeff Johnson295189b2012-06-20 16:38:30 -07003725};
3726
3727
Jeff Johnson295189b2012-06-20 16:38:30 -07003728void
3729limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3730{
3731 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3732 tpPESession psessionEntry;
3733 tANI_U8 sessionId; //PE sessionId
3734
3735 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3736 {
3737 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003738 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 return;
3740 }
3741
3742 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3743 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003744 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 return;
3746 }
3747
3748 if ( tkipCntrMeasReq.bEnable )
3749 {
3750 __limCounterMeasures( pMac, psessionEntry );
3751 }
3752
3753 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3754}
Jeff Johnson295189b2012-06-20 16:38:30 -07003755
3756
3757static void
3758__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3759{
3760 tSirSmeStopBssReq stopBssReq;
3761 tSirRetStatus status;
3762 tLimSmeStates prevState;
3763 tANI_U8 sessionId; //PE sessionId
3764 tpPESession psessionEntry;
3765 tANI_U8 smesessionId;
3766 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303767 tANI_U8 i = 0;
3768 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003769
3770 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3771
3772
3773
3774 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3775 !limIsSmeStopBssReqValid(pMsgBuf))
3776 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003777 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 /// Send Stop BSS response to host
3779 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3780 return;
3781 }
3782
3783
3784 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3785 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003786 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3788 return;
3789 }
3790
3791#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3792 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3793#endif //FEATURE_WLAN_DIAG_SUPPORT
3794
3795
3796 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3797 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3798 {
3799 /**
3800 * Should not have received STOP_BSS_REQ in states
3801 * other than 'normal' state or on STA in Infrastructure
3802 * mode. Log error and return response to host.
3803 */
3804 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303805 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3807 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3808 /// Send Stop BSS response to host
3809 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3810 return;
3811 }
3812
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3814 {
3815 limWPSPBCClose(pMac, psessionEntry);
3816 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003817 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003818
3819 prevState = psessionEntry->limSmeState;
3820
3821 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003822 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003823
3824 /* Update SME session Id and Transaction Id */
3825 psessionEntry->smeSessionId = smesessionId;
3826 psessionEntry->transactionId = smetransactionId;
3827
Abhishek Singh8944b222014-09-17 16:13:17 +05303828 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3829 * If PMF is enabled then don't send broadcast disassociation */
3830 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3831 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3832#ifdef WLAN_FEATURE_11W
3833 && !psessionEntry->limRmfEnabled
3834#endif
3835 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003836 {
3837 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3838 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3839 // Send disassoc all stations associated thru TKIP
3840 __limCounterMeasures(pMac,psessionEntry);
3841 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303842 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 }
3844
3845 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3846 pMac->lim.gLimIbssCoalescingHappened = false;
3847
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303848 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3849 {
3850 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3851 if (NULL == pStaDs)
3852 continue;
3853 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3854 if(eSIR_SUCCESS == status)
3855 {
3856 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3857 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3858 }
3859 else
3860 {
3861 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3862 VOS_ASSERT(0) ;
3863 }
3864 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003865 /* send a delBss to HAL and wait for a response */
3866 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3867
3868 if (status != eSIR_SUCCESS)
3869 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003870 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003871 psessionEntry->limSmeState= prevState;
3872
Jeff Johnsone7245742012-09-05 17:12:55 -07003873 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003874
3875 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3876 }
3877}
3878
3879
3880/**--------------------------------------------------------------
3881\fn __limProcessSmeStopBssReq
3882
3883\brief Wrapper for the function __limHandleSmeStopBssRequest
3884 This message will be defered until softmac come out of
3885 scan mode. Message should be handled even if we have
3886 detected radar in the current operating channel.
3887\param pMac
3888\param pMsg
3889
3890\return TRUE - If we consumed the buffer
3891 FALSE - If have defered the message.
3892 ---------------------------------------------------------------*/
3893static tANI_BOOLEAN
3894__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3895{
3896 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3897 {
3898 /**
3899 * If message defered, buffer is not consumed yet.
3900 * So return false
3901 */
3902 return eANI_BOOLEAN_FALSE;
3903 }
3904 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3905 return eANI_BOOLEAN_TRUE;
3906} /*** end __limProcessSmeStopBssReq() ***/
3907
3908
3909void limProcessSmeDelBssRsp(
3910 tpAniSirGlobal pMac,
3911 tANI_U32 body,tpPESession psessionEntry)
3912{
3913
3914 (void) body;
3915 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3916 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003917 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3919 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3921 return;
3922}
3923
3924
Jeff Johnson295189b2012-06-20 16:38:30 -07003925/**---------------------------------------------------------------
3926\fn __limProcessSmeAssocCnfNew
3927\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3928\ in BTAMP AP.
3929\
3930\param pMac
3931\param msgType - message type
3932\param pMsgBuf - a pointer to the SME message buffer
3933\return None
3934------------------------------------------------------------------*/
3935
3936 void
3937__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3938{
3939 tSirSmeAssocCnf assocCnf;
3940 tpDphHashNode pStaDs = NULL;
3941 tpPESession psessionEntry= NULL;
3942 tANI_U8 sessionId;
3943
3944
3945 if(pMsgBuf == NULL)
3946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003947 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 goto end;
3949 }
3950
3951 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3952 !__limIsSmeAssocCnfValid(&assocCnf))
3953 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003954 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 goto end;
3956 }
3957
3958 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3959 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003960 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 goto end;
3962 }
3963
3964 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3965 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3966 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303967 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303968 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003969 goto end;
3970 }
3971
3972 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3973
3974 if (pStaDs == NULL)
3975 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303976 limLog(pMac, LOGE,
3977 FL("Received invalid message %X due to no STA context, "
3978 "for aid %d, peer "),
3979 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003980 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3981
3982 /*
3983 ** send a DISASSOC_IND message to WSM to make sure
3984 ** the state in WSM and LIM is the same
3985 **/
3986 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3987 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3988 goto end;
3989 }
3990 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303991 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 (tANI_U8 *) assocCnf.peerMacAddr,
3993 sizeof(tSirMacAddr)) ) ||
3994 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3995 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3996 (msgType != eWNI_SME_ASSOC_CNF)) ||
3997 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304000 limLog(pMac, LOGE,
4001 FL("Received invalid message %X due to peerMacAddr mismatched "
4002 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
4003 "StaD mlmState : %d"),
4004 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
4006 goto end;
4007 }
4008
4009 /*
4010 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
4011 ** has been received
4012 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004013 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
4015
4016 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
4017 {
4018 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
4019 * when it had received Assoc Request frame. Now, PE just needs to send
4020 * Association Response frame to the requesting BTAMP-STA.
4021 */
4022 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004023 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004024 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
4025 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
4026 goto end;
4027 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
4028 else
4029 {
4030 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
4031 /*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*/
4032 if(!pStaDs->mlmStaContext.updateContext)
4033 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304034 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
4035 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004036 limRejectAssociation(pMac, pStaDs->staAddr,
4037 pStaDs->mlmStaContext.subType,
4038 true, pStaDs->mlmStaContext.authType,
4039 pStaDs->assocId, true,
4040 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 }
4042
4043end:
4044 if((psessionEntry != NULL) && (pStaDs != NULL))
4045 {
4046 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4047 {
4048 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4049 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304050 vos_mem_free(((tpSirAssocReq)
4051 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4053 }
4054
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304055 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004056 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4057 }
4058 }
4059
4060} /*** end __limProcessSmeAssocCnfNew() ***/
4061
4062
Jeff Johnson295189b2012-06-20 16:38:30 -07004063
4064
4065static void
4066__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4067{
4068 tpDphHashNode pStaDs;
4069 tSirMacAddr peerMac;
4070 tpSirAddtsReq pSirAddts;
4071 tANI_U32 timeout;
4072 tpPESession psessionEntry;
4073 tANI_U8 sessionId; //PE sessionId
4074 tANI_U8 smesessionId;
4075 tANI_U16 smetransactionId;
4076
4077
4078 if(pMsgBuf == NULL)
4079 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004080 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 return;
4082 }
4083
4084 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4085
4086 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4087
4088 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4089 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004090 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004091 return;
4092 }
4093#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4094 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4095#endif //FEATURE_WLAN_DIAG_SUPPORT
4096
4097
4098
4099 /* if sta
4100 * - verify assoc state
4101 * - send addts request to ap
4102 * - wait for addts response from ap
4103 * if ap, just ignore with error log
4104 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304105 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004106 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304108 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004109
4110 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4111 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004112 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
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
Jeff Johnson295189b2012-06-20 16:38:30 -07004118 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4119
4120 if(pStaDs == NULL)
4121 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004122 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004123 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4124 smesessionId,smetransactionId);
4125 return;
4126 }
4127
4128 if ((! pStaDs->valid) ||
4129 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4130 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004131 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004132 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4133 smesessionId,smetransactionId);
4134 return;
4135 }
4136
4137 pSirAddts->req.wsmTspecPresent = 0;
4138 pSirAddts->req.wmeTspecPresent = 0;
4139 pSirAddts->req.lleTspecPresent = 0;
4140
4141 if ((pStaDs->wsmEnabled) &&
4142 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4143 pSirAddts->req.wsmTspecPresent = 1;
4144 else if (pStaDs->wmeEnabled)
4145 pSirAddts->req.wmeTspecPresent = 1;
4146 else if (pStaDs->lleEnabled)
4147 pSirAddts->req.lleTspecPresent = 1;
4148 else
4149 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004150 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4152 smesessionId,smetransactionId);
4153 return;
4154 }
4155
4156 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4157 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004159 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 psessionEntry->limSmeState);
4161 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4162 smesessionId,smetransactionId);
4163 return;
4164 }
4165
4166 if (pMac->lim.gLimAddtsSent)
4167 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004168 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 pMac->lim.gLimAddtsReq.req.dialogToken,
4170 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4171 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4172 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4173 smesessionId,smetransactionId);
4174 return;
4175 }
4176
4177 #if 0
4178 val = sizeof(tSirMacAddr);
4179 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4180 {
4181 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004182 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 return;
4184 }
4185 #endif
4186 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4187
4188 // save the addts request
4189 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304190 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004191
4192 // ship out the message now
4193 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4194 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304195 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004196
4197 // start a timer to wait for the response
4198 if (pSirAddts->timeout)
4199 timeout = pSirAddts->timeout;
4200 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4201 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004202 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004203 WNI_CFG_ADDTS_RSP_TIMEOUT);
4204 return;
4205 }
4206
4207 timeout = SYS_MS_TO_TICKS(timeout);
4208 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4209 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004210 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 return;
4212 }
4213 pMac->lim.gLimAddtsRspTimerCount++;
4214 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4215 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4216 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004217 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 return;
4219 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004220 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004221
4222 //add the sessionId to the timer object
4223 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4224 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4225 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004226 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004227 return;
4228 }
4229 return;
4230}
4231
4232
4233static void
4234__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4235{
4236 tSirMacAddr peerMacAddr;
4237 tANI_U8 ac;
4238 tSirMacTSInfo *pTsinfo;
4239 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4240 tpDphHashNode pStaDs = NULL;
4241 tpPESession psessionEntry;
4242 tANI_U8 sessionId;
4243 tANI_U32 status = eSIR_SUCCESS;
4244 tANI_U8 smesessionId;
4245 tANI_U16 smetransactionId;
4246
4247 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4248
4249 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4250 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004251 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004252 status = eSIR_FAILURE;
4253 goto end;
4254 }
4255#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4256 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4257#endif //FEATURE_WLAN_DIAG_SUPPORT
4258
4259
4260 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4261 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004262 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004263 status = eSIR_FAILURE;
4264 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4265 return;
4266 }
4267
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304268 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4269 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4270 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004271
4272 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4273 psessionEntry);
4274
4275 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4276
4277 /* We've successfully send DELTS frame to AP. Update the
4278 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4279 * is no longer trigger enabled or delivery enabled
4280 */
4281 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4282
4283 /* We're deleting the TSPEC, so this particular AC is no longer
4284 * admitted. PE needs to downgrade the EDCA
4285 * parameters(for the AC for which TS is being deleted) to the
4286 * next best AC for which ACM is not enabled, and send the
4287 * updated values to HAL.
4288 */
4289 ac = upToAc(pTsinfo->traffic.userPrio);
4290
4291 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4292 {
4293 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4294 }
4295 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4296 {
4297 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4298 }
4299 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4300 {
4301 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4302 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4303 }
4304
4305 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4306
4307 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4308 if (pStaDs != NULL)
4309 {
4310 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4311 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4312 else
4313 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4314 status = eSIR_SUCCESS;
4315 }
4316 else
4317 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004318 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 status = eSIR_FAILURE;
4320 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004321#ifdef FEATURE_WLAN_ESE
4322#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004323 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4324#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004326#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004327#endif
4328
4329 // send an sme response back
4330 end:
4331 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4332}
4333
4334
4335void
4336limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4337{
4338 //fetch the sessionEntry based on the sessionId
4339 tpPESession psessionEntry;
4340 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4341 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004342 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004343 return;
4344 }
4345
4346 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4347 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004348 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 pMac->lim.gLimAddtsSent = false;
4350 return;
4351 }
4352
4353 if (! pMac->lim.gLimAddtsSent)
4354 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004355 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004356 return;
4357 }
4358
4359 if (param != pMac->lim.gLimAddtsRspTimerCount)
4360 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004361 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 param, pMac->lim.gLimAddtsRspTimerCount);
4363 return;
4364 }
4365
4366 // this a real response timeout
4367 pMac->lim.gLimAddtsSent = false;
4368 pMac->lim.gLimAddtsRspTimerCount++;
4369
4370 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4371 psessionEntry->smeSessionId, psessionEntry->transactionId);
4372}
4373
4374
4375/**
4376 * __limProcessSmeStatsRequest()
4377 *
4378 *FUNCTION:
4379 *
4380 *
4381 *NOTE:
4382 *
4383 * @param pMac Pointer to Global MAC structure
4384 * @param *pMsgBuf A pointer to the SME message buffer
4385 * @return None
4386 */
4387static void
4388__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4389{
4390 tpAniGetStatsReq pStatsReq;
4391 tSirMsgQ msgQ;
4392 tpPESession psessionEntry;
4393 tANI_U8 sessionId;
4394
4395
4396 if(pMsgBuf == NULL)
4397 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004398 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004399 return;
4400 }
4401
4402 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4403
4404 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4405 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004406 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304407 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004408 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004409 return;
4410 }
4411
4412
4413
4414 switch(pStatsReq->msgType)
4415 {
4416 //Add Lim stats here. and send reqsponse.
4417
4418 //HAL maintained Stats.
4419 case eWNI_SME_STA_STAT_REQ:
4420 msgQ.type = WDA_STA_STAT_REQ;
4421 break;
4422 case eWNI_SME_AGGR_STAT_REQ:
4423 msgQ.type = WDA_AGGR_STAT_REQ;
4424 break;
4425 case eWNI_SME_GLOBAL_STAT_REQ:
4426 msgQ.type = WDA_GLOBAL_STAT_REQ;
4427 break;
4428 case eWNI_SME_STAT_SUMM_REQ:
4429 msgQ.type = WDA_STAT_SUMM_REQ;
4430 break;
4431 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004432 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304433 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004434 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 return;
4436 }
4437
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 msgQ.reserved = 0;
4439 msgQ.bodyptr = pMsgBuf;
4440 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004441 if(NULL == psessionEntry)
4442 {
4443 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4444 }
4445 else
4446 {
4447 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4448 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004449 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004450 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304451 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004452 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004453 return;
4454 }
4455
4456 return;
4457}
4458
4459
4460/**
4461 * __limProcessSmeGetStatisticsRequest()
4462 *
4463 *FUNCTION:
4464 *
4465 *
4466 *NOTE:
4467 *
4468 * @param pMac Pointer to Global MAC structure
4469 * @param *pMsgBuf A pointer to the SME message buffer
4470 * @return None
4471 */
4472static void
4473__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4474{
4475 tpAniGetPEStatsReq pPEStatsReq;
4476 tSirMsgQ msgQ;
4477
4478 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4479
4480 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4481
4482 msgQ.type = WDA_GET_STATISTICS_REQ;
4483
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 msgQ.reserved = 0;
4485 msgQ.bodyptr = pMsgBuf;
4486 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004487 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004488
4489 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304490 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004491 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004492 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 return;
4494 }
4495
4496 return;
4497}
4498
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004499#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004500/**
4501 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4502 *
4503 *NOTE:
4504 *
4505 * @param pMac Pointer to Global MAC structure
4506 * @param *pMsgBuf A pointer to the SME message buffer
4507 * @return None
4508 */
4509static void
4510__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4511{
4512 tSirMsgQ msgQ;
4513
4514 msgQ.type = WDA_TSM_STATS_REQ;
4515 msgQ.reserved = 0;
4516 msgQ.bodyptr = pMsgBuf;
4517 msgQ.bodyval = 0;
4518 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4519
4520 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4521 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004522 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004523 limLog(pMac, LOGP, "Unable to forward request");
4524 return;
4525 }
4526}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004527#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004528
4529
Jeff Johnson295189b2012-06-20 16:38:30 -07004530
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004531#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004532/**
4533 * __limProcessSmeGetRoamRssiRequest()
4534 *
4535 *FUNCTION:
4536 *
4537 *
4538 *NOTE:
4539 *
4540 * @param pMac Pointer to Global MAC structure
4541 * @param *pMsgBuf A pointer to the SME message buffer
4542 * @return None
4543 */
4544static void
4545__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4546{
4547 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4548 tSirMsgQ msgQ;
4549
4550 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4551 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4552
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004553 msgQ.reserved = 0;
4554 msgQ.bodyptr = pMsgBuf;
4555 msgQ.bodyval = 0;
4556 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4557
4558 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304559 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004560 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004561 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004562 return;
4563 }
4564
4565 return;
4566}
4567#endif
4568
4569
Jeff Johnson295189b2012-06-20 16:38:30 -07004570static void
4571__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4572{
4573 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4574 tpPESession psessionEntry;
4575 tANI_U8 sessionId; //PE sessionID
4576
4577 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004578 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004579
4580 if(pMsgBuf == NULL)
4581 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004582 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 return;
4584 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004585
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304586 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4587 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304589 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004590 return;
4591 }
4592
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004593 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004595 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 goto end;
4597 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004598
Jeff Johnson295189b2012-06-20 16:38:30 -07004599 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4600 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004601 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 goto end;
4603 }
4604
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304605 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004606
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004608 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004609
4610end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304611 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004612 return;
4613} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4614
4615static void
4616__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4617{
4618 tpSirUpdateParams pUpdateParams;
4619 tpPESession psessionEntry;
4620
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304621 limLog(pMac, LOG1,
4622 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004623
4624 if(pMsgBuf == NULL)
4625 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004626 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004627 return;
4628 }
4629
4630 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4631
4632 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004634 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004635 pUpdateParams->sessionId);
4636 return;
4637 }
4638
4639 /* Update the session entry */
4640 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4641
4642 /* Update beacon */
4643 schSetFixedBeaconFields(pMac, psessionEntry);
4644 limSendBeaconInd(pMac, psessionEntry);
4645
4646 return;
4647} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4648
4649static void
4650__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4651{
4652 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4653 tpPESession psessionEntry;
4654 tANI_U8 sessionId; //PE sessionID
4655
4656 if(pMsgBuf == NULL)
4657 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004658 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004659 return;
4660 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304661
4662 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4663 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304665 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 return;
4667 }
4668
4669 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4670 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004671 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004672 goto end;
4673 }
4674
4675 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4676 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004677 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 goto end;
4679 }
4680
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304681 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4682 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004683
4684 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4685
4686 psessionEntry->pLimStartBssReq->privacy = 1;
4687 psessionEntry->privacy = 1;
4688
4689 schSetFixedBeaconFields(pMac, psessionEntry);
4690 limSendBeaconInd(pMac, psessionEntry);
4691
4692end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304693 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004694 return;
4695} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4696
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004697/*
4698Update the beacon Interval dynamically if beaconInterval is different in MCC
4699*/
4700static void
4701__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4702{
4703 tpSirChangeBIParams pChangeBIParams;
4704 tpPESession psessionEntry;
4705 tANI_U8 sessionId = 0;
4706 tUpdateBeaconParams beaconParams;
4707
4708 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004709 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004710
4711 if(pMsgBuf == NULL)
4712 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004713 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004714 return;
4715 }
4716
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304717 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004718 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4719
4720 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4721 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004722 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004723 return;
4724 }
4725
4726 /*Update sessionEntry Beacon Interval*/
4727 if(psessionEntry->beaconParams.beaconInterval !=
4728 pChangeBIParams->beaconInterval )
4729 {
4730 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4731 }
4732
4733 /*Update sch beaconInterval*/
4734 if(pMac->sch.schObject.gSchBeaconInterval !=
4735 pChangeBIParams->beaconInterval )
4736 {
4737 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4738
4739 PELOG1(limLog(pMac, LOG1,
4740 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4741
4742 /* Update beacon */
4743 schSetFixedBeaconFields(pMac, psessionEntry);
4744
Sunil Ravib96f7b52013-05-22 21:40:05 -07004745 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004746 //Set change in beacon Interval
4747 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004748 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004749 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4750 }
4751
4752 return;
4753} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4754
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304755/** -------------------------------------------------------------
4756\fn
4757\brief handles indication message from HDD to update HT mode
4758\param tpAniSirGlobal pMac
4759\param tANI_U32 pMsgBuf
4760\return None
4761-------------------------------------------------------------*/
4762#ifdef WLAN_FEATURE_AP_HT40_24G
4763static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4764{
4765 tpSirSetHT2040Mode pSetHT2040Mode;
4766 tpPESession psessionEntry;
4767 tANI_U8 sessionId = 0;
4768 tUpdateVHTOpMode *pHtOpMode = NULL;
4769 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004770
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304771 PELOG1(limLog(pMac, LOGRW,
4772 FL("received Set HT 20/40 mode message")););
4773
4774 if(pMsgBuf == NULL)
4775 {
4776 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4777 return;
4778 }
4779
4780 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4781
4782 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4783 &sessionId)) == NULL)
4784 {
4785 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4786 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4787 return;
4788 }
4789
4790 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4791 pSetHT2040Mode->cbMode);
4792
4793 /*Update sessionEntry HT related fields*/
4794 switch(pSetHT2040Mode->cbMode)
4795 {
4796 case PHY_SINGLE_CHANNEL_CENTERED:
4797 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4798 psessionEntry->htRecommendedTxWidthSet = 0;
4799 break;
4800 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4801 psessionEntry->htSecondaryChannelOffset =
4802 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4803 psessionEntry->htRecommendedTxWidthSet = 1;
4804 break;
4805 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4806 psessionEntry->htSecondaryChannelOffset =
4807 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4808 psessionEntry->htRecommendedTxWidthSet = 1;
4809 break;
4810 default:
4811 limLog(pMac, LOGE,FL("Invalid cbMode"));
4812 return;
4813 }
4814
4815 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4816 " htSecondaryChannelOffset: %d"
4817 " htRecommendedTxWidthSet :%d"),
4818 pSetHT2040Mode->cbMode,
4819 psessionEntry->htSecondaryChannelOffset,
4820 psessionEntry->htRecommendedTxWidthSet);
4821
4822 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4823
4824 /* Update beacon */
4825 schSetFixedBeaconFields(pMac, psessionEntry);
4826 limSendBeaconInd(pMac, psessionEntry);
4827
4828 /* Update OP Mode */
4829 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4830 if ( NULL == pHtOpMode )
4831 {
4832 limLog(pMac, LOGE,
4833 FL("Not able to allocate memory for setting OP mode"));
4834 return;
4835 }
4836
4837 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4838 PHY_SINGLE_CHANNEL_CENTERED)?
4839 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4840
4841 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4842 * operating mode for all connected STA.
4843 */
4844
4845 pHtOpMode->staId = psessionEntry->staId;
4846
4847 msg.type = WDA_UPDATE_OP_MODE;
4848 msg.reserved = 0;
4849 msg.bodyptr = pHtOpMode;
4850
4851 if (!VOS_IS_STATUS_SUCCESS(
4852 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4853 {
4854 limLog(pMac, LOGE,
4855 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4856 vos_mem_free(pHtOpMode);
4857 return;
4858 }
4859
4860 limLog(pMac, LOGW,
4861 FL("Notifed FW about OP mode: %d for staId=%d"),
4862 pHtOpMode->opMode, pHtOpMode->staId);
4863
4864 return;
4865}
4866#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004867
4868/** -------------------------------------------------------------
4869\fn limProcessSmeDelBaPeerInd
4870\brief handles indication message from HDD to send delete BA request
4871\param tpAniSirGlobal pMac
4872\param tANI_U32 pMsgBuf
4873\return None
4874-------------------------------------------------------------*/
4875void
4876limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4877{
4878 tANI_U16 assocId =0;
4879 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4880 tpDphHashNode pSta;
4881 tpPESession psessionEntry;
4882 tANI_U8 sessionId;
4883
4884
4885
4886 if(NULL == pSmeDelBAPeerInd)
4887 return;
4888
4889 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4890 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004891 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004892 return;
4893 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004894 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4896
4897 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4898 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4899 pSta,
4900 pSmeDelBAPeerInd->baDirection,
4901 pSmeDelBAPeerInd->baTID,
4902 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4903 {
4904 limLog( pMac, LOGW,
4905 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4906 if (pSta)
4907 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4908 }
4909}
4910
4911// --------------------------------------------------------------------
4912/**
4913 * __limProcessReportMessage
4914 *
4915 * FUNCTION: Processes the next received Radio Resource Management message
4916 *
4917 * LOGIC:
4918 *
4919 * ASSUMPTIONS:
4920 *
4921 * NOTE:
4922 *
4923 * @param None
4924 * @return None
4925 */
4926
4927void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4928{
4929#ifdef WLAN_FEATURE_VOWIFI
4930 switch (pMsg->type)
4931 {
4932 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4933 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4934 break;
4935 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4936 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004937#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004938 tpSirBeaconReportXmitInd pBcnReport=NULL;
4939 tpPESession psessionEntry=NULL;
4940 tANI_U8 sessionId;
4941
4942 if(pMsg->bodyptr == NULL)
4943 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004944 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004945 return;
4946 }
4947 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4948 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4949 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004950 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 return;
4952 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004953 if (psessionEntry->isESEconnection)
4954 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 else
4956#endif
4957 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4958 }
4959 break;
4960 }
4961#endif
4962}
4963
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004964#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004965// --------------------------------------------------------------------
4966/**
4967 * limSendSetMaxTxPowerReq
4968 *
4969 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4970 *
4971 * LOGIC:
4972 *
4973 * ASSUMPTIONS:
4974 *
4975 * NOTE:
4976 *
4977 * @param txPower txPower to be set.
4978 * @param pSessionEntry session entry.
4979 * @return None
4980 */
4981tSirRetStatus
4982limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4983{
4984 tpMaxTxPowerParams pMaxTxParams = NULL;
4985 tSirRetStatus retCode = eSIR_SUCCESS;
4986 tSirMsgQ msgQ;
4987
4988 if( pSessionEntry == NULL )
4989 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004990 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 return eSIR_FAILURE;
4992 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304993
4994 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4995 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004996 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004997 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004998 return eSIR_MEM_ALLOC_FAILED;
4999
5000 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005001#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305002 limLog( pMac, LOG1,
5003 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005004#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005005 if( pMaxTxParams == NULL )
5006 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305007 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07005008 return eSIR_FAILURE;
5009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005010 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305011 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
5012 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005013
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005014 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
5015 msgQ.bodyptr = pMaxTxParams;
5016 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305017 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005018 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
5019 retCode = wdaPostCtrlMsg(pMac, &msgQ);
5020 if (eSIR_SUCCESS != retCode)
5021 {
5022 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305023 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07005024 }
5025 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005026}
5027#endif
5028
5029/**
5030 * __limProcessSmeAddStaSelfReq()
5031 *
5032 *FUNCTION:
5033 * This function is called to process SME_ADD_STA_SELF_REQ message
5034 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
5035 *
5036 *LOGIC:
5037 *
5038 *ASSUMPTIONS:
5039 *
5040 *NOTE:
5041 *
5042 * @param pMac Pointer to Global MAC structure
5043 * @param *pMsgBuf A pointer to the SME message buffer
5044 * @return None
5045 */
5046
5047static void
5048__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5049{
5050 tSirMsgQ msg;
5051 tpAddStaSelfParams pAddStaSelfParams;
5052 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5053
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305054 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5055 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 {
5057 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5058 return;
5059 }
5060
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305061 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005062 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5064 msg.reserved = 0;
5065 msg.bodyptr = pAddStaSelfParams;
5066 msg.bodyval = 0;
5067
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005068 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005069 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005070
5071 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5072 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005073 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005074 }
5075 return;
5076} /*** end __limProcessAddStaSelfReq() ***/
5077
5078
5079/**
5080 * __limProcessSmeDelStaSelfReq()
5081 *
5082 *FUNCTION:
5083 * This function is called to process SME_DEL_STA_SELF_REQ message
5084 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5085 *
5086 *LOGIC:
5087 *
5088 *ASSUMPTIONS:
5089 *
5090 *NOTE:
5091 *
5092 * @param pMac Pointer to Global MAC structure
5093 * @param *pMsgBuf A pointer to the SME message buffer
5094 * @return None
5095 */
5096
5097static void
5098__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5099{
5100 tSirMsgQ msg;
5101 tpDelStaSelfParams pDelStaSelfParams;
5102 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5103
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305104 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5105 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005106 {
5107 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5108 return;
5109 }
5110
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305111 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005112
5113 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5114 msg.reserved = 0;
5115 msg.bodyptr = pDelStaSelfParams;
5116 msg.bodyval = 0;
5117
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05305118 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005119 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005120
5121 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5122 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005123 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005124 }
5125 return;
5126} /*** end __limProcessSmeDelStaSelfReq() ***/
5127
5128
Jeff Johnson295189b2012-06-20 16:38:30 -07005129/**
5130 * __limProcessSmeRegisterMgmtFrameReq()
5131 *
5132 *FUNCTION:
5133 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5134 * from SME. It Register this information within PE.
5135 *
5136 *LOGIC:
5137 *
5138 *ASSUMPTIONS:
5139 *
5140 *NOTE:
5141 *
5142 * @param pMac Pointer to Global MAC structure
5143 * @param *pMsgBuf A pointer to the SME message buffer
5144 * @return None
5145 */
5146static void
5147__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5148{
5149 VOS_STATUS vosStatus;
5150 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5151 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005152 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305153 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005154 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305155 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005156
Jeff Johnsond13512a2012-07-17 11:42:19 -07005157 /* First check whether entry exists already*/
5158
5159 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5160 (vos_list_node_t**)&pLimMgmtRegistration);
5161
5162 while(pLimMgmtRegistration != NULL)
5163 {
5164 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5165 {
5166 if(pSmeReq->matchLen)
5167 {
5168 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5169 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305170 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005171 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5172 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005173 /* found match! */
5174 match = VOS_TRUE;
5175 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005176 }
5177 }
5178 }
5179 else
5180 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005181 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005182 match = VOS_TRUE;
5183 break;
5184 }
5185 }
5186 vosStatus = vos_list_peek_next (
5187 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5188 (vos_list_node_t*) pLimMgmtRegistration,
5189 (vos_list_node_t**) &pNext );
5190
5191 pLimMgmtRegistration = pNext;
5192 pNext = NULL;
5193
5194 }
5195
5196 if (match)
5197 {
5198 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5199 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305200 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005201 }
5202
Jeff Johnson295189b2012-06-20 16:38:30 -07005203 if(pSmeReq->registerFrame)
5204 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305205 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5206 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005207 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305208 vos_mem_set((void*)pLimMgmtRegistration,
5209 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005210 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5211 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5212 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5213 if(pSmeReq->matchLen)
5214 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305215 vos_mem_copy(pLimMgmtRegistration->matchData,
5216 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005217 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005218 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5219 &pLimMgmtRegistration->node);
5220 }
5221 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005222
5223 return;
5224} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005225
5226static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005227__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005228{
5229 tpP2pPsParams pMsgNoA;
5230 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005231
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305232 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5233 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005234 {
5235 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005236 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005237 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005238 }
5239
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305240 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005241 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5242 pMsgNoA->opp_ps = 0;
5243 pMsgNoA->ctWindow = 0;
5244 pMsgNoA->duration = 0;
5245 pMsgNoA->interval = 0;
5246 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005247
Vinay Malekal62757362012-12-17 12:15:51 -08005248 /* Below params used for Single Shot NOA - so assign proper values */
5249 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005250 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005251
Viral Modid86bde22012-12-10 13:09:21 -08005252 /* Start Insert NOA timer
5253 * 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 -08005254 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5255 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005256 */
5257 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5258 == TX_TIMER_ERROR)
5259 {
5260 /// Could not activate Insert NOA timer.
5261 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005262 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005263
5264 // send the scan response back with status failure and do not even call insert NOA
5265 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305266 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005267 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005268 }
5269
Viral Modid440e682013-03-06 02:25:31 -08005270 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5271
Viral Modid86bde22012-12-10 13:09:21 -08005272 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5273 msg.reserved = 0;
5274 msg.bodyptr = pMsgNoA;
5275 msg.bodyval = 0;
5276
5277 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5278 {
5279 /* 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 -07005280 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005281 /* Deactivate the NOA timer in failure case */
5282 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5283 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005284 }
Viral Modid440e682013-03-06 02:25:31 -08005285 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005286
Viral Modid440e682013-03-06 02:25:31 -08005287error:
5288 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5289 * worrying about the NOA
5290 */
5291 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5292 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005293 return FALSE;
5294
5295}
5296
Viral Modid440e682013-03-06 02:25:31 -08005297static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5298{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005299 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005300 pMac->lim.gDeferMsgTypeForNOA = msgType;
5301 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5302}
5303
5304static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5305{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005306 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005307 pMac->lim.gDeferMsgTypeForNOA = 0;
5308 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5309 {
5310 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305311 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005312 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5313 }
5314}
5315
5316static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305317tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5318 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005319{
5320 tANI_U32 noaDuration = 0;
5321
5322 switch (msgType)
5323 {
5324 case eWNI_SME_SCAN_REQ:
5325 {
5326 tANI_U32 val;
5327 tANI_U8 i;
5328 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5329 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5330 {
5331 /*
5332 * Could not get max channel value
5333 * from CFG. Log error.
5334 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005335 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005336
5337 /* use a default value of 110ms */
5338 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5339 }
5340
5341 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5342 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5343
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305344 if (pMac->miracast_mode) {
5345 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5346 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5347 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005348 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5349 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5350 */
5351 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305352 } else {
5353 /* Use min + max channel time to calculate the total duration of scan */
5354 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005355 }
5356 }
5357
5358 /* Adding an overhead of 20ms to account for the scan messaging delays */
5359 noaDuration += SCAN_MESSAGING_OVERHEAD;
5360 noaDuration *= CONV_MS_TO_US;
5361
5362 break;
5363 }
5364
5365 case eWNI_SME_OEM_DATA_REQ:
5366 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5367 break;
5368
5369 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5370 {
5371 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5372 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5373 break;
5374 }
5375
5376 case eWNI_SME_JOIN_REQ:
5377 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5378 break;
5379
5380 default:
5381 noaDuration = 0;
5382 break;
5383
5384 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005385 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005386 return noaDuration;
5387}
5388
5389void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5390{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305391 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005392
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005393 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005394 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5395 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5396 {
5397 switch (pMac->lim.gDeferMsgTypeForNOA)
5398 {
5399 case eWNI_SME_SCAN_REQ:
5400 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5401 break;
5402 case eWNI_SME_OEM_DATA_REQ:
5403 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5404 break;
5405 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305406 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5407 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5408 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5409 */
5410 if (FALSE == bufConsumed)
5411 {
5412 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5413 }
Viral Modid440e682013-03-06 02:25:31 -08005414 break;
5415 case eWNI_SME_JOIN_REQ:
5416 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5417 break;
5418 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005419 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005420 break;
5421 }
5422 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5423 }
5424 else
5425 {
5426 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005427 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005428 }
5429}
Jeff Johnson295189b2012-06-20 16:38:30 -07005430
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305431static void
5432__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5433{
5434 tpSirResetAPCapsChange pResetCapsChange;
5435 tpPESession psessionEntry;
5436 tANI_U8 sessionId = 0;
5437 if (pMsgBuf == NULL)
5438 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005439 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305440 return;
5441 }
5442
5443 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5444 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5445 if (psessionEntry == NULL)
5446 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005447 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305448 return;
5449 }
5450
5451 psessionEntry->limSentCapsChangeNtf = false;
5452 return;
5453}
5454
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305455static void
5456__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5457{
5458 tSirMsgQ msg;
5459 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5460 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5461
5462 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5463 if ( NULL == pSpoofMacAddrParams )
5464 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305465 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305466 return;
5467 }
5468
5469 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5470
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305471 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5472
5473 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5474 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5475
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305476 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5477 msg.reserved = 0;
5478 msg.bodyptr = pSpoofMacAddrParams;
5479 msg.bodyval = 0;
5480
5481 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5482 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5483
5484 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5485 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305486 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305487 vos_mem_free(pSpoofMacAddrParams);
5488 }
5489 return;
5490}
5491
Jeff Johnson295189b2012-06-20 16:38:30 -07005492/**
5493 * limProcessSmeReqMessages()
5494 *
5495 *FUNCTION:
5496 * This function is called by limProcessMessageQueue(). This
5497 * function processes SME request messages from HDD or upper layer
5498 * application.
5499 *
5500 *LOGIC:
5501 *
5502 *ASSUMPTIONS:
5503 *
5504 *NOTE:
5505 *
5506 * @param pMac Pointer to Global MAC structure
5507 * @param msgType Indicates the SME message type
5508 * @param *pMsgBuf A pointer to the SME message buffer
5509 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5510 * FALSE - if pMsgBuf is not to be freed.
5511 */
5512
5513tANI_BOOLEAN
5514limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5515{
5516 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5517 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005518 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305519 tANI_BOOLEAN isPassiveScan = FALSE;
5520
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005521 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 -07005522 limMsgStr(pMsg->type), pMsg->type,
5523 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5524 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5525
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005526 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005527 /* Special handling of some SME Req msgs where we have an existing GO session and
5528 * want to insert NOA before processing those msgs. These msgs will be processed later when
5529 * start event happens
5530 */
5531 switch (pMsg->type)
5532 {
5533 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305534 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5535 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005536 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005537
5538 /* If scan is disabled return from here
5539 */
5540 if (pMac->lim.fScanDisabled)
5541 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005542 if (pMsg->type == eWNI_SME_SCAN_REQ)
5543 {
5544 limSendSmeScanRsp(pMac,
5545 offsetof(tSirSmeScanRsp,bssDescription[0]),
5546 eSIR_SME_INVALID_PARAMETERS,
5547 pScanReq->sessionId,
5548 pScanReq->transactionId);
5549
5550 bufConsumed = TRUE;
5551 }
5552 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5553 {
5554 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5555 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5556 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5557
5558 /*
5559 * limRemainOnChnRsp will free the buffer this change is to
5560 * avoid "double free"
5561 */
5562 bufConsumed = FALSE;
5563 }
5564
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305565 limLog(pMac, LOGE,
5566 FL("Error: Scan Disabled."
5567 " Return with error status for SME Message %s(%d)"),
5568 limMsgStr(pMsg->type), pMsg->type);
5569
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005570 return bufConsumed;
5571 }
5572 /*
5573 * Do not add BREAK here
5574 */
5575 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005576 case eWNI_SME_JOIN_REQ:
5577 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5578 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5579 {
5580 tANI_U32 noaDuration;
5581 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305582 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005583 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5584 return bufConsumed;
5585 }
5586 }
5587 /* If no insert NOA required then execute the code below */
5588
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 switch (pMsg->type)
5590 {
5591 case eWNI_SME_START_REQ:
5592 __limProcessSmeStartReq(pMac, pMsgBuf);
5593 break;
5594
5595 case eWNI_SME_SYS_READY_IND:
5596 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5597 break;
5598
Jeff Johnson295189b2012-06-20 16:38:30 -07005599 case eWNI_SME_START_BSS_REQ:
5600 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5601 break;
5602
5603 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005604 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005605 break;
5606
Jeff Johnsone7245742012-09-05 17:12:55 -07005607#ifdef FEATURE_OEM_DATA_SUPPORT
5608 case eWNI_SME_OEM_DATA_REQ:
5609 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005610 break;
5611#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005612 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5613 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5614 break;
5615
5616 case eWNI_SME_UPDATE_NOA:
5617 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5618 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305619 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5620 __limProcessClearDfsChannelList(pMac, pMsg);
5621 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005622 case eWNI_SME_JOIN_REQ:
5623 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005624 break;
5625
5626 case eWNI_SME_AUTH_REQ:
5627 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5628
5629 break;
5630
5631 case eWNI_SME_REASSOC_REQ:
5632 __limProcessSmeReassocReq(pMac, pMsgBuf);
5633
5634 break;
5635
5636 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5637 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5638
5639 break;
5640
5641 case eWNI_SME_DISASSOC_REQ:
5642 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5643
5644 break;
5645
5646 case eWNI_SME_DISASSOC_CNF:
5647 case eWNI_SME_DEAUTH_CNF:
5648 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5649
5650 break;
5651
5652 case eWNI_SME_DEAUTH_REQ:
5653 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5654
5655 break;
5656
Jeff Johnson295189b2012-06-20 16:38:30 -07005657
5658
5659 case eWNI_SME_SETCONTEXT_REQ:
5660 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5661
5662 break;
5663
5664 case eWNI_SME_REMOVEKEY_REQ:
5665 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5666
5667 break;
5668
5669 case eWNI_SME_STOP_BSS_REQ:
5670 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5671 break;
5672
5673 case eWNI_SME_ASSOC_CNF:
5674 case eWNI_SME_REASSOC_CNF:
5675 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305676 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005677 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305678 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005679 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5680 break;
5681
5682 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305683 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5685 break;
5686
5687 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305688 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005689 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5690 break;
5691
5692 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305693 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005694 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5695 break;
5696
5697 case eWNI_SME_STA_STAT_REQ:
5698 case eWNI_SME_AGGR_STAT_REQ:
5699 case eWNI_SME_GLOBAL_STAT_REQ:
5700 case eWNI_SME_STAT_SUMM_REQ:
5701 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5702 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5703 bufConsumed = FALSE;
5704 break;
5705 case eWNI_SME_GET_STATISTICS_REQ:
5706 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5707 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5708 bufConsumed = FALSE;
5709 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005710#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005711 case eWNI_SME_GET_ROAM_RSSI_REQ:
5712 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5713 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5714 bufConsumed = FALSE;
5715 break;
5716#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005717#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005718 case eWNI_SME_GET_TSM_STATS_REQ:
5719 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5720 bufConsumed = FALSE;
5721 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005722#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005723 case eWNI_SME_DEL_BA_PEER_IND:
5724 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5725 break;
5726 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5727 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5728 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005729 case eWNI_SME_GET_ASSOC_STAS_REQ:
5730 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5731 break;
5732 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5733 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5734 break;
5735
5736 case eWNI_SME_HIDE_SSID_REQ:
5737 __limProcessSmeHideSSID(pMac, pMsgBuf);
5738 break;
5739 case eWNI_SME_UPDATE_APWPSIE_REQ:
5740 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5741 break;
5742 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5743 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5744 break;
5745
5746 case eWNI_SME_SET_APWPARSNIEs_REQ:
5747 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5748 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005749
5750 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5751 //Update the beaconInterval
5752 __limProcessSmeChangeBI(pMac, pMsgBuf );
5753 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305754
5755#ifdef WLAN_FEATURE_AP_HT40_24G
5756 case eWNI_SME_SET_HT_2040_MODE:
5757 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5758 break;
5759#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005760
5761#if defined WLAN_FEATURE_VOWIFI
5762 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5763 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5764 __limProcessReportMessage(pMac, pMsg);
5765 break;
5766#endif
5767
5768#if defined WLAN_FEATURE_VOWIFI_11R
5769 case eWNI_SME_FT_PRE_AUTH_REQ:
5770 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5771 break;
5772 case eWNI_SME_FT_UPDATE_KEY:
5773 limProcessFTUpdateKey(pMac, pMsgBuf);
5774 break;
5775
5776 case eWNI_SME_FT_AGGR_QOS_REQ:
5777 limProcessFTAggrQosReq(pMac, pMsgBuf);
5778 break;
5779#endif
5780
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005781#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5782 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005783 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5784 break;
5785#endif
5786 case eWNI_SME_ADD_STA_SELF_REQ:
5787 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5788 break;
5789 case eWNI_SME_DEL_STA_SELF_REQ:
5790 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5791 break;
5792
Jeff Johnson295189b2012-06-20 16:38:30 -07005793 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5794 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5795 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005796#ifdef FEATURE_WLAN_TDLS
5797 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5798 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5799 break;
5800 case eWNI_SME_TDLS_ADD_STA_REQ:
5801 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5802 break;
5803 case eWNI_SME_TDLS_DEL_STA_REQ:
5804 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5805 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305806 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5807 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5808 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305809// tdlsoffchan
5810 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5811 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5812 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005813#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305814 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5815 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5816 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005817
schang86c22c42013-03-13 18:41:24 -07005818 case eWNI_SME_SET_TX_POWER_REQ:
5819 limSendSetTxPowerReq(pMac, pMsgBuf);
5820 break ;
5821
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305822 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5823 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5824 break ;
5825
Jeff Johnson295189b2012-06-20 16:38:30 -07005826 default:
5827 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5828 pMsg->bodyptr = NULL;
5829 break;
5830 } // switch (msgType)
5831
5832 return bufConsumed;
5833} /*** end limProcessSmeReqMessages() ***/